0
|
1 function [CFG]=process_command_line_args(CFG,ARGS)
|
|
2 % [CFG]=process_command_line_args(CFG,ARGS)
|
|
3
|
|
4 %This function adds the command line arguments to the CFG config variable
|
|
5
|
|
6 %Parse the ARGS
|
|
7
|
|
8 %Check wether octave or matlab is used
|
|
9 if size(ver('Octave'),1)
|
|
10 INTERPR = 1;
|
|
11 else
|
|
12 INTERPR = 0;
|
|
13 end
|
|
14
|
|
15 %turn of warning
|
|
16 if INTERPR
|
|
17 warning('off', 'Octave:precedence-change');
|
|
18 warning('off', 'Octave:function-name-clash');
|
|
19 warning('off', '');
|
|
20 warning('off', 'Octave:num-to-str');
|
|
21 warning('off', 'Octave:function-name-clash');
|
|
22 warning('off', 'Octave:divide-by-zero');
|
|
23 warning('off', 'Octave:future-time-stamp');
|
|
24 warning('off', 'solve_qp:constraints');
|
|
25 warning('off', 'Octave:assign-as-truth-value');
|
|
26 warning('off', 'Octave:matlab-incompatible');
|
|
27 else
|
|
28 warning('off', 'MATLAB:typeaheadBufferOverflow');
|
|
29 end
|
|
30
|
|
31 %Seperate the Variable Field
|
|
32 if INTERPR
|
|
33 ARGS = strsplit(ARGS,';');
|
|
34 else
|
|
35 ARGS=regexp(ARGS,';','split');
|
|
36 end
|
|
37
|
|
38 %Assign the local variables
|
|
39
|
|
40 %iterate over Fields
|
|
41 for i=1:length(ARGS)
|
|
42 if isempty(ARGS{i})
|
|
43 continue
|
|
44 end
|
|
45 if INTERPR
|
|
46 VALS = strsplit(ARGS{i},':');
|
|
47 else
|
|
48 VALS=regexp(ARGS{i},':','split');
|
|
49 end
|
|
50
|
|
51
|
|
52 if length(VALS)>2
|
|
53 error([" more than one field for variable: " VALS{1} ":" VALS{:} "\n Maybe there are colons in the input argument?"])
|
|
54 end
|
|
55
|
|
56 if strcmp(VALS{1},"RDIFF_RES_DIR"),RDIFF_RES_DIR=VALS{2};continue,end
|
|
57 if strcmp(VALS{1},"RDIFF_INPUT_DIR"),RDIFF_INPUT_DIR=VALS{2};continue,end
|
|
58 if strcmp(VALS{1},"BAM_INPUT1"),BAM_INPUT1=VALS{2};continue,end
|
|
59 if strcmp(VALS{1},"BAM_INPUT2"),BAM_INPUT2=VALS{2};continue,end
|
|
60 if strcmp(VALS{1},"GFF_INPUT"),GFF_INPUT=VALS{2};continue,end
|
|
61 if strcmp(VALS{1},"READ_LENGTH"),READ_LENGTH=str2num(VALS{2});continue,end
|
|
62 if strcmp(VALS{1},"MIN_READ_LENGTH"),MIN_READ_LENGTH=str2num(VALS{2});continue,end
|
|
63 if strcmp(VALS{1},"EST_GENE_EXPR"),EST_GENE_EXPR=str2num(VALS{2});continue,end
|
|
64 if strcmp(VALS{1},"ONLY_GENE_EXPR"),ONLY_GENE_EXPR=str2num(VALS{2});continue,end
|
|
65 if strcmp(VALS{1},"VAR_PATH1"),VAR_PATH1=VALS{2};continue,end
|
|
66 if strcmp(VALS{1},"VAR_PATH2"),VAR_PATH2=VALS{2};continue,end
|
|
67 if strcmp(VALS{1},"SAVE_VAR1"),SAVE_VAR1=VALS{2};continue,end
|
|
68 if strcmp(VALS{1},"SAVE_VAR2"),SAVE_VAR2=VALS{2};continue,end
|
|
69 if strcmp(VALS{1},"PRED_VAR1"),PRED_VAR1=VALS{2};continue,end
|
|
70 if strcmp(VALS{1},"PRED_VAR2"),PRED_VAR2=VALS{2};continue,end
|
|
71 if strcmp(VALS{1},"ONLY_GENE_START"),ONLY_GENE_START=str2num(VALS{2});continue,end
|
|
72 if strcmp(VALS{1},"SUBSAMPLE"),SUBSAMPLE=str2num(VALS{2});continue,end
|
|
73 if strcmp(VALS{1},"CLIP"),CLIP=str2num(VALS{2});continue,end
|
|
74 if strcmp(VALS{1},"BOOTSTRAP"),BOOTSTRAP=str2num(VALS{2});continue,end
|
|
75 if strcmp(VALS{1},"TEST_METH_NAME"),TEST_METH_NAME=VALS{2};continue,end
|
|
76 if strcmp(VALS{1},"MERGE_SAMPLE"),MERGE_SAMPLE=str2num(VALS{2});continue,end
|
|
77 end
|
|
78
|
|
79 %Process Bamfiles
|
|
80 if INTERPR
|
|
81 BAMS1 = strsplit(BAM_INPUT1,',');
|
|
82 BAMS2 = strsplit(BAM_INPUT2,',');
|
|
83 else
|
|
84 BAMS1=regexp(BAM_INPUT1,',','split');
|
|
85 BAMS2=regexp(BAM_INPUT2,',','split');
|
|
86 end
|
|
87
|
|
88 CFG.BAM_FILES={BAMS1{:},BAMS2{:}};
|
|
89
|
|
90 %Name of the experiment. Use the FILENAMES if the entries are empty.
|
|
91 CFG.NAMES=CFG.BAM_FILES;
|
|
92 for i=1:length(CFG.NAMES)
|
|
93 CFG.NAMES{i}=strrep(CFG.NAMES{i},"/","_");
|
|
94 end
|
|
95
|
|
96 % Give the directory where the input-files are
|
|
97 CFG.data_dir = [RDIFF_INPUT_DIR '/'];
|
|
98
|
|
99 % Indicate to which sample the bam-files belong
|
|
100 CFG.SAMPLES=[repmat(1,1,size(BAMS1,2)),repmat(2,1,size(BAMS2,2))];
|
|
101
|
|
102 %Process directories
|
|
103
|
|
104
|
|
105
|
|
106 % Location of the gene structure
|
|
107 CFG.genes_path=GFF_INPUT;
|
|
108
|
|
109 % Output directory
|
|
110
|
|
111 CFG.out_base = [RDIFF_RES_DIR '/'];
|
|
112
|
|
113 % Output directory for temporary files
|
|
114 CFG.out_base_temp = [CFG.out_base '/temp/'];
|
|
115 mkdir(CFG.out_base_temp);
|
|
116
|
|
117
|
|
118 %Check which method to perform
|
|
119 if strcmp(TEST_METH_NAME,'poisson')
|
|
120 CFG.perform_poisson=1;
|
|
121 end
|
|
122 if strcmp(TEST_METH_NAME,'param')
|
|
123 CFG.perform_parametric=1;
|
|
124 end
|
|
125 if strcmp(TEST_METH_NAME,'nonparam')
|
|
126 CFG.perform_nonparametric=1;
|
|
127 end
|
|
128 if strcmp(TEST_METH_NAME,'mmd')
|
|
129 CFG.perform_mmd=1;
|
|
130 end
|
|
131
|
|
132
|
|
133 %Process arguments for gene expression estimation
|
|
134 CFG.estimate_gene_expression=EST_GENE_EXPR;
|
|
135 CFG.only_gene_expression=ONLY_GENE_EXPR;
|
|
136
|
|
137
|
|
138 %Set options for the variance function
|
|
139 CFG.merge_sample1=MERGE_SAMPLE;
|
|
140 CFG.merge_sample2=MERGE_SAMPLE;
|
|
141
|
|
142 %If samples contains leass than one sample, merge replicates
|
|
143 if length(BAMS1)<2
|
|
144 CFG.merge_sample1=1;
|
|
145 end
|
|
146 if length(BAMS2)<2
|
|
147 CFG.merge_sample2=1;
|
|
148 end
|
|
149
|
|
150 %Use predefined parameters
|
|
151 CFG.predefined_variance_function1=[];
|
|
152 if not(isempty(PRED_VAR1))
|
|
153 if INTERPR
|
|
154 VALS = strsplit(PRED_VAR1,',');
|
|
155 else
|
|
156 VALS=regexp(PRED_VAR1,',','split');
|
|
157 end
|
|
158 for i=1:length(VALS)
|
|
159 CFG.predefined_variance_function1(end+1)=str2num(VALS{i});
|
|
160 end
|
|
161 end
|
|
162 CFG.predefined_variance_function2=[];
|
|
163 if not(isempty(PRED_VAR2))
|
|
164 if INTERPR
|
|
165 VALS = strsplit(PRED_VAR2,',');
|
|
166 else
|
|
167 VALS=regexp(PRED_VAR2,',','split');
|
|
168 end
|
|
169 for i=1:length(VALS)
|
|
170 CFG.predefined_variance_function2(end+1)=str2num(VALS{i});
|
|
171 end
|
|
172 end
|
|
173
|
|
174
|
|
175 if not(isempty(SAVE_VAR1))
|
|
176 CFG.save_variance_function_1=SAVE_VAR1;
|
|
177 else
|
|
178 CFG.save_variance_function_1='variance_function_1.mat';
|
|
179 end
|
|
180 if not(isempty(SAVE_VAR2))
|
|
181 CFG.save_variance_function_2=SAVE_VAR2;
|
|
182 else
|
|
183 CFG.save_variance_function_2='variance_function_2.mat';
|
|
184 end
|
|
185
|
|
186 if not(isempty(VAR_PATH1))
|
|
187 CFG.variance_function_1=VAR_PATH1;
|
|
188 end
|
|
189 if not(isempty(VAR_PATH2))
|
|
190 CFG.variance_function_2=VAR_PATH2;
|
|
191 end
|
|
192
|
|
193 %Option not implemented yet
|
|
194 CFG.compute_variance_function_1=1;
|
|
195 CFG.compute_variance_function_2=1;
|
|
196
|
|
197 %use only gene starts and stops for rDiff.nonparametric variance
|
|
198 %function esitmation
|
|
199 CFG.only_gene_start=ONLY_GENE_START;
|
|
200
|
|
201 %Process read arguments
|
|
202 CFG.sequenced_length=READ_LENGTH;
|
|
203 CFG.min_read_length=min(CFG.sequenced_length,MIN_READ_LENGTH);
|
|
204
|
|
205 CFG.rDiff_subsample=SUBSAMPLE;
|
|
206 CFG.rDiff_nonparametric_subsample_variance_estimation=CFG.rDiff_subsample;
|
|
207
|
|
208 CFG.bases_to_clip=CLIP;
|
|
209
|
|
210 %Process arguments for rDiff.nonparametric
|
|
211 CFG.bootstraps=BOOTSTRAP;
|
|
212
|
|
213 return
|