0
|
1 function []=rdiff(ARGS)
|
|
2 % rdiff()
|
|
3 %
|
|
4
|
|
5 if isempty(ARGS)
|
|
6 usage() ;
|
|
7 exit(-1) ;
|
|
8 end
|
|
9 %ARGS=[ARGS ':.:.'] ;
|
|
10
|
|
11 %%% Add paths %%%
|
|
12 fprintf('Set the paths\n')
|
|
13 CFG.paths = set_rdiff_paths();
|
|
14
|
|
15
|
|
16 %%% Read configuration file %%%
|
|
17 fprintf('Load configuration\n')
|
|
18 CFG = configure_rdiff(CFG);
|
|
19 CFG = process_command_line_args(CFG,ARGS);
|
|
20 CFG = process_configure_rdiff(CFG);
|
|
21
|
|
22 %%% Get read counts %%%
|
|
23
|
|
24 %load the gene structure
|
|
25 load(CFG.genes_path , 'genes');
|
|
26
|
|
27 % mask the regions which overlap with other genes
|
|
28 fprintf('Compute regions common to multiple genes\n')
|
|
29 [genes]=detect_overlapping_regions(genes);
|
|
30
|
|
31 %Precompute testing regions
|
|
32 fprintf('Compute alternative regions\n')
|
|
33 [genes]=compute_testing_region(CFG,genes);
|
|
34
|
|
35 %Get the gene expression
|
|
36 if CFG.estimate_gene_expression
|
|
37 fprintf('Measure gene expression\n')
|
|
38 get_read_counts(CFG,genes);
|
|
39 end
|
|
40
|
|
41 %%% Estimate variance function %%%
|
|
42 if CFG.perform_nonparametric
|
|
43 variance_function_nonparametric_1=[];
|
|
44 variance_function_nonparametric_2=[];
|
|
45 [variance_function_nonparametric_1, variance_function_nonparametric_2]=estimate_variance_nonparametric(CFG,genes);
|
|
46 end
|
|
47
|
|
48 if CFG.perform_poisson
|
|
49 variance_function_parametric_1=[];
|
|
50 variance_function_parametric_2=[];
|
|
51 end
|
|
52 if CFG.perform_parametric
|
|
53 variance_function_parametric_1=[];
|
|
54 variance_function_parametric_2=[];
|
|
55 [variance_function_parametric_1, variance_function_parametric_2]=estimate_variance_parametric(CFG,genes);
|
|
56 end
|
|
57
|
|
58 %If only gene expression is needed, stop here
|
|
59 if CFG.only_gene_expression
|
|
60 return
|
|
61 end
|
|
62
|
|
63
|
|
64 %%% Perform tests & Write output %%%
|
|
65
|
|
66 %Run the prametric tests
|
|
67 if or(CFG.perform_parametric,CFG.perform_poisson)
|
|
68 perform_parametric_tests(CFG,genes,variance_function_parametric_1, variance_function_parametric_2)
|
|
69 end
|
|
70 %Run the nonparametric tests
|
|
71 if or(CFG.perform_nonparametric,CFG.perform_mmd)
|
|
72 perform_nonparametric_tests(CFG,genes,variance_function_nonparametric_1, variance_function_nonparametric_2)
|
|
73 end
|
|
74
|
|
75 return
|
|
76
|
|
77
|
|
78
|