📄 amenu.c
字号:
/* Menus and command line interface for Clustal W *//* DES was here MARCH. 1994 *//* DES was here SEPT. 1994 */#include <stdio.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <stdarg.h>#include <signal.h>#include <setjmp.h>#include "clustalw.h"static jmp_buf jmpbuf;#ifndef VMS#ifndef AIX#define BADSIG (void (*)())-1#endif#endifstatic void jumper(int);static void jumper(int i){ longjmp(jmpbuf,1);}/** Prototypes*/static void pair_menu(void);static void multi_menu(void);static void gap_penalties_menu(void);static void multiple_align_menu(void); /* multiple alignments menu */static void profile_align_menu(void); /* profile " " */static void phylogenetic_tree_menu(void); /* NJ trees/distances menu */static void format_options_menu(void); /* format of alignment output */static void tree_format_options_menu(void); /* format of tree output */static void ss_options_menu(void);static sint secstroutput_options(void);static sint read_matrix(char *title,MatMenu menu, char *matnam, sint matn, short *mat, short *xref);/** Global variables*/extern float gap_open, gap_extend;extern float dna_gap_open, dna_gap_extend;extern float prot_gap_open, prot_gap_extend;extern float pw_go_penalty, pw_ge_penalty;extern float dna_pw_go_penalty, dna_pw_ge_penalty;extern float prot_pw_go_penalty, prot_pw_ge_penalty;extern float transition_weight;extern char revision_level[];extern sint wind_gap,ktup,window,signif;extern sint dna_wind_gap, dna_ktup, dna_window, dna_signif;extern sint prot_wind_gap,prot_ktup,prot_window,prot_signif;extern sint nseqs;extern sint divergence_cutoff;extern sint debug;extern Boolean neg_matrix;extern Boolean quick_pairalign;extern Boolean reset_alignments_new; /* DES */extern Boolean reset_alignments_all; /* DES */extern sint gap_dist;extern Boolean no_var_penalties, no_hyd_penalties, no_pref_penalties;extern sint output_order;extern sint profile_no;extern short usermat[], pw_usermat[];extern short aa_xref[], pw_aa_xref[];extern short userdnamat[], pw_userdnamat[];extern short dna_xref[], pw_dna_xref[];extern Boolean lowercase; /* Flag for GDE output - set on comm. line*/extern Boolean cl_seq_numbers;extern Boolean seqRange; /* to append sequence range with seq names, Ranu */extern Boolean output_clustal, output_nbrf, output_phylip, output_gcg, output_gde, output_nexus;extern Boolean output_fasta; /* Ramu */extern Boolean output_tree_clustal, output_tree_phylip, output_tree_distances,output_tree_nexus;extern sint bootstrap_format;extern Boolean tossgaps, kimura;extern Boolean percent;extern Boolean usemenu;extern Boolean showaln, save_parameters;extern Boolean dnaflag;extern Boolean use_ambiguities;extern char hyd_residues[];extern char mtrxname[], pw_mtrxname[];extern char dnamtrxname[], pw_dnamtrxname[];extern char seqname[];extern sint output_struct_penalties;extern Boolean use_ss1, use_ss2;extern Boolean empty;extern Boolean profile1_empty, profile2_empty; /* whether or not profiles */extern char profile1_name[FILENAMELEN+1];extern char profile2_name[FILENAMELEN+1];extern Boolean use_endgaps;extern sint matnum,pw_matnum;extern sint dnamatnum,pw_dnamatnum;extern sint helix_penalty;extern sint strand_penalty;extern sint loop_penalty;extern sint helix_end_minus;extern sint helix_end_plus;extern sint strand_end_minus;extern sint strand_end_plus;extern sint helix_end_penalty;extern sint strand_end_penalty;extern MatMenu matrix_menu;extern MatMenu pw_matrix_menu;extern MatMenu dnamatrix_menu;static char phylip_name[FILENAMELEN]="";static char clustal_name[FILENAMELEN]="";static char dist_name[FILENAMELEN]="";static char nexus_name[FILENAMELEN]="";static char fasta_name[FILENAMELEN]="";static char p1_tree_name[FILENAMELEN]="";static char p2_tree_name[FILENAMELEN]="";static char *secstroutput_txt[] = { "Secondary Structure", "Gap Penalty Mask", "Structure and Penalty Mask", "None" }; static char *lin1, *lin2, *lin3;static int firstres =0; /* range of alignment for saving as ... */static int lastres = 0;void init_amenu(void){ lin1 = (char *)ckalloc( (MAXLINE+1) * sizeof (char) ); lin2 = (char *)ckalloc( (MAXLINE+1) * sizeof (char) ); lin3 = (char *)ckalloc( (MAXLINE+1) * sizeof (char) );}void main_menu(void){ int catchint; catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; if (catchint) { if (setjmp(jmpbuf) != 0) fprintf(stdout,"\n.. Interrupt\n");#ifdef UNIX if (signal(SIGINT,jumper) == BADSIG) fprintf(stdout,"Error: signal\n");#else if (signal(SIGINT,SIG_DFL) == BADSIG) fprintf(stdout,"Error: signal\n");#endif } while(TRUE) { fprintf(stdout,"\n\n\n"); fprintf(stdout," **************************************************************\n"); fprintf(stdout," ******** CLUSTAL %s Multiple Sequence Alignments ********\n",revision_level); fprintf(stdout," **************************************************************\n"); fprintf(stdout,"\n\n"); fprintf(stdout," 1. Sequence Input From Disc\n"); fprintf(stdout," 2. Multiple Alignments\n"); fprintf(stdout," 3. Profile / Structure Alignments\n"); fprintf(stdout," 4. Phylogenetic trees\n"); fprintf(stdout,"\n"); fprintf(stdout," S. Execute a system command\n"); fprintf(stdout," H. HELP\n"); fprintf(stdout," X. EXIT (leave program)\n\n\n"); getstr("Your choice",lin1); switch(toupper(*lin1)) { case '1': seq_input(FALSE); phylip_name[0]=EOS; clustal_name[0]=EOS; dist_name[0]=EOS; nexus_name[0]=EOS; break; case '2': multiple_align_menu(); break; case '3': profile_align_menu(); break; case '4': phylogenetic_tree_menu(); break; case 'S': do_system(); break; case '?': case 'H': get_help('1'); break; case 'Q': case 'X': exit(0); break; default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); break; } }}static void multiple_align_menu(void){ int catchint; catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; if (catchint) { if (setjmp(jmpbuf) != 0) fprintf(stdout,"\n.. Interrupt\n");#ifdef UNIX if (signal(SIGINT,jumper) == BADSIG) fprintf(stdout,"Error: signal\n");#else if (signal(SIGINT,SIG_DFL) == BADSIG) fprintf(stdout,"Error: signal\n");#endif } while(TRUE) { fprintf(stdout,"\n\n\n"); fprintf(stdout,"****** MULTIPLE ALIGNMENT MENU ******\n"); fprintf(stdout,"\n\n"); fprintf(stdout," 1. Do complete multiple alignment now (%s)\n", (!quick_pairalign) ? "Slow/Accurate" : "Fast/Approximate"); fprintf(stdout," 2. Produce guide tree file only\n"); fprintf(stdout," 3. Do alignment using old guide tree file\n\n"); fprintf(stdout," 4. Toggle Slow/Fast pairwise alignments = %s\n\n", (!quick_pairalign) ? "SLOW" : "FAST"); fprintf(stdout," 5. Pairwise alignment parameters\n"); fprintf(stdout," 6. Multiple alignment parameters\n\n"); fprintf(stdout," 7. Reset gaps before alignment?"); if(reset_alignments_new) fprintf(stdout," = ON\n"); else fprintf(stdout," = OFF\n"); fprintf(stdout," 8. Toggle screen display = %s\n", (!showaln) ? "OFF" : "ON"); fprintf(stdout," 9. Output format options\n"); fprintf(stdout,"\n"); fprintf(stdout," S. Execute a system command\n"); fprintf(stdout," H. HELP\n"); fprintf(stdout," or press [RETURN] to go back to main menu\n\n\n"); getstr("Your choice",lin1); if(*lin1 == EOS) return; switch(toupper(*lin1)) { case '1': align(phylip_name); break; case '2': make_tree(phylip_name); break; case '3': get_tree(phylip_name); break; case '4': quick_pairalign ^= TRUE; break; case '5': pair_menu(); break; case '6': multi_menu(); break; case '7': reset_alignments_new ^= TRUE; if(reset_alignments_new==TRUE) reset_alignments_all=FALSE; break; case '8': showaln ^= TRUE; break; case '9': format_options_menu(); break; case 'S': do_system(); break; case '?': case 'H': get_help('2'); break; case 'Q': case 'X': return; default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); break; } }}static void profile_align_menu(void){ int catchint; catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; if (catchint) { if (setjmp(jmpbuf) != 0) fprintf(stdout,"\n.. Interrupt\n");#ifdef UNIX if (signal(SIGINT,jumper) == BADSIG) fprintf(stdout,"Error: signal\n");#else if (signal(SIGINT,SIG_DFL) == BADSIG) fprintf(stdout,"Error: signal\n");#endif } while(TRUE) { fprintf(stdout,"\n\n\n"); fprintf(stdout,"****** PROFILE AND STRUCTURE ALIGNMENT MENU ******\n"); fprintf(stdout,"\n\n"); fprintf(stdout," 1. Input 1st. profile "); if (!profile1_empty) fprintf(stdout,"(loaded)"); fprintf(stdout,"\n"); fprintf(stdout," 2. Input 2nd. profile/sequences "); if (!profile2_empty) fprintf(stdout,"(loaded)"); fprintf(stdout,"\n\n"); fprintf(stdout," 3. Align 2nd. profile to 1st. profile\n"); fprintf(stdout," 4. Align sequences to 1st. profile (%s)\n\n", (!quick_pairalign) ? "Slow/Accurate" : "Fast/Approximate"); fprintf(stdout," 5. Toggle Slow/Fast pairwise alignments = %s\n\n", (!quick_pairalign) ? "SLOW" : "FAST"); fprintf(stdout," 6. Pairwise alignment parameters\n"); fprintf(stdout," 7. Multiple alignment parameters\n\n"); fprintf(stdout," 8. Toggle screen display = %s\n", (!showaln) ? "OFF" : "ON"); fprintf(stdout," 9. Output format options\n"); fprintf(stdout," 0. Secondary structure options\n"); fprintf(stdout,"\n"); fprintf(stdout," S. Execute a system command\n"); fprintf(stdout," H. HELP\n"); fprintf(stdout," or press [RETURN] to go back to main menu\n\n\n"); getstr("Your choice",lin1); if(*lin1 == EOS) return; switch(toupper(*lin1)) { case '1': profile_no = 1; /* 1 => 1st profile */ profile_input(); strcpy(profile1_name, seqname); break; case '2': profile_no = 2; /* 2 => 2nd profile */ profile_input(); strcpy(profile2_name, seqname); break; case '3': profile_align(p1_tree_name,p2_tree_name); /* align the 2 alignments now */ break; case '4': new_sequence_align(phylip_name); /* align new sequences to profile 1 */ break; case '5': quick_pairalign ^= TRUE; break; case '6': pair_menu(); break; case '7': multi_menu(); break; case '8': showaln ^= TRUE; break; case '9': format_options_menu(); break; case '0': ss_options_menu(); break; case 'S': do_system(); break; case '?': case 'H': get_help('6'); break; case 'Q': case 'X': return; default: fprintf(stdout,"\n\nUnrecognised Command\n\n"); break; } }}static void ss_options_menu(void){ int catchint; catchint = signal(SIGINT, SIG_IGN) != SIG_IGN; if (catchint) { if (setjmp(jmpbuf) != 0) fprintf(stdout,"\n.. Interrupt\n");#ifdef UNIX if (signal(SIGINT,jumper) == BADSIG) fprintf(stdout,"Error: signal\n");#else if (signal(SIGINT,SIG_DFL) == BADSIG) fprintf(stdout,"Error: signal\n");#endif } while(TRUE) { fprintf(stdout,"\n\n\n"); fprintf(stdout," ********* SECONDARY STRUCTURE OPTIONS *********\n"); fprintf(stdout,"\n\n"); fprintf(stdout," 1. Use profile 1 secondary structure / penalty mask "); if(use_ss1) fprintf(stdout,"= YES\n"); else fprintf(stdout,"= NO\n"); fprintf(stdout," 2. Use profile 2 secondary structure / penalty mask "); if(use_ss2) fprintf(stdout,"= YES\n"); else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -