Skip to content

Commit 391f800

Browse files
author
Christian Ponte
committed
Add sample script
1 parent 3705ba2 commit 391f800

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

generate_models.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
%% Import Toxo library
2+
addpath('src/');
3+
import toxo.*;
4+
5+
%% Penetrance table generation
6+
% Read models from models/ folder
7+
models = {};
8+
for m = dir('models')'
9+
if ~ m.isdir
10+
models{end + 1} = Model(fullfile(m.folder, m.name));
11+
end
12+
end
13+
14+
% Create MAF and heritabilities to test
15+
maf = [0.1, 0.25, 0.4];
16+
h = [0.1, 0.25, 0.5, 0.8];
17+
18+
% Find penetrance tables and write the results into files
19+
output_folder = "output\";
20+
if ~ isfolder(output_folder)
21+
mkdir(output_folder);
22+
end
23+
24+
for m = models
25+
for i = maf
26+
for j = h
27+
try
28+
pt = m{:}.find_max_prevalence(i, j);
29+
file_name = sprintf("%s_%.2f_h%.2f.txt", m{:}.name, i, j);
30+
pt.write(fullfile(output_folder, file_name), PT.format_gametes);
31+
catch ME
32+
% disp(ME.message);
33+
warning("Unable to generate model %s with MAF %f and heritability %f.\n", m{:}.name, i, j);
34+
continue;
35+
end
36+
end
37+
end
38+
end

0 commit comments

Comments
 (0)