| 1 | /* Menus and command line interface for Clustal W */ |
|---|
| 2 | /* DES was here MARCH. 1994 */ |
|---|
| 3 | /* DES was here SEPT. 1994 */ |
|---|
| 4 | #include <stdio.h> |
|---|
| 5 | #include <string.h> |
|---|
| 6 | #include <ctype.h> |
|---|
| 7 | #include <stdlib.h> |
|---|
| 8 | #include <stdarg.h> |
|---|
| 9 | #include <signal.h> |
|---|
| 10 | #include <setjmp.h> |
|---|
| 11 | #include "clustalw.h" |
|---|
| 12 | |
|---|
| 13 | static jmp_buf jmpbuf; |
|---|
| 14 | #ifndef VMS |
|---|
| 15 | #ifndef AIX |
|---|
| 16 | #define BADSIG (void (*)())-1 |
|---|
| 17 | #endif |
|---|
| 18 | #endif |
|---|
| 19 | |
|---|
| 20 | static void jumper(int); |
|---|
| 21 | |
|---|
| 22 | static void jumper(int i) |
|---|
| 23 | { |
|---|
| 24 | longjmp(jmpbuf,1); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | /* |
|---|
| 29 | * Prototypes |
|---|
| 30 | */ |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | static void pair_menu(void); |
|---|
| 34 | static void multi_menu(void); |
|---|
| 35 | static void gap_penalties_menu(void); |
|---|
| 36 | static void multiple_align_menu(void); /* multiple alignments menu */ |
|---|
| 37 | static void profile_align_menu(void); /* profile " " */ |
|---|
| 38 | static void phylogenetic_tree_menu(void); /* NJ trees/distances menu */ |
|---|
| 39 | static void format_options_menu(void); /* format of alignment output */ |
|---|
| 40 | static void tree_format_options_menu(void); /* format of tree output */ |
|---|
| 41 | static void ss_options_menu(void); |
|---|
| 42 | static sint secstroutput_options(void); |
|---|
| 43 | static sint read_matrix(char *title,MatMenu menu, char *matnam, sint matn, short *mat, short *xref); |
|---|
| 44 | |
|---|
| 45 | /* |
|---|
| 46 | * Global variables |
|---|
| 47 | */ |
|---|
| 48 | |
|---|
| 49 | extern float gap_open, gap_extend; |
|---|
| 50 | extern float dna_gap_open, dna_gap_extend; |
|---|
| 51 | extern float prot_gap_open, prot_gap_extend; |
|---|
| 52 | extern float pw_go_penalty, pw_ge_penalty; |
|---|
| 53 | extern float dna_pw_go_penalty, dna_pw_ge_penalty; |
|---|
| 54 | extern float prot_pw_go_penalty, prot_pw_ge_penalty; |
|---|
| 55 | extern float transition_weight; |
|---|
| 56 | extern char revision_level[]; |
|---|
| 57 | extern sint wind_gap,ktup,window,signif; |
|---|
| 58 | extern sint dna_wind_gap, dna_ktup, dna_window, dna_signif; |
|---|
| 59 | extern sint prot_wind_gap,prot_ktup,prot_window,prot_signif; |
|---|
| 60 | extern sint nseqs; |
|---|
| 61 | extern sint divergence_cutoff; |
|---|
| 62 | extern sint debug; |
|---|
| 63 | extern Boolean neg_matrix; |
|---|
| 64 | extern Boolean quick_pairalign; |
|---|
| 65 | extern Boolean reset_alignments_new; /* DES */ |
|---|
| 66 | extern Boolean reset_alignments_all; /* DES */ |
|---|
| 67 | extern sint gap_dist; |
|---|
| 68 | extern Boolean no_var_penalties, no_hyd_penalties, no_pref_penalties; |
|---|
| 69 | extern sint output_order; |
|---|
| 70 | extern sint profile_no; |
|---|
| 71 | extern short usermat[], pw_usermat[]; |
|---|
| 72 | extern short aa_xref[], pw_aa_xref[]; |
|---|
| 73 | extern short userdnamat[], pw_userdnamat[]; |
|---|
| 74 | extern short dna_xref[], pw_dna_xref[]; |
|---|
| 75 | |
|---|
| 76 | extern Boolean lowercase; /* Flag for GDE output - set on comm. line*/ |
|---|
| 77 | extern Boolean cl_seq_numbers; |
|---|
| 78 | extern Boolean seqRange; /* to append sequence range with seq names, Ranu */ |
|---|
| 79 | |
|---|
| 80 | extern Boolean output_clustal, output_nbrf, output_phylip, output_gcg, output_gde, output_nexus; |
|---|
| 81 | extern Boolean output_fasta; /* Ramu */ |
|---|
| 82 | |
|---|
| 83 | extern Boolean output_tree_clustal, output_tree_phylip, output_tree_distances,output_tree_nexus; |
|---|
| 84 | extern sint bootstrap_format; |
|---|
| 85 | extern Boolean tossgaps, kimura; |
|---|
| 86 | extern Boolean percent; |
|---|
| 87 | extern Boolean usemenu; |
|---|
| 88 | extern Boolean showaln, save_parameters; |
|---|
| 89 | extern Boolean dnaflag; |
|---|
| 90 | extern Boolean use_ambiguities; |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | extern char hyd_residues[]; |
|---|
| 94 | extern char mtrxname[], pw_mtrxname[]; |
|---|
| 95 | extern char dnamtrxname[], pw_dnamtrxname[]; |
|---|
| 96 | extern char seqname[]; |
|---|
| 97 | |
|---|
| 98 | extern sint output_struct_penalties; |
|---|
| 99 | extern Boolean use_ss1, use_ss2; |
|---|
| 100 | |
|---|
| 101 | extern Boolean empty; |
|---|
| 102 | extern Boolean profile1_empty, profile2_empty; /* whether or not profiles */ |
|---|
| 103 | |
|---|
| 104 | extern char profile1_name[FILENAMELEN+1]; |
|---|
| 105 | extern char profile2_name[FILENAMELEN+1]; |
|---|
| 106 | |
|---|
| 107 | extern Boolean use_endgaps; |
|---|
| 108 | extern sint matnum,pw_matnum; |
|---|
| 109 | extern sint dnamatnum,pw_dnamatnum; |
|---|
| 110 | |
|---|
| 111 | extern sint helix_penalty; |
|---|
| 112 | extern sint strand_penalty; |
|---|
| 113 | extern sint loop_penalty; |
|---|
| 114 | extern sint helix_end_minus; |
|---|
| 115 | extern sint helix_end_plus; |
|---|
| 116 | extern sint strand_end_minus; |
|---|
| 117 | extern sint strand_end_plus; |
|---|
| 118 | extern sint helix_end_penalty; |
|---|
| 119 | extern sint strand_end_penalty; |
|---|
| 120 | |
|---|
| 121 | extern MatMenu matrix_menu; |
|---|
| 122 | extern MatMenu pw_matrix_menu; |
|---|
| 123 | extern MatMenu dnamatrix_menu; |
|---|
| 124 | |
|---|
| 125 | static char phylip_name[FILENAMELEN]=""; |
|---|
| 126 | static char clustal_name[FILENAMELEN]=""; |
|---|
| 127 | static char dist_name[FILENAMELEN]=""; |
|---|
| 128 | static char nexus_name[FILENAMELEN]=""; |
|---|
| 129 | static char fasta_name[FILENAMELEN]=""; |
|---|
| 130 | |
|---|
| 131 | static char p1_tree_name[FILENAMELEN]=""; |
|---|
| 132 | static char p2_tree_name[FILENAMELEN]=""; |
|---|
| 133 | |
|---|
| 134 | static char *secstroutput_txt[] = { |
|---|
| 135 | "Secondary Structure", |
|---|
| 136 | "Gap Penalty Mask", |
|---|
| 137 | "Structure and Penalty Mask", |
|---|
| 138 | "None" }; |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | static char *lin1, *lin2, *lin3; |
|---|
| 142 | |
|---|
| 143 | static int firstres =0; /* range of alignment for saving as ... */ |
|---|
| 144 | static int lastres = 0; |
|---|
| 145 | |
|---|
| 146 | void init_amenu(void) |
|---|
| 147 | { |
|---|
| 148 | |
|---|
| 149 | lin1 = (char *)ckalloc( (MAXLINE+1) * sizeof (char) ); |
|---|
| 150 | lin2 = (char *)ckalloc( (MAXLINE+1) * sizeof (char) ); |
|---|
| 151 | lin3 = (char *)ckalloc( (MAXLINE+1) * sizeof (char) ); |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | void main_menu(void) |
|---|
| 155 | { |
|---|
| 156 | int catchint; |
|---|
| 157 | |
|---|
| 158 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 159 | if (catchint) { |
|---|
| 160 | if (setjmp(jmpbuf) != 0) |
|---|
| 161 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 162 | #ifdef UNIX |
|---|
| 163 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 164 | fprintf(stdout,"Error: signal\n"); |
|---|
| 165 | #else |
|---|
| 166 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 167 | fprintf(stdout,"Error: signal\n"); |
|---|
| 168 | #endif |
|---|
| 169 | } |
|---|
| 170 | |
|---|
| 171 | while(TRUE) { |
|---|
| 172 | fprintf(stdout,"\n\n\n"); |
|---|
| 173 | fprintf(stdout," **************************************************************\n"); |
|---|
| 174 | fprintf(stdout," ******** CLUSTAL %s Multiple Sequence Alignments ********\n",revision_level); |
|---|
| 175 | fprintf(stdout," **************************************************************\n"); |
|---|
| 176 | fprintf(stdout,"\n\n"); |
|---|
| 177 | |
|---|
| 178 | fprintf(stdout," 1. Sequence Input From Disc\n"); |
|---|
| 179 | fprintf(stdout," 2. Multiple Alignments\n"); |
|---|
| 180 | fprintf(stdout," 3. Profile / Structure Alignments\n"); |
|---|
| 181 | fprintf(stdout," 4. Phylogenetic trees\n"); |
|---|
| 182 | fprintf(stdout,"\n"); |
|---|
| 183 | fprintf(stdout," S. Execute a system command\n"); |
|---|
| 184 | fprintf(stdout," H. HELP\n"); |
|---|
| 185 | fprintf(stdout," X. EXIT (leave program)\n\n\n"); |
|---|
| 186 | |
|---|
| 187 | getstr("Your choice",lin1); |
|---|
| 188 | |
|---|
| 189 | switch(toupper(*lin1)) { |
|---|
| 190 | case '1': seq_input(FALSE); |
|---|
| 191 | phylip_name[0]=EOS; |
|---|
| 192 | clustal_name[0]=EOS; |
|---|
| 193 | dist_name[0]=EOS; |
|---|
| 194 | nexus_name[0]=EOS; |
|---|
| 195 | break; |
|---|
| 196 | case '2': multiple_align_menu(); |
|---|
| 197 | break; |
|---|
| 198 | case '3': profile_align_menu(); |
|---|
| 199 | break; |
|---|
| 200 | case '4': phylogenetic_tree_menu(); |
|---|
| 201 | break; |
|---|
| 202 | case 'S': do_system(); |
|---|
| 203 | break; |
|---|
| 204 | case '?': |
|---|
| 205 | case 'H': get_help('1'); |
|---|
| 206 | break; |
|---|
| 207 | case 'Q': |
|---|
| 208 | case 'X': exit(0); |
|---|
| 209 | break; |
|---|
| 210 | default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 211 | break; |
|---|
| 212 | } |
|---|
| 213 | } |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | |
|---|
| 224 | static void multiple_align_menu(void) |
|---|
| 225 | { |
|---|
| 226 | int catchint; |
|---|
| 227 | |
|---|
| 228 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 229 | if (catchint) { |
|---|
| 230 | if (setjmp(jmpbuf) != 0) |
|---|
| 231 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 232 | #ifdef UNIX |
|---|
| 233 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 234 | fprintf(stdout,"Error: signal\n"); |
|---|
| 235 | #else |
|---|
| 236 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 237 | fprintf(stdout,"Error: signal\n"); |
|---|
| 238 | #endif |
|---|
| 239 | } |
|---|
| 240 | |
|---|
| 241 | |
|---|
| 242 | while(TRUE) |
|---|
| 243 | { |
|---|
| 244 | fprintf(stdout,"\n\n\n"); |
|---|
| 245 | fprintf(stdout,"****** MULTIPLE ALIGNMENT MENU ******\n"); |
|---|
| 246 | fprintf(stdout,"\n\n"); |
|---|
| 247 | |
|---|
| 248 | |
|---|
| 249 | fprintf(stdout," 1. Do complete multiple alignment now (%s)\n", |
|---|
| 250 | (!quick_pairalign) ? "Slow/Accurate" : "Fast/Approximate"); |
|---|
| 251 | fprintf(stdout," 2. Produce guide tree file only\n"); |
|---|
| 252 | fprintf(stdout," 3. Do alignment using old guide tree file\n\n"); |
|---|
| 253 | fprintf(stdout," 4. Toggle Slow/Fast pairwise alignments = %s\n\n", |
|---|
| 254 | (!quick_pairalign) ? "SLOW" : "FAST"); |
|---|
| 255 | fprintf(stdout," 5. Pairwise alignment parameters\n"); |
|---|
| 256 | fprintf(stdout," 6. Multiple alignment parameters\n\n"); |
|---|
| 257 | fprintf(stdout," 7. Reset gaps before alignment?"); |
|---|
| 258 | if(reset_alignments_new) |
|---|
| 259 | fprintf(stdout," = ON\n"); |
|---|
| 260 | else |
|---|
| 261 | fprintf(stdout," = OFF\n"); |
|---|
| 262 | fprintf(stdout," 8. Toggle screen display = %s\n", |
|---|
| 263 | (!showaln) ? "OFF" : "ON"); |
|---|
| 264 | fprintf(stdout," 9. Output format options\n"); |
|---|
| 265 | fprintf(stdout,"\n"); |
|---|
| 266 | |
|---|
| 267 | fprintf(stdout," S. Execute a system command\n"); |
|---|
| 268 | fprintf(stdout," H. HELP\n"); |
|---|
| 269 | fprintf(stdout," or press [RETURN] to go back to main menu\n\n\n"); |
|---|
| 270 | |
|---|
| 271 | getstr("Your choice",lin1); |
|---|
| 272 | if(*lin1 == EOS) return; |
|---|
| 273 | |
|---|
| 274 | switch(toupper(*lin1)) |
|---|
| 275 | { |
|---|
| 276 | case '1': align(phylip_name); |
|---|
| 277 | break; |
|---|
| 278 | case '2': make_tree(phylip_name); |
|---|
| 279 | break; |
|---|
| 280 | case '3': get_tree(phylip_name); |
|---|
| 281 | break; |
|---|
| 282 | case '4': quick_pairalign ^= TRUE; |
|---|
| 283 | break; |
|---|
| 284 | case '5': pair_menu(); |
|---|
| 285 | break; |
|---|
| 286 | case '6': multi_menu(); |
|---|
| 287 | break; |
|---|
| 288 | case '7': reset_alignments_new ^= TRUE; |
|---|
| 289 | if(reset_alignments_new==TRUE) |
|---|
| 290 | reset_alignments_all=FALSE; |
|---|
| 291 | break; |
|---|
| 292 | case '8': showaln ^= TRUE; |
|---|
| 293 | break; |
|---|
| 294 | case '9': format_options_menu(); |
|---|
| 295 | break; |
|---|
| 296 | case 'S': do_system(); |
|---|
| 297 | break; |
|---|
| 298 | case '?': |
|---|
| 299 | case 'H': get_help('2'); |
|---|
| 300 | break; |
|---|
| 301 | case 'Q': |
|---|
| 302 | case 'X': return; |
|---|
| 303 | |
|---|
| 304 | default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 305 | break; |
|---|
| 306 | } |
|---|
| 307 | } |
|---|
| 308 | } |
|---|
| 309 | |
|---|
| 310 | |
|---|
| 311 | |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | static void profile_align_menu(void) |
|---|
| 319 | { |
|---|
| 320 | int catchint; |
|---|
| 321 | |
|---|
| 322 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 323 | if (catchint) { |
|---|
| 324 | if (setjmp(jmpbuf) != 0) |
|---|
| 325 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 326 | #ifdef UNIX |
|---|
| 327 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 328 | fprintf(stdout,"Error: signal\n"); |
|---|
| 329 | #else |
|---|
| 330 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 331 | fprintf(stdout,"Error: signal\n"); |
|---|
| 332 | #endif |
|---|
| 333 | } |
|---|
| 334 | |
|---|
| 335 | |
|---|
| 336 | while(TRUE) |
|---|
| 337 | { |
|---|
| 338 | fprintf(stdout,"\n\n\n"); |
|---|
| 339 | fprintf(stdout,"****** PROFILE AND STRUCTURE ALIGNMENT MENU ******\n"); |
|---|
| 340 | fprintf(stdout,"\n\n"); |
|---|
| 341 | |
|---|
| 342 | fprintf(stdout," 1. Input 1st. profile "); |
|---|
| 343 | if (!profile1_empty) fprintf(stdout,"(loaded)"); |
|---|
| 344 | fprintf(stdout,"\n"); |
|---|
| 345 | fprintf(stdout," 2. Input 2nd. profile/sequences "); |
|---|
| 346 | if (!profile2_empty) fprintf(stdout,"(loaded)"); |
|---|
| 347 | fprintf(stdout,"\n\n"); |
|---|
| 348 | fprintf(stdout," 3. Align 2nd. profile to 1st. profile\n"); |
|---|
| 349 | fprintf(stdout," 4. Align sequences to 1st. profile (%s)\n\n", |
|---|
| 350 | (!quick_pairalign) ? "Slow/Accurate" : "Fast/Approximate"); |
|---|
| 351 | fprintf(stdout," 5. Toggle Slow/Fast pairwise alignments = %s\n\n", |
|---|
| 352 | (!quick_pairalign) ? "SLOW" : "FAST"); |
|---|
| 353 | fprintf(stdout," 6. Pairwise alignment parameters\n"); |
|---|
| 354 | fprintf(stdout," 7. Multiple alignment parameters\n\n"); |
|---|
| 355 | fprintf(stdout," 8. Toggle screen display = %s\n", |
|---|
| 356 | (!showaln) ? "OFF" : "ON"); |
|---|
| 357 | fprintf(stdout," 9. Output format options\n"); |
|---|
| 358 | fprintf(stdout," 0. Secondary structure options\n"); |
|---|
| 359 | fprintf(stdout,"\n"); |
|---|
| 360 | fprintf(stdout," S. Execute a system command\n"); |
|---|
| 361 | fprintf(stdout," H. HELP\n"); |
|---|
| 362 | fprintf(stdout," or press [RETURN] to go back to main menu\n\n\n"); |
|---|
| 363 | |
|---|
| 364 | getstr("Your choice",lin1); |
|---|
| 365 | if(*lin1 == EOS) return; |
|---|
| 366 | |
|---|
| 367 | switch(toupper(*lin1)) |
|---|
| 368 | { |
|---|
| 369 | case '1': profile_no = 1; /* 1 => 1st profile */ |
|---|
| 370 | profile_input(); |
|---|
| 371 | strcpy(profile1_name, seqname); |
|---|
| 372 | break; |
|---|
| 373 | case '2': profile_no = 2; /* 2 => 2nd profile */ |
|---|
| 374 | profile_input(); |
|---|
| 375 | strcpy(profile2_name, seqname); |
|---|
| 376 | break; |
|---|
| 377 | case '3': profile_align(p1_tree_name,p2_tree_name); /* align the 2 alignments now */ |
|---|
| 378 | break; |
|---|
| 379 | case '4': new_sequence_align(phylip_name); /* align new sequences to profile 1 */ |
|---|
| 380 | break; |
|---|
| 381 | case '5': quick_pairalign ^= TRUE; |
|---|
| 382 | break; |
|---|
| 383 | case '6': pair_menu(); |
|---|
| 384 | break; |
|---|
| 385 | case '7': multi_menu(); |
|---|
| 386 | break; |
|---|
| 387 | case '8': showaln ^= TRUE; |
|---|
| 388 | break; |
|---|
| 389 | case '9': format_options_menu(); |
|---|
| 390 | break; |
|---|
| 391 | case '0': ss_options_menu(); |
|---|
| 392 | break; |
|---|
| 393 | case 'S': do_system(); |
|---|
| 394 | break; |
|---|
| 395 | case '?': |
|---|
| 396 | case 'H': get_help('6'); |
|---|
| 397 | break; |
|---|
| 398 | case 'Q': |
|---|
| 399 | case 'X': return; |
|---|
| 400 | |
|---|
| 401 | default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 402 | break; |
|---|
| 403 | } |
|---|
| 404 | } |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | |
|---|
| 408 | static void ss_options_menu(void) |
|---|
| 409 | { |
|---|
| 410 | int catchint; |
|---|
| 411 | |
|---|
| 412 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 413 | if (catchint) { |
|---|
| 414 | if (setjmp(jmpbuf) != 0) |
|---|
| 415 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 416 | #ifdef UNIX |
|---|
| 417 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 418 | fprintf(stdout,"Error: signal\n"); |
|---|
| 419 | #else |
|---|
| 420 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 421 | fprintf(stdout,"Error: signal\n"); |
|---|
| 422 | #endif |
|---|
| 423 | } |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | while(TRUE) { |
|---|
| 427 | |
|---|
| 428 | fprintf(stdout,"\n\n\n"); |
|---|
| 429 | fprintf(stdout," ********* SECONDARY STRUCTURE OPTIONS *********\n"); |
|---|
| 430 | fprintf(stdout,"\n\n"); |
|---|
| 431 | |
|---|
| 432 | fprintf(stdout," 1. Use profile 1 secondary structure / penalty mask "); |
|---|
| 433 | if(use_ss1) |
|---|
| 434 | fprintf(stdout,"= YES\n"); |
|---|
| 435 | else |
|---|
| 436 | fprintf(stdout,"= NO\n"); |
|---|
| 437 | fprintf(stdout," 2. Use profile 2 secondary structure / penalty mask "); |
|---|
| 438 | if(use_ss2) |
|---|
| 439 | fprintf(stdout,"= YES\n"); |
|---|
| 440 | else |
|---|
| 441 | fprintf(stdout,"= NO\n"); |
|---|
| 442 | fprintf(stdout,"\n"); |
|---|
| 443 | fprintf(stdout," 3. Output in alignment "); |
|---|
| 444 | fprintf(stdout,"= %s\n",secstroutput_txt[output_struct_penalties]); |
|---|
| 445 | fprintf(stdout,"\n"); |
|---|
| 446 | |
|---|
| 447 | fprintf(stdout," 4. Helix gap penalty :%d\n",(pint)helix_penalty); |
|---|
| 448 | fprintf(stdout," 5. Strand gap penalty :%d\n",(pint)strand_penalty); |
|---|
| 449 | fprintf(stdout," 6. Loop gap penalty :%d\n",(pint)loop_penalty); |
|---|
| 450 | |
|---|
| 451 | fprintf(stdout," 7. Secondary structure terminal penalty :%d\n",(pint)helix_end_penalty); |
|---|
| 452 | fprintf(stdout," 8. Helix terminal positions within :%d outside :%d\n", |
|---|
| 453 | (pint)helix_end_minus,(pint)helix_end_plus); |
|---|
| 454 | fprintf(stdout," 9. Strand terminal positions within :%d outside :%d\n", |
|---|
| 455 | (pint)strand_end_minus,(pint)strand_end_plus); |
|---|
| 456 | |
|---|
| 457 | fprintf(stdout,"\n\n"); |
|---|
| 458 | fprintf(stdout," H. HELP\n\n\n"); |
|---|
| 459 | |
|---|
| 460 | getstr("Enter number (or [RETURN] to exit)",lin2); |
|---|
| 461 | if( *lin2 == EOS) { |
|---|
| 462 | return; |
|---|
| 463 | } |
|---|
| 464 | |
|---|
| 465 | switch(toupper(*lin2)) { |
|---|
| 466 | case '1': use_ss1 ^= TRUE; |
|---|
| 467 | break; |
|---|
| 468 | case '2': use_ss2 ^= TRUE; |
|---|
| 469 | break; |
|---|
| 470 | case '3': output_struct_penalties = secstroutput_options(); |
|---|
| 471 | break; |
|---|
| 472 | case '4': |
|---|
| 473 | fprintf(stdout,"Helix Penalty Currently: %d\n",(pint)helix_penalty); |
|---|
| 474 | helix_penalty=getint("Enter number",1,9,helix_penalty); |
|---|
| 475 | break; |
|---|
| 476 | case '5': |
|---|
| 477 | fprintf(stdout,"Strand Gap Penalty Currently: %d\n",(pint)strand_penalty); |
|---|
| 478 | strand_penalty=getint("Enter number",1,9,strand_penalty); |
|---|
| 479 | break; |
|---|
| 480 | case '6': |
|---|
| 481 | fprintf(stdout,"Loop Gap Penalty Currently: %d\n",(pint)loop_penalty); |
|---|
| 482 | loop_penalty=getint("Enter number",1,9,loop_penalty); |
|---|
| 483 | break; |
|---|
| 484 | case '7': |
|---|
| 485 | fprintf(stdout,"Secondary Structure Terminal Penalty Currently: %d\n", |
|---|
| 486 | (pint)helix_end_penalty); |
|---|
| 487 | helix_end_penalty=getint("Enter number",1,9,helix_end_penalty); |
|---|
| 488 | strand_end_penalty = helix_end_penalty; |
|---|
| 489 | break; |
|---|
| 490 | case '8': |
|---|
| 491 | fprintf(stdout,"Helix Terminal Positions Currently: \n"); |
|---|
| 492 | fprintf(stdout," within helix: %d outside helix: %d\n", |
|---|
| 493 | (pint)helix_end_minus,(pint)helix_end_plus); |
|---|
| 494 | helix_end_minus=getint("Enter number of residues within helix",0,3,helix_end_minus); |
|---|
| 495 | helix_end_plus=getint("Enter number of residues outside helix",0,3,helix_end_plus); |
|---|
| 496 | break; |
|---|
| 497 | case '9': |
|---|
| 498 | fprintf(stdout,"Strand Terminal Positions Currently: \n"); |
|---|
| 499 | fprintf(stdout," within strand: %d outside strand: %d\n", |
|---|
| 500 | (pint)strand_end_minus,(pint)strand_end_plus); |
|---|
| 501 | strand_end_minus=getint("Enter number of residues within strand",0,3,strand_end_minus); |
|---|
| 502 | strand_end_plus=getint("Enter number of residues outside strand",0,3,strand_end_plus); |
|---|
| 503 | break; |
|---|
| 504 | case '?': |
|---|
| 505 | case 'H': |
|---|
| 506 | get_help('B'); |
|---|
| 507 | break; |
|---|
| 508 | default: |
|---|
| 509 | fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 510 | break; |
|---|
| 511 | } |
|---|
| 512 | } |
|---|
| 513 | } |
|---|
| 514 | |
|---|
| 515 | |
|---|
| 516 | static sint secstroutput_options(void) |
|---|
| 517 | { |
|---|
| 518 | |
|---|
| 519 | while(TRUE) |
|---|
| 520 | { |
|---|
| 521 | fprintf(stdout,"\n\n\n"); |
|---|
| 522 | fprintf(stdout," ********* Secondary Structure Output Menu *********\n"); |
|---|
| 523 | fprintf(stdout,"\n\n"); |
|---|
| 524 | |
|---|
| 525 | |
|---|
| 526 | fprintf(stdout," 1. %s\n",secstroutput_txt[0]); |
|---|
| 527 | fprintf(stdout," 2. %s\n",secstroutput_txt[1]); |
|---|
| 528 | fprintf(stdout," 3. %s\n",secstroutput_txt[2]); |
|---|
| 529 | fprintf(stdout," 4. %s\n",secstroutput_txt[3]); |
|---|
| 530 | fprintf(stdout," H. HELP\n\n"); |
|---|
| 531 | fprintf(stdout, |
|---|
| 532 | " -- Current output is %s ",secstroutput_txt[output_struct_penalties]); |
|---|
| 533 | fprintf(stdout,"--\n"); |
|---|
| 534 | |
|---|
| 535 | |
|---|
| 536 | getstr("\n\nEnter number (or [RETURN] to exit)",lin2); |
|---|
| 537 | if(*lin2 == EOS) return(output_struct_penalties); |
|---|
| 538 | |
|---|
| 539 | switch(toupper(*lin2)) |
|---|
| 540 | { |
|---|
| 541 | case '1': return(0); |
|---|
| 542 | case '2': return(1); |
|---|
| 543 | case '3': return(2); |
|---|
| 544 | case '4': return(3); |
|---|
| 545 | case '?': |
|---|
| 546 | case 'H': get_help('C'); |
|---|
| 547 | case 'Q': |
|---|
| 548 | case 'X': return(0); |
|---|
| 549 | |
|---|
| 550 | default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 551 | break; |
|---|
| 552 | } |
|---|
| 553 | } |
|---|
| 554 | } |
|---|
| 555 | |
|---|
| 556 | |
|---|
| 557 | |
|---|
| 558 | |
|---|
| 559 | |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | static void phylogenetic_tree_menu(void) |
|---|
| 563 | { |
|---|
| 564 | int catchint; |
|---|
| 565 | |
|---|
| 566 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 567 | if (catchint) { |
|---|
| 568 | if (setjmp(jmpbuf) != 0) |
|---|
| 569 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 570 | #ifdef UNIX |
|---|
| 571 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 572 | fprintf(stdout,"Error: signal\n"); |
|---|
| 573 | #else |
|---|
| 574 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 575 | fprintf(stdout,"Error: signal\n"); |
|---|
| 576 | #endif |
|---|
| 577 | } |
|---|
| 578 | |
|---|
| 579 | |
|---|
| 580 | while(TRUE) |
|---|
| 581 | { |
|---|
| 582 | fprintf(stdout,"\n\n\n"); |
|---|
| 583 | fprintf(stdout,"****** PHYLOGENETIC TREE MENU ******\n"); |
|---|
| 584 | fprintf(stdout,"\n\n"); |
|---|
| 585 | |
|---|
| 586 | fprintf(stdout," 1. Input an alignment\n"); |
|---|
| 587 | fprintf(stdout," 2. Exclude positions with gaps? "); |
|---|
| 588 | if(tossgaps) |
|---|
| 589 | fprintf(stdout,"= ON\n"); |
|---|
| 590 | else |
|---|
| 591 | fprintf(stdout,"= OFF\n"); |
|---|
| 592 | fprintf(stdout," 3. Correct for multiple substitutions? "); |
|---|
| 593 | if(kimura) |
|---|
| 594 | fprintf(stdout,"= ON\n"); |
|---|
| 595 | else |
|---|
| 596 | fprintf(stdout,"= OFF\n"); |
|---|
| 597 | fprintf(stdout," 4. Draw tree now\n"); |
|---|
| 598 | fprintf(stdout," 5. Bootstrap tree\n"); |
|---|
| 599 | fprintf(stdout," 6. Output format options\n"); |
|---|
| 600 | fprintf(stdout,"\n"); |
|---|
| 601 | fprintf(stdout," S. Execute a system command\n"); |
|---|
| 602 | fprintf(stdout," H. HELP\n"); |
|---|
| 603 | fprintf(stdout," or press [RETURN] to go back to main menu\n\n\n"); |
|---|
| 604 | |
|---|
| 605 | getstr("Your choice",lin1); |
|---|
| 606 | if(*lin1 == EOS) return; |
|---|
| 607 | |
|---|
| 608 | switch(toupper(*lin1)) |
|---|
| 609 | { |
|---|
| 610 | case '1': seq_input(FALSE); |
|---|
| 611 | phylip_name[0]=EOS; |
|---|
| 612 | clustal_name[0]=EOS; |
|---|
| 613 | dist_name[0]=EOS; |
|---|
| 614 | nexus_name[0]=EOS; |
|---|
| 615 | break; |
|---|
| 616 | case '2': tossgaps ^= TRUE; |
|---|
| 617 | break; |
|---|
| 618 | case '3': kimura ^= TRUE;; |
|---|
| 619 | break; |
|---|
| 620 | case '4': phylogenetic_tree(phylip_name,clustal_name,dist_name,nexus_name,"amenu.pim"); |
|---|
| 621 | break; |
|---|
| 622 | case '5': bootstrap_tree(phylip_name,clustal_name,nexus_name); |
|---|
| 623 | break; |
|---|
| 624 | case '6': tree_format_options_menu(); |
|---|
| 625 | break; |
|---|
| 626 | case 'S': do_system(); |
|---|
| 627 | break; |
|---|
| 628 | case '?': |
|---|
| 629 | case 'H': get_help('7'); |
|---|
| 630 | break; |
|---|
| 631 | case 'Q': |
|---|
| 632 | case 'X': return; |
|---|
| 633 | |
|---|
| 634 | default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 635 | break; |
|---|
| 636 | } |
|---|
| 637 | } |
|---|
| 638 | } |
|---|
| 639 | |
|---|
| 640 | |
|---|
| 641 | |
|---|
| 642 | |
|---|
| 643 | |
|---|
| 644 | |
|---|
| 645 | static void tree_format_options_menu(void) /* format of tree output */ |
|---|
| 646 | { |
|---|
| 647 | int catchint; |
|---|
| 648 | |
|---|
| 649 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 650 | if (catchint) { |
|---|
| 651 | if (setjmp(jmpbuf) != 0) |
|---|
| 652 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 653 | #ifdef UNIX |
|---|
| 654 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 655 | fprintf(stdout,"Error: signal\n"); |
|---|
| 656 | #else |
|---|
| 657 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 658 | fprintf(stdout,"Error: signal\n"); |
|---|
| 659 | #endif |
|---|
| 660 | } |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | while(TRUE) { |
|---|
| 664 | fprintf(stdout,"\n\n\n"); |
|---|
| 665 | fprintf(stdout," ****** Format of Phylogenetic Tree Output ******\n"); |
|---|
| 666 | fprintf(stdout,"\n\n"); |
|---|
| 667 | fprintf(stdout," 1. Toggle CLUSTAL format tree output = %s\n", |
|---|
| 668 | (!output_tree_clustal) ? "OFF" : "ON"); |
|---|
| 669 | fprintf(stdout," 2. Toggle Phylip format tree output = %s\n", |
|---|
| 670 | (!output_tree_phylip) ? "OFF" : "ON"); |
|---|
| 671 | fprintf(stdout," 3. Toggle Phylip distance matrix output = %s\n", |
|---|
| 672 | (!output_tree_distances)? "OFF" : "ON"); |
|---|
| 673 | fprintf(stdout," 4. Toggle Nexus format tree output = %s\n\n", |
|---|
| 674 | (!output_tree_nexus)? "OFF" : "ON"); |
|---|
| 675 | fprintf(stdout," 5. Toggle Phylip bootstrap positions = %s\n\n", |
|---|
| 676 | (bootstrap_format==BS_NODE_LABELS) ? "NODE LABELS" : "BRANCH LABELS"); |
|---|
| 677 | fprintf(stdout,"\n"); |
|---|
| 678 | fprintf(stdout," H. HELP\n\n\n"); |
|---|
| 679 | |
|---|
| 680 | getstr("Enter number (or [RETURN] to exit)",lin2); |
|---|
| 681 | if(*lin2 == EOS) return; |
|---|
| 682 | |
|---|
| 683 | switch(toupper(*lin2)) { |
|---|
| 684 | case '1': |
|---|
| 685 | output_tree_clustal ^= TRUE; |
|---|
| 686 | break; |
|---|
| 687 | case '2': |
|---|
| 688 | output_tree_phylip ^= TRUE; |
|---|
| 689 | break; |
|---|
| 690 | case '3': |
|---|
| 691 | output_tree_distances ^= TRUE; |
|---|
| 692 | break; |
|---|
| 693 | case '4': |
|---|
| 694 | output_tree_nexus ^= TRUE; |
|---|
| 695 | break; |
|---|
| 696 | case '5': |
|---|
| 697 | if (bootstrap_format == BS_NODE_LABELS) |
|---|
| 698 | bootstrap_format = BS_BRANCH_LABELS; |
|---|
| 699 | else |
|---|
| 700 | bootstrap_format = BS_NODE_LABELS; |
|---|
| 701 | break; |
|---|
| 702 | case '?': |
|---|
| 703 | case 'H': |
|---|
| 704 | get_help('0'); |
|---|
| 705 | break; |
|---|
| 706 | default: |
|---|
| 707 | fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 708 | break; |
|---|
| 709 | } |
|---|
| 710 | } |
|---|
| 711 | } |
|---|
| 712 | |
|---|
| 713 | |
|---|
| 714 | static void format_options_menu(void) /* format of alignment output */ |
|---|
| 715 | { |
|---|
| 716 | sint i; |
|---|
| 717 | sint length = 0; |
|---|
| 718 | char path[FILENAMELEN+1]; |
|---|
| 719 | int catchint; |
|---|
| 720 | |
|---|
| 721 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 722 | if (catchint) { |
|---|
| 723 | if (setjmp(jmpbuf) != 0) |
|---|
| 724 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 725 | #ifdef UNIX |
|---|
| 726 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 727 | fprintf(stdout,"Error: signal\n"); |
|---|
| 728 | #else |
|---|
| 729 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 730 | fprintf(stdout,"Error: signal\n"); |
|---|
| 731 | #endif |
|---|
| 732 | } |
|---|
| 733 | |
|---|
| 734 | |
|---|
| 735 | while(TRUE) { |
|---|
| 736 | fprintf(stdout,"\n\n\n"); |
|---|
| 737 | fprintf(stdout," ********* Format of Alignment Output *********\n"); |
|---|
| 738 | fprintf(stdout,"\n\n"); |
|---|
| 739 | fprintf(stdout," F. Toggle FASTA format output = %s\n\n", |
|---|
| 740 | (!output_fasta) ? "OFF" : "ON"); |
|---|
| 741 | fprintf(stdout," 1. Toggle CLUSTAL format output = %s\n", |
|---|
| 742 | (!output_clustal) ? "OFF" : "ON"); |
|---|
| 743 | fprintf(stdout," 2. Toggle NBRF/PIR format output = %s\n", |
|---|
| 744 | (!output_nbrf) ? "OFF" : "ON"); |
|---|
| 745 | fprintf(stdout," 3. Toggle GCG/MSF format output = %s\n", |
|---|
| 746 | (!output_gcg) ? "OFF" : "ON"); |
|---|
| 747 | fprintf(stdout," 4. Toggle PHYLIP format output = %s\n", |
|---|
| 748 | (!output_phylip) ? "OFF" : "ON"); |
|---|
| 749 | fprintf(stdout," 5. Toggle NEXUS format output = %s\n", |
|---|
| 750 | (!output_nexus) ? "OFF" : "ON"); |
|---|
| 751 | fprintf(stdout," 6. Toggle GDE format output = %s\n\n", |
|---|
| 752 | (!output_gde) ? "OFF" : "ON"); |
|---|
| 753 | fprintf(stdout," 7. Toggle GDE output case = %s\n", |
|---|
| 754 | (!lowercase) ? "UPPER" : "LOWER"); |
|---|
| 755 | |
|---|
| 756 | fprintf(stdout," 8. Toggle CLUSTALW sequence numbers = %s\n", |
|---|
| 757 | (!cl_seq_numbers) ? "OFF" : "ON"); |
|---|
| 758 | fprintf(stdout," 9. Toggle output order = %s\n\n", |
|---|
| 759 | (output_order==0) ? "INPUT FILE" : "ALIGNED"); |
|---|
| 760 | |
|---|
| 761 | fprintf(stdout," 0. Create alignment output file(s) now?\n\n"); |
|---|
| 762 | fprintf(stdout," T. Toggle parameter output = %s\n", |
|---|
| 763 | (!save_parameters) ? "OFF" : "ON"); |
|---|
| 764 | fprintf(stdout," R. Toggle sequence range numbers = %s\n", |
|---|
| 765 | (!seqRange) ? "OFF" : "ON"); |
|---|
| 766 | fprintf(stdout,"\n"); |
|---|
| 767 | fprintf(stdout," H. HELP\n\n\n"); |
|---|
| 768 | |
|---|
| 769 | getstr("Enter number (or [RETURN] to exit)",lin2); |
|---|
| 770 | if(*lin2 == EOS) return; |
|---|
| 771 | |
|---|
| 772 | switch(toupper(*lin2)) { |
|---|
| 773 | case '1': |
|---|
| 774 | output_clustal ^= TRUE; |
|---|
| 775 | break; |
|---|
| 776 | case '2': |
|---|
| 777 | output_nbrf ^= TRUE; |
|---|
| 778 | break; |
|---|
| 779 | case '3': |
|---|
| 780 | output_gcg ^= TRUE; |
|---|
| 781 | break; |
|---|
| 782 | case '4': |
|---|
| 783 | output_phylip ^= TRUE; |
|---|
| 784 | break; |
|---|
| 785 | case '5': |
|---|
| 786 | output_nexus ^= TRUE; |
|---|
| 787 | break; |
|---|
| 788 | case '6': |
|---|
| 789 | output_gde ^= TRUE; |
|---|
| 790 | break; |
|---|
| 791 | case '7': |
|---|
| 792 | lowercase ^= TRUE; |
|---|
| 793 | break; |
|---|
| 794 | case '8': |
|---|
| 795 | cl_seq_numbers ^= TRUE; |
|---|
| 796 | break; |
|---|
| 797 | case '9': |
|---|
| 798 | if (output_order == INPUT) output_order = ALIGNED; |
|---|
| 799 | else output_order = INPUT; |
|---|
| 800 | break; |
|---|
| 801 | case 'F': |
|---|
| 802 | output_fasta ^= TRUE; |
|---|
| 803 | break; |
|---|
| 804 | case 'R': |
|---|
| 805 | seqRange ^= TRUE; |
|---|
| 806 | break; |
|---|
| 807 | |
|---|
| 808 | case '0': /* DES */ |
|---|
| 809 | if(empty) { |
|---|
| 810 | error("No sequences loaded"); |
|---|
| 811 | break; |
|---|
| 812 | } |
|---|
| 813 | get_path(seqname,path); |
|---|
| 814 | if(!open_alignment_output(path)) break; |
|---|
| 815 | create_alignment_output(1,nseqs); |
|---|
| 816 | break; |
|---|
| 817 | case 'T': save_parameters ^= TRUE; |
|---|
| 818 | break; |
|---|
| 819 | case '?': |
|---|
| 820 | case 'H': |
|---|
| 821 | get_help('5'); |
|---|
| 822 | break; |
|---|
| 823 | default: |
|---|
| 824 | fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 825 | break; |
|---|
| 826 | } |
|---|
| 827 | } |
|---|
| 828 | } |
|---|
| 829 | |
|---|
| 830 | |
|---|
| 831 | |
|---|
| 832 | |
|---|
| 833 | |
|---|
| 834 | |
|---|
| 835 | |
|---|
| 836 | |
|---|
| 837 | |
|---|
| 838 | |
|---|
| 839 | |
|---|
| 840 | |
|---|
| 841 | static void pair_menu(void) |
|---|
| 842 | { |
|---|
| 843 | int catchint; |
|---|
| 844 | |
|---|
| 845 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 846 | if (catchint) { |
|---|
| 847 | if (setjmp(jmpbuf) != 0) |
|---|
| 848 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 849 | #ifdef UNIX |
|---|
| 850 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 851 | fprintf(stdout,"Error: signal\n"); |
|---|
| 852 | #else |
|---|
| 853 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 854 | fprintf(stdout,"Error: signal\n"); |
|---|
| 855 | #endif |
|---|
| 856 | } |
|---|
| 857 | |
|---|
| 858 | |
|---|
| 859 | if(dnaflag) { |
|---|
| 860 | pw_go_penalty = dna_pw_go_penalty; |
|---|
| 861 | pw_ge_penalty = dna_pw_ge_penalty; |
|---|
| 862 | ktup = dna_ktup; |
|---|
| 863 | window = dna_window; |
|---|
| 864 | signif = dna_signif; |
|---|
| 865 | wind_gap = dna_wind_gap; |
|---|
| 866 | |
|---|
| 867 | } |
|---|
| 868 | else { |
|---|
| 869 | pw_go_penalty = prot_pw_go_penalty; |
|---|
| 870 | pw_ge_penalty = prot_pw_ge_penalty; |
|---|
| 871 | ktup = prot_ktup; |
|---|
| 872 | window = prot_window; |
|---|
| 873 | signif = prot_signif; |
|---|
| 874 | wind_gap = prot_wind_gap; |
|---|
| 875 | |
|---|
| 876 | } |
|---|
| 877 | |
|---|
| 878 | while(TRUE) { |
|---|
| 879 | |
|---|
| 880 | fprintf(stdout,"\n\n\n"); |
|---|
| 881 | fprintf(stdout," ********* PAIRWISE ALIGNMENT PARAMETERS *********\n"); |
|---|
| 882 | fprintf(stdout,"\n\n"); |
|---|
| 883 | |
|---|
| 884 | fprintf(stdout," Slow/Accurate alignments:\n\n"); |
|---|
| 885 | |
|---|
| 886 | fprintf(stdout," 1. Gap Open Penalty :%4.2f\n",pw_go_penalty); |
|---|
| 887 | fprintf(stdout," 2. Gap Extension Penalty :%4.2f\n",pw_ge_penalty); |
|---|
| 888 | fprintf(stdout," 3. Protein weight matrix :%s\n" , |
|---|
| 889 | matrix_menu.opt[pw_matnum-1].title); |
|---|
| 890 | fprintf(stdout," 4. DNA weight matrix :%s\n" , |
|---|
| 891 | dnamatrix_menu.opt[pw_dnamatnum-1].title); |
|---|
| 892 | fprintf(stdout,"\n"); |
|---|
| 893 | |
|---|
| 894 | fprintf(stdout," Fast/Approximate alignments:\n\n"); |
|---|
| 895 | |
|---|
| 896 | fprintf(stdout," 5. Gap penalty :%d\n",(pint)wind_gap); |
|---|
| 897 | fprintf(stdout," 6. K-tuple (word) size :%d\n",(pint)ktup); |
|---|
| 898 | fprintf(stdout," 7. No. of top diagonals :%d\n",(pint)signif); |
|---|
| 899 | fprintf(stdout," 8. Window size :%d\n\n",(pint)window); |
|---|
| 900 | |
|---|
| 901 | fprintf(stdout," 9. Toggle Slow/Fast pairwise alignments "); |
|---|
| 902 | if(quick_pairalign) |
|---|
| 903 | fprintf(stdout,"= FAST\n\n"); |
|---|
| 904 | else |
|---|
| 905 | fprintf(stdout,"= SLOW\n\n"); |
|---|
| 906 | |
|---|
| 907 | |
|---|
| 908 | fprintf(stdout," H. HELP\n\n\n"); |
|---|
| 909 | |
|---|
| 910 | getstr("Enter number (or [RETURN] to exit)",lin2); |
|---|
| 911 | if( *lin2 == EOS) { |
|---|
| 912 | if(dnaflag) { |
|---|
| 913 | dna_pw_go_penalty = pw_go_penalty; |
|---|
| 914 | dna_pw_ge_penalty = pw_ge_penalty; |
|---|
| 915 | dna_ktup = ktup; |
|---|
| 916 | dna_window = window; |
|---|
| 917 | dna_signif = signif; |
|---|
| 918 | dna_wind_gap = wind_gap; |
|---|
| 919 | |
|---|
| 920 | } |
|---|
| 921 | else { |
|---|
| 922 | prot_pw_go_penalty = pw_go_penalty; |
|---|
| 923 | prot_pw_ge_penalty = pw_ge_penalty; |
|---|
| 924 | prot_ktup = ktup; |
|---|
| 925 | prot_window = window; |
|---|
| 926 | prot_signif = signif; |
|---|
| 927 | prot_wind_gap = wind_gap; |
|---|
| 928 | |
|---|
| 929 | } |
|---|
| 930 | |
|---|
| 931 | return; |
|---|
| 932 | } |
|---|
| 933 | |
|---|
| 934 | switch(toupper(*lin2)) { |
|---|
| 935 | case '1': |
|---|
| 936 | fprintf(stdout,"Gap Open Penalty Currently: %4.2f\n",pw_go_penalty); |
|---|
| 937 | pw_go_penalty=(float)getreal("Enter number",(double)0.0,(double)100.0,(double)pw_go_penalty); |
|---|
| 938 | break; |
|---|
| 939 | case '2': |
|---|
| 940 | fprintf(stdout,"Gap Extension Penalty Currently: %4.2f\n",pw_ge_penalty); |
|---|
| 941 | pw_ge_penalty=(float)getreal("Enter number",(double)0.0,(double)10.0,(double)pw_ge_penalty); |
|---|
| 942 | break; |
|---|
| 943 | case '3': |
|---|
| 944 | pw_matnum = read_matrix("PROTEIN",pw_matrix_menu,pw_mtrxname,pw_matnum,pw_usermat,pw_aa_xref); |
|---|
| 945 | break; |
|---|
| 946 | case '4': |
|---|
| 947 | pw_dnamatnum = read_matrix("DNA",dnamatrix_menu,pw_dnamtrxname,pw_dnamatnum,pw_userdnamat,pw_dna_xref); |
|---|
| 948 | break; |
|---|
| 949 | case '5': |
|---|
| 950 | fprintf(stdout,"Gap Penalty Currently: %d\n",(pint)wind_gap); |
|---|
| 951 | wind_gap=getint("Enter number",1,500,wind_gap); |
|---|
| 952 | break; |
|---|
| 953 | case '6': |
|---|
| 954 | fprintf(stdout,"K-tuple Currently: %d\n",(pint)ktup); |
|---|
| 955 | if(dnaflag) |
|---|
| 956 | ktup=getint("Enter number",1,4,ktup); |
|---|
| 957 | else |
|---|
| 958 | ktup=getint("Enter number",1,2,ktup); |
|---|
| 959 | break; |
|---|
| 960 | case '7': |
|---|
| 961 | fprintf(stdout,"Top diagonals Currently: %d\n",(pint)signif); |
|---|
| 962 | signif=getint("Enter number",1,50,signif); |
|---|
| 963 | break; |
|---|
| 964 | case '8': |
|---|
| 965 | fprintf(stdout,"Window size Currently: %d\n",(pint)window); |
|---|
| 966 | window=getint("Enter number",1,50,window); |
|---|
| 967 | break; |
|---|
| 968 | case '9': quick_pairalign ^= TRUE; |
|---|
| 969 | break; |
|---|
| 970 | case '?': |
|---|
| 971 | case 'H': |
|---|
| 972 | get_help('3'); |
|---|
| 973 | break; |
|---|
| 974 | default: |
|---|
| 975 | fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 976 | break; |
|---|
| 977 | } |
|---|
| 978 | } |
|---|
| 979 | } |
|---|
| 980 | |
|---|
| 981 | |
|---|
| 982 | |
|---|
| 983 | |
|---|
| 984 | |
|---|
| 985 | static void multi_menu(void) |
|---|
| 986 | { |
|---|
| 987 | int catchint; |
|---|
| 988 | |
|---|
| 989 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 990 | if (catchint) { |
|---|
| 991 | if (setjmp(jmpbuf) != 0) |
|---|
| 992 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 993 | #ifdef UNIX |
|---|
| 994 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 995 | fprintf(stdout,"Error: signal\n"); |
|---|
| 996 | #else |
|---|
| 997 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 998 | fprintf(stdout,"Error: signal\n"); |
|---|
| 999 | #endif |
|---|
| 1000 | } |
|---|
| 1001 | |
|---|
| 1002 | |
|---|
| 1003 | if(dnaflag) { |
|---|
| 1004 | gap_open = dna_gap_open; |
|---|
| 1005 | gap_extend = dna_gap_extend; |
|---|
| 1006 | } |
|---|
| 1007 | else { |
|---|
| 1008 | gap_open = prot_gap_open; |
|---|
| 1009 | gap_extend = prot_gap_extend; |
|---|
| 1010 | } |
|---|
| 1011 | |
|---|
| 1012 | while(TRUE) { |
|---|
| 1013 | |
|---|
| 1014 | fprintf(stdout,"\n\n\n"); |
|---|
| 1015 | fprintf(stdout," ********* MULTIPLE ALIGNMENT PARAMETERS *********\n"); |
|---|
| 1016 | fprintf(stdout,"\n\n"); |
|---|
| 1017 | |
|---|
| 1018 | fprintf(stdout," 1. Gap Opening Penalty :%4.2f\n",gap_open); |
|---|
| 1019 | fprintf(stdout," 2. Gap Extension Penalty :%4.2f\n",gap_extend); |
|---|
| 1020 | |
|---|
| 1021 | fprintf(stdout," 3. Delay divergent sequences :%d %%\n\n",(pint)divergence_cutoff); |
|---|
| 1022 | |
|---|
| 1023 | fprintf(stdout," 4. DNA Transitions Weight :%1.2f\n\n",transition_weight); |
|---|
| 1024 | fprintf(stdout," 5. Protein weight matrix :%s\n" |
|---|
| 1025 | ,matrix_menu.opt[matnum-1].title); |
|---|
| 1026 | fprintf(stdout," 6. DNA weight matrix :%s\n" |
|---|
| 1027 | ,dnamatrix_menu.opt[dnamatnum-1].title); |
|---|
| 1028 | fprintf(stdout," 7. Use negative matrix :%s\n\n",(!neg_matrix) ? "OFF" : "ON"); |
|---|
| 1029 | fprintf(stdout," 8. Protein Gap Parameters\n\n"); |
|---|
| 1030 | fprintf(stdout," H. HELP\n\n\n"); |
|---|
| 1031 | |
|---|
| 1032 | getstr("Enter number (or [RETURN] to exit)",lin2); |
|---|
| 1033 | |
|---|
| 1034 | if(*lin2 == EOS) { |
|---|
| 1035 | if(dnaflag) { |
|---|
| 1036 | dna_gap_open = gap_open; |
|---|
| 1037 | dna_gap_extend = gap_extend; |
|---|
| 1038 | } |
|---|
| 1039 | else { |
|---|
| 1040 | prot_gap_open = gap_open; |
|---|
| 1041 | prot_gap_extend = gap_extend; |
|---|
| 1042 | } |
|---|
| 1043 | return; |
|---|
| 1044 | } |
|---|
| 1045 | |
|---|
| 1046 | switch(toupper(*lin2)) { |
|---|
| 1047 | case '1': |
|---|
| 1048 | fprintf(stdout,"Gap Opening Penalty Currently: %4.2f\n",gap_open); |
|---|
| 1049 | gap_open=(float)getreal("Enter number",(double)0.0,(double)100.0,(double)gap_open); |
|---|
| 1050 | break; |
|---|
| 1051 | case '2': |
|---|
| 1052 | fprintf(stdout,"Gap Extension Penalty Currently: %4.2f\n",gap_extend); |
|---|
| 1053 | gap_extend=(float)getreal("Enter number",(double)0.0,(double)10.0,(double)gap_extend); |
|---|
| 1054 | break; |
|---|
| 1055 | case '3': |
|---|
| 1056 | fprintf(stdout,"Min Identity Currently: %d\n",(pint)divergence_cutoff); |
|---|
| 1057 | divergence_cutoff=getint("Enter number",0,100,divergence_cutoff); |
|---|
| 1058 | break; |
|---|
| 1059 | case '4': |
|---|
| 1060 | fprintf(stdout,"Transition Weight Currently: %1.2f\n",(pint)transition_weight); |
|---|
| 1061 | transition_weight=(float)getreal("Enter number",(double)0.0,(double)1.0,(double)transition_weight); |
|---|
| 1062 | break; |
|---|
| 1063 | case '5': |
|---|
| 1064 | matnum = read_matrix("PROTEIN",matrix_menu,mtrxname,matnum,usermat,aa_xref); |
|---|
| 1065 | break; |
|---|
| 1066 | case '6': |
|---|
| 1067 | dnamatnum = read_matrix("DNA",dnamatrix_menu,dnamtrxname,dnamatnum,userdnamat,dna_xref); |
|---|
| 1068 | break; |
|---|
| 1069 | case '7': |
|---|
| 1070 | neg_matrix ^= TRUE; |
|---|
| 1071 | break; |
|---|
| 1072 | case '8': |
|---|
| 1073 | gap_penalties_menu(); |
|---|
| 1074 | break; |
|---|
| 1075 | case '?': |
|---|
| 1076 | case 'H': |
|---|
| 1077 | get_help('4'); |
|---|
| 1078 | break; |
|---|
| 1079 | default: |
|---|
| 1080 | fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 1081 | break; |
|---|
| 1082 | } |
|---|
| 1083 | } |
|---|
| 1084 | } |
|---|
| 1085 | |
|---|
| 1086 | |
|---|
| 1087 | |
|---|
| 1088 | |
|---|
| 1089 | |
|---|
| 1090 | |
|---|
| 1091 | static void gap_penalties_menu(void) |
|---|
| 1092 | { |
|---|
| 1093 | char c; |
|---|
| 1094 | sint i; |
|---|
| 1095 | int catchint; |
|---|
| 1096 | |
|---|
| 1097 | catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; |
|---|
| 1098 | if (catchint) { |
|---|
| 1099 | if (setjmp(jmpbuf) != 0) |
|---|
| 1100 | fprintf(stdout,"\n.. Interrupt\n"); |
|---|
| 1101 | #ifdef UNIX |
|---|
| 1102 | if (signal(SIGINT,jumper) == BADSIG) |
|---|
| 1103 | fprintf(stdout,"Error: signal\n"); |
|---|
| 1104 | #else |
|---|
| 1105 | if (signal(SIGINT,SIG_DFL) == BADSIG) |
|---|
| 1106 | fprintf(stdout,"Error: signal\n"); |
|---|
| 1107 | #endif |
|---|
| 1108 | } |
|---|
| 1109 | |
|---|
| 1110 | |
|---|
| 1111 | while(TRUE) { |
|---|
| 1112 | |
|---|
| 1113 | fprintf(stdout,"\n\n\n"); |
|---|
| 1114 | fprintf(stdout," ********* PROTEIN GAP PARAMETERS *********\n"); |
|---|
| 1115 | fprintf(stdout,"\n\n\n"); |
|---|
| 1116 | |
|---|
| 1117 | fprintf(stdout," 1. Toggle Residue-Specific Penalties :%s\n\n",(no_pref_penalties) ? "OFF" : "ON"); |
|---|
| 1118 | fprintf(stdout," 2. Toggle Hydrophilic Penalties :%s\n",(no_hyd_penalties) ? "OFF" : "ON"); |
|---|
| 1119 | fprintf(stdout," 3. Hydrophilic Residues :%s\n\n" |
|---|
| 1120 | ,hyd_residues); |
|---|
| 1121 | fprintf(stdout," 4. Gap Separation Distance :%d\n",(pint)gap_dist); |
|---|
| 1122 | fprintf(stdout," 5. Toggle End Gap Separation :%s\n\n",(!use_endgaps) ? "OFF" : "ON"); |
|---|
| 1123 | fprintf(stdout," H. HELP\n\n\n"); |
|---|
| 1124 | |
|---|
| 1125 | getstr("Enter number (or [RETURN] to exit)",lin2); |
|---|
| 1126 | |
|---|
| 1127 | if(*lin2 == EOS) return; |
|---|
| 1128 | |
|---|
| 1129 | switch(toupper(*lin2)) { |
|---|
| 1130 | case '1': |
|---|
| 1131 | no_pref_penalties ^= TRUE; |
|---|
| 1132 | break; |
|---|
| 1133 | case '2': |
|---|
| 1134 | no_hyd_penalties ^= TRUE; |
|---|
| 1135 | break; |
|---|
| 1136 | case '3': |
|---|
| 1137 | fprintf(stdout,"Hydrophilic Residues Currently: %s\n",hyd_residues); |
|---|
| 1138 | |
|---|
| 1139 | getstr("Enter residues (or [RETURN] to quit)",lin1); |
|---|
| 1140 | if (*lin1 != EOS) { |
|---|
| 1141 | for (i=0;i<strlen(hyd_residues) && i<26;i++) { |
|---|
| 1142 | c = lin1[i]; |
|---|
| 1143 | if (isalpha(c)) |
|---|
| 1144 | hyd_residues[i] = (char)toupper(c); |
|---|
| 1145 | else |
|---|
| 1146 | break; |
|---|
| 1147 | } |
|---|
| 1148 | hyd_residues[i] = EOS; |
|---|
| 1149 | } |
|---|
| 1150 | break; |
|---|
| 1151 | case '4': |
|---|
| 1152 | fprintf(stdout,"Gap Separation Distance Currently: %d\n",(pint)gap_dist); |
|---|
| 1153 | gap_dist=getint("Enter number",0,100,gap_dist); |
|---|
| 1154 | break; |
|---|
| 1155 | case '5': |
|---|
| 1156 | use_endgaps ^= TRUE; |
|---|
| 1157 | break; |
|---|
| 1158 | case '?': |
|---|
| 1159 | case 'H': |
|---|
| 1160 | get_help('A'); |
|---|
| 1161 | break; |
|---|
| 1162 | default: |
|---|
| 1163 | fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 1164 | break; |
|---|
| 1165 | } |
|---|
| 1166 | } |
|---|
| 1167 | } |
|---|
| 1168 | |
|---|
| 1169 | |
|---|
| 1170 | |
|---|
| 1171 | |
|---|
| 1172 | static sint read_matrix(char *title,MatMenu menu, char *matnam, sint matn, short *mat, short *xref) |
|---|
| 1173 | { static char userfile[FILENAMELEN+1]; |
|---|
| 1174 | int i; |
|---|
| 1175 | |
|---|
| 1176 | while(TRUE) |
|---|
| 1177 | { |
|---|
| 1178 | fprintf(stdout,"\n\n\n"); |
|---|
| 1179 | fprintf(stdout," ********* %s WEIGHT MATRIX MENU *********\n",title); |
|---|
| 1180 | fprintf(stdout,"\n\n"); |
|---|
| 1181 | |
|---|
| 1182 | for(i=0;i<menu.noptions;i++) |
|---|
| 1183 | fprintf(stdout," %d. %s\n",i+1,menu.opt[i].title); |
|---|
| 1184 | fprintf(stdout," H. HELP\n\n"); |
|---|
| 1185 | fprintf(stdout, |
|---|
| 1186 | " -- Current matrix is the %s ",menu.opt[matn-1].title); |
|---|
| 1187 | if(matn == menu.noptions) fprintf(stdout,"(file = %s)",userfile); |
|---|
| 1188 | fprintf(stdout,"--\n"); |
|---|
| 1189 | |
|---|
| 1190 | |
|---|
| 1191 | getstr("\n\nEnter number (or [RETURN] to exit)",lin2); |
|---|
| 1192 | if(*lin2 == EOS) return(matn); |
|---|
| 1193 | |
|---|
| 1194 | i=toupper(*lin2)-'0'; |
|---|
| 1195 | if(i>0 && i<menu.noptions) { |
|---|
| 1196 | strcpy(matnam,menu.opt[i-1].string); |
|---|
| 1197 | matn=i; |
|---|
| 1198 | } else if (i==menu.noptions) { |
|---|
| 1199 | if(user_mat(userfile, mat, xref)) { |
|---|
| 1200 | strcpy(matnam,userfile); |
|---|
| 1201 | matn=i; |
|---|
| 1202 | } |
|---|
| 1203 | } |
|---|
| 1204 | else |
|---|
| 1205 | switch(toupper(*lin2)) { |
|---|
| 1206 | case '?': |
|---|
| 1207 | case 'H': |
|---|
| 1208 | get_help('8'); |
|---|
| 1209 | break; |
|---|
| 1210 | default: |
|---|
| 1211 | fprintf(stdout,"\n\nUnrecognised Command\n\n"); |
|---|
| 1212 | break; |
|---|
| 1213 | } |
|---|
| 1214 | } |
|---|
| 1215 | } |
|---|
| 1216 | |
|---|
| 1217 | |
|---|
| 1218 | char prompt_for_yes_no(char *title,char *prompt) |
|---|
| 1219 | { |
|---|
| 1220 | char line[80]; |
|---|
| 1221 | char lin2[80]; |
|---|
| 1222 | |
|---|
| 1223 | fprintf(stdout,"\n%s\n",title); |
|---|
| 1224 | strcpy(line,prompt); |
|---|
| 1225 | strcat(line, "(y/n) ? [y]"); |
|---|
| 1226 | getstr(line,lin2); |
|---|
| 1227 | if ((*lin2 != 'n') && (*lin2 != 'N')) |
|---|
| 1228 | return('y'); |
|---|
| 1229 | else |
|---|
| 1230 | return('n'); |
|---|
| 1231 | |
|---|
| 1232 | } |
|---|
| 1233 | |
|---|
| 1234 | |
|---|
| 1235 | /* |
|---|
| 1236 | * fatal() |
|---|
| 1237 | * |
|---|
| 1238 | * Prints error msg to stdout and exits. |
|---|
| 1239 | * Variadic parameter list can be passed. |
|---|
| 1240 | * |
|---|
| 1241 | * Return values: |
|---|
| 1242 | * none |
|---|
| 1243 | */ |
|---|
| 1244 | |
|---|
| 1245 | void fatal( char *msg,...) |
|---|
| 1246 | { |
|---|
| 1247 | va_list ap; |
|---|
| 1248 | |
|---|
| 1249 | va_start(ap,msg); |
|---|
| 1250 | fprintf(stdout,"\n\nFATAL ERROR: "); |
|---|
| 1251 | vfprintf(stdout,msg,ap); |
|---|
| 1252 | fprintf(stdout,"\n\n"); |
|---|
| 1253 | va_end(ap); |
|---|
| 1254 | exit(1); |
|---|
| 1255 | } |
|---|
| 1256 | |
|---|
| 1257 | /* |
|---|
| 1258 | * error() |
|---|
| 1259 | * |
|---|
| 1260 | * Prints error msg to stdout. |
|---|
| 1261 | * Variadic parameter list can be passed. |
|---|
| 1262 | * |
|---|
| 1263 | * Return values: |
|---|
| 1264 | * none |
|---|
| 1265 | */ |
|---|
| 1266 | |
|---|
| 1267 | void error( char *msg,...) |
|---|
| 1268 | { |
|---|
| 1269 | va_list ap; |
|---|
| 1270 | |
|---|
| 1271 | va_start(ap,msg); |
|---|
| 1272 | fprintf(stdout,"\n\nERROR: "); |
|---|
| 1273 | vfprintf(stdout,msg,ap); |
|---|
| 1274 | fprintf(stdout,"\n\n"); |
|---|
| 1275 | va_end(ap); |
|---|
| 1276 | } |
|---|
| 1277 | |
|---|
| 1278 | /* |
|---|
| 1279 | * warning() |
|---|
| 1280 | * |
|---|
| 1281 | * Prints warning msg to stdout. |
|---|
| 1282 | * Variadic parameter list can be passed. |
|---|
| 1283 | * |
|---|
| 1284 | * Return values: |
|---|
| 1285 | * none |
|---|
| 1286 | */ |
|---|
| 1287 | |
|---|
| 1288 | void warning( char *msg,...) |
|---|
| 1289 | { |
|---|
| 1290 | va_list ap; |
|---|
| 1291 | |
|---|
| 1292 | va_start(ap,msg); |
|---|
| 1293 | fprintf(stdout,"\n\nWARNING: "); |
|---|
| 1294 | vfprintf(stdout,msg,ap); |
|---|
| 1295 | fprintf(stdout,"\n\n"); |
|---|
| 1296 | va_end(ap); |
|---|
| 1297 | } |
|---|
| 1298 | |
|---|
| 1299 | /* |
|---|
| 1300 | * info() |
|---|
| 1301 | * |
|---|
| 1302 | * Prints info msg to stdout. |
|---|
| 1303 | * Variadic parameter list can be passed. |
|---|
| 1304 | * |
|---|
| 1305 | * Return values: |
|---|
| 1306 | * none |
|---|
| 1307 | */ |
|---|
| 1308 | |
|---|
| 1309 | void info( char *msg,...) |
|---|
| 1310 | { |
|---|
| 1311 | va_list ap; |
|---|
| 1312 | |
|---|
| 1313 | va_start(ap,msg); |
|---|
| 1314 | fprintf(stdout,"\n"); |
|---|
| 1315 | vfprintf(stdout,msg,ap); |
|---|
| 1316 | va_end(ap); |
|---|
| 1317 | } |
|---|