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