1 | /* |
---|
2 | |
---|
3 | PhyML: a program that computes maximum likelihood phyLOGenies from |
---|
4 | DNA or AA homoLOGous sequences. |
---|
5 | |
---|
6 | Copyright (C) Stephane Guindon. Oct 2003 onward. |
---|
7 | |
---|
8 | All parts of the source except where indicated are distributed under |
---|
9 | the GNU public licence. See http://www.opensource.org for details. |
---|
10 | |
---|
11 | */ |
---|
12 | |
---|
13 | #include "cl.h" |
---|
14 | |
---|
15 | |
---|
16 | /*********************************************************/ |
---|
17 | /** |
---|
18 | * Fill the Option fields, with the argc array |
---|
19 | */ |
---|
20 | int Read_Command_Line(option *io, int argc, char **argv) |
---|
21 | { |
---|
22 | int c; |
---|
23 | int idx; |
---|
24 | int writemode; |
---|
25 | |
---|
26 | if(argc == 1) Exit("\n. No argument was passed to the program. Please check the documentation. \n"); |
---|
27 | |
---|
28 | struct option longopts[] = |
---|
29 | { |
---|
30 | {"n_rgrft", required_argument,NULL,0}, |
---|
31 | {"n_globl", required_argument,NULL,1}, |
---|
32 | {"max_dist", required_argument,NULL,2}, |
---|
33 | {"n_optim", required_argument,NULL,3}, |
---|
34 | {"n_best", required_argument,NULL,4}, |
---|
35 | {"model", required_argument,NULL,5}, |
---|
36 | {"search", required_argument,NULL,6}, |
---|
37 | {"datatype", required_argument,NULL,7}, |
---|
38 | {"multiple", required_argument,NULL,8}, |
---|
39 | {"input", required_argument,NULL,9}, |
---|
40 | {"bootstrap", required_argument,NULL,10}, |
---|
41 | {"ts/tv", required_argument,NULL,11}, |
---|
42 | {"nclasses", required_argument,NULL,12}, |
---|
43 | {"pinv", required_argument,NULL,13}, |
---|
44 | {"alpha", required_argument,NULL,14}, |
---|
45 | {"inputtree", required_argument,NULL,15}, |
---|
46 | {"min_diff_lk_local", required_argument,NULL,16}, |
---|
47 | {"min_diff_lk_global",required_argument,NULL,17}, |
---|
48 | {"steph_spr", no_argument,NULL,18}, |
---|
49 | {"brent_it_max", required_argument,NULL,19}, |
---|
50 | {"rand_start", no_argument,NULL,20}, |
---|
51 | {"n_rand_starts", required_argument,NULL,21}, |
---|
52 | {"sequential", no_argument,NULL,22}, |
---|
53 | {"inside_opt", no_argument,NULL,23}, |
---|
54 | {"p_moves", required_argument,NULL,24}, |
---|
55 | {"fast_nni", no_argument,NULL,25}, |
---|
56 | {"g_pars", no_argument,NULL,26}, |
---|
57 | {"r_seed", required_argument,NULL,27}, |
---|
58 | {"collapse_boot", required_argument,NULL,28}, |
---|
59 | {"random_boot", required_argument,NULL,29}, |
---|
60 | {"print_trace", no_argument,NULL,30}, |
---|
61 | {"print_site_lnl", no_argument,NULL,31}, |
---|
62 | {"print_site_lk", no_argument,NULL,31}, |
---|
63 | {"cov", no_argument,NULL,32}, |
---|
64 | {"cov_delta", required_argument,NULL,33}, |
---|
65 | {"cov_alpha", required_argument,NULL,34}, |
---|
66 | {"cov_ncats", required_argument,NULL,35}, |
---|
67 | {"ps", no_argument,NULL,36}, |
---|
68 | {"cov_free", no_argument,NULL,37}, |
---|
69 | {"no_gap", no_argument,NULL,38}, |
---|
70 | {"n_rr_branch", required_argument,NULL,39}, |
---|
71 | {"append", no_argument,NULL,40}, |
---|
72 | {"no_five_branch", no_argument,NULL,41}, |
---|
73 | {"pars_thresh", required_argument,NULL,42}, |
---|
74 | {"min_diff_lk_move", required_argument,NULL,43}, |
---|
75 | {"hybrid", no_argument,NULL,44}, |
---|
76 | {"use_median", no_argument,NULL,45}, |
---|
77 | {"run_id", required_argument,NULL,46}, |
---|
78 | {"pars", no_argument,NULL,47}, |
---|
79 | {"quiet", no_argument,NULL,48}, |
---|
80 | {"version", no_argument,NULL,49}, |
---|
81 | {"calibration_file", required_argument,NULL,50}, |
---|
82 | {"calibration", required_argument,NULL,50}, |
---|
83 | {"clade_file", required_argument,NULL,50}, |
---|
84 | {"boot_progress_every", required_argument,NULL,51}, |
---|
85 | {"aa_rate_file", required_argument,NULL,52}, |
---|
86 | {"chain_len", required_argument,NULL,53}, |
---|
87 | {"sample_freq", required_argument,NULL,54}, |
---|
88 | {"burnin", required_argument,NULL,55}, |
---|
89 | {"no_memory_check", no_argument,NULL,56}, |
---|
90 | {"no_colalias", no_argument,NULL,57}, |
---|
91 | {"alias_subpatt", no_argument,NULL,58}, |
---|
92 | {"no_sequences", no_argument,NULL,59}, |
---|
93 | {"prior", no_argument,NULL,59}, |
---|
94 | {"fastlk", no_argument,NULL,60}, |
---|
95 | {"free_rates", no_argument,NULL,61}, |
---|
96 | {"freerates", no_argument,NULL,61}, |
---|
97 | {"is", no_argument,NULL,62}, |
---|
98 | // no 63 since it corresponds to character '?' |
---|
99 | {"rate_model", required_argument,NULL,64}, |
---|
100 | {"ratemodel", required_argument,NULL,64}, |
---|
101 | {"log_l", no_argument,NULL,65}, |
---|
102 | {"gamma_lens", no_argument,NULL,66}, |
---|
103 | {"il", no_argument,NULL,66}, |
---|
104 | {"codpos", required_argument,NULL,67}, |
---|
105 | {"constraint_file", required_argument,NULL,68}, |
---|
106 | {"constraint_tree", required_argument,NULL,68}, |
---|
107 | {"help", no_argument,NULL,69}, |
---|
108 | {"mutmap", no_argument,NULL,70}, |
---|
109 | {"parvals", required_argument,NULL,71}, |
---|
110 | {"constrained_lens", no_argument,NULL,72}, |
---|
111 | {"xml", required_argument,NULL,73}, |
---|
112 | {"l_var", required_argument,NULL,74}, |
---|
113 | {0,0,0,0} |
---|
114 | }; |
---|
115 | |
---|
116 | io->datatype = UNDEFINED; |
---|
117 | |
---|
118 | writemode = 1; |
---|
119 | #ifndef PHYML |
---|
120 | int open_ps_file = 0; |
---|
121 | #endif |
---|
122 | idx=-1; |
---|
123 | |
---|
124 | do |
---|
125 | { |
---|
126 | |
---|
127 | c = getopt_long(argc,argv,"qi:d:m:b:n:t:f:zk:v:c:a:u:ho:s:x:g:l:ep",longopts,&idx); |
---|
128 | |
---|
129 | switch(c) |
---|
130 | { |
---|
131 | case 74: |
---|
132 | { |
---|
133 | io->mod->l_var_sigma = String_To_Dbl(optarg); |
---|
134 | break; |
---|
135 | } |
---|
136 | case 73: |
---|
137 | { |
---|
138 | #ifndef SERGEII |
---|
139 | Free_Optimiz(io->mod->s_opt); |
---|
140 | M4_Free_M4_Model(io->mod->m4mod); |
---|
141 | Free_Model_Basic(io->mod); |
---|
142 | Free_Input(io); |
---|
143 | PhyML_XML(optarg); |
---|
144 | return 0; |
---|
145 | #endif |
---|
146 | |
---|
147 | #ifdef SERGEII |
---|
148 | Free_Optimiz(io->mod->s_opt); |
---|
149 | M4_Free_M4_Model(io->mod->m4mod); |
---|
150 | Free_Model_Basic(io->mod); |
---|
151 | Free_Input(io); |
---|
152 | PhyTime_XML(optarg); |
---|
153 | return 0; |
---|
154 | #endif |
---|
155 | } |
---|
156 | case 72: |
---|
157 | { |
---|
158 | io->mod->s_opt->constrained_br_len = YES; |
---|
159 | break; |
---|
160 | } |
---|
161 | case 71: |
---|
162 | { |
---|
163 | io->mcmc->in_fp_par = fopen(optarg,"r"); |
---|
164 | io->mcmc->randomize = NO; |
---|
165 | break; |
---|
166 | } |
---|
167 | case 70: |
---|
168 | { |
---|
169 | io->mutmap = YES; |
---|
170 | break; |
---|
171 | } |
---|
172 | case 68: |
---|
173 | { |
---|
174 | char *tmp; |
---|
175 | tmp = (char *)mCalloc(T_MAX_FILE, sizeof(char)); |
---|
176 | |
---|
177 | if(strlen(optarg) > T_MAX_FILE -11) |
---|
178 | { |
---|
179 | char choix; |
---|
180 | strcpy (tmp, "\n. The file name'"); |
---|
181 | strcat (tmp, optarg); |
---|
182 | strcat (tmp, "' is too long.\n"); |
---|
183 | PhyML_Printf("%s",tmp); |
---|
184 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
185 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
186 | Exit("\n"); |
---|
187 | } |
---|
188 | else if (!Filexists (optarg)) |
---|
189 | { |
---|
190 | char choix; |
---|
191 | strcpy (tmp, "\n. The file '"); |
---|
192 | strcat (tmp, optarg); |
---|
193 | strcat (tmp, "' doesn't exist.\n"); |
---|
194 | PhyML_Printf("%s",tmp); |
---|
195 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
196 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
197 | Exit("\n"); |
---|
198 | } |
---|
199 | else |
---|
200 | { |
---|
201 | strcpy(io->in_constraint_tree_file, optarg); |
---|
202 | io->fp_in_constraint_tree = Openfile(io->in_constraint_tree_file,0); |
---|
203 | } |
---|
204 | Free(tmp); |
---|
205 | break; |
---|
206 | } |
---|
207 | case 67: |
---|
208 | { |
---|
209 | phydbl pos; |
---|
210 | pos = atof(optarg); |
---|
211 | io->codpos = (int)pos; |
---|
212 | if(io->codpos < 1 || io->codpos > 3) |
---|
213 | { |
---|
214 | char choix; |
---|
215 | PhyML_Printf("\n. Coding position must be set to 1, 2 or 3.\n"); |
---|
216 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
217 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
218 | Exit("\n"); |
---|
219 | } |
---|
220 | break; |
---|
221 | |
---|
222 | break; |
---|
223 | } |
---|
224 | case 66: |
---|
225 | { |
---|
226 | io->mod->gamma_mgf_bl = YES; |
---|
227 | io->mod->s_opt->opt_gamma_br_len = YES; |
---|
228 | break; |
---|
229 | } |
---|
230 | case 65: |
---|
231 | { |
---|
232 | io->mod->log_l = YES; |
---|
233 | break; |
---|
234 | } |
---|
235 | case 64: |
---|
236 | { |
---|
237 | char *s; |
---|
238 | int i; |
---|
239 | s = (char *)mCalloc(T_MAX_NAME,sizeof(char)); |
---|
240 | i = 0; |
---|
241 | while(optarg[i++]) s[i]=tolower(optarg[i]); |
---|
242 | if(!strcmp(optarg,"gbd")) io->rates->model = THORNE; |
---|
243 | else if(!strcmp(optarg,"gbs")) io->rates->model = GUINDON; |
---|
244 | else if(!strcmp(optarg,"gamma")) io->rates->model = GAMMA; |
---|
245 | else if(!strcmp(optarg,"clock")) io->rates->model = STRICTCLOCK; |
---|
246 | else if(!strcmp(optarg,"strictclock")) io->rates->model = STRICTCLOCK; |
---|
247 | else if(!strcmp(optarg,"strict_clock")) io->rates->model = STRICTCLOCK; |
---|
248 | else |
---|
249 | { |
---|
250 | PhyML_Printf("\n. rate_model should be 'gbs', 'gbd', 'gamma' or 'clock'."); |
---|
251 | Exit("\n"); |
---|
252 | } |
---|
253 | Free(s); |
---|
254 | break; |
---|
255 | } |
---|
256 | |
---|
257 | |
---|
258 | case 62: |
---|
259 | { |
---|
260 | io->mcmc->is = YES; |
---|
261 | break; |
---|
262 | } |
---|
263 | case 61: |
---|
264 | { |
---|
265 | io->mod->ras->free_mixt_rates = YES; |
---|
266 | io->mod->s_opt->opt_free_mixt_rates = YES; |
---|
267 | break; |
---|
268 | } |
---|
269 | case 60: |
---|
270 | { |
---|
271 | io->lk_approx = NORMAL; |
---|
272 | break; |
---|
273 | } |
---|
274 | case 59: |
---|
275 | { |
---|
276 | io->mcmc->use_data = NO; |
---|
277 | break; |
---|
278 | } |
---|
279 | case 58: |
---|
280 | { |
---|
281 | io->do_alias_subpatt = YES; |
---|
282 | break; |
---|
283 | } |
---|
284 | case 57: |
---|
285 | { |
---|
286 | io->colalias = NO; |
---|
287 | break; |
---|
288 | } |
---|
289 | case 56: |
---|
290 | { |
---|
291 | io->mem_question = NO; |
---|
292 | break; |
---|
293 | } |
---|
294 | case 55: |
---|
295 | { |
---|
296 | phydbl len; |
---|
297 | len = atof(optarg); |
---|
298 | io->mcmc->chain_len_burnin = (int)len; |
---|
299 | if(io->mcmc->chain_len_burnin < 1) |
---|
300 | { |
---|
301 | char choix; |
---|
302 | PhyML_Printf("\n. chain_len_burnin must be an integer greater than 0.\n"); |
---|
303 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
304 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
305 | Exit("\n"); |
---|
306 | } |
---|
307 | break; |
---|
308 | } |
---|
309 | case 54: |
---|
310 | { |
---|
311 | phydbl len; |
---|
312 | len = atof(optarg); |
---|
313 | io->mcmc->sample_interval = (int)len; |
---|
314 | if(io->mcmc->sample_interval < 1) |
---|
315 | { |
---|
316 | char choix; |
---|
317 | PhyML_Printf("\n. sample_interval must be an integer greater than 0.\n"); |
---|
318 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
319 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
320 | Exit("\n"); |
---|
321 | } |
---|
322 | break; |
---|
323 | } |
---|
324 | case 53: |
---|
325 | { |
---|
326 | phydbl len; |
---|
327 | len = atof(optarg); |
---|
328 | io->mcmc->chain_len = (int)len; |
---|
329 | if(io->mcmc->chain_len < 1) |
---|
330 | { |
---|
331 | char choix; |
---|
332 | PhyML_Printf("\n. chain_len must be an integer greater than 0.\n"); |
---|
333 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
334 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
335 | Exit("\n"); |
---|
336 | } |
---|
337 | break; |
---|
338 | } |
---|
339 | case 52: |
---|
340 | { |
---|
341 | char *s; |
---|
342 | s = (char *)mCalloc(T_MAX_FILE, sizeof(char)); |
---|
343 | strcpy(s,optarg); |
---|
344 | io->mod->fp_aa_rate_mat = Openfile(s,0); |
---|
345 | strcpy(io->mod->aa_rate_mat_file->s,s); |
---|
346 | Free(s); |
---|
347 | break; |
---|
348 | } |
---|
349 | case 51: |
---|
350 | { |
---|
351 | io->boot_prog_every = atoi(optarg); |
---|
352 | if(io->boot_prog_every < 1) |
---|
353 | { |
---|
354 | char choix; |
---|
355 | PhyML_Printf("\n. boot_progress_every must be an integer greater than 0.\n"); |
---|
356 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
357 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
358 | Exit("\n"); |
---|
359 | } |
---|
360 | break; |
---|
361 | } |
---|
362 | case 50: |
---|
363 | { |
---|
364 | strcpy(io->clade_list_file,optarg); |
---|
365 | break; |
---|
366 | } |
---|
367 | case 49: |
---|
368 | { |
---|
369 | PhyML_Printf("\n. This is PhyML version %s.\n\n",VERSION); |
---|
370 | Exit(""); |
---|
371 | break; |
---|
372 | } |
---|
373 | case 48 : |
---|
374 | { |
---|
375 | io->quiet = 1; |
---|
376 | break; |
---|
377 | } |
---|
378 | case 'p' : case 47 : |
---|
379 | { |
---|
380 | io->in_tree = 1; |
---|
381 | break; |
---|
382 | } |
---|
383 | case 46 : |
---|
384 | { |
---|
385 | io->append_run_ID = YES; |
---|
386 | strcpy(io->run_id_string,optarg); |
---|
387 | break; |
---|
388 | } |
---|
389 | case 45 : |
---|
390 | { |
---|
391 | io->mod->ras->gamma_median = 1; |
---|
392 | break; |
---|
393 | } |
---|
394 | case 44 : |
---|
395 | { |
---|
396 | io->mod->s_opt->hybrid_thresh = 0; |
---|
397 | break; |
---|
398 | } |
---|
399 | case 43 : |
---|
400 | { |
---|
401 | io->mod->s_opt->min_diff_lk_move = atof(optarg); |
---|
402 | if(io->mod->s_opt->min_diff_lk_move < 0) |
---|
403 | { |
---|
404 | char choix; |
---|
405 | PhyML_Printf("\n. Min_diff_lk_move must be a double greater than 0.\n"); |
---|
406 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
407 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
408 | Exit("\n"); |
---|
409 | } |
---|
410 | break; |
---|
411 | } |
---|
412 | case 42 : |
---|
413 | { |
---|
414 | io->mod->s_opt->pars_thresh = (int)atoi(optarg); |
---|
415 | if(io->mod->s_opt->pars_thresh < 0) |
---|
416 | { |
---|
417 | PhyML_Printf("\n. The parsimony threshold must be an integer greater than 0.\n"); |
---|
418 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
419 | Exit("\n"); |
---|
420 | } |
---|
421 | break; |
---|
422 | } |
---|
423 | case 41 : |
---|
424 | { |
---|
425 | io->mod->s_opt->opt_five_branch = 0; |
---|
426 | break; |
---|
427 | } |
---|
428 | case 40 : |
---|
429 | { |
---|
430 | writemode = 2; |
---|
431 | break; |
---|
432 | } |
---|
433 | case 39 : |
---|
434 | { |
---|
435 | break; |
---|
436 | } |
---|
437 | case 38 : |
---|
438 | { |
---|
439 | io->rm_ambigu = 1; |
---|
440 | break; |
---|
441 | } |
---|
442 | case 37 : |
---|
443 | { |
---|
444 | io->mod->s_opt->opt_cov_free_rates = YES; |
---|
445 | io->mod->m4mod->use_cov_alpha = NO; |
---|
446 | io->mod->m4mod->use_cov_free = YES; |
---|
447 | break; |
---|
448 | } |
---|
449 | case 36 : |
---|
450 | { |
---|
451 | #ifndef PHYML |
---|
452 | open_ps_file = 1; |
---|
453 | #endif |
---|
454 | break; |
---|
455 | } |
---|
456 | case 35 : |
---|
457 | { |
---|
458 | io->mod->m4mod->n_h = (int)atoi(optarg); |
---|
459 | |
---|
460 | if(io->mod->m4mod->n_h < 1) |
---|
461 | { |
---|
462 | char choix; |
---|
463 | PhyML_Printf("\n. The number of classes must be greater than 0.\n"); |
---|
464 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
465 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
466 | Exit("\n"); |
---|
467 | } |
---|
468 | break; |
---|
469 | } |
---|
470 | case 34 : |
---|
471 | { |
---|
472 | io->mod->m4mod->use_cov_alpha = 1; |
---|
473 | io->mod->m4mod->use_cov_free = 0; |
---|
474 | |
---|
475 | if(!strcmp(optarg,"e") || !strcmp(optarg,"E") || |
---|
476 | !strcmp(optarg,"estimated") || !strcmp(optarg,"ESTIMATED")) |
---|
477 | { |
---|
478 | io->mod->s_opt->opt_cov_alpha = 1; |
---|
479 | io->mod->m4mod->alpha = 1.0; |
---|
480 | } |
---|
481 | else |
---|
482 | { |
---|
483 | io->mod->m4mod->alpha = (phydbl)atof(optarg); |
---|
484 | |
---|
485 | if(io->mod->m4mod->alpha < 1.E-5) |
---|
486 | { |
---|
487 | char choix; |
---|
488 | PhyML_Printf("\n. The value of alpha must be greater than 1.E-5.\n"); |
---|
489 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
490 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
491 | Exit("\n"); |
---|
492 | } |
---|
493 | } |
---|
494 | break; |
---|
495 | } |
---|
496 | case 33 : |
---|
497 | { |
---|
498 | if(!strcmp(optarg,"e") || !strcmp(optarg,"E") || |
---|
499 | !strcmp(optarg,"estimated") || !strcmp(optarg,"ESTIMATED")) |
---|
500 | { |
---|
501 | io->mod->s_opt->opt_cov_delta = YES; |
---|
502 | io->mod->m4mod->delta = 1.0; |
---|
503 | } |
---|
504 | else |
---|
505 | { |
---|
506 | io->mod->m4mod->delta = (phydbl)atof(optarg); |
---|
507 | |
---|
508 | if(atof(optarg) < 1.E-10) |
---|
509 | { |
---|
510 | char choix; |
---|
511 | PhyML_Printf("\n. The value of delta must be larger than 1.E-10.\n"); |
---|
512 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
513 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
514 | Exit("\n"); |
---|
515 | } |
---|
516 | } |
---|
517 | break; |
---|
518 | } |
---|
519 | case 32 : |
---|
520 | { |
---|
521 | io->mod->use_m4mod = YES; |
---|
522 | break; |
---|
523 | } |
---|
524 | case 31 : |
---|
525 | { |
---|
526 | io->print_site_lnl = YES; |
---|
527 | break; |
---|
528 | } |
---|
529 | case 30 : |
---|
530 | { |
---|
531 | io->print_trace = YES; |
---|
532 | break; |
---|
533 | } |
---|
534 | case 29 : |
---|
535 | { |
---|
536 | io->random_boot_seq_order = (int)atoi(optarg); |
---|
537 | break; |
---|
538 | } |
---|
539 | case 28 : |
---|
540 | { |
---|
541 | io->collapse_boot = (int)atoi(optarg); |
---|
542 | break; |
---|
543 | } |
---|
544 | case 27 : |
---|
545 | { |
---|
546 | io->r_seed = (int)atoi(optarg); |
---|
547 | break; |
---|
548 | } |
---|
549 | case 26 : |
---|
550 | { |
---|
551 | io->mod->s_opt->general_pars = YES; |
---|
552 | break; |
---|
553 | } |
---|
554 | case 25 : |
---|
555 | { |
---|
556 | io->mod->s_opt->fast_nni = YES; |
---|
557 | break; |
---|
558 | } |
---|
559 | case 24 : |
---|
560 | { |
---|
561 | io->mod->s_opt->p_moves_to_examine = (phydbl)atof(optarg); |
---|
562 | break; |
---|
563 | } |
---|
564 | case 23 : |
---|
565 | { |
---|
566 | io->mod->s_opt->wim_inside_opt = 1; |
---|
567 | break; |
---|
568 | } |
---|
569 | case 0 : |
---|
570 | { |
---|
571 | io->mod->s_opt->wim_n_rgrft = atoi(optarg); |
---|
572 | break; |
---|
573 | } |
---|
574 | case 1 : |
---|
575 | { |
---|
576 | io->mod->s_opt->wim_n_globl = atoi(optarg); |
---|
577 | break; |
---|
578 | } |
---|
579 | case 2 : |
---|
580 | { |
---|
581 | io->mod->s_opt->wim_max_dist = atoi(optarg); |
---|
582 | break; |
---|
583 | } |
---|
584 | case 3 : |
---|
585 | { |
---|
586 | io->mod->s_opt->wim_n_optim = atoi(optarg); |
---|
587 | break; |
---|
588 | } |
---|
589 | case 4 : |
---|
590 | { |
---|
591 | io->mod->s_opt->wim_n_best = atoi(optarg); |
---|
592 | break; |
---|
593 | } |
---|
594 | case 16 : |
---|
595 | { |
---|
596 | io->mod->s_opt->min_diff_lk_local = atof(optarg); |
---|
597 | break; |
---|
598 | } |
---|
599 | case 17 : |
---|
600 | { |
---|
601 | io->mod->s_opt->min_diff_lk_global = atof(optarg); |
---|
602 | break; |
---|
603 | } |
---|
604 | case 18 : |
---|
605 | { |
---|
606 | io->mod->s_opt->steph_spr = 0; |
---|
607 | io->mod->s_opt->greedy = 1; |
---|
608 | break; |
---|
609 | } |
---|
610 | case 19 : |
---|
611 | { |
---|
612 | io->mod->s_opt->brent_it_max = atoi(optarg); |
---|
613 | break; |
---|
614 | } |
---|
615 | case 20 : |
---|
616 | { |
---|
617 | io->mod->s_opt->random_input_tree = 1; |
---|
618 | break; |
---|
619 | } |
---|
620 | case 21 : |
---|
621 | { |
---|
622 | io->mod->s_opt->random_input_tree = 1; |
---|
623 | io->mod->s_opt->n_rand_starts = atoi(optarg); |
---|
624 | if(io->mod->s_opt->n_rand_starts < 1) Exit("\n== Number of random starting trees must be > 0.\n\n"); |
---|
625 | } |
---|
626 | case 's':case 6: |
---|
627 | { |
---|
628 | if((!strcmp(optarg,"spr")) || (!strcmp(optarg,"SPR"))) |
---|
629 | { |
---|
630 | io->mod->s_opt->topo_search = SPR_MOVE; |
---|
631 | io->mod->s_opt->greedy = (io->mod->s_opt->steph_spr)?(0):(1); |
---|
632 | } |
---|
633 | else if((!strcmp(optarg,"nni")) || (!strcmp(optarg,"NNI"))) |
---|
634 | { |
---|
635 | io->mod->s_opt->topo_search = NNI_MOVE; |
---|
636 | io->mod->s_opt->random_input_tree = 0; |
---|
637 | } |
---|
638 | else if((!strcmp(optarg,"best")) || (!strcmp(optarg,"BEST"))) |
---|
639 | { |
---|
640 | io->mod->s_opt->topo_search = BEST_OF_NNI_AND_SPR; |
---|
641 | io->mod->s_opt->greedy = (io->mod->s_opt->steph_spr)?(0):(1); |
---|
642 | } |
---|
643 | break; |
---|
644 | } |
---|
645 | |
---|
646 | case 'd':case 7: |
---|
647 | { |
---|
648 | if(!strcmp(optarg,"nt")) |
---|
649 | { |
---|
650 | io->datatype = NT; |
---|
651 | io->mod->ns = 4; |
---|
652 | io->mod->m4mod->n_o = 4; |
---|
653 | |
---|
654 | if( |
---|
655 | (io->mod->whichmodel == LG) || |
---|
656 | (io->mod->whichmodel == WAG) || |
---|
657 | (io->mod->whichmodel == DAYHOFF) || |
---|
658 | (io->mod->whichmodel == JTT) || |
---|
659 | (io->mod->whichmodel == BLOSUM62) || |
---|
660 | (io->mod->whichmodel == MTREV) || |
---|
661 | (io->mod->whichmodel == RTREV) || |
---|
662 | (io->mod->whichmodel == CPREV) || |
---|
663 | (io->mod->whichmodel == DCMUT) || |
---|
664 | (io->mod->whichmodel == VT) || |
---|
665 | (io->mod->whichmodel == MTMAM) || |
---|
666 | (io->mod->whichmodel == MTART) || |
---|
667 | (io->mod->whichmodel == HIVW) || |
---|
668 | (io->mod->whichmodel == HIVB) || |
---|
669 | (io->mod->whichmodel == CUSTOMAA) |
---|
670 | ) |
---|
671 | { |
---|
672 | io->mod->whichmodel = HKY85; |
---|
673 | strcpy(io->mod->modelname->s, "HKY85\0"); |
---|
674 | } |
---|
675 | } |
---|
676 | else if (!strcmp(optarg,"aa")) |
---|
677 | { |
---|
678 | io->datatype = AA; |
---|
679 | io->mod->s_opt->opt_kappa = NO; |
---|
680 | io->mod->ns = 20; |
---|
681 | io->mod->m4mod->n_o = 20; |
---|
682 | |
---|
683 | if( |
---|
684 | (io->mod->whichmodel == JC69) || |
---|
685 | (io->mod->whichmodel == K80) || |
---|
686 | (io->mod->whichmodel == F81) || |
---|
687 | (io->mod->whichmodel == HKY85) || |
---|
688 | (io->mod->whichmodel == F84) || |
---|
689 | (io->mod->whichmodel == TN93) || |
---|
690 | (io->mod->whichmodel == GTR) || |
---|
691 | (io->mod->whichmodel == CUSTOM) |
---|
692 | ) |
---|
693 | { |
---|
694 | io->mod->whichmodel = LG; |
---|
695 | strcpy(io->mod->modelname->s, "LG\0"); |
---|
696 | } |
---|
697 | } |
---|
698 | else if ((!strcmp(optarg,"generic")) || (!strcmp(optarg,"gen"))) |
---|
699 | { |
---|
700 | io->datatype = GENERIC; |
---|
701 | } |
---|
702 | else |
---|
703 | { |
---|
704 | char choix; |
---|
705 | PhyML_Printf("\n. Unknown argument to -d option: please use `nt' for DNA or `aa' for Amino-Acids\n"); |
---|
706 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
707 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
708 | Exit("\n"); |
---|
709 | } |
---|
710 | |
---|
711 | break; |
---|
712 | } |
---|
713 | case 'm': case 5 : |
---|
714 | { |
---|
715 | int i; |
---|
716 | |
---|
717 | For(i,strlen(optarg)) Uppercase(optarg+i); |
---|
718 | |
---|
719 | if(!isalpha(optarg[0])) |
---|
720 | { |
---|
721 | strcpy(io->mod->custom_mod_string->s,optarg); |
---|
722 | |
---|
723 | if(strlen(io->mod->custom_mod_string->s) != 6) |
---|
724 | { |
---|
725 | Warn_And_Exit("\n. The string should be of length 6.\n"); |
---|
726 | } |
---|
727 | else |
---|
728 | { |
---|
729 | /* Make_Custom_Model(io->mod); */ |
---|
730 | /* Translate_Custom_Mod_String(io->mod); */ |
---|
731 | } |
---|
732 | |
---|
733 | io->datatype = NT; |
---|
734 | io->mod->whichmodel = CUSTOM; |
---|
735 | strcpy(io->mod->modelname->s, "custom"); |
---|
736 | io->mod->s_opt->opt_kappa = NO; |
---|
737 | io->mod->s_opt->opt_rr = YES; |
---|
738 | } |
---|
739 | |
---|
740 | else if (strcmp(optarg, "JC69") == 0) |
---|
741 | { |
---|
742 | io->datatype = NT; |
---|
743 | io->mod->whichmodel = JC69; |
---|
744 | } |
---|
745 | else if(strcmp(optarg, "K80") == 0) |
---|
746 | { |
---|
747 | io->datatype = NT; |
---|
748 | io->mod->whichmodel = K80; |
---|
749 | } |
---|
750 | else if(strcmp(optarg, "F81") == 0) |
---|
751 | { |
---|
752 | io->datatype = NT; |
---|
753 | io->mod->whichmodel = F81; |
---|
754 | } |
---|
755 | else if (strcmp(optarg, "HKY85") == 0) |
---|
756 | { |
---|
757 | io->datatype = NT; |
---|
758 | io->mod->whichmodel = HKY85; |
---|
759 | } |
---|
760 | else if(strcmp(optarg, "F84") == 0) |
---|
761 | { |
---|
762 | io->datatype = NT; |
---|
763 | io->mod->whichmodel = F84; |
---|
764 | } |
---|
765 | else if (strcmp (optarg,"TN93") == 0) |
---|
766 | { |
---|
767 | io->datatype = NT; |
---|
768 | io->mod->whichmodel = TN93; |
---|
769 | } |
---|
770 | else if(strcmp (optarg, "GTR") == 0) |
---|
771 | { |
---|
772 | io->datatype = NT; |
---|
773 | io->mod->whichmodel = GTR; |
---|
774 | } |
---|
775 | else if(strcmp(optarg, "DAYHOFF") == 0) |
---|
776 | { |
---|
777 | io->datatype = AA; |
---|
778 | io->mod->whichmodel = DAYHOFF; |
---|
779 | } |
---|
780 | else if(strcmp (optarg, "JTT") == 0) |
---|
781 | { |
---|
782 | io->datatype = AA; |
---|
783 | io->mod->whichmodel = JTT; |
---|
784 | } |
---|
785 | else if(strcmp(optarg, "MTREV") == 0) |
---|
786 | { |
---|
787 | io->datatype = AA; |
---|
788 | io->mod->whichmodel = MTREV; |
---|
789 | } |
---|
790 | else if(strcmp (optarg, "LG") == 0) |
---|
791 | { |
---|
792 | io->datatype = AA; |
---|
793 | io->mod->whichmodel = LG; |
---|
794 | } |
---|
795 | else if(strcmp (optarg, "WAG") == 0) |
---|
796 | { |
---|
797 | io->datatype = AA; |
---|
798 | io->mod->whichmodel = WAG; |
---|
799 | } |
---|
800 | else if(strcmp(optarg, "DCMUT") == 0) |
---|
801 | { |
---|
802 | io->datatype = AA; |
---|
803 | io->mod->whichmodel = DCMUT; |
---|
804 | } |
---|
805 | else if(strcmp (optarg, "RTREV") == 0) |
---|
806 | { |
---|
807 | io->datatype = AA; |
---|
808 | io->mod->whichmodel = RTREV; |
---|
809 | } |
---|
810 | else if(strcmp(optarg, "CPREV") == 0) |
---|
811 | { |
---|
812 | io->datatype = AA; |
---|
813 | io->mod->whichmodel = CPREV; |
---|
814 | } |
---|
815 | else if(strcmp(optarg, "VT") == 0) |
---|
816 | { |
---|
817 | io->datatype = AA; |
---|
818 | io->mod->whichmodel = VT; |
---|
819 | } |
---|
820 | else if(strcmp(optarg, "BLOSUM62") == 0) |
---|
821 | { |
---|
822 | io->datatype = AA; |
---|
823 | io->mod->whichmodel = BLOSUM62; |
---|
824 | } |
---|
825 | else if(strcmp(optarg, "MTMAM") == 0) |
---|
826 | { |
---|
827 | io->datatype = AA; |
---|
828 | io->mod->whichmodel = MTMAM; |
---|
829 | } |
---|
830 | else if (strcmp(optarg,"MTART") == 0) |
---|
831 | { |
---|
832 | io->datatype = AA; |
---|
833 | io->mod->whichmodel = MTART; |
---|
834 | } |
---|
835 | else if (strcmp(optarg,"HIVW") == 0) |
---|
836 | { |
---|
837 | io->datatype = AA; |
---|
838 | io->mod->whichmodel = HIVW; |
---|
839 | } |
---|
840 | else if(strcmp(optarg, "HIVB") == 0) |
---|
841 | { |
---|
842 | io->datatype = AA; |
---|
843 | io->mod->whichmodel = HIVB; |
---|
844 | } |
---|
845 | else if (strcmp(optarg, "CUSTOM") == 0) |
---|
846 | { |
---|
847 | io->datatype = AA; |
---|
848 | io->mod->whichmodel = CUSTOMAA; |
---|
849 | } |
---|
850 | else |
---|
851 | { |
---|
852 | PhyML_Printf("\n. The model name is incorrect. Please see the documentation.\n"); |
---|
853 | Exit("\n"); |
---|
854 | } |
---|
855 | |
---|
856 | Set_Model_Name(io->mod); |
---|
857 | |
---|
858 | break; |
---|
859 | } |
---|
860 | |
---|
861 | case 'a':case 14 : |
---|
862 | { |
---|
863 | if ((strcmp (optarg, "e") == 0) || |
---|
864 | (strcmp (optarg, "E") == 0) || |
---|
865 | (strcmp (optarg, "estimated") == 0) || |
---|
866 | (strcmp (optarg, "ESTIMATED") == 0)) |
---|
867 | { |
---|
868 | io->mod->s_opt->opt_alpha = YES; |
---|
869 | } |
---|
870 | else if (atof(optarg) < 1.E-10) |
---|
871 | { |
---|
872 | char choix; |
---|
873 | PhyML_Printf("\n. Alpha must be > 1.E-10.\n"); |
---|
874 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
875 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
876 | Exit("\n"); |
---|
877 | } |
---|
878 | else |
---|
879 | { |
---|
880 | io->mod->ras->alpha->v = (phydbl)atof(optarg); |
---|
881 | io->mod->s_opt->opt_alpha = 0; |
---|
882 | } |
---|
883 | break; |
---|
884 | } |
---|
885 | case 'b':case 10: |
---|
886 | { |
---|
887 | if ((int)String_To_Dbl(optarg) < -5) |
---|
888 | { |
---|
889 | char choix; |
---|
890 | PhyML_Printf("\n. Branch test value must be a positive integer for bootstrap, or between -1 and -4 for aLRT branch test\n"); |
---|
891 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
892 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
893 | Exit("\n"); |
---|
894 | } |
---|
895 | else |
---|
896 | { |
---|
897 | if((int)String_To_Dbl(optarg) > 0) |
---|
898 | { |
---|
899 | io->ratio_test = 0; |
---|
900 | io->mod->bootstrap = (int)atoi(optarg); |
---|
901 | io->print_boot_trees = 1; |
---|
902 | |
---|
903 | if(io->n_data_sets > 1) |
---|
904 | { |
---|
905 | char choix; |
---|
906 | PhyML_Printf("\n. Bootstrap option is not allowed with multiple data sets\n"); |
---|
907 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
908 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
909 | Exit("\n"); |
---|
910 | } |
---|
911 | } |
---|
912 | else if (atoi(optarg)==0) |
---|
913 | { |
---|
914 | io->mod->bootstrap = 0; |
---|
915 | io->ratio_test = 0; |
---|
916 | } |
---|
917 | else |
---|
918 | { |
---|
919 | io->mod->bootstrap = 0; |
---|
920 | io->ratio_test = -(int)atoi(optarg); |
---|
921 | } |
---|
922 | } |
---|
923 | break; |
---|
924 | } |
---|
925 | case 'c':case 12: |
---|
926 | { |
---|
927 | if ((!atoi(optarg)) || (atoi(optarg) < 0)) |
---|
928 | { |
---|
929 | char choix; |
---|
930 | PhyML_Printf("\n. Unknown argument to -c option: the number of rate categories must be a positive integer\n"); |
---|
931 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
932 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
933 | Exit("\n"); |
---|
934 | } |
---|
935 | else |
---|
936 | { |
---|
937 | io->mod->ras->n_catg = atoi(optarg); |
---|
938 | if(io->mod->ras->n_catg < 1) |
---|
939 | { |
---|
940 | PhyML_Printf("\n. The number of rate categories must be a positive integer\n"); |
---|
941 | Exit("\n"); |
---|
942 | } |
---|
943 | } |
---|
944 | break; |
---|
945 | } |
---|
946 | case 'f': |
---|
947 | { |
---|
948 | if(!strcmp(optarg,"e")) |
---|
949 | { |
---|
950 | if(io->datatype == NT) |
---|
951 | io->mod->s_opt->opt_state_freq = NO; |
---|
952 | else if (io->datatype == AA) |
---|
953 | io->mod->s_opt->opt_state_freq = YES; |
---|
954 | else |
---|
955 | { |
---|
956 | PhyML_Printf("\n. Please define the data type (nt or aa) before setting the -f option\n"); |
---|
957 | Exit("\n"); |
---|
958 | } |
---|
959 | } |
---|
960 | else if(!strcmp(optarg,"m")) |
---|
961 | { |
---|
962 | if (io->datatype == NT) |
---|
963 | io->mod->s_opt->opt_state_freq = YES; |
---|
964 | else if (io->datatype == AA) |
---|
965 | io->mod->s_opt->opt_state_freq = NO; |
---|
966 | else |
---|
967 | { |
---|
968 | PhyML_Printf("\n. Please define the data type (nt or aa) before setting the -f option\n"); |
---|
969 | Exit("\n"); |
---|
970 | } |
---|
971 | } |
---|
972 | else if(!isalpha(optarg[0])) |
---|
973 | { |
---|
974 | phydbl sum; |
---|
975 | double val1,val2,val3,val4; |
---|
976 | |
---|
977 | io->mod->s_opt->opt_state_freq = 0; |
---|
978 | io->mod->s_opt->user_state_freq = 1; |
---|
979 | |
---|
980 | /* sscanf(optarg,"%lf,%lf,%lf,%lf", */ |
---|
981 | /* io->mod->user_b_freq, */ |
---|
982 | /* io->mod->user_b_freq+1, */ |
---|
983 | /* io->mod->user_b_freq+2, */ |
---|
984 | /* io->mod->user_b_freq+3); */ |
---|
985 | sscanf(optarg,"%lf,%lf,%lf,%lf",&val1,&val2,&val3,&val4); |
---|
986 | io->mod->user_b_freq->v[0] = (phydbl)val1; |
---|
987 | io->mod->user_b_freq->v[1] = (phydbl)val2; |
---|
988 | io->mod->user_b_freq->v[2] = (phydbl)val3; |
---|
989 | io->mod->user_b_freq->v[3] = (phydbl)val4; |
---|
990 | |
---|
991 | sum = |
---|
992 | (io->mod->user_b_freq->v[0] + |
---|
993 | io->mod->user_b_freq->v[1] + |
---|
994 | io->mod->user_b_freq->v[2] + |
---|
995 | io->mod->user_b_freq->v[3]); |
---|
996 | |
---|
997 | io->mod->user_b_freq->v[0] /= sum; |
---|
998 | io->mod->user_b_freq->v[1] /= sum; |
---|
999 | io->mod->user_b_freq->v[2] /= sum; |
---|
1000 | io->mod->user_b_freq->v[3] /= sum; |
---|
1001 | |
---|
1002 | |
---|
1003 | if(io->mod->user_b_freq->v[0] < .0 || |
---|
1004 | io->mod->user_b_freq->v[1] < .0 || |
---|
1005 | io->mod->user_b_freq->v[2] < .0 || |
---|
1006 | io->mod->user_b_freq->v[3] < .0 || |
---|
1007 | io->mod->user_b_freq->v[0] > 1. || |
---|
1008 | io->mod->user_b_freq->v[1] > 1. || |
---|
1009 | io->mod->user_b_freq->v[2] > 1. || |
---|
1010 | io->mod->user_b_freq->v[3] > 1.) |
---|
1011 | { |
---|
1012 | Warn_And_Exit("\n. Invalid base frequencies.\n"); |
---|
1013 | } |
---|
1014 | } |
---|
1015 | break; |
---|
1016 | } |
---|
1017 | |
---|
1018 | case 'h':case 69: |
---|
1019 | { |
---|
1020 | Usage(); |
---|
1021 | break; |
---|
1022 | } |
---|
1023 | |
---|
1024 | case 'i':case 9: |
---|
1025 | { |
---|
1026 | char *tmp; |
---|
1027 | tmp = (char *) mCalloc (T_MAX_FILE, sizeof(char)); |
---|
1028 | if (strlen (optarg) > T_MAX_FILE -16) |
---|
1029 | { |
---|
1030 | char choix; |
---|
1031 | strcpy (tmp, "\n. The file name'"); |
---|
1032 | strcat (tmp, optarg); |
---|
1033 | strcat (tmp, "' is too long.\n"); |
---|
1034 | PhyML_Printf("%s",tmp); |
---|
1035 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
1036 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1037 | Exit("\n"); |
---|
1038 | } |
---|
1039 | |
---|
1040 | else if (!Filexists (optarg)) |
---|
1041 | { |
---|
1042 | char choix; |
---|
1043 | strcpy (tmp, "\n. The file '"); |
---|
1044 | strcat (tmp, optarg); |
---|
1045 | strcat (tmp, "' does not exist.\n"); |
---|
1046 | PhyML_Printf("%s",tmp); |
---|
1047 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
1048 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1049 | Exit("\n"); |
---|
1050 | } |
---|
1051 | else |
---|
1052 | { |
---|
1053 | strcpy(io->in_align_file, optarg); |
---|
1054 | io->fp_in_align = Openfile(io->in_align_file,0); |
---|
1055 | |
---|
1056 | strcpy(io->out_tree_file,optarg); |
---|
1057 | #ifdef PHYML |
---|
1058 | strcat(io->out_tree_file,"_phyml_tree"); |
---|
1059 | #elif(MC) |
---|
1060 | strcat(io->out_tree_file,"_mc_tree"); |
---|
1061 | #elif(M4) |
---|
1062 | strcat(io->out_tree_file,"_m4_tree"); |
---|
1063 | #endif |
---|
1064 | |
---|
1065 | strcpy(io->out_stats_file,optarg); |
---|
1066 | #ifdef PHYML |
---|
1067 | strcat(io->out_stats_file,"_phyml_stats"); |
---|
1068 | #elif(MC) |
---|
1069 | strcat(io->out_stats_file,"_mc_stats"); |
---|
1070 | #elif(M4) |
---|
1071 | strcat(io->out_stats_file,"_m4_stats"); |
---|
1072 | #endif |
---|
1073 | } |
---|
1074 | Free (tmp); |
---|
1075 | break; |
---|
1076 | } |
---|
1077 | |
---|
1078 | case 't':case 11: |
---|
1079 | { |
---|
1080 | if ((io->mod->whichmodel != JC69) && |
---|
1081 | (io->mod->whichmodel != F81) && |
---|
1082 | (io->mod->whichmodel != GTR)) |
---|
1083 | { |
---|
1084 | if ((strcmp(optarg, "e") == 0) || |
---|
1085 | (strcmp(optarg, "E") == 0) || |
---|
1086 | (strcmp(optarg, "estimated") == 0) || |
---|
1087 | (strcmp(optarg, "ESTIMATED") == 0)) |
---|
1088 | { |
---|
1089 | io->mod->kappa->v = 4.0; |
---|
1090 | io->mod->s_opt->opt_kappa = YES; |
---|
1091 | if (io->mod->whichmodel == TN93) |
---|
1092 | io->mod->s_opt->opt_lambda = YES; |
---|
1093 | } |
---|
1094 | else |
---|
1095 | { |
---|
1096 | if (atof(optarg) < .0) |
---|
1097 | { |
---|
1098 | char choix; |
---|
1099 | PhyML_Printf("\n. The ts/tv ratio must be a positive number\n"); |
---|
1100 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
1101 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1102 | Exit("\n"); |
---|
1103 | } |
---|
1104 | else |
---|
1105 | { |
---|
1106 | io->mod->kappa->v = (phydbl)atof(optarg); |
---|
1107 | io->mod->s_opt->opt_kappa = 0; |
---|
1108 | io->mod->s_opt->opt_lambda = 0; |
---|
1109 | } |
---|
1110 | } |
---|
1111 | } |
---|
1112 | break; |
---|
1113 | } |
---|
1114 | case 'n':case 8: |
---|
1115 | { |
---|
1116 | if ((!atoi(optarg)) || (atoi(optarg) < 0)) |
---|
1117 | { |
---|
1118 | char choix; |
---|
1119 | PhyML_Printf("\n. The number of alignments must be a positive integer\n"); |
---|
1120 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
1121 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1122 | Exit("\n"); |
---|
1123 | } |
---|
1124 | else io->n_data_sets = atoi (optarg); |
---|
1125 | break; |
---|
1126 | } |
---|
1127 | case 'q':case 22: |
---|
1128 | { |
---|
1129 | io->interleaved = NO; |
---|
1130 | break; |
---|
1131 | } |
---|
1132 | case 'u':case 15: |
---|
1133 | { |
---|
1134 | char *tmp; |
---|
1135 | tmp = (char *)mCalloc(T_MAX_FILE, sizeof(char)); |
---|
1136 | if(strlen(optarg) > T_MAX_FILE -11) |
---|
1137 | { |
---|
1138 | char choix; |
---|
1139 | strcpy (tmp, "\n. The file name'"); |
---|
1140 | strcat (tmp, optarg); |
---|
1141 | strcat (tmp, "' is too long.\n"); |
---|
1142 | PhyML_Printf("%s",tmp); |
---|
1143 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
1144 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1145 | Exit("\n"); |
---|
1146 | } |
---|
1147 | else if (! Filexists (optarg)) |
---|
1148 | { |
---|
1149 | char choix; |
---|
1150 | strcpy (tmp, "\n. The file '"); |
---|
1151 | strcat (tmp, optarg); |
---|
1152 | strcat (tmp, "' doesn't exist.\n"); |
---|
1153 | PhyML_Printf("%s",tmp); |
---|
1154 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
1155 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1156 | Exit("\n"); |
---|
1157 | } |
---|
1158 | else |
---|
1159 | { |
---|
1160 | strcpy(io->in_tree_file, optarg); |
---|
1161 | io->in_tree = 2; |
---|
1162 | io->fp_in_tree = Openfile(io->in_tree_file,READ); |
---|
1163 | } |
---|
1164 | Free(tmp); |
---|
1165 | break; |
---|
1166 | } |
---|
1167 | |
---|
1168 | case 'v':case 13: |
---|
1169 | { |
---|
1170 | if ((strcmp (optarg, "e") == 0) || |
---|
1171 | (strcmp (optarg, "E") == 0) || |
---|
1172 | (strcmp (optarg, "estimated") == 0) || |
---|
1173 | (strcmp (optarg, "ESTIMATED") == 0)) |
---|
1174 | { |
---|
1175 | io->mod->s_opt->opt_pinvar = YES; |
---|
1176 | io->mod->ras->invar = YES; |
---|
1177 | } |
---|
1178 | |
---|
1179 | else if ((atof(optarg) < 0.0) || (atof(optarg) > 1.0)) |
---|
1180 | { |
---|
1181 | char choix; |
---|
1182 | PhyML_Printf("\n. The proportion of invariable site must be a number between 0.0 and 1.0\n"); |
---|
1183 | PhyML_Printf("\n. Type any key to exit."); |
---|
1184 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1185 | Exit("\n"); |
---|
1186 | } |
---|
1187 | else |
---|
1188 | { |
---|
1189 | io->mod->ras->pinvar->v = (phydbl)atof(optarg); |
---|
1190 | if (io->mod->ras->pinvar->v > 0.0+SMALL) |
---|
1191 | io->mod->ras->invar = 1; |
---|
1192 | else |
---|
1193 | io->mod->ras->invar = 0; |
---|
1194 | io->mod->s_opt->opt_pinvar = 0; |
---|
1195 | } |
---|
1196 | break; |
---|
1197 | } |
---|
1198 | case 'o': |
---|
1199 | { |
---|
1200 | if(!strcmp(optarg,"tlr")) |
---|
1201 | { |
---|
1202 | io->mod->s_opt->opt_topo = YES; |
---|
1203 | io->mod->s_opt->opt_bl = YES; |
---|
1204 | io->mod->s_opt->opt_subst_param = YES; |
---|
1205 | } |
---|
1206 | else if(!strcmp(optarg,"tl")) |
---|
1207 | { |
---|
1208 | io->mod->s_opt->opt_topo = YES; |
---|
1209 | io->mod->s_opt->opt_bl = YES; |
---|
1210 | io->mod->s_opt->opt_subst_param = NO; |
---|
1211 | } |
---|
1212 | else if(!strcmp(optarg,"t")) |
---|
1213 | { |
---|
1214 | Warn_And_Exit("\n. You can't optimize the topology without adjusting branch length too...\n"); |
---|
1215 | } |
---|
1216 | else if(!strcmp(optarg,"lr")) |
---|
1217 | { |
---|
1218 | io->mod->s_opt->opt_topo = NO; |
---|
1219 | io->mod->s_opt->opt_bl = YES; |
---|
1220 | io->mod->s_opt->opt_subst_param = YES; |
---|
1221 | } |
---|
1222 | else if(!strcmp(optarg,"l")) |
---|
1223 | { |
---|
1224 | io->mod->s_opt->opt_topo = NO; |
---|
1225 | io->mod->s_opt->opt_bl = YES; |
---|
1226 | io->mod->s_opt->opt_subst_param = NO; |
---|
1227 | } |
---|
1228 | else if(!strcmp(optarg,"r")) |
---|
1229 | { |
---|
1230 | io->mod->s_opt->opt_topo = NO; |
---|
1231 | io->mod->s_opt->opt_bl = NO; |
---|
1232 | io->mod->s_opt->opt_subst_param = YES; |
---|
1233 | } |
---|
1234 | else if(!strcmp(optarg,"none") || !strcmp(optarg,"n")) |
---|
1235 | { |
---|
1236 | io->mod->s_opt->opt_topo = NO; |
---|
1237 | io->mod->s_opt->opt_bl = NO; |
---|
1238 | io->mod->s_opt->opt_subst_param = NO; |
---|
1239 | } |
---|
1240 | else |
---|
1241 | { |
---|
1242 | char choix; |
---|
1243 | PhyML_Printf ("\n. The optimization parameter must be 'tlr' or 'tl' or 'lr' or 'l' or 'r' or ''."); |
---|
1244 | PhyML_Printf("\n. Type any key to exit.\n"); |
---|
1245 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1246 | Exit("\n"); |
---|
1247 | } |
---|
1248 | break; |
---|
1249 | } |
---|
1250 | |
---|
1251 | case '?': |
---|
1252 | { |
---|
1253 | Exit("\n"); |
---|
1254 | break; |
---|
1255 | } |
---|
1256 | |
---|
1257 | case -1: |
---|
1258 | { |
---|
1259 | break; |
---|
1260 | } |
---|
1261 | |
---|
1262 | default: |
---|
1263 | { |
---|
1264 | Usage(); |
---|
1265 | break; |
---|
1266 | } |
---|
1267 | } |
---|
1268 | }while(c != -1); |
---|
1269 | |
---|
1270 | |
---|
1271 | /* if((io->mod->whichmodel == K80) || (io->mod->whichmodel == JC69)) */ |
---|
1272 | /* { */ |
---|
1273 | /* if(io->mod->s_opt->opt_state_freq) */ |
---|
1274 | /* { */ |
---|
1275 | /* char c; */ |
---|
1276 | /* PhyML_Printf("\n. WARNING: nucleotide frequencies must be set to 1/4 with this model.\n"); */ |
---|
1277 | /* PhyML_Printf("\n. Type the enter key to resume the analysis.\n"); */ |
---|
1278 | /* scanf("%c",&c); */ |
---|
1279 | /* } */ |
---|
1280 | /* io->mod->s_opt->opt_state_freq = 0; */ |
---|
1281 | /* } */ |
---|
1282 | |
---|
1283 | |
---|
1284 | if(io->mod->s_opt->constrained_br_len == YES) |
---|
1285 | { |
---|
1286 | io->mod->s_opt->opt_topo = NO; |
---|
1287 | /* io->mod->s_opt->opt_bl = NO; */ |
---|
1288 | } |
---|
1289 | |
---|
1290 | #ifndef PHYML |
---|
1291 | if((open_ps_file) || (io->m4_model == YES)) |
---|
1292 | { |
---|
1293 | strcpy(io->out_ps_file,io->in_align_file); |
---|
1294 | strcat(io->out_ps_file, "_mc_tree.ps"); |
---|
1295 | io->fp_out_ps = Openfile(io->out_ps_file,WRITE); |
---|
1296 | } |
---|
1297 | #endif |
---|
1298 | |
---|
1299 | |
---|
1300 | if(io->datatype == UNDEFINED) io->datatype = NT; |
---|
1301 | |
---|
1302 | |
---|
1303 | if((io->mod->s_opt->n_rand_starts) && |
---|
1304 | (io->mod->s_opt->topo_search == NNI_MOVE) && |
---|
1305 | (io->mod->s_opt->random_input_tree)) |
---|
1306 | { |
---|
1307 | Warn_And_Exit("\n== The random starting tree option is only compatible with SPR based search options.\n"); |
---|
1308 | } |
---|
1309 | |
---|
1310 | if ((io->datatype == NT) && (io->mod->whichmodel > 10)) |
---|
1311 | { |
---|
1312 | char choix; |
---|
1313 | PhyML_Printf("\n== Err.: model incompatible with the data type. Please use JC69, K80, F81, HKY, F84, TN93 or GTR\n"); |
---|
1314 | PhyML_Printf("\n== Type any key to exit.\n"); |
---|
1315 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1316 | Warn_And_Exit("\n"); |
---|
1317 | } |
---|
1318 | else if ((io->datatype == AA) && (io->mod->whichmodel < 11)) |
---|
1319 | { |
---|
1320 | char choix; |
---|
1321 | PhyML_Printf("\n== Err.: model incompatible with the data type. Please use LG, Dayhoff, JTT, MtREV, WAG, DCMut, RtREV, CpREV, VT, Blosum62, MtMam, MtArt, HIVw or HIVb.\n"); |
---|
1322 | PhyML_Printf("\n== Type any key to exit.\n"); |
---|
1323 | if(!scanf("%c",&choix)) Exit("\n"); |
---|
1324 | Exit("\n"); |
---|
1325 | } |
---|
1326 | |
---|
1327 | |
---|
1328 | |
---|
1329 | |
---|
1330 | if(io->mod->use_m4mod == NO) |
---|
1331 | { |
---|
1332 | io->mod->s_opt->opt_cov_delta = 0; |
---|
1333 | io->mod->s_opt->opt_cov_alpha = 0; |
---|
1334 | io->mod->s_opt->opt_cov_free_rates = 0; |
---|
1335 | } |
---|
1336 | |
---|
1337 | if((io->mod->s_opt->opt_cov_free_rates) && (io->mod->s_opt->opt_cov_alpha)) |
---|
1338 | { |
---|
1339 | io->mod->s_opt->opt_cov_free_rates = 1; |
---|
1340 | io->mod->m4mod->use_cov_alpha = 0; |
---|
1341 | io->mod->m4mod->use_cov_free = 1; |
---|
1342 | } |
---|
1343 | |
---|
1344 | if(io->print_site_lnl) |
---|
1345 | { |
---|
1346 | strcpy(io->out_lk_file,io->in_align_file); |
---|
1347 | strcat(io->out_lk_file, "_phyml_lk"); |
---|
1348 | if(io->append_run_ID) { strcat(io->out_lk_file,"_"); strcat(io->out_lk_file,io->run_id_string); } |
---|
1349 | strcat(io->out_lk_file, ".txt"); |
---|
1350 | io->fp_out_lk = Openfile(io->out_lk_file,1); |
---|
1351 | } |
---|
1352 | |
---|
1353 | if(io->print_trace) |
---|
1354 | { |
---|
1355 | strcpy(io->out_trace_file,io->in_align_file); |
---|
1356 | strcat(io->out_trace_file,"_phyml_trace"); |
---|
1357 | if(io->append_run_ID) { strcat(io->out_trace_file,"_"); strcat(io->out_trace_file,io->run_id_string); } |
---|
1358 | strcat(io->out_trace_file,".txt"); |
---|
1359 | io->fp_out_trace = Openfile(io->out_trace_file,1); |
---|
1360 | } |
---|
1361 | |
---|
1362 | if(io->mod->s_opt->random_input_tree) |
---|
1363 | { |
---|
1364 | strcpy(io->out_trees_file,io->in_align_file); |
---|
1365 | strcat(io->out_trees_file,"_phyml_rand_trees"); |
---|
1366 | if(io->append_run_ID) { strcat(io->out_trees_file,"_"); strcat(io->out_trees_file,io->run_id_string); } |
---|
1367 | strcat(io->out_trees_file,".txt"); |
---|
1368 | io->fp_out_trees = Openfile(io->out_trees_file,1); |
---|
1369 | } |
---|
1370 | |
---|
1371 | if((io->print_boot_trees) && (io->mod->bootstrap > 0)) |
---|
1372 | { |
---|
1373 | strcpy(io->out_boot_tree_file,io->in_align_file); |
---|
1374 | strcat(io->out_boot_tree_file,"_phyml_boot_trees"); |
---|
1375 | if(io->append_run_ID) { strcat(io->out_boot_tree_file,"_"); strcat(io->out_boot_tree_file,io->run_id_string); } |
---|
1376 | strcat(io->out_boot_tree_file,".txt"); |
---|
1377 | io->fp_out_boot_tree = Openfile(io->out_boot_tree_file,1); |
---|
1378 | |
---|
1379 | strcpy(io->out_boot_stats_file,io->in_align_file); |
---|
1380 | strcat(io->out_boot_stats_file,"_phyml_boot_stats"); |
---|
1381 | if(io->append_run_ID) { strcat(io->out_boot_stats_file,"_"); strcat(io->out_boot_stats_file,io->run_id_string); } |
---|
1382 | strcat(io->out_boot_stats_file,".txt"); |
---|
1383 | io->fp_out_boot_stats = Openfile(io->out_boot_stats_file,1); |
---|
1384 | } |
---|
1385 | |
---|
1386 | if(io->append_run_ID) |
---|
1387 | { |
---|
1388 | strcat(io->out_tree_file,"_"); |
---|
1389 | strcat(io->out_stats_file,"_"); |
---|
1390 | strcat(io->out_tree_file,io->run_id_string); |
---|
1391 | strcat(io->out_stats_file,io->run_id_string); |
---|
1392 | } |
---|
1393 | strcat(io->out_tree_file,".txt"); |
---|
1394 | strcat(io->out_stats_file,".txt"); |
---|
1395 | |
---|
1396 | if(io->mod->ras->n_catg == 1) io->mod->s_opt->opt_alpha = 0; |
---|
1397 | |
---|
1398 | if(!io->mod->s_opt->opt_subst_param) |
---|
1399 | { |
---|
1400 | io->mod->s_opt->opt_alpha = 0; |
---|
1401 | io->mod->s_opt->opt_kappa = 0; |
---|
1402 | io->mod->s_opt->opt_lambda = 0; |
---|
1403 | io->mod->s_opt->opt_pinvar = 0; |
---|
1404 | io->mod->s_opt->opt_rr = 0; |
---|
1405 | } |
---|
1406 | |
---|
1407 | if(io->mod->whichmodel != K80 && |
---|
1408 | io->mod->whichmodel != HKY85 && |
---|
1409 | io->mod->whichmodel != F84 && |
---|
1410 | io->mod->whichmodel != TN93) |
---|
1411 | { |
---|
1412 | io->mod->s_opt->opt_kappa = 0; |
---|
1413 | } |
---|
1414 | |
---|
1415 | if(io->datatype == AA && io->mod->whichmodel == CUSTOMAA && !io->mod->fp_aa_rate_mat) |
---|
1416 | { |
---|
1417 | PhyML_Printf("\n== Custom model option with amino-acid requires you to specify a rate matrix file through the '--aa_rate_file' option.\n"); |
---|
1418 | Exit("\n"); |
---|
1419 | } |
---|
1420 | |
---|
1421 | io->fp_out_tree = Openfile(io->out_tree_file,writemode); |
---|
1422 | io->fp_out_stats = Openfile(io->out_stats_file,writemode); |
---|
1423 | |
---|
1424 | if(io->mod->whichmodel == GTR) |
---|
1425 | { |
---|
1426 | /* Make_Custom_Model(io->mod); */ |
---|
1427 | io->mod->s_opt->opt_rr = 1; |
---|
1428 | } |
---|
1429 | |
---|
1430 | return 1; |
---|
1431 | } |
---|
1432 | |
---|
1433 | ////////////////////////////////////////////////////////////// |
---|
1434 | ////////////////////////////////////////////////////////////// |
---|
1435 | |
---|