| 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 "interface.h" |
|---|
| 14 | #include "mg.h" |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | void Launch_Interface(option *io) |
|---|
| 18 | { |
|---|
| 19 | Launch_Interface_Input(io); |
|---|
| 20 | io->ready_to_go = 0; |
|---|
| 21 | do |
|---|
| 22 | { |
|---|
| 23 | switch(io->curr_interface) |
|---|
| 24 | { |
|---|
| 25 | case INTERFACE_DATA_TYPE : |
|---|
| 26 | { |
|---|
| 27 | Launch_Interface_Data_Type(io); |
|---|
| 28 | break; |
|---|
| 29 | } |
|---|
| 30 | case INTERFACE_MULTIGENE : |
|---|
| 31 | { |
|---|
| 32 | Launch_Interface_Multigene(io); |
|---|
| 33 | break; |
|---|
| 34 | } |
|---|
| 35 | case INTERFACE_MODEL : |
|---|
| 36 | { |
|---|
| 37 | Launch_Interface_Model(io); |
|---|
| 38 | break; |
|---|
| 39 | } |
|---|
| 40 | case INTERFACE_TOPO_SEARCH : |
|---|
| 41 | { |
|---|
| 42 | Launch_Interface_Topo_Search(io); |
|---|
| 43 | break; |
|---|
| 44 | } |
|---|
| 45 | case INTERFACE_BRANCH_SUPPORT : |
|---|
| 46 | { |
|---|
| 47 | Launch_Interface_Branch_Support(io); |
|---|
| 48 | break; |
|---|
| 49 | } |
|---|
| 50 | default : |
|---|
| 51 | { |
|---|
| 52 | PhyML_Printf("\n== Err in file %s at line %d\n\n",__FILE__,__LINE__); |
|---|
| 53 | Exit(""); |
|---|
| 54 | break; |
|---|
| 55 | } |
|---|
| 56 | } |
|---|
| 57 | }while(!io->ready_to_go); |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | if(io->in_tree == 2) |
|---|
| 61 | { |
|---|
| 62 | PhyML_Printf("\n. Enter the name of the input tree file > "); |
|---|
| 63 | Getstring_Stdin(io->in_tree_file); |
|---|
| 64 | io->fp_in_tree = Openfile(io->in_tree_file,0); |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | if((io->mod->whichmodel == CUSTOMAA) && (io->datatype == AA)) |
|---|
| 68 | { |
|---|
| 69 | char *filename; |
|---|
| 70 | |
|---|
| 71 | filename = (char *)mCalloc(T_MAX_NAME,sizeof(char)); |
|---|
| 72 | |
|---|
| 73 | fflush(NULL); |
|---|
| 74 | PhyML_Printf("\n"); |
|---|
| 75 | PhyML_Printf("\n. Enter the rate matrix file name > "); fflush(NULL); |
|---|
| 76 | Getstring_Stdin(filename); |
|---|
| 77 | io->mod->fp_aa_rate_mat = Openfile(filename,0); |
|---|
| 78 | strcpy(io->mod->aa_rate_mat_file->s,filename); |
|---|
| 79 | PhyML_Printf("\n"); |
|---|
| 80 | Free(filename); |
|---|
| 81 | fflush(NULL); |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | if((io->mod->s_opt->n_rand_starts) && |
|---|
| 85 | (io->mod->s_opt->topo_search == NNI_MOVE) && |
|---|
| 86 | (io->mod->s_opt->random_input_tree)) |
|---|
| 87 | { |
|---|
| 88 | Warn_And_Exit("\n. The random starting tree option is only compatible with SPR based search options.\n"); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | if ((io->datatype == NT) && (io->mod->whichmodel > 10)) |
|---|
| 92 | { |
|---|
| 93 | char choix; |
|---|
| 94 | PhyML_Printf("\n== Err: model incompatible with the data type. Please use JC69, K80, F81, HKY, F84, TN93 or GTR\n"); |
|---|
| 95 | PhyML_Printf("\n. Type any key to exit.\n"); |
|---|
| 96 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 97 | Warn_And_Exit("\n"); |
|---|
| 98 | } |
|---|
| 99 | else if ((io->datatype == AA) && (io->mod->whichmodel < 11)) |
|---|
| 100 | { |
|---|
| 101 | char choix; |
|---|
| 102 | 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"); |
|---|
| 103 | PhyML_Printf("\n. Type any key to exit.\n"); |
|---|
| 104 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 105 | Exit("\n"); |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | if(io->m4_model == YES) |
|---|
| 109 | { |
|---|
| 110 | #ifdef M4 |
|---|
| 111 | io->mod->ns *= io->mod->m4mod->n_h; |
|---|
| 112 | io->mod->use_m4mod = 1; |
|---|
| 113 | M4_Make_Complete(io->mod->m4mod->n_h, |
|---|
| 114 | io->mod->m4mod->n_o, |
|---|
| 115 | io->mod->m4mod); |
|---|
| 116 | #endif |
|---|
| 117 | } |
|---|
| 118 | else |
|---|
| 119 | { |
|---|
| 120 | io->mod->s_opt->opt_cov_delta = 0; |
|---|
| 121 | io->mod->s_opt->opt_cov_alpha = 0; |
|---|
| 122 | io->mod->s_opt->opt_cov_free_rates = 0; |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | if((io->mod->s_opt->opt_cov_free_rates) && (io->mod->s_opt->opt_cov_alpha)) |
|---|
| 126 | { |
|---|
| 127 | io->mod->s_opt->opt_cov_free_rates = 0; |
|---|
| 128 | io->mod->m4mod->use_cov_alpha = 0; |
|---|
| 129 | io->mod->m4mod->use_cov_free = 1; |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | if(io->print_site_lnl) |
|---|
| 134 | { |
|---|
| 135 | strcpy(io->out_lk_file,io->in_align_file); |
|---|
| 136 | strcat(io->out_lk_file, "_phyml_lk"); |
|---|
| 137 | if(io->append_run_ID) { strcat(io->out_lk_file,"_"); strcat(io->out_lk_file,io->run_id_string); } |
|---|
| 138 | strcat(io->out_lk_file, ".txt"); |
|---|
| 139 | io->fp_out_lk = Openfile(io->out_lk_file,1); |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | if(io->print_trace) |
|---|
| 143 | { |
|---|
| 144 | strcpy(io->out_trace_file,io->in_align_file); |
|---|
| 145 | strcat(io->out_trace_file,"_phyml_trace"); |
|---|
| 146 | if(io->append_run_ID) { strcat(io->out_trace_file,"_"); strcat(io->out_trace_file,io->run_id_string); } |
|---|
| 147 | strcat(io->out_trace_file,".txt"); |
|---|
| 148 | io->fp_out_trace = Openfile(io->out_trace_file,1); |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | if(io->mod->s_opt->random_input_tree) |
|---|
| 152 | { |
|---|
| 153 | strcpy(io->out_trees_file,io->in_align_file); |
|---|
| 154 | strcat(io->out_trees_file,"_phyml_trees"); |
|---|
| 155 | if(io->append_run_ID) { strcat(io->out_trees_file,"_"); strcat(io->out_trees_file,io->run_id_string); } |
|---|
| 156 | strcat(io->out_trees_file,".txt"); |
|---|
| 157 | io->fp_out_trees = Openfile(io->out_trees_file,1); |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | if((io->print_boot_trees) && (io->mod->bootstrap > 0)) |
|---|
| 161 | { |
|---|
| 162 | strcpy(io->out_boot_tree_file,io->in_align_file); |
|---|
| 163 | strcat(io->out_boot_tree_file,"_phyml_boot_trees"); |
|---|
| 164 | if(io->append_run_ID) { strcat(io->out_boot_tree_file,"_"); strcat(io->out_boot_tree_file,io->run_id_string); } |
|---|
| 165 | strcat(io->out_boot_tree_file,".txt"); |
|---|
| 166 | io->fp_out_boot_tree = Openfile(io->out_boot_tree_file,1); |
|---|
| 167 | |
|---|
| 168 | strcpy(io->out_boot_stats_file,io->in_align_file); |
|---|
| 169 | strcat(io->out_boot_stats_file,"_phyml_boot_stats"); |
|---|
| 170 | if(io->append_run_ID) { strcat(io->out_boot_stats_file,"_"); strcat(io->out_boot_stats_file,io->run_id_string); } |
|---|
| 171 | strcat(io->out_boot_stats_file,".txt"); |
|---|
| 172 | io->fp_out_boot_stats = Openfile(io->out_boot_stats_file,1); |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | if(io->append_run_ID) |
|---|
| 176 | { |
|---|
| 177 | strcat(io->out_tree_file,"_"); |
|---|
| 178 | strcat(io->out_stats_file,"_"); |
|---|
| 179 | strcat(io->out_tree_file,io->run_id_string); |
|---|
| 180 | strcat(io->out_stats_file,io->run_id_string); |
|---|
| 181 | strcat(io->out_tree_file,".txt"); |
|---|
| 182 | strcat(io->out_stats_file,".txt"); |
|---|
| 183 | } |
|---|
| 184 | |
|---|
| 185 | if(io->mod->ras->n_catg == 1) io->mod->s_opt->opt_alpha = 0; |
|---|
| 186 | |
|---|
| 187 | if(io->mod->whichmodel != K80 && |
|---|
| 188 | io->mod->whichmodel != HKY85 && |
|---|
| 189 | io->mod->whichmodel != F84 && |
|---|
| 190 | io->mod->whichmodel != TN93) |
|---|
| 191 | { |
|---|
| 192 | io->mod->s_opt->opt_kappa = 0; |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | io->fp_out_tree = Openfile(io->out_tree_file,1); |
|---|
| 196 | io->fp_out_stats = Openfile(io->out_stats_file,1); |
|---|
| 197 | |
|---|
| 198 | if(io->mod->whichmodel == GTR) |
|---|
| 199 | { |
|---|
| 200 | /* Make_Custom_Model(io->mod); */ |
|---|
| 201 | io->mod->s_opt->opt_rr = 1; |
|---|
| 202 | } |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | ////////////////////////////////////////////////////////////// |
|---|
| 206 | ////////////////////////////////////////////////////////////// |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | void Clear() |
|---|
| 210 | { |
|---|
| 211 | #ifdef WIN32 |
|---|
| 212 | system("cls"); |
|---|
| 213 | #elif UNIX |
|---|
| 214 | PhyML_Printf("\033[2J\033[H"); |
|---|
| 215 | #endif |
|---|
| 216 | } |
|---|
| 217 | |
|---|
| 218 | ////////////////////////////////////////////////////////////// |
|---|
| 219 | ////////////////////////////////////////////////////////////// |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | void Launch_Interface_Input(option *io) |
|---|
| 223 | { |
|---|
| 224 | char choix; |
|---|
| 225 | int n_trial; |
|---|
| 226 | |
|---|
| 227 | Clear(); |
|---|
| 228 | Print_Banner(stdout); |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | #ifdef EVOLVE |
|---|
| 232 | |
|---|
| 233 | char *n_data_sets; |
|---|
| 234 | |
|---|
| 235 | PhyML_Printf("\n\n"); |
|---|
| 236 | PhyML_Printf("\n. Enter the tree file name > "); fflush(NULL); |
|---|
| 237 | Getstring_Stdin(io->in_tree_file); |
|---|
| 238 | io->fp_in_tree = Openfile(io->in_tree_file,0); |
|---|
| 239 | PhyML_Printf("\n"); |
|---|
| 240 | |
|---|
| 241 | PhyML_Printf("\n. Enter the reference sequence file name > "); fflush(NULL); |
|---|
| 242 | Getstring_Stdin(io->in_align_file); |
|---|
| 243 | io->fp_in_align = Openfile(io->in_align_file,0); |
|---|
| 244 | PhyML_Printf("\n"); |
|---|
| 245 | |
|---|
| 246 | PhyML_Printf("\n. Number of data sets > "); |
|---|
| 247 | n_data_sets = (char *)mCalloc(10000,sizeof(char)); |
|---|
| 248 | Getstring_Stdin(n_data_sets); |
|---|
| 249 | n_trial = 0; |
|---|
| 250 | while((!atoi(n_data_sets)) || (atoi(n_data_sets) < 0)) |
|---|
| 251 | { |
|---|
| 252 | if(++n_trial > 10) Exit("\n== Err : the number of sets must be a positive integer"); |
|---|
| 253 | PhyML_Printf("\n. The number of sets must be a positive integer"); |
|---|
| 254 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 255 | Getstring_Stdin(n_data_sets); |
|---|
| 256 | } |
|---|
| 257 | io->n_data_set_asked = atoi(n_data_sets); |
|---|
| 258 | Free(n_data_sets); |
|---|
| 259 | |
|---|
| 260 | #elif OPTIMIZ |
|---|
| 261 | |
|---|
| 262 | PhyML_Printf("\n. Enter the tree file name > "); fflush(NULL); |
|---|
| 263 | Getstring_Stdin(io->in_tree_file); |
|---|
| 264 | io->fp_in_tree = Openfile(io->in_tree_file,0); |
|---|
| 265 | PhyML_Printf("\n"); |
|---|
| 266 | |
|---|
| 267 | PhyML_Printf("\n. Enter the reference sequence file name > "); fflush(NULL); |
|---|
| 268 | Getstring_Stdin(io->in_align_file); |
|---|
| 269 | io->fp_in_align = Openfile(io->in_align_file,0); |
|---|
| 270 | PhyML_Printf("\n"); |
|---|
| 271 | |
|---|
| 272 | #elif defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 273 | |
|---|
| 274 | PhyML_Printf("\n. Enter the sequence file name > "); fflush(NULL); |
|---|
| 275 | Getstring_Stdin(io->in_align_file); |
|---|
| 276 | io->fp_in_align = Openfile(io->in_align_file,0); |
|---|
| 277 | |
|---|
| 278 | #endif |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | #if defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 282 | |
|---|
| 283 | strcpy(io->out_stats_file,io->in_align_file); |
|---|
| 284 | strcat(io->out_stats_file,"_phyml_stats.txt"); |
|---|
| 285 | |
|---|
| 286 | strcpy(io->out_tree_file,io->in_align_file); |
|---|
| 287 | strcat(io->out_tree_file,"_phyml_tree.txt"); |
|---|
| 288 | |
|---|
| 289 | strcpy(io->out_lk_file,io->in_align_file); |
|---|
| 290 | strcat(io->out_lk_file,"_phyml_lk.txt"); |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | #endif |
|---|
| 294 | |
|---|
| 295 | |
|---|
| 296 | #ifdef WIN32 |
|---|
| 297 | #ifdef EVOLVE |
|---|
| 298 | if(Filexists("evolve_out.txt")); |
|---|
| 299 | #elif OPTIMIZ |
|---|
| 300 | if(Filexists("optimiz_out.txt")) |
|---|
| 301 | #elif defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 302 | if(Filexists(io->out_stats_file)) |
|---|
| 303 | #endif |
|---|
| 304 | #elif UNIX |
|---|
| 305 | #ifdef EVOLVE |
|---|
| 306 | if(Filexists("evolve_out")); |
|---|
| 307 | #elif OPTIMIZ |
|---|
| 308 | if(Filexists("optimiz_out")) |
|---|
| 309 | #elif defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 310 | if(Filexists(io->out_stats_file)) |
|---|
| 311 | #endif |
|---|
| 312 | #endif |
|---|
| 313 | { |
|---|
| 314 | PhyML_Printf("\n"); |
|---|
| 315 | #ifdef EVOLVE |
|---|
| 316 | PhyML_Printf("\n. A file 'evolve_out' already exists"); |
|---|
| 317 | #elif OPTIMIZ |
|---|
| 318 | PhyML_Printf("\n. A file 'optimiz_out' already exists"); |
|---|
| 319 | #elif defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 320 | PhyML_Printf("\n. A file '%s' already exists",io->out_stats_file); |
|---|
| 321 | #endif |
|---|
| 322 | PhyML_Printf("\n. Do you want to Replace it or Append to it ? "); |
|---|
| 323 | n_trial = 0; |
|---|
| 324 | do |
|---|
| 325 | { |
|---|
| 326 | PhyML_Printf("\n. Please type R or A > "); |
|---|
| 327 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 328 | if(choix == '\n') choix = 'r'; |
|---|
| 329 | else getchar(); |
|---|
| 330 | if(++n_trial>10) Exit("\n"); |
|---|
| 331 | Uppercase(&choix); |
|---|
| 332 | } |
|---|
| 333 | while((choix != 'R') && (choix != 'A')); |
|---|
| 334 | if(choix == 'R') io->out_stats_file_open_mode = 1; |
|---|
| 335 | else io->out_stats_file_open_mode = 2; |
|---|
| 336 | } |
|---|
| 337 | |
|---|
| 338 | /* io->fp_out_stats = Openfile(io->out_stats_file,io->out_stats_file_open_mode); */ |
|---|
| 339 | |
|---|
| 340 | #ifdef WIN32 |
|---|
| 341 | #ifdef EVOLVE |
|---|
| 342 | if(Filexists("evolve_seq.txt")) |
|---|
| 343 | #elif OPTIMIZ |
|---|
| 344 | if(Filexists("optimiz_tree.txt")) |
|---|
| 345 | #elif defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 346 | if(Filexists(io->out_tree_file)) |
|---|
| 347 | #endif |
|---|
| 348 | #elif UNIX |
|---|
| 349 | #ifdef EVOLVE |
|---|
| 350 | if(Filexists("evolve_seq")) |
|---|
| 351 | #elif OPTIMIZ |
|---|
| 352 | if(Filexists("optimiz_tree")) |
|---|
| 353 | #elif defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 354 | if(Filexists(io->out_tree_file)) |
|---|
| 355 | #endif |
|---|
| 356 | #endif |
|---|
| 357 | { |
|---|
| 358 | PhyML_Printf("\n"); |
|---|
| 359 | #ifdef EVOLVE |
|---|
| 360 | PhyML_Printf("\n. A file 'evolve_seq' already exists"); |
|---|
| 361 | #elif OPTIMIZ |
|---|
| 362 | PhyML_Printf("\n. A file 'optimiz_tree' already exists"); |
|---|
| 363 | #elif defined(PHYML) || defined(PART) || defined(PHYML_INSERT) |
|---|
| 364 | PhyML_Printf("\n. A file '%s' already exists",io->out_tree_file); |
|---|
| 365 | #endif |
|---|
| 366 | PhyML_Printf("\n. Do you want to Replace it or Append to it ? "); |
|---|
| 367 | n_trial = 0; |
|---|
| 368 | do |
|---|
| 369 | { |
|---|
| 370 | PhyML_Printf("\n. Please type R or A > "); |
|---|
| 371 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 372 | if(choix == '\n') choix = 'r'; |
|---|
| 373 | else getchar(); |
|---|
| 374 | Uppercase(&choix); |
|---|
| 375 | if(++n_trial>10) Exit("\n"); |
|---|
| 376 | } |
|---|
| 377 | while((choix != 'R') && (choix != 'A')); |
|---|
| 378 | if(choix == 'R') io->out_tree_file_open_mode = 1; |
|---|
| 379 | else io->out_tree_file_open_mode = 2; |
|---|
| 380 | } |
|---|
| 381 | |
|---|
| 382 | /* io->fp_out_tree = Openfile(io->out_tree_file,io->out_tree_file_open_mode); */ |
|---|
| 383 | } |
|---|
| 384 | |
|---|
| 385 | ////////////////////////////////////////////////////////////// |
|---|
| 386 | ////////////////////////////////////////////////////////////// |
|---|
| 387 | |
|---|
| 388 | |
|---|
| 389 | void Launch_Interface_Data_Type(option *io) |
|---|
| 390 | { |
|---|
| 391 | char choix; |
|---|
| 392 | char *s; |
|---|
| 393 | char *buff; |
|---|
| 394 | |
|---|
| 395 | Clear(); |
|---|
| 396 | Print_Banner(stdout); |
|---|
| 397 | if(io->config_multigene) Print_Data_Set_Number(io,stdout); |
|---|
| 398 | |
|---|
| 399 | s = (char *)mCalloc(100,sizeof(char)); |
|---|
| 400 | buff = (char *)mCalloc(100,sizeof(char)); |
|---|
| 401 | |
|---|
| 402 | |
|---|
| 403 | PhyML_Printf("\n\n"); |
|---|
| 404 | |
|---|
| 405 | PhyML_Printf(" ................... \n"); |
|---|
| 406 | PhyML_Printf(" Menu : Input Data \n"); |
|---|
| 407 | PhyML_Printf(" ......................... \n"); |
|---|
| 408 | |
|---|
| 409 | PhyML_Printf("\n\n"); |
|---|
| 410 | |
|---|
| 411 | PhyML_Printf(" [+] " |
|---|
| 412 | ".................................... Next sub-menu\n"); |
|---|
| 413 | |
|---|
| 414 | PhyML_Printf(" [-] " |
|---|
| 415 | "................................ Previous sub-menu\n"); |
|---|
| 416 | |
|---|
| 417 | PhyML_Printf(" [Y] " |
|---|
| 418 | ".............................. Launch the analysis\n"); |
|---|
| 419 | |
|---|
| 420 | PhyML_Printf("\n"); |
|---|
| 421 | |
|---|
| 422 | if(io->datatype == NT) strcpy(s,"DNA"); |
|---|
| 423 | else if(io->datatype == AA) strcpy(s,"AA"); |
|---|
| 424 | else strcpy(s,"Generic"); |
|---|
| 425 | |
|---|
| 426 | PhyML_Printf(" [D] " |
|---|
| 427 | "....................... Data type (DNA/AA/Generic) " |
|---|
| 428 | " %-15s \n",s); |
|---|
| 429 | |
|---|
| 430 | PhyML_Printf(" [I] " |
|---|
| 431 | "...... Input sequences interleaved (or sequential) " |
|---|
| 432 | " %-15s \n", |
|---|
| 433 | (io->interleaved)?("interleaved"):("sequential")); |
|---|
| 434 | |
|---|
| 435 | strcpy(s,""); |
|---|
| 436 | sprintf(s," (%d sets)",io->n_data_sets); |
|---|
| 437 | strcpy(buff,(io->n_data_sets > 1)?("yes"):("no")); |
|---|
| 438 | buff=strcat(buff,(io->n_data_sets > 1)?(s):("\0")); |
|---|
| 439 | PhyML_Printf(" [M] " |
|---|
| 440 | "....................... Analyze multiple data sets " |
|---|
| 441 | " %-15s \n",buff); |
|---|
| 442 | |
|---|
| 443 | if(!io->append_run_ID) strcpy(s,"none"); |
|---|
| 444 | else strcpy(s,io->run_id_string); |
|---|
| 445 | PhyML_Printf(" [R] " |
|---|
| 446 | "........................................... Run ID " |
|---|
| 447 | " %-15s \n",s); |
|---|
| 448 | |
|---|
| 449 | |
|---|
| 450 | PhyML_Printf("\n\n. Are these settings correct ? " |
|---|
| 451 | "(type '+', '-', 'Y' or other letter for one to change) "); |
|---|
| 452 | |
|---|
| 453 | |
|---|
| 454 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 455 | if(choix != '\n') getchar(); /* \n */ |
|---|
| 456 | fflush(NULL); |
|---|
| 457 | |
|---|
| 458 | Uppercase(&choix); |
|---|
| 459 | |
|---|
| 460 | switch(choix) |
|---|
| 461 | { |
|---|
| 462 | /* case '\n': */ |
|---|
| 463 | /* { */ |
|---|
| 464 | /* io->curr_interface++; */ |
|---|
| 465 | /* break; */ |
|---|
| 466 | /* } */ |
|---|
| 467 | case 'R' : |
|---|
| 468 | { |
|---|
| 469 | io->append_run_ID = (io->append_run_ID)?(0):(1); |
|---|
| 470 | PhyML_Printf("\n. Enter a run ID (any string of characters) > "); |
|---|
| 471 | Getstring_Stdin(io->run_id_string); |
|---|
| 472 | break; |
|---|
| 473 | } |
|---|
| 474 | |
|---|
| 475 | |
|---|
| 476 | case 'M' : |
|---|
| 477 | { |
|---|
| 478 | char *c; |
|---|
| 479 | int n_trial; |
|---|
| 480 | |
|---|
| 481 | PhyML_Printf("\n. How many data sets > "); |
|---|
| 482 | c = (char *)mCalloc(100,sizeof(char)); |
|---|
| 483 | Getstring_Stdin(c); |
|---|
| 484 | n_trial = 0; |
|---|
| 485 | while((!atoi(c)) || (atoi(c) < 0)) |
|---|
| 486 | { |
|---|
| 487 | if(++n_trial > 10) Exit("\n== Err : The number of data sets must be a positive integer"); |
|---|
| 488 | PhyML_Printf("\n. The number of data sets must be a positive integer"); |
|---|
| 489 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 490 | Getstring_Stdin(c); |
|---|
| 491 | } |
|---|
| 492 | io->n_data_sets = atoi(c); |
|---|
| 493 | |
|---|
| 494 | #ifdef PART |
|---|
| 495 | if(io->n_data_sets > 1) |
|---|
| 496 | { |
|---|
| 497 | io->multigene = 1; |
|---|
| 498 | } |
|---|
| 499 | #endif |
|---|
| 500 | |
|---|
| 501 | if((io->mod->bootstrap > 1) && (io->n_data_sets > 1)) |
|---|
| 502 | { |
|---|
| 503 | PhyML_Printf("\n. Bootstrap option is not allowed with multiple data sets !\n"); |
|---|
| 504 | PhyML_Printf("\n. Type any key to exit."); |
|---|
| 505 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 506 | Exit("\n"); |
|---|
| 507 | } |
|---|
| 508 | |
|---|
| 509 | Free(c); |
|---|
| 510 | break; |
|---|
| 511 | } |
|---|
| 512 | case 'I' : |
|---|
| 513 | { |
|---|
| 514 | if(io->interleaved) |
|---|
| 515 | io->interleaved = 0; |
|---|
| 516 | else io->interleaved = 1; |
|---|
| 517 | break; |
|---|
| 518 | } |
|---|
| 519 | case 'D' : |
|---|
| 520 | { |
|---|
| 521 | if(io->datatype == NT) |
|---|
| 522 | { |
|---|
| 523 | io->datatype = AA; |
|---|
| 524 | io->mod->ns = 20; |
|---|
| 525 | io->mod->s_opt->opt_kappa = 0; |
|---|
| 526 | io->mod->whichmodel = LG; |
|---|
| 527 | strcpy(io->mod->modelname->s,"LG"); |
|---|
| 528 | } |
|---|
| 529 | else if(io->datatype == AA) |
|---|
| 530 | { |
|---|
| 531 | io->datatype = GENERIC; |
|---|
| 532 | io->mod->whichmodel = JC69; |
|---|
| 533 | strcpy(io->mod->modelname->s,"JC69"); |
|---|
| 534 | strcpy(io->nt_or_cd,"natural numbers"); |
|---|
| 535 | } |
|---|
| 536 | else if(io->datatype == GENERIC) |
|---|
| 537 | { |
|---|
| 538 | io->datatype = NT; |
|---|
| 539 | io->mod->ns = 4; |
|---|
| 540 | io->mod->whichmodel = HKY85; |
|---|
| 541 | strcpy(io->mod->modelname->s,"HKY85"); |
|---|
| 542 | strcpy(io->nt_or_cd,"nucleotides"); |
|---|
| 543 | } |
|---|
| 544 | break; |
|---|
| 545 | } |
|---|
| 546 | case '-' : |
|---|
| 547 | { |
|---|
| 548 | io->curr_interface = (io->config_multigene)?(INTERFACE_MODEL):(INTERFACE_BRANCH_SUPPORT); |
|---|
| 549 | break; |
|---|
| 550 | } |
|---|
| 551 | case '+' : |
|---|
| 552 | { |
|---|
| 553 | io->curr_interface = (io->multigene)?(INTERFACE_MULTIGENE):(INTERFACE_MODEL); |
|---|
| 554 | break; |
|---|
| 555 | } |
|---|
| 556 | case 'Y' : |
|---|
| 557 | { |
|---|
| 558 | io->ready_to_go = 1; |
|---|
| 559 | break; |
|---|
| 560 | } |
|---|
| 561 | default : |
|---|
| 562 | { |
|---|
| 563 | break; |
|---|
| 564 | } |
|---|
| 565 | } |
|---|
| 566 | |
|---|
| 567 | Free(s); |
|---|
| 568 | Free(buff); |
|---|
| 569 | } |
|---|
| 570 | ////////////////////////////////////////////////////////////// |
|---|
| 571 | ////////////////////////////////////////////////////////////// |
|---|
| 572 | |
|---|
| 573 | |
|---|
| 574 | void Launch_Interface_Model(option *io) |
|---|
| 575 | { |
|---|
| 576 | char choix; |
|---|
| 577 | char *s; |
|---|
| 578 | |
|---|
| 579 | s = (char *)mCalloc(100,sizeof(char)); |
|---|
| 580 | |
|---|
| 581 | Clear(); |
|---|
| 582 | Print_Banner(stdout); |
|---|
| 583 | if(io->config_multigene) Print_Data_Set_Number(io,stdout); |
|---|
| 584 | |
|---|
| 585 | |
|---|
| 586 | PhyML_Printf("\n\n"); |
|---|
| 587 | |
|---|
| 588 | PhyML_Printf(" ........................... \n"); |
|---|
| 589 | PhyML_Printf(" Menu : Substitution Model \n"); |
|---|
| 590 | PhyML_Printf(" ................................. \n"); |
|---|
| 591 | |
|---|
| 592 | PhyML_Printf("\n\n"); |
|---|
| 593 | |
|---|
| 594 | PhyML_Printf(" [+] " |
|---|
| 595 | ".................................... Next sub-menu\n"); |
|---|
| 596 | |
|---|
| 597 | PhyML_Printf(" [-] " |
|---|
| 598 | "................................ Previous sub-menu\n"); |
|---|
| 599 | |
|---|
| 600 | PhyML_Printf(" [Y] " |
|---|
| 601 | ".............................. Launch the analysis\n"); |
|---|
| 602 | |
|---|
| 603 | PhyML_Printf("\n"); |
|---|
| 604 | |
|---|
| 605 | if (io->datatype == NT) |
|---|
| 606 | { |
|---|
| 607 | if(!strcmp(io->nt_or_cd,"nucleotides")) |
|---|
| 608 | { |
|---|
| 609 | PhyML_Printf(" [M] " |
|---|
| 610 | "................. Model of nucleotide substitution " |
|---|
| 611 | " %-15s \n", io->mod->modelname->s); |
|---|
| 612 | |
|---|
| 613 | if((io->mod->whichmodel == F81) || |
|---|
| 614 | (io->mod->whichmodel == HKY85) || |
|---|
| 615 | (io->mod->whichmodel == F84) || |
|---|
| 616 | (io->mod->whichmodel == TN93) || |
|---|
| 617 | (io->mod->whichmodel == GTR) || |
|---|
| 618 | (io->mod->whichmodel == CUSTOM)) |
|---|
| 619 | { |
|---|
| 620 | /* PhyML_Printf(" [F] " */ |
|---|
| 621 | /* ".......... Base frequency estimates (empirical/ML) " */ |
|---|
| 622 | /* " %-15s \n", */ |
|---|
| 623 | /* (io->mod->s_opt->opt_state_freq)?("ML"):("empirical")); */ |
|---|
| 624 | /* } */ |
|---|
| 625 | /* else if(io->mod->whichmodel == CUSTOM) */ |
|---|
| 626 | /* { */ |
|---|
| 627 | PhyML_Printf(" [F] " |
|---|
| 628 | "................. Optimise equilibrium frequencies " |
|---|
| 629 | " %-15s \n", |
|---|
| 630 | (io->mod->s_opt->opt_state_freq)?("yes"):("no")); |
|---|
| 631 | } |
|---|
| 632 | |
|---|
| 633 | |
|---|
| 634 | if(io->mod->whichmodel == CUSTOM) |
|---|
| 635 | { |
|---|
| 636 | if(!io->mod->s_opt->opt_state_freq) |
|---|
| 637 | { |
|---|
| 638 | PhyML_Printf(" [E] " |
|---|
| 639 | "......... Equilibrium frequencies (empirical/user) " |
|---|
| 640 | " %-15s \n", |
|---|
| 641 | (io->mod->s_opt->user_state_freq)?("user defined"):("empirical")); |
|---|
| 642 | } |
|---|
| 643 | PhyML_Printf(" [K] " |
|---|
| 644 | "............................. Current custom model " |
|---|
| 645 | " %-15s \n", io->mod->custom_mod_string->s); |
|---|
| 646 | |
|---|
| 647 | PhyML_Printf(" [O] " |
|---|
| 648 | "................ Optimise relative rate parameters " |
|---|
| 649 | " %-15s \n",(io->mod->s_opt->opt_rr)?("yes"):("no")); |
|---|
| 650 | } |
|---|
| 651 | } |
|---|
| 652 | } |
|---|
| 653 | else if(io->datatype == AA) |
|---|
| 654 | { |
|---|
| 655 | PhyML_Printf(" [M] " |
|---|
| 656 | "................ Model of amino-acids substitution " |
|---|
| 657 | " %-15s \n", io->mod->modelname->s); |
|---|
| 658 | |
|---|
| 659 | PhyML_Printf(" [F] " |
|---|
| 660 | ". Amino acid frequencies (empirical/model defined) " |
|---|
| 661 | " %-15s \n", |
|---|
| 662 | (io->mod->s_opt->opt_state_freq)?("empirical"):("model")); |
|---|
| 663 | } |
|---|
| 664 | else if(io->datatype == GENERIC) |
|---|
| 665 | { |
|---|
| 666 | PhyML_Printf(" [M] " |
|---|
| 667 | "................. Model of nucleotide substitution " |
|---|
| 668 | " %-15s \n", io->mod->modelname->s); |
|---|
| 669 | } |
|---|
| 670 | |
|---|
| 671 | if ((io->datatype == NT) && |
|---|
| 672 | ((io->mod->whichmodel == K80) || |
|---|
| 673 | (io->mod->whichmodel == HKY85)|| |
|---|
| 674 | (io->mod->whichmodel == F84) || |
|---|
| 675 | (io->mod->whichmodel == TN93))) |
|---|
| 676 | { |
|---|
| 677 | strcpy(s,(io->mod->s_opt->opt_kappa)?("estimated"):("fixed")); |
|---|
| 678 | (io->mod->s_opt->opt_kappa)?((char *)strcat(s,"")):((char *)strcat(s," (ts/tv = ")); |
|---|
| 679 | /* (io->mod->s_opt->opt_kappa)?((char *)strcat(s,"")):((char *)sprintf(s+(int)strlen((char *)s),"%3.2f)",io->mod->kappa->v)); */ |
|---|
| 680 | if(io->mod->s_opt->opt_kappa) |
|---|
| 681 | { |
|---|
| 682 | strcat((char *)s,""); |
|---|
| 683 | } |
|---|
| 684 | else |
|---|
| 685 | { |
|---|
| 686 | sprintf((char *)(s+(int)strlen(s)),"%3.2f)",io->mod->kappa->v); |
|---|
| 687 | } |
|---|
| 688 | |
|---|
| 689 | PhyML_Printf(" [T] " |
|---|
| 690 | ".................... Ts/tv ratio (fixed/estimated) " |
|---|
| 691 | " %-15s \n",s); |
|---|
| 692 | } |
|---|
| 693 | |
|---|
| 694 | |
|---|
| 695 | (io->mod->s_opt->opt_pinvar)?(strcpy(s,"estimated")):(strcpy(s,"fixed")); |
|---|
| 696 | (io->mod->s_opt->opt_pinvar)?((char *)strcat(s,"")):((char *)strcat(s," (p-invar = ")); |
|---|
| 697 | |
|---|
| 698 | if(io->mod->s_opt->opt_pinvar) |
|---|
| 699 | { |
|---|
| 700 | strcat(s,""); |
|---|
| 701 | } |
|---|
| 702 | else |
|---|
| 703 | { |
|---|
| 704 | sprintf((char *)(s+strlen((char *)s)),"%3.2f)",io->mod->ras->pinvar->v); |
|---|
| 705 | } |
|---|
| 706 | |
|---|
| 707 | PhyML_Printf(" [V] " |
|---|
| 708 | ". Proportion of invariable sites (fixed/estimated)" |
|---|
| 709 | " %-15s \n",s); |
|---|
| 710 | |
|---|
| 711 | PhyML_Printf(" [R] " |
|---|
| 712 | "....... One category of substitution rate (yes/no) " |
|---|
| 713 | " %-15s \n", |
|---|
| 714 | (io->mod->ras->n_catg > 1)?("no"):("yes")); |
|---|
| 715 | |
|---|
| 716 | if(io->mod->ras->n_catg > 1) |
|---|
| 717 | { |
|---|
| 718 | PhyML_Printf(" [C] " |
|---|
| 719 | "........... Number of substitution rate categories " |
|---|
| 720 | " %-15d \n", |
|---|
| 721 | io->mod->ras->n_catg); |
|---|
| 722 | } |
|---|
| 723 | |
|---|
| 724 | |
|---|
| 725 | if(io->mod->ras->n_catg > 1) |
|---|
| 726 | { |
|---|
| 727 | PhyML_Printf(" [G] " |
|---|
| 728 | "............. Gamma distributed rates across sites " |
|---|
| 729 | " %-15s \n",(io->mod->ras->free_mixt_rates)?("no"):("yes")); |
|---|
| 730 | } |
|---|
| 731 | |
|---|
| 732 | |
|---|
| 733 | if((io->mod->ras->n_catg > 1) && (io->mod->ras->free_mixt_rates == NO)) |
|---|
| 734 | { |
|---|
| 735 | strcpy(s,(io->mod->s_opt->opt_alpha)?("estimated"):("fixed")); |
|---|
| 736 | (io->mod->s_opt->opt_alpha)?(strcat(s, "")):(strcat(s," (alpha = ")); |
|---|
| 737 | |
|---|
| 738 | if(io->mod->s_opt->opt_alpha) |
|---|
| 739 | { |
|---|
| 740 | strcat(s, ""); |
|---|
| 741 | } |
|---|
| 742 | else |
|---|
| 743 | { |
|---|
| 744 | sprintf(s+strlen(s),"%3.2f)",io->mod->ras->alpha->v); |
|---|
| 745 | } |
|---|
| 746 | |
|---|
| 747 | PhyML_Printf(" [A] " |
|---|
| 748 | "... Gamma distribution parameter (fixed/estimated) " |
|---|
| 749 | " %-15s \n",s); |
|---|
| 750 | |
|---|
| 751 | |
|---|
| 752 | /* strcpy(s,(io->mod->ras->gamma_median)?("median"):("mean")); */ |
|---|
| 753 | |
|---|
| 754 | /* PhyML_Printf(" [G] " */ |
|---|
| 755 | /* ".........'Middle' of each rate class (mean/median) " */ |
|---|
| 756 | /* " %-15s \n",s); */ |
|---|
| 757 | |
|---|
| 758 | |
|---|
| 759 | } |
|---|
| 760 | |
|---|
| 761 | PhyML_Printf("\n\n. Are these settings correct ? " |
|---|
| 762 | "(type '+', '-', 'Y' or other letter for one to change) "); |
|---|
| 763 | |
|---|
| 764 | |
|---|
| 765 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 766 | if(choix != '\n') getchar(); /* \n */ |
|---|
| 767 | |
|---|
| 768 | Uppercase(&choix); |
|---|
| 769 | |
|---|
| 770 | switch(choix) |
|---|
| 771 | { |
|---|
| 772 | /* case '\n': */ |
|---|
| 773 | /* { */ |
|---|
| 774 | /* io->curr_interface++; */ |
|---|
| 775 | /* break; */ |
|---|
| 776 | /* } */ |
|---|
| 777 | |
|---|
| 778 | case 'G' : |
|---|
| 779 | { |
|---|
| 780 | io->mod->ras->free_mixt_rates = (io->mod->ras->free_mixt_rates)?(NO):(YES); |
|---|
| 781 | break; |
|---|
| 782 | } |
|---|
| 783 | |
|---|
| 784 | case 'O' : |
|---|
| 785 | { |
|---|
| 786 | io->mod->s_opt->opt_rr = (io->mod->s_opt->opt_rr)?(0):(1); |
|---|
| 787 | break; |
|---|
| 788 | } |
|---|
| 789 | |
|---|
| 790 | case 'K' : |
|---|
| 791 | { |
|---|
| 792 | int i,j; |
|---|
| 793 | char **rr_param,*rr; |
|---|
| 794 | t_mod *mod; |
|---|
| 795 | int n_trial; |
|---|
| 796 | |
|---|
| 797 | if(io->mod->whichmodel == CUSTOM) |
|---|
| 798 | { |
|---|
| 799 | rr_param = (char **)mCalloc(6,sizeof(char *)); |
|---|
| 800 | For(i,6) rr_param[i] = (char *)mCalloc(10,sizeof(char)); |
|---|
| 801 | rr = (char *)mCalloc(50,sizeof(char)); |
|---|
| 802 | |
|---|
| 803 | mod = io->mod; |
|---|
| 804 | mod->s_opt->opt_rr = 1; |
|---|
| 805 | |
|---|
| 806 | n_trial = 0; |
|---|
| 807 | do |
|---|
| 808 | { |
|---|
| 809 | PhyML_Printf("\n. Enter a new custom model > "); |
|---|
| 810 | Getstring_Stdin(io->mod->custom_mod_string->s); |
|---|
| 811 | if(strlen(io->mod->custom_mod_string->s) == 6) |
|---|
| 812 | { |
|---|
| 813 | For(i,6) |
|---|
| 814 | { |
|---|
| 815 | while(!isdigit((int)io->mod->custom_mod_string->s[i])) |
|---|
| 816 | { |
|---|
| 817 | if(++n_trial > 10) Exit("\n== Err : this string is not valid !\n"); |
|---|
| 818 | PhyML_Printf("\n. This string is not valid\n"); |
|---|
| 819 | PhyML_Printf("\n. Enter a new model > "); |
|---|
| 820 | Getstring_Stdin(io->mod->custom_mod_string->s); |
|---|
| 821 | } |
|---|
| 822 | } |
|---|
| 823 | if(i == 6) break; |
|---|
| 824 | } |
|---|
| 825 | else |
|---|
| 826 | { |
|---|
| 827 | PhyML_Printf("\n. The string should be of length 6\n"); |
|---|
| 828 | n_trial++; |
|---|
| 829 | } |
|---|
| 830 | }while(n_trial < 10); |
|---|
| 831 | if(n_trial == 10) Exit(""); |
|---|
| 832 | |
|---|
| 833 | if(!mod->r_mat) |
|---|
| 834 | { |
|---|
| 835 | mod->r_mat = (t_rmat *)Make_Rmat(mod->ns); |
|---|
| 836 | Init_Rmat(mod->r_mat); |
|---|
| 837 | Make_Custom_Model(mod); |
|---|
| 838 | Translate_Custom_Mod_String(io->mod); |
|---|
| 839 | } |
|---|
| 840 | |
|---|
| 841 | strcpy(rr_param[0],"A<->C"); |
|---|
| 842 | strcpy(rr_param[1],"A<->G"); |
|---|
| 843 | strcpy(rr_param[2],"A<->T"); |
|---|
| 844 | strcpy(rr_param[3],"C<->G"); |
|---|
| 845 | strcpy(rr_param[4],"C<->T"); |
|---|
| 846 | strcpy(rr_param[5],"G<->T"); |
|---|
| 847 | |
|---|
| 848 | PhyML_Printf("\n. Set the relative rate values\n"); |
|---|
| 849 | For(i,mod->r_mat->n_diff_rr) |
|---|
| 850 | { |
|---|
| 851 | sprintf(rr,"\n. ["); |
|---|
| 852 | For(j,6) |
|---|
| 853 | { |
|---|
| 854 | if(mod->r_mat->rr_num->v[j] == i) |
|---|
| 855 | { |
|---|
| 856 | sprintf(rr+strlen(rr),"%s = ",rr_param[j]); |
|---|
| 857 | } |
|---|
| 858 | } |
|---|
| 859 | sprintf(rr+strlen(rr)-3,"]"); |
|---|
| 860 | PhyML_Printf("%s",rr); |
|---|
| 861 | |
|---|
| 862 | PhyML_Printf(" (current=%.2f) > ",mod->r_mat->rr_val->v[i]); |
|---|
| 863 | |
|---|
| 864 | Getstring_Stdin(rr); |
|---|
| 865 | |
|---|
| 866 | if(rr[0] != '\0') |
|---|
| 867 | { |
|---|
| 868 | n_trial = 0; |
|---|
| 869 | while((atof(rr) < .0)) |
|---|
| 870 | { |
|---|
| 871 | if(++n_trial > 10) |
|---|
| 872 | Exit("\n== Err : the value of this parameter must be a positive number\n"); |
|---|
| 873 | PhyML_Printf("\n. The value of this parameter must be a positive number\n"); |
|---|
| 874 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 875 | Getstring_Stdin(rr); |
|---|
| 876 | } |
|---|
| 877 | io->mod->r_mat->rr_val->v[i] = (phydbl)atof(rr); |
|---|
| 878 | } |
|---|
| 879 | } |
|---|
| 880 | |
|---|
| 881 | For(i,6) Free(rr_param[i]); |
|---|
| 882 | Free(rr_param); |
|---|
| 883 | Free(rr); |
|---|
| 884 | } |
|---|
| 885 | break; |
|---|
| 886 | } |
|---|
| 887 | case 'E' : |
|---|
| 888 | { |
|---|
| 889 | int i; |
|---|
| 890 | |
|---|
| 891 | if(io->mod->whichmodel == CUSTOM) |
|---|
| 892 | { |
|---|
| 893 | io->mod->s_opt->user_state_freq = (io->mod->s_opt->user_state_freq)?(0):(1); |
|---|
| 894 | |
|---|
| 895 | if(io->mod->s_opt->user_state_freq) |
|---|
| 896 | { |
|---|
| 897 | if(!io->mod->s_opt->opt_state_freq) |
|---|
| 898 | { |
|---|
| 899 | char **bases; |
|---|
| 900 | char *bs; |
|---|
| 901 | phydbl sum; |
|---|
| 902 | int n_trial; |
|---|
| 903 | |
|---|
| 904 | bases = (char **)mCalloc(4,sizeof(char *)); |
|---|
| 905 | For(i,4) bases[i] = (char *)mCalloc(50,sizeof(char)); |
|---|
| 906 | bs = (char *)mCalloc(100,sizeof(char)); |
|---|
| 907 | |
|---|
| 908 | strcpy(bases[0],". f(A)> "); |
|---|
| 909 | strcpy(bases[1],". f(C)> "); |
|---|
| 910 | strcpy(bases[2],". f(G)> "); |
|---|
| 911 | strcpy(bases[3],". f(T)> "); |
|---|
| 912 | |
|---|
| 913 | PhyML_Printf("\n. Set nucleotide frequencies \n"); |
|---|
| 914 | sum = .0; |
|---|
| 915 | For(i,4) |
|---|
| 916 | { |
|---|
| 917 | PhyML_Printf("%s",bases[i]); |
|---|
| 918 | Getstring_Stdin(bs); |
|---|
| 919 | n_trial = 0; |
|---|
| 920 | |
|---|
| 921 | while((atof(bs) < .0001) || (bs[0] == '\0')) |
|---|
| 922 | { |
|---|
| 923 | if(++n_trial > 10) |
|---|
| 924 | Exit("\n== Err : the value of this parameter must be a positive number\n"); |
|---|
| 925 | PhyML_Printf("\n. The value of this parameter must be a positive number\n"); |
|---|
| 926 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 927 | Getstring_Stdin(bs); |
|---|
| 928 | } |
|---|
| 929 | io->mod->user_b_freq->v[i] = (phydbl)atof(bs); |
|---|
| 930 | sum += io->mod->user_b_freq->v[i]; |
|---|
| 931 | } |
|---|
| 932 | |
|---|
| 933 | For(i,4) io->mod->user_b_freq->v[i] /= sum; |
|---|
| 934 | |
|---|
| 935 | if(sum > 1.0 || sum < 1.0) |
|---|
| 936 | { |
|---|
| 937 | PhyML_Printf("\n. The nucleotide frequencies have to be normalised in order to sum to 1.0.\n"); |
|---|
| 938 | PhyML_Printf("\n. The frequencies are now : f(A)=%f, f(C)=%f, f(G)=%f, f(T)=%f.\n", |
|---|
| 939 | io->mod->user_b_freq->v[0], |
|---|
| 940 | io->mod->user_b_freq->v[1], |
|---|
| 941 | io->mod->user_b_freq->v[2], |
|---|
| 942 | io->mod->user_b_freq->v[3]); |
|---|
| 943 | PhyML_Printf("\n. Enter any key to continue.\n"); |
|---|
| 944 | if(!scanf("%c",bs)) Exit("\n"); |
|---|
| 945 | } |
|---|
| 946 | |
|---|
| 947 | For(i,4) Free(bases[i]); |
|---|
| 948 | Free(bases); |
|---|
| 949 | Free(bs); |
|---|
| 950 | } |
|---|
| 951 | else |
|---|
| 952 | { |
|---|
| 953 | Warn_And_Exit("\n. 'E' is not a valid option with these model settings.\n"); |
|---|
| 954 | } |
|---|
| 955 | } |
|---|
| 956 | } |
|---|
| 957 | break; |
|---|
| 958 | } |
|---|
| 959 | case 'A' : |
|---|
| 960 | { |
|---|
| 961 | char answer; |
|---|
| 962 | int n_trial; |
|---|
| 963 | |
|---|
| 964 | switch(io->mod->s_opt->opt_alpha) |
|---|
| 965 | { |
|---|
| 966 | case 0 : |
|---|
| 967 | { |
|---|
| 968 | PhyML_Printf("\n. Optimise alpha ? [Y/n] "); |
|---|
| 969 | if(!scanf("%c",&answer)) Exit("\n"); |
|---|
| 970 | if(answer == '\n') answer = 'Y'; |
|---|
| 971 | else getchar(); |
|---|
| 972 | break; |
|---|
| 973 | } |
|---|
| 974 | case 1 : |
|---|
| 975 | { |
|---|
| 976 | PhyML_Printf("\n. Optimise alpha ? [N/y] "); |
|---|
| 977 | if(!scanf("%c",&answer)) Exit("\n"); |
|---|
| 978 | if(answer == '\n') answer = 'N'; |
|---|
| 979 | else getchar(); |
|---|
| 980 | break; |
|---|
| 981 | } |
|---|
| 982 | default : Exit("\n"); |
|---|
| 983 | } |
|---|
| 984 | |
|---|
| 985 | n_trial = 0; |
|---|
| 986 | while((answer != 'Y') && (answer != 'y') && |
|---|
| 987 | (answer != 'N') && (answer != 'n')) |
|---|
| 988 | { |
|---|
| 989 | if(++n_trial > 10) Exit("\n== Err : wrong answers !"); |
|---|
| 990 | PhyML_Printf("\n. Optimise alpha ? [N/y] "); |
|---|
| 991 | if(!scanf("%c",&answer)) Exit("\n"); |
|---|
| 992 | if(answer == '\n') answer = 'N'; |
|---|
| 993 | else getchar(); |
|---|
| 994 | } |
|---|
| 995 | |
|---|
| 996 | switch(answer) |
|---|
| 997 | { |
|---|
| 998 | case 'Y' : case 'y' : |
|---|
| 999 | { |
|---|
| 1000 | io->mod->s_opt->opt_alpha = 1; |
|---|
| 1001 | io->mod->s_opt->opt_subst_param = 1; |
|---|
| 1002 | break; |
|---|
| 1003 | } |
|---|
| 1004 | case 'N' : case 'n' : |
|---|
| 1005 | { |
|---|
| 1006 | char *a; |
|---|
| 1007 | a = (char *)mCalloc(100,sizeof(char)); |
|---|
| 1008 | io->mod->ras->alpha->v = 10.0; |
|---|
| 1009 | io->mod->s_opt->opt_alpha = 0; |
|---|
| 1010 | PhyML_Printf("\n. Enter your value of alpha > "); |
|---|
| 1011 | Getstring_Stdin(a); |
|---|
| 1012 | n_trial = 0; |
|---|
| 1013 | while(atof(a) < 1.E-10) |
|---|
| 1014 | { |
|---|
| 1015 | if(++n_trial > 10) Exit("\n== Err : alpha must be > 1.E-10\n"); |
|---|
| 1016 | PhyML_Printf("\n. Alpha must be 1.E-10\n"); |
|---|
| 1017 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 1018 | Getstring_Stdin(a); |
|---|
| 1019 | } |
|---|
| 1020 | io->mod->ras->alpha->v = (phydbl)atof(a); |
|---|
| 1021 | Free(a); |
|---|
| 1022 | io->mod->s_opt->opt_alpha = 0; |
|---|
| 1023 | break; |
|---|
| 1024 | } |
|---|
| 1025 | } |
|---|
| 1026 | break; |
|---|
| 1027 | } |
|---|
| 1028 | |
|---|
| 1029 | case 'C' : |
|---|
| 1030 | { |
|---|
| 1031 | char *c; |
|---|
| 1032 | int n_trial; |
|---|
| 1033 | |
|---|
| 1034 | PhyML_Printf("\n. Enter your number of categories > "); |
|---|
| 1035 | c = (char *)mCalloc(100,sizeof(char)); |
|---|
| 1036 | Getstring_Stdin(c); |
|---|
| 1037 | n_trial = 0; |
|---|
| 1038 | while((!atoi(c)) || (atoi(c) < 0)) |
|---|
| 1039 | { |
|---|
| 1040 | if(++n_trial > 10) Exit("\n== Err : the number of categories must be a positive integer\n"); |
|---|
| 1041 | PhyML_Printf("\n. The number of categories must be a positive integer\n"); |
|---|
| 1042 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 1043 | Getstring_Stdin(c); |
|---|
| 1044 | } |
|---|
| 1045 | io->mod->ras->n_catg = atoi(c); |
|---|
| 1046 | Free(c); |
|---|
| 1047 | break; |
|---|
| 1048 | } |
|---|
| 1049 | |
|---|
| 1050 | case 'R' : |
|---|
| 1051 | { |
|---|
| 1052 | (io->mod->ras->n_catg == 1)?(io->mod->ras->n_catg = 4):(io->mod->ras->n_catg = 1); |
|---|
| 1053 | break; |
|---|
| 1054 | } |
|---|
| 1055 | |
|---|
| 1056 | case 'V' : |
|---|
| 1057 | { |
|---|
| 1058 | char answer; |
|---|
| 1059 | int n_trial; |
|---|
| 1060 | |
|---|
| 1061 | switch(io->mod->s_opt->opt_pinvar) |
|---|
| 1062 | { |
|---|
| 1063 | case 0 : |
|---|
| 1064 | { |
|---|
| 1065 | PhyML_Printf("\n. Optimise p-invar ? [Y/n] "); |
|---|
| 1066 | if(!scanf("%c", &answer)) Exit("\n"); |
|---|
| 1067 | if(answer == '\n') answer = 'Y'; |
|---|
| 1068 | else getchar(); |
|---|
| 1069 | break; |
|---|
| 1070 | } |
|---|
| 1071 | case 1 : |
|---|
| 1072 | { |
|---|
| 1073 | PhyML_Printf("\n. Optimise p-invar ? [N/y] "); |
|---|
| 1074 | if(!scanf("%c", &answer)) Exit("\n"); |
|---|
| 1075 | if(answer == '\n') answer = 'N'; |
|---|
| 1076 | else getchar(); |
|---|
| 1077 | break; |
|---|
| 1078 | } |
|---|
| 1079 | default : Exit("\n"); |
|---|
| 1080 | } |
|---|
| 1081 | |
|---|
| 1082 | n_trial = 0; |
|---|
| 1083 | while((answer != 'Y') && (answer != 'y') && |
|---|
| 1084 | (answer != 'N') && (answer != 'n')) |
|---|
| 1085 | { |
|---|
| 1086 | if(++n_trial > 10) Exit("\n== Err : wrong answers !"); |
|---|
| 1087 | PhyML_Printf("\n. Optimise p-invar ? [N/y] "); |
|---|
| 1088 | if(!scanf("%c", &answer)) Exit("\n"); |
|---|
| 1089 | if(answer == '\n') answer = 'N'; |
|---|
| 1090 | else getchar(); |
|---|
| 1091 | } |
|---|
| 1092 | |
|---|
| 1093 | switch(answer) |
|---|
| 1094 | { |
|---|
| 1095 | case 'Y' : case 'y' : |
|---|
| 1096 | { |
|---|
| 1097 | io->mod->s_opt->opt_subst_param = 1; |
|---|
| 1098 | io->mod->s_opt->opt_pinvar = 1; |
|---|
| 1099 | io->mod->ras->pinvar->v = 0.2; |
|---|
| 1100 | io->mod->ras->invar = 1; |
|---|
| 1101 | break; |
|---|
| 1102 | } |
|---|
| 1103 | case 'N' : case 'n' : |
|---|
| 1104 | { |
|---|
| 1105 | char *p; |
|---|
| 1106 | p = (char *)mCalloc(100,sizeof(char)); |
|---|
| 1107 | PhyML_Printf("\n. Enter your value of p-invar > "); |
|---|
| 1108 | Getstring_Stdin(p); |
|---|
| 1109 | n_trial = 0; |
|---|
| 1110 | while((atof(p) < 0.0) || (atof(p) > 1.0)) |
|---|
| 1111 | { |
|---|
| 1112 | if(++n_trial > 10) |
|---|
| 1113 | Exit("\n== Err : the proportion of invariable sites must be a positive number between 0.0 and 1.0"); |
|---|
| 1114 | PhyML_Printf("\n. The proportion must be a positive number between 0.0 and 1.0\n"); |
|---|
| 1115 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 1116 | Getstring_Stdin(p); |
|---|
| 1117 | } |
|---|
| 1118 | io->mod->ras->pinvar->v = (phydbl)atof(p); |
|---|
| 1119 | |
|---|
| 1120 | if(io->mod->ras->pinvar->v > 0.0+SMALL) io->mod->ras->invar = 1; |
|---|
| 1121 | else io->mod->ras->invar = 0; |
|---|
| 1122 | |
|---|
| 1123 | Free(p); |
|---|
| 1124 | |
|---|
| 1125 | io->mod->s_opt->opt_pinvar = 0; |
|---|
| 1126 | break; |
|---|
| 1127 | } |
|---|
| 1128 | } |
|---|
| 1129 | break; |
|---|
| 1130 | } |
|---|
| 1131 | |
|---|
| 1132 | case 'T' : |
|---|
| 1133 | { |
|---|
| 1134 | char answer; |
|---|
| 1135 | int n_trial; |
|---|
| 1136 | |
|---|
| 1137 | if((io->datatype == AA) || |
|---|
| 1138 | (io->mod->whichmodel == JC69)|| |
|---|
| 1139 | (io->mod->whichmodel == F81) || |
|---|
| 1140 | (io->mod->whichmodel == GTR) || |
|---|
| 1141 | (io->mod->whichmodel == CUSTOM)) |
|---|
| 1142 | { |
|---|
| 1143 | PhyML_Printf("\n. 'K' is not a valid choice for this model\n"); |
|---|
| 1144 | PhyML_Printf("\n. Type any key to exit.\n"); |
|---|
| 1145 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 1146 | Exit("\n"); |
|---|
| 1147 | } |
|---|
| 1148 | |
|---|
| 1149 | switch(io->mod->s_opt->opt_kappa) |
|---|
| 1150 | { |
|---|
| 1151 | case 0 : |
|---|
| 1152 | { |
|---|
| 1153 | PhyML_Printf("\n. Optimise ts/tv ratio ? [Y/n] "); |
|---|
| 1154 | if(!scanf("%c", &answer)) Exit("\n"); |
|---|
| 1155 | if(answer == '\n') answer = 'Y'; |
|---|
| 1156 | else getchar(); |
|---|
| 1157 | break; |
|---|
| 1158 | } |
|---|
| 1159 | case 1 : |
|---|
| 1160 | { |
|---|
| 1161 | PhyML_Printf("\n. Optimise ts/tv ratio ? [N/y] "); |
|---|
| 1162 | if(!scanf("%c", &answer)) Exit("\n"); |
|---|
| 1163 | if(answer == '\n') answer = 'N'; |
|---|
| 1164 | else getchar(); |
|---|
| 1165 | break; |
|---|
| 1166 | } |
|---|
| 1167 | default : Exit("\n"); |
|---|
| 1168 | } |
|---|
| 1169 | |
|---|
| 1170 | n_trial = 0; |
|---|
| 1171 | while((answer != 'Y') && (answer != 'y') && |
|---|
| 1172 | (answer != 'N') && (answer != 'n')) |
|---|
| 1173 | { |
|---|
| 1174 | if(++n_trial > 10) Exit("\n== Err : wrong answers !"); |
|---|
| 1175 | PhyML_Printf("\n. Optimise ts/tv ratio ? [N/y] "); |
|---|
| 1176 | if(!scanf("%c", &answer)) Exit("\n"); |
|---|
| 1177 | if(answer == '\n') answer = 'N'; |
|---|
| 1178 | else getchar(); |
|---|
| 1179 | } |
|---|
| 1180 | |
|---|
| 1181 | switch(answer) |
|---|
| 1182 | { |
|---|
| 1183 | case 'Y' : case 'y' : |
|---|
| 1184 | { |
|---|
| 1185 | io->mod->kappa->v = 4.0; |
|---|
| 1186 | io->mod->s_opt->opt_subst_param = 1; |
|---|
| 1187 | io->mod->s_opt->opt_kappa = 1; |
|---|
| 1188 | if(io->mod->whichmodel == TN93) |
|---|
| 1189 | io->mod->s_opt->opt_lambda = 1; |
|---|
| 1190 | break; |
|---|
| 1191 | } |
|---|
| 1192 | case 'N' : case 'n' : |
|---|
| 1193 | { |
|---|
| 1194 | char *t; |
|---|
| 1195 | t = (char *)mCalloc(100,sizeof(char)); |
|---|
| 1196 | io->mod->s_opt->opt_kappa = 0; |
|---|
| 1197 | PhyML_Printf("\n. Enter your value of the ts/tv ratio > "); |
|---|
| 1198 | Getstring_Stdin(t); |
|---|
| 1199 | n_trial = 0; |
|---|
| 1200 | while(atof(t) < .0) |
|---|
| 1201 | { |
|---|
| 1202 | if(++n_trial > 10) Exit("\n== Err : the ts/tv ratio must be a positive number\n"); |
|---|
| 1203 | PhyML_Printf("\n. The ratio must be a positive number"); |
|---|
| 1204 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 1205 | Getstring_Stdin(t); |
|---|
| 1206 | } |
|---|
| 1207 | io->mod->kappa->v = (phydbl)atof(t); |
|---|
| 1208 | io->mod->s_opt->opt_kappa = 0; |
|---|
| 1209 | io->mod->s_opt->opt_lambda = 0; |
|---|
| 1210 | Free(t); |
|---|
| 1211 | break; |
|---|
| 1212 | } |
|---|
| 1213 | } |
|---|
| 1214 | break; |
|---|
| 1215 | } |
|---|
| 1216 | |
|---|
| 1217 | case 'F' : |
|---|
| 1218 | { |
|---|
| 1219 | if((io->mod->whichmodel == JC69) || |
|---|
| 1220 | (io->mod->whichmodel == K80)) |
|---|
| 1221 | { |
|---|
| 1222 | Warn_And_Exit("\n. 'F' is not a valid choice with these model settings.\n"); |
|---|
| 1223 | } |
|---|
| 1224 | io->mod->s_opt->opt_state_freq = (io->mod->s_opt->opt_state_freq)?(0):(1); |
|---|
| 1225 | break; |
|---|
| 1226 | } |
|---|
| 1227 | |
|---|
| 1228 | case 'M' : |
|---|
| 1229 | { |
|---|
| 1230 | if(io->datatype == NT) |
|---|
| 1231 | { |
|---|
| 1232 | if(!strcmp(io->nt_or_cd,"nucleotides")) |
|---|
| 1233 | { |
|---|
| 1234 | if(io->mod->whichmodel == JC69) |
|---|
| 1235 | { |
|---|
| 1236 | io->mod->whichmodel = K80; |
|---|
| 1237 | } |
|---|
| 1238 | else if(io->mod->whichmodel == K80) |
|---|
| 1239 | { |
|---|
| 1240 | io->mod->whichmodel = F81; |
|---|
| 1241 | } |
|---|
| 1242 | else if(io->mod->whichmodel == F81) |
|---|
| 1243 | { |
|---|
| 1244 | io->mod->whichmodel = HKY85; |
|---|
| 1245 | } |
|---|
| 1246 | else if(io->mod->whichmodel == HKY85) |
|---|
| 1247 | { |
|---|
| 1248 | io->mod->whichmodel = F84; |
|---|
| 1249 | } |
|---|
| 1250 | else if(io->mod->whichmodel == F84) |
|---|
| 1251 | { |
|---|
| 1252 | io->mod->whichmodel = TN93; |
|---|
| 1253 | } |
|---|
| 1254 | else if(io->mod->whichmodel == TN93) |
|---|
| 1255 | { |
|---|
| 1256 | io->mod->whichmodel = GTR; |
|---|
| 1257 | } |
|---|
| 1258 | else if(io->mod->whichmodel == GTR) |
|---|
| 1259 | { |
|---|
| 1260 | io->mod->whichmodel = CUSTOM; |
|---|
| 1261 | } |
|---|
| 1262 | |
|---|
| 1263 | else if(io->mod->whichmodel == CUSTOM) |
|---|
| 1264 | { |
|---|
| 1265 | io->mod->whichmodel = JC69; |
|---|
| 1266 | } |
|---|
| 1267 | } |
|---|
| 1268 | } |
|---|
| 1269 | else if(io->datatype == AA) |
|---|
| 1270 | { |
|---|
| 1271 | if(io->mod->whichmodel == LG) |
|---|
| 1272 | { |
|---|
| 1273 | io->mod->whichmodel = WAG; |
|---|
| 1274 | } |
|---|
| 1275 | else if(io->mod->whichmodel == WAG) |
|---|
| 1276 | { |
|---|
| 1277 | io->mod->whichmodel = DAYHOFF; |
|---|
| 1278 | } |
|---|
| 1279 | else if(io->mod->whichmodel == DAYHOFF) |
|---|
| 1280 | { |
|---|
| 1281 | io->mod->whichmodel = JTT; |
|---|
| 1282 | } |
|---|
| 1283 | else if(io->mod->whichmodel == JTT) |
|---|
| 1284 | { |
|---|
| 1285 | io->mod->whichmodel = BLOSUM62; |
|---|
| 1286 | } |
|---|
| 1287 | else if(io->mod->whichmodel == BLOSUM62) |
|---|
| 1288 | { |
|---|
| 1289 | io->mod->whichmodel = MTREV; |
|---|
| 1290 | } |
|---|
| 1291 | else if(io->mod->whichmodel == MTREV) |
|---|
| 1292 | { |
|---|
| 1293 | io->mod->whichmodel = RTREV; |
|---|
| 1294 | } |
|---|
| 1295 | else if(io->mod->whichmodel == RTREV) |
|---|
| 1296 | { |
|---|
| 1297 | io->mod->whichmodel = CPREV; |
|---|
| 1298 | } |
|---|
| 1299 | else if(io->mod->whichmodel == CPREV) |
|---|
| 1300 | { |
|---|
| 1301 | io->mod->whichmodel = DCMUT; |
|---|
| 1302 | } |
|---|
| 1303 | else if(io->mod->whichmodel == DCMUT) |
|---|
| 1304 | { |
|---|
| 1305 | io->mod->whichmodel = VT; |
|---|
| 1306 | } |
|---|
| 1307 | else if(io->mod->whichmodel == VT) |
|---|
| 1308 | { |
|---|
| 1309 | io->mod->whichmodel = MTMAM; |
|---|
| 1310 | } |
|---|
| 1311 | else if(io->mod->whichmodel == MTMAM) |
|---|
| 1312 | { |
|---|
| 1313 | io->mod->whichmodel = MTART; |
|---|
| 1314 | } |
|---|
| 1315 | else if(io->mod->whichmodel == MTART) |
|---|
| 1316 | { |
|---|
| 1317 | io->mod->whichmodel = HIVW; |
|---|
| 1318 | } |
|---|
| 1319 | else if(io->mod->whichmodel == HIVW) |
|---|
| 1320 | { |
|---|
| 1321 | io->mod->whichmodel = HIVB; |
|---|
| 1322 | } |
|---|
| 1323 | else if(io->mod->whichmodel == HIVB) |
|---|
| 1324 | { |
|---|
| 1325 | io->mod->whichmodel = CUSTOMAA; |
|---|
| 1326 | } |
|---|
| 1327 | else if(io->mod->whichmodel == CUSTOMAA) |
|---|
| 1328 | { |
|---|
| 1329 | io->mod->whichmodel = LG; |
|---|
| 1330 | } |
|---|
| 1331 | } |
|---|
| 1332 | else if(io->datatype == GENERIC) |
|---|
| 1333 | { |
|---|
| 1334 | io->mod->whichmodel = JC69; |
|---|
| 1335 | } |
|---|
| 1336 | Set_Model_Name(io->mod); |
|---|
| 1337 | break; |
|---|
| 1338 | } |
|---|
| 1339 | case '-' : |
|---|
| 1340 | { |
|---|
| 1341 | io->curr_interface = INTERFACE_DATA_TYPE; |
|---|
| 1342 | break; |
|---|
| 1343 | } |
|---|
| 1344 | case '+' : |
|---|
| 1345 | { |
|---|
| 1346 | io->curr_interface = (io->config_multigene)?(INTERFACE_DATA_TYPE):(INTERFACE_TOPO_SEARCH); |
|---|
| 1347 | break; |
|---|
| 1348 | } |
|---|
| 1349 | case 'Y' : |
|---|
| 1350 | { |
|---|
| 1351 | io->ready_to_go = 1; |
|---|
| 1352 | break; |
|---|
| 1353 | } |
|---|
| 1354 | default : |
|---|
| 1355 | { |
|---|
| 1356 | break; |
|---|
| 1357 | } |
|---|
| 1358 | } |
|---|
| 1359 | |
|---|
| 1360 | if(io->mod->s_opt->opt_alpha || |
|---|
| 1361 | io->mod->s_opt->opt_kappa || |
|---|
| 1362 | io->mod->s_opt->opt_lambda || |
|---|
| 1363 | io->mod->s_opt->opt_pinvar || |
|---|
| 1364 | io->mod->s_opt->opt_rr) io->mod->s_opt->opt_subst_param = 1; |
|---|
| 1365 | else io->mod->s_opt->opt_subst_param = 0; |
|---|
| 1366 | |
|---|
| 1367 | Free(s); |
|---|
| 1368 | } |
|---|
| 1369 | |
|---|
| 1370 | ////////////////////////////////////////////////////////////// |
|---|
| 1371 | ////////////////////////////////////////////////////////////// |
|---|
| 1372 | |
|---|
| 1373 | |
|---|
| 1374 | void Launch_Interface_Topo_Search(option *io) |
|---|
| 1375 | { |
|---|
| 1376 | char choix; |
|---|
| 1377 | char *s; |
|---|
| 1378 | |
|---|
| 1379 | s = (char *)mCalloc(100,sizeof(char)); |
|---|
| 1380 | |
|---|
| 1381 | Clear(); |
|---|
| 1382 | Print_Banner(stdout); |
|---|
| 1383 | |
|---|
| 1384 | PhyML_Printf("\n\n"); |
|---|
| 1385 | |
|---|
| 1386 | |
|---|
| 1387 | PhyML_Printf(" ....................... \n"); |
|---|
| 1388 | PhyML_Printf(" Menu : Tree Searching \n"); |
|---|
| 1389 | PhyML_Printf(" ............................. \n"); |
|---|
| 1390 | |
|---|
| 1391 | |
|---|
| 1392 | PhyML_Printf("\n\n"); |
|---|
| 1393 | |
|---|
| 1394 | PhyML_Printf(" [+] " |
|---|
| 1395 | ".................................... Next sub-menu\n"); |
|---|
| 1396 | |
|---|
| 1397 | PhyML_Printf(" [-] " |
|---|
| 1398 | "................................ Previous sub-menu\n"); |
|---|
| 1399 | |
|---|
| 1400 | PhyML_Printf(" [Y] " |
|---|
| 1401 | ".............................. Launch the analysis\n"); |
|---|
| 1402 | |
|---|
| 1403 | PhyML_Printf("\n"); |
|---|
| 1404 | |
|---|
| 1405 | PhyML_Printf(" [O] " |
|---|
| 1406 | "........................... Optimise tree topology " |
|---|
| 1407 | " %-15s \n", |
|---|
| 1408 | (io->mod->s_opt->opt_topo)?("yes"):("no")); |
|---|
| 1409 | |
|---|
| 1410 | |
|---|
| 1411 | if(io->mod->s_opt->opt_topo) |
|---|
| 1412 | { |
|---|
| 1413 | switch(io->in_tree) |
|---|
| 1414 | { |
|---|
| 1415 | case 0: { strcpy(s,"BioNJ"); break; } |
|---|
| 1416 | case 1: { strcpy(s,"parsimony"); break; } |
|---|
| 1417 | case 2: { strcpy(s,"user tree"); break; } |
|---|
| 1418 | } |
|---|
| 1419 | |
|---|
| 1420 | PhyML_Printf(" [U] " |
|---|
| 1421 | "........ Starting tree (BioNJ/parsimony/user tree) " |
|---|
| 1422 | " %-15s \n",s); |
|---|
| 1423 | } |
|---|
| 1424 | else |
|---|
| 1425 | { |
|---|
| 1426 | switch(io->in_tree) |
|---|
| 1427 | { |
|---|
| 1428 | case 0: { strcpy(s,"BioNJ"); break; } |
|---|
| 1429 | case 2: { strcpy(s,"user tree"); break; } |
|---|
| 1430 | } |
|---|
| 1431 | |
|---|
| 1432 | PhyML_Printf(" [U] " |
|---|
| 1433 | "..................... Input tree (BioNJ/user tree) " |
|---|
| 1434 | " %-15s \n",s); |
|---|
| 1435 | } |
|---|
| 1436 | |
|---|
| 1437 | if(io->mod->s_opt->opt_topo) |
|---|
| 1438 | { |
|---|
| 1439 | char *s; |
|---|
| 1440 | |
|---|
| 1441 | s = (char *)mCalloc(T_MAX_OPTION,sizeof(char)); |
|---|
| 1442 | if(io->mod->s_opt->topo_search == NNI_MOVE) |
|---|
| 1443 | { |
|---|
| 1444 | strcpy(s,"NNI moves (fast, approximate)\0"); |
|---|
| 1445 | } |
|---|
| 1446 | else if(io->mod->s_opt->topo_search == SPR_MOVE) |
|---|
| 1447 | { |
|---|
| 1448 | strcpy(s,"SPR moves (slow, accurate)\0"); |
|---|
| 1449 | } |
|---|
| 1450 | else if(io->mod->s_opt->topo_search == BEST_OF_NNI_AND_SPR) |
|---|
| 1451 | { |
|---|
| 1452 | strcpy(s,"Best of NNI and SPR \0"); |
|---|
| 1453 | } |
|---|
| 1454 | |
|---|
| 1455 | PhyML_Printf(" [S] " |
|---|
| 1456 | ".................. Tree topology search operations " |
|---|
| 1457 | " %-15s \n",s); |
|---|
| 1458 | |
|---|
| 1459 | Free(s); |
|---|
| 1460 | |
|---|
| 1461 | if(io->mod->s_opt->topo_search != NNI_MOVE) |
|---|
| 1462 | { |
|---|
| 1463 | PhyML_Printf(" [R] " |
|---|
| 1464 | "........................ Add random starting trees " |
|---|
| 1465 | " %-15s \n", |
|---|
| 1466 | (io->mod->s_opt->random_input_tree)?("yes"):("no")); |
|---|
| 1467 | |
|---|
| 1468 | if(io->mod->s_opt->random_input_tree) |
|---|
| 1469 | { |
|---|
| 1470 | PhyML_Printf(" [N] " |
|---|
| 1471 | ".................. Number of random starting trees " |
|---|
| 1472 | " %-15d \n",io->mod->s_opt->n_rand_starts); |
|---|
| 1473 | } |
|---|
| 1474 | } |
|---|
| 1475 | } |
|---|
| 1476 | else |
|---|
| 1477 | { |
|---|
| 1478 | PhyML_Printf(" [L] " |
|---|
| 1479 | ".......................... Optimise branch lengths " |
|---|
| 1480 | " %-15s \n", |
|---|
| 1481 | (io->mod->s_opt->opt_bl)?("yes"):("no")); |
|---|
| 1482 | } |
|---|
| 1483 | |
|---|
| 1484 | PhyML_Printf("\n\n. Are these settings correct ? " |
|---|
| 1485 | "(type '+', '-', 'Y' or other letter for one to change) "); |
|---|
| 1486 | |
|---|
| 1487 | |
|---|
| 1488 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 1489 | if(choix != '\n') getchar(); /* \n */ |
|---|
| 1490 | |
|---|
| 1491 | Free(s); |
|---|
| 1492 | |
|---|
| 1493 | Uppercase(&choix); |
|---|
| 1494 | |
|---|
| 1495 | |
|---|
| 1496 | switch(choix) |
|---|
| 1497 | { |
|---|
| 1498 | case '-' : |
|---|
| 1499 | { |
|---|
| 1500 | io->curr_interface = INTERFACE_MODEL; |
|---|
| 1501 | break; |
|---|
| 1502 | } |
|---|
| 1503 | case '+' : |
|---|
| 1504 | { |
|---|
| 1505 | io->curr_interface = INTERFACE_BRANCH_SUPPORT; |
|---|
| 1506 | break; |
|---|
| 1507 | } |
|---|
| 1508 | case 'Y' : |
|---|
| 1509 | { |
|---|
| 1510 | io->ready_to_go = 1; |
|---|
| 1511 | break; |
|---|
| 1512 | } |
|---|
| 1513 | case 'U' : |
|---|
| 1514 | { |
|---|
| 1515 | io->in_tree++; |
|---|
| 1516 | if(!io->mod->s_opt->opt_topo) |
|---|
| 1517 | { |
|---|
| 1518 | if(io->in_tree == 1) io->in_tree = 2; |
|---|
| 1519 | } |
|---|
| 1520 | if(io->in_tree == 3) io->in_tree = 0; |
|---|
| 1521 | break; |
|---|
| 1522 | } |
|---|
| 1523 | case 'N' : |
|---|
| 1524 | { |
|---|
| 1525 | char *n; |
|---|
| 1526 | int n_trial; |
|---|
| 1527 | |
|---|
| 1528 | PhyML_Printf("\n. Enter your number of starting trees > "); |
|---|
| 1529 | n = (char *)mCalloc(100,sizeof(char)); |
|---|
| 1530 | Getstring_Stdin(n); |
|---|
| 1531 | n_trial = 0; |
|---|
| 1532 | while(atoi(n) < 1) |
|---|
| 1533 | { |
|---|
| 1534 | if(++n_trial > 10) Exit("\n== Err : the number of starting trees must be a positive integer\n"); |
|---|
| 1535 | PhyML_Printf("\n. The number of starting trees must be a positive integer\n"); |
|---|
| 1536 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 1537 | Getstring_Stdin(n); |
|---|
| 1538 | } |
|---|
| 1539 | io->mod->s_opt->n_rand_starts = atoi(n); |
|---|
| 1540 | io->n_trees = 1; |
|---|
| 1541 | Free(n); |
|---|
| 1542 | break; |
|---|
| 1543 | } |
|---|
| 1544 | case 'O' : |
|---|
| 1545 | { |
|---|
| 1546 | io->mod->s_opt->opt_topo = (io->mod->s_opt->opt_topo)?(0):(1); |
|---|
| 1547 | break; |
|---|
| 1548 | } |
|---|
| 1549 | |
|---|
| 1550 | case 'L' : |
|---|
| 1551 | { |
|---|
| 1552 | if(!io->mod->s_opt->opt_topo) |
|---|
| 1553 | { |
|---|
| 1554 | io->mod->s_opt->opt_bl = (io->mod->s_opt->opt_bl)?(0):(1); |
|---|
| 1555 | } |
|---|
| 1556 | break; |
|---|
| 1557 | } |
|---|
| 1558 | |
|---|
| 1559 | case 'S' : |
|---|
| 1560 | { |
|---|
| 1561 | if(io->mod->s_opt->topo_search == NNI_MOVE) |
|---|
| 1562 | { |
|---|
| 1563 | io->mod->s_opt->topo_search = SPR_MOVE; |
|---|
| 1564 | io->mod->s_opt->n_rand_starts = 1; |
|---|
| 1565 | io->mod->s_opt->random_input_tree = 0; |
|---|
| 1566 | io->mod->s_opt->greedy = 0; |
|---|
| 1567 | } |
|---|
| 1568 | else if(io->mod->s_opt->topo_search == SPR_MOVE) |
|---|
| 1569 | { |
|---|
| 1570 | io->mod->s_opt->topo_search = BEST_OF_NNI_AND_SPR; |
|---|
| 1571 | io->mod->s_opt->n_rand_starts = 1; |
|---|
| 1572 | io->mod->s_opt->random_input_tree = 0; |
|---|
| 1573 | io->mod->s_opt->greedy = 0; |
|---|
| 1574 | } |
|---|
| 1575 | else if(io->mod->s_opt->topo_search == BEST_OF_NNI_AND_SPR) |
|---|
| 1576 | { |
|---|
| 1577 | io->mod->s_opt->topo_search = NNI_MOVE; |
|---|
| 1578 | io->mod->s_opt->n_rand_starts = 1; |
|---|
| 1579 | io->mod->s_opt->random_input_tree = 0; |
|---|
| 1580 | io->mod->s_opt->greedy = 0; |
|---|
| 1581 | } |
|---|
| 1582 | break; |
|---|
| 1583 | } |
|---|
| 1584 | case 'R' : |
|---|
| 1585 | { |
|---|
| 1586 | io->mod->s_opt->random_input_tree = (io->mod->s_opt->random_input_tree)?(0):(1); |
|---|
| 1587 | |
|---|
| 1588 | if(io->mod->s_opt->random_input_tree) |
|---|
| 1589 | { |
|---|
| 1590 | if(io->fp_in_tree) fclose(io->fp_in_tree); |
|---|
| 1591 | /* io->in_tree = 0; */ |
|---|
| 1592 | io->n_trees = 1; |
|---|
| 1593 | io->mod->s_opt->n_rand_starts = 5; |
|---|
| 1594 | |
|---|
| 1595 | strcpy(io->out_trees_file,io->in_align_file); |
|---|
| 1596 | strcat(io->out_trees_file,"_phyml_trees.txt"); |
|---|
| 1597 | } |
|---|
| 1598 | break; |
|---|
| 1599 | } |
|---|
| 1600 | default : |
|---|
| 1601 | { |
|---|
| 1602 | break; |
|---|
| 1603 | } |
|---|
| 1604 | } |
|---|
| 1605 | } |
|---|
| 1606 | |
|---|
| 1607 | ////////////////////////////////////////////////////////////// |
|---|
| 1608 | ////////////////////////////////////////////////////////////// |
|---|
| 1609 | |
|---|
| 1610 | |
|---|
| 1611 | void Launch_Interface_Branch_Support(option *io) |
|---|
| 1612 | { |
|---|
| 1613 | char choix; |
|---|
| 1614 | char *s; |
|---|
| 1615 | |
|---|
| 1616 | s = (char *)mCalloc(100,sizeof(char)); |
|---|
| 1617 | |
|---|
| 1618 | Clear(); |
|---|
| 1619 | Print_Banner(stdout); |
|---|
| 1620 | |
|---|
| 1621 | PhyML_Printf("\n\n"); |
|---|
| 1622 | |
|---|
| 1623 | PhyML_Printf(" ....................... \n"); |
|---|
| 1624 | PhyML_Printf(" Menu : Branch Support \n"); |
|---|
| 1625 | PhyML_Printf(" ............................. \n"); |
|---|
| 1626 | |
|---|
| 1627 | PhyML_Printf("\n\n"); |
|---|
| 1628 | |
|---|
| 1629 | PhyML_Printf(" [+] " |
|---|
| 1630 | ".................................... Next sub-menu\n"); |
|---|
| 1631 | |
|---|
| 1632 | PhyML_Printf(" [-] " |
|---|
| 1633 | "................................ Previous sub-menu\n"); |
|---|
| 1634 | |
|---|
| 1635 | PhyML_Printf(" [Y] " |
|---|
| 1636 | ".............................. Launch the analysis\n"); |
|---|
| 1637 | |
|---|
| 1638 | PhyML_Printf("\n"); |
|---|
| 1639 | |
|---|
| 1640 | |
|---|
| 1641 | strcpy(s,(io->mod->bootstrap > 0)?("yes"):("no")); |
|---|
| 1642 | if(io->mod->bootstrap > 0) sprintf(s+strlen(s)," (%d replicate%s)", |
|---|
| 1643 | io->mod->bootstrap, |
|---|
| 1644 | (io->mod->bootstrap>1)?("s"):("")); |
|---|
| 1645 | |
|---|
| 1646 | /* PhyML_Printf(" [+] " */ |
|---|
| 1647 | PhyML_Printf(" [B] " |
|---|
| 1648 | "................ Non parametric bootstrap analysis " |
|---|
| 1649 | " %-15s \n",s); |
|---|
| 1650 | |
|---|
| 1651 | if(io->ratio_test == 0) |
|---|
| 1652 | { |
|---|
| 1653 | strcpy(s,"no"); |
|---|
| 1654 | } |
|---|
| 1655 | else if(io->ratio_test == 1) |
|---|
| 1656 | { |
|---|
| 1657 | strcpy(s,"yes / aLRT statistics"); |
|---|
| 1658 | } |
|---|
| 1659 | else if(io->ratio_test == 2) |
|---|
| 1660 | { |
|---|
| 1661 | strcpy(s,"yes / Chi2-based supports"); |
|---|
| 1662 | } |
|---|
| 1663 | else if(io->ratio_test == 3) |
|---|
| 1664 | { |
|---|
| 1665 | strcpy(s,"yes / min of SH-like & Chi2-based supports"); |
|---|
| 1666 | } |
|---|
| 1667 | else if(io->ratio_test == 4) |
|---|
| 1668 | { |
|---|
| 1669 | strcpy(s,"yes / SH-like supports"); |
|---|
| 1670 | } |
|---|
| 1671 | else if(io->ratio_test == 5) |
|---|
| 1672 | { |
|---|
| 1673 | strcpy(s,"yes / aBayes supports"); |
|---|
| 1674 | } |
|---|
| 1675 | |
|---|
| 1676 | |
|---|
| 1677 | /* PhyML_Printf(" [+] " */ |
|---|
| 1678 | PhyML_Printf(" [A] " |
|---|
| 1679 | "................ Approximate likelihood ratio test " |
|---|
| 1680 | " %-15s \n",s); |
|---|
| 1681 | |
|---|
| 1682 | PhyML_Printf("\n. Are these settings correct ? " |
|---|
| 1683 | "(type '+', '-', 'Y' or other letter for one to change) "); |
|---|
| 1684 | |
|---|
| 1685 | |
|---|
| 1686 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 1687 | if(choix != '\n') getchar(); /* \n */ |
|---|
| 1688 | |
|---|
| 1689 | Uppercase(&choix); |
|---|
| 1690 | |
|---|
| 1691 | Free(s); |
|---|
| 1692 | |
|---|
| 1693 | switch(choix) |
|---|
| 1694 | { |
|---|
| 1695 | /* case '\n': */ |
|---|
| 1696 | /* { */ |
|---|
| 1697 | /* io->curr_interface++; */ |
|---|
| 1698 | /* break; */ |
|---|
| 1699 | /* } */ |
|---|
| 1700 | |
|---|
| 1701 | case 'B' : |
|---|
| 1702 | { |
|---|
| 1703 | if(io->mod->bootstrap > 0) io->mod->bootstrap = 0; |
|---|
| 1704 | else |
|---|
| 1705 | { |
|---|
| 1706 | char *r; |
|---|
| 1707 | char answer; |
|---|
| 1708 | int n_trial; |
|---|
| 1709 | |
|---|
| 1710 | io->ratio_test = 0; |
|---|
| 1711 | |
|---|
| 1712 | if(io->n_data_sets > 1) |
|---|
| 1713 | { |
|---|
| 1714 | PhyML_Printf("\n. Bootstrap option is not allowed with multiple data sets.\n"); |
|---|
| 1715 | PhyML_Printf("\n. Type any key to exit.\n"); |
|---|
| 1716 | if(!scanf("%c",&choix)) Exit("\n"); |
|---|
| 1717 | Exit("\n"); |
|---|
| 1718 | } |
|---|
| 1719 | |
|---|
| 1720 | |
|---|
| 1721 | PhyML_Printf("\n. Number of replicates > "); |
|---|
| 1722 | r = (char *)mCalloc(T_MAX_OPTION,sizeof(char)); |
|---|
| 1723 | Getstring_Stdin(r); |
|---|
| 1724 | n_trial = 0; |
|---|
| 1725 | while((!atoi(r)) || (atoi(r) < 0)) |
|---|
| 1726 | { |
|---|
| 1727 | if(++n_trial > 10) Exit("\n== Err : the number of replicates must be a positive integer\n"); |
|---|
| 1728 | PhyML_Printf("\n. The number of replicates must be a positive integer"); |
|---|
| 1729 | PhyML_Printf("\n. Enter a new value > "); |
|---|
| 1730 | Getstring_Stdin(r); |
|---|
| 1731 | } |
|---|
| 1732 | io->mod->bootstrap = atoi(r); |
|---|
| 1733 | |
|---|
| 1734 | PhyML_Printf("\n. Print bootstrap trees (and statistics) ? (%s) > ", |
|---|
| 1735 | (io->print_boot_trees)?("Y/n"):("y/N")); |
|---|
| 1736 | |
|---|
| 1737 | if(!scanf("%c",&answer)) Exit("\n"); |
|---|
| 1738 | if(answer == '\n') answer = (io->print_boot_trees)?('Y'):('N'); |
|---|
| 1739 | else getchar(); |
|---|
| 1740 | |
|---|
| 1741 | switch(answer) |
|---|
| 1742 | { |
|---|
| 1743 | case 'Y' : case 'y' : |
|---|
| 1744 | { |
|---|
| 1745 | io->print_boot_trees = 1; |
|---|
| 1746 | |
|---|
| 1747 | strcpy(io->out_boot_tree_file,io->in_align_file); |
|---|
| 1748 | strcat(io->out_boot_tree_file,"_phyml_boot_trees.txt"); |
|---|
| 1749 | io->fp_out_boot_tree = Openfile(io->out_boot_tree_file,1); |
|---|
| 1750 | |
|---|
| 1751 | strcpy(io->out_boot_stats_file,io->in_align_file); |
|---|
| 1752 | strcat(io->out_boot_stats_file,"_phyml_boot_stats.txt"); |
|---|
| 1753 | io->fp_out_boot_stats = Openfile(io->out_boot_stats_file,1); |
|---|
| 1754 | |
|---|
| 1755 | break; |
|---|
| 1756 | } |
|---|
| 1757 | case 'N' : case 'n' : |
|---|
| 1758 | { |
|---|
| 1759 | io->print_boot_trees = 0; |
|---|
| 1760 | io->fp_out_boot_tree = NULL; |
|---|
| 1761 | io->fp_out_boot_stats = NULL; |
|---|
| 1762 | break; |
|---|
| 1763 | } |
|---|
| 1764 | } |
|---|
| 1765 | Free(r); |
|---|
| 1766 | } |
|---|
| 1767 | break; |
|---|
| 1768 | } |
|---|
| 1769 | case 'A' : |
|---|
| 1770 | { |
|---|
| 1771 | io->mod->bootstrap = 0; |
|---|
| 1772 | |
|---|
| 1773 | switch(io->ratio_test) |
|---|
| 1774 | { |
|---|
| 1775 | case 0 : |
|---|
| 1776 | { |
|---|
| 1777 | io->ratio_test = 1; |
|---|
| 1778 | break; |
|---|
| 1779 | } |
|---|
| 1780 | case 1 : |
|---|
| 1781 | { |
|---|
| 1782 | io->ratio_test = 2; |
|---|
| 1783 | break; |
|---|
| 1784 | } |
|---|
| 1785 | case 2 : |
|---|
| 1786 | { |
|---|
| 1787 | /* io->ratio_test = 3; */ |
|---|
| 1788 | io->ratio_test = 4; |
|---|
| 1789 | break; |
|---|
| 1790 | } |
|---|
| 1791 | case 3 : |
|---|
| 1792 | { |
|---|
| 1793 | io->ratio_test = 4; |
|---|
| 1794 | break; |
|---|
| 1795 | } |
|---|
| 1796 | case 4 : |
|---|
| 1797 | { |
|---|
| 1798 | io->ratio_test = 5; |
|---|
| 1799 | break; |
|---|
| 1800 | } |
|---|
| 1801 | case 5 : |
|---|
| 1802 | { |
|---|
| 1803 | io->ratio_test = 0; |
|---|
| 1804 | break; |
|---|
| 1805 | } |
|---|
| 1806 | } |
|---|
| 1807 | break; |
|---|
| 1808 | } |
|---|
| 1809 | |
|---|
| 1810 | case '-' : |
|---|
| 1811 | { |
|---|
| 1812 | io->curr_interface = INTERFACE_TOPO_SEARCH; |
|---|
| 1813 | break; |
|---|
| 1814 | } |
|---|
| 1815 | case '+' : |
|---|
| 1816 | { |
|---|
| 1817 | io->curr_interface = INTERFACE_DATA_TYPE; |
|---|
| 1818 | break; |
|---|
| 1819 | } |
|---|
| 1820 | case 'Y' : |
|---|
| 1821 | { |
|---|
| 1822 | io->ready_to_go = 1; |
|---|
| 1823 | break; |
|---|
| 1824 | } |
|---|
| 1825 | default : break; |
|---|
| 1826 | } |
|---|
| 1827 | } |
|---|
| 1828 | |
|---|
| 1829 | ////////////////////////////////////////////////////////////// |
|---|
| 1830 | ////////////////////////////////////////////////////////////// |
|---|
| 1831 | |
|---|
| 1832 | void Launch_Interface_Multigene(option *io) |
|---|
| 1833 | { |
|---|
| 1834 | |
|---|
| 1835 | #ifdef PART |
|---|
| 1836 | |
|---|
| 1837 | if((io->n_data_sets > 1) && (io->multigene)) |
|---|
| 1838 | { |
|---|
| 1839 | int set, n_trial; |
|---|
| 1840 | char choix; |
|---|
| 1841 | |
|---|
| 1842 | io->n_part = io->n_data_sets; |
|---|
| 1843 | io->st = (supert_tree *)PART_Make_Supert_tree_Light(io); |
|---|
| 1844 | io->st->n_part = io->n_data_sets; |
|---|
| 1845 | |
|---|
| 1846 | For(set,io->n_part) |
|---|
| 1847 | { |
|---|
| 1848 | io->st->optionlist[set] = Make_Input(); |
|---|
| 1849 | Set_Defaults_Input(io->st->optionlist[set]); |
|---|
| 1850 | Set_Defaults_Model(io->st->optionlist[set]->mod); |
|---|
| 1851 | Set_Defaults_Optimiz(io->st->optionlist[set]->mod->s_opt); |
|---|
| 1852 | io->st->optionlist[set]->curr_gt = set; |
|---|
| 1853 | PhyML_Printf("\n. Enter the sequence file name [data set %2d] > ",set+1); fflush(NULL); |
|---|
| 1854 | Getstring_Stdin(io->st->optionlist[set]->in_align_file); |
|---|
| 1855 | io->st->optionlist[set]->fp_in_align = Openfile(io->st->optionlist[set]->in_align_file,0); |
|---|
| 1856 | } |
|---|
| 1857 | |
|---|
| 1858 | |
|---|
| 1859 | PhyML_Printf("\n. Do you want to use your own initial tree ? [N/y] "); |
|---|
| 1860 | if(!scanf("%c", &choix)) Exit("\n"); |
|---|
| 1861 | if(choix != '\n') getchar(); |
|---|
| 1862 | |
|---|
| 1863 | n_trial = 0; |
|---|
| 1864 | while((choix != 'Y') && (choix != 'y') && |
|---|
| 1865 | (choix != 'N') && (choix != 'n')) |
|---|
| 1866 | { |
|---|
| 1867 | if(++n_trial > 10) Exit("\n== Err : wrong answers !"); |
|---|
| 1868 | PhyML_Printf("\n. Do you want to use your own initial tree ? [N/y] ? "); |
|---|
| 1869 | if(!scanf("%c", &choix)) Exit("\n"); |
|---|
| 1870 | if(choix == '\n') choix = 'N'; |
|---|
| 1871 | else getchar(); |
|---|
| 1872 | } |
|---|
| 1873 | |
|---|
| 1874 | switch(choix) |
|---|
| 1875 | { |
|---|
| 1876 | case '\n' : break; |
|---|
| 1877 | case 'Y' : case 'y' : |
|---|
| 1878 | { |
|---|
| 1879 | io->in_tree = 2; |
|---|
| 1880 | PhyML_Printf("\n. Enter the name of the tree file > "); |
|---|
| 1881 | Getstring_Stdin(io->in_tree_file); |
|---|
| 1882 | io->fp_in_tree = Openfile(io->in_tree_file,0); |
|---|
| 1883 | break; |
|---|
| 1884 | } |
|---|
| 1885 | case 'N' : case 'n' : |
|---|
| 1886 | { |
|---|
| 1887 | io->in_tree = 0; |
|---|
| 1888 | break; |
|---|
| 1889 | } |
|---|
| 1890 | default : break; |
|---|
| 1891 | } |
|---|
| 1892 | |
|---|
| 1893 | io->curr_gt = 0; |
|---|
| 1894 | |
|---|
| 1895 | do |
|---|
| 1896 | { |
|---|
| 1897 | io->st->optionlist[io->curr_gt]->config_multigene = 1; |
|---|
| 1898 | do |
|---|
| 1899 | { |
|---|
| 1900 | switch(io->st->optionlist[io->curr_gt]->curr_interface) |
|---|
| 1901 | { |
|---|
| 1902 | case INTERFACE_DATA_TYPE : |
|---|
| 1903 | { |
|---|
| 1904 | Launch_Interface_Data_Type(io->st->optionlist[io->curr_gt]); |
|---|
| 1905 | break; |
|---|
| 1906 | } |
|---|
| 1907 | case INTERFACE_MODEL : |
|---|
| 1908 | { |
|---|
| 1909 | Launch_Interface_Model(io->st->optionlist[io->curr_gt]); |
|---|
| 1910 | break; |
|---|
| 1911 | } |
|---|
| 1912 | default : |
|---|
| 1913 | { |
|---|
| 1914 | PhyML_Printf("\n== Err in file %s at line %d\n\n",__FILE__,__LINE__); |
|---|
| 1915 | Exit(""); |
|---|
| 1916 | break; |
|---|
| 1917 | } |
|---|
| 1918 | } |
|---|
| 1919 | }while(!io->st->optionlist[io->curr_gt]->ready_to_go); |
|---|
| 1920 | io->curr_gt++; |
|---|
| 1921 | }while(io->curr_gt < io->n_part); |
|---|
| 1922 | } |
|---|
| 1923 | io->ready_to_go = 1; |
|---|
| 1924 | PART_Fill_Model_Partitions_Table(io->st); |
|---|
| 1925 | #endif |
|---|
| 1926 | } |
|---|