📄 xmenu.c
字号:
/*********************************************************************************************** * * * * History * * 27.3.2002 - color parameter chooser can browse filenames like load sequences - Jose * 16.1.2002 - remove the 'cut sequences' dialog box, not needed - Jise * 17.1.2002 - 'Remove positions that contain gaps in all sequences ?' removed, no need for confirmation - Toby * * **/#include <stdarg.h>#include <string.h>#include <vibrant.h>#include <document.h>/* #include <ncbi.h> ramu for time funs */#include "clustalw.h"#include "xmenu.h"static void RemoveWin(WindoW w);static void QuitWinW(WindoW w);static void QuitWinI(IteM i);static void QuitHelpW(WindoW w);static void QuitHelpB(ButtoN b);static void SearchStrWin (IteM item);static void SavePSSeqWin (IteM item);static void SavePSPrf1Win (IteM item);static void SavePSPrf2Win (IteM item);static void SaveSeqFileWin (IteM item);static void SavePrf1FileWin (IteM item);static void SavePrf2FileWin (IteM item);static void OpenColorParWin (IteM item);static void SearchStr(ButtoN but);static void SavePSSeqFile(ButtoN but);static void SavePSPrf1File(ButtoN but);static void SavePSPrf2File(ButtoN but);static void SaveSeqFile(ButtoN but);static void SavePrf1File(ButtoN but);static void SavePrf2File(ButtoN but);static void SaveScoresWin (IteM item);static void SaveScores(ButtoN but);static void OpenColorPar(ButtoN but);static void CancelWin(ButtoN but);static void SaveTreeWin (IteM item);static void CAlignWin (IteM item);static void RealignSeqsWin (IteM item);static void RealignSeqRangeWin (IteM item);static void DrawTreeWin (IteM item);static void AlignFromTreeWin(IteM item);static void PrfPrfAlignWin(IteM item);static void PrfPrfTreeAlignWin(IteM item);static void SeqPrfAlignWin(IteM item);static void SeqPrfTreeAlignWin(IteM item);static void BootstrapTreeWin (IteM item);static void CreateAlignTree(ButtoN but);static void CompleteAlign(ButtoN but);static void RealignSeqs(ButtoN but);static void RealignSeqRange(ButtoN but);static void DrawTree(ButtoN but);static void AlignFromTree(ButtoN but);static void PrfPrfAlign(ButtoN but);static void PrfPrfTreeAlign(ButtoN but);static void SeqPrfAlign(ButtoN but);static void SeqPrfTreeAlign(ButtoN but);static void BootstrapTree(ButtoN but);static void OpenSeqFile (IteM item);static void AppendSeqFile (IteM item);static void OpenPrf1File (IteM item);static void OpenPrf2File (IteM item);static void ScoreWin(IteM item);static void SegmentWin(IteM item);static void ScoreSegments(ButtoN but);static void PWParameters(IteM item);static void MultiParameters(IteM item);static void GapParameters(IteM item);static void SSParameters(IteM item);static void OutputParameters(IteM item);static void OutputTreeParameters(IteM item);static void HelpProc(IteM item);static void DefColorPar(IteM item);static void BlackandWhite(IteM item);static void set_reset_new_gaps(IteM i);static void set_reset_all_gaps(IteM i);static void SearchStringAgain(ButtoN but);static PopuP make_toggle(GrouP g,CharPtr title,CharPtr true_text, CharPtr false_text, Boolean *value,PupActnProc SetProc);static PrompT make_scale(GrouP g,CharPtr title,int length,int value,int max,BarScrlProc SetProc);static PrompT make_prompt(GrouP g,CharPtr title);static void CutSequences(IteM item);static void PasteSequences(IteM item);static void RemoveGaps(IteM item);static void RemoveGapPos(IteM item);static void SelectSeqs(IteM item);static void SelectPrf1(IteM item);static void SelectPrf2(IteM item);static void MergeProfiles(IteM item);static void ClearSeqs(IteM item); static void cut_multiplem(void);static void cut_profile1(void);static void cut_profile2(void);static void ssave(int j);static void sscpy(int i,int j);static void sload(int i);static void clear_seqrange(spanel p);static void select_seqs(spanel p,Boolean flag);static void clear_seg_exceptions(spanel p);static void make_menu_headers(WindoW w);static void make_help_menu(void);static void make_score_menu(void);static void make_file_menu(void);static void make_edit_menu(void);static void make_align_menu(void);static void make_tree_menu(void);static void make_color_menu(void);static void save_aln_window(int prf_no,char *title,char *prompt,void save_proc(ButtoN but));static void save_ps_window(int prf_no,char *prompt,void save_proc(ButtoN but));static void read_file_window(char *title,char *prompt,char *filename,void read_proc(ButtoN but));static void do_align_window(WindoW *alignw,TexT *treetext,Boolean treestatus,char *title,void align_proc(ButtoN but));static void do_palign_window(WindoW *alignw,TexT *tree1text,TexT *tree2test,Boolean treestatus,char *title,void align_proc(ButtoN but));static Boolean open_aln_files(void);static void write_file(int fseq,int lseq,int fres,int lres);Boolean x_menus=FALSE;int mheader = 2; /* maximum header lines */int mfooter = 1; /* maximum footer lines */int max_mlines = 20; /* multiple align display length */int min_mlines = 10; /* multiple align display length */int max_plines = 8; /* profile align display length */int min_plines1 = 5; /* profile align display length */int min_plines2 = 3; /* profile align display length */Boolean aln_mode = MULTIPLEM;Boolean window_displayed = FALSE;int save_format = CLUSTAL;Boolean fixed_prf_scroll = FALSE;int loffset,boffset,toffset;int roffset;int poffset;int score_cutoff=5; /* cutoff for residue exceptions */int score_hwin=5; /* half window for summing alignment column scores */int score_scale=5;int segment_dnascale=5;int length_cutoff=1; /* length cutoff for segment exceptions */Boolean residue_exceptions=FALSE;Boolean segment_exceptions=FALSE;int score_matnum=4;char score_mtrxname[FILENAMELEN];int segment_matnum=3;char segment_mtrxname[FILENAMELEN];int score_dnamatnum=1;char score_dnamtrxname[FILENAMELEN];int segment_dnamatnum=1;char segment_dnamtrxname[FILENAMELEN];Boolean output_ss;Boolean output_gp;extern char revision_level[];extern Boolean interactive;extern char seqname[];extern char outfile_name[];extern char profile1_name[];extern char profile2_name[];extern char usermtrxname[], pw_usermtrxname[];extern char dnausermtrxname[], pw_dnausermtrxname[];extern Boolean usemenu;extern Boolean use_tree_file;extern Boolean use_tree1_file,use_tree2_file;extern Boolean dnaflag;extern sint nseqs;extern sint profile1_nseqs;extern sint profile_no;extern sint max_aa;extern sint *seqlen_array;extern char **seq_array;extern char **names, **titles;extern Boolean empty;extern Boolean profile1_empty, profile2_empty;extern sint gap_pos1, gap_pos2;extern Boolean use_ambiguities;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 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 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 sint divergence_cutoff;extern sint gap_dist;extern sint boot_ntrials; /* number of bootstrap trials */extern unsigned sint boot_ran_seed; /* random number generator seed */extern sint matnum,pw_matnum;extern char mtrxname[], pw_mtrxname[];extern sint dnamatnum,pw_dnamatnum;extern char dnamtrxname[], pw_dnamtrxname[];extern MatMenu matrix_menu;extern MatMenu pw_matrix_menu;extern MatMenu dnamatrix_menu;extern Boolean quick_pairalign;extern sint matnum,pw_matnum;extern Boolean neg_matrix;extern float transition_weight;extern char hyd_residues[];extern Boolean no_var_penalties, no_hyd_penalties, no_pref_penalties;extern Boolean use_endgaps;extern Boolean endgappenalties;extern Boolean output_clustal, output_nbrf, output_phylip, output_gcg, output_gde, output_nexus;extern Boolean output_fasta; /* Ramu */extern Boolean save_parameters;extern Boolean output_tree_clustal, output_tree_phylip, output_tree_distances, output_tree_nexus, output_pim;extern Boolean lowercase; /* Flag for GDE output - set on comm. line*/extern Boolean cl_seq_numbers;extern Boolean seqRange;extern sint output_order;extern sint *output_index;extern Boolean reset_alignments_new; /* DES */extern Boolean reset_alignments_all; /* DES */extern FILE *clustal_outfile, *gcg_outfile, *nbrf_outfile, *phylip_outfile;extern FILE *gde_outfile, *nexus_outfile;extern FILE *fasta_outfile;extern sint max_aln_length;extern Boolean tossgaps; /* Ignore places in align. where ANY seq. has a gap*/extern Boolean kimura; /* Use correction for multiple substitutions */extern sint bootstrap_format; /* bootstrap file format */extern sint output_struct_penalties;extern Boolean use_ss1, use_ss2;extern char *res_cat1[];extern char *res_cat2[];extern char *amino_acid_codes;PrompT message; /* used in temporary message window */static Char filename[FILENAMELEN]; /* used in temporary file selection window */Boolean mess_output=TRUE;Boolean save_log=FALSE;FILE *save_log_fd=NULL;static char save_log_filename[FILENAMELEN];static IteM save_item1,save_item2,exc_item;spanel seq_panel; /* data for multiple alignment area */spanel prf_panel[2]; /* data for profile alignment areas */spanel active_panel; /* 'in-use' panel -scrolling,clicking etc. */static range selected_seqs; /* sequences selected by clicking on names */static range selected_res; /* residues selected by clicking on seqs */int firstres, lastres; /* range of alignment for saving as ... */ /* data for Search function */char find_string[MAXFINDSTR]="";aln_pos find_pos;/* arrays for storing clustalw data for cut-and-paste sequences */static sint *saveseqlen_array=NULL;static char **saveseq_array=NULL;static char **savenames=NULL, **savetitles=NULL;sint ncutseqs=0;FonT datafont,helpfont;WindoW mainw=NULL;WindoW messagew=NULL;WindoW readfilew=NULL;WindoW savealnw=NULL;WindoW savescoresw=NULL;WindoW savepsw=NULL;WindoW findw=NULL;WindoW calignw=NULL;WindoW ralignw=NULL;WindoW rralignw=NULL;WindoW talignw=NULL;WindoW palignw=NULL;WindoW salignw=NULL;WindoW scorew=NULL;WindoW exceptionw=NULL;TexT savealntext;TexT savescorestext;TexT savepstext;TexT findtext;TexT pspartext;TexT ctreetext;TexT rtreetext;TexT rrtreetext;TexT ttreetext;TexT ptree1text,ptree2text;TexT streetext;TexT readfiletext;WindoW savetreew=NULL;TexT savetreetext;WindoW drawtreew=NULL;TexT drawnjtreetext;TexT drawphtreetext;TexT drawdsttreetext;TexT drawnxstreetext;TexT drawpimtext;WindoW boottreew=NULL;TexT bootnjtreetext;TexT bootphtreetext;TexT bootnxstreetext;TexT blocklentext;PrompT mattext,pwmattext,dnamattext,pwdnamattext,scoremattext,segmentmattext;PrompT scorednamattext,segmentdnamattext;GrouP seg_matrix_list,score_matrix_list;GrouP seg_dnamatrix_list,score_dnamatrix_list;GrouP matrix_list,pw_matrix_list,dnamatrix_list,pw_dnamatrix_list;TexT cl_outtext,pir_outtext,msf_outtext,phylip_outtext,gde_outtext,nexus_outtext;TexT fasta_outtext; /* Ramu */GrouP slow_para,fast_para;GrouP seq_display,prf1_display,prf2_display;MenU filem,alignm,editm,treem,colorm;menu_item file_item,align_item,edit_item,tree_item,color_item;MenU scorem,helpmenu;menu_item score_item,help_item;IteM segment_item;IteM bw_item,defcol_item,usercol_item;IteM new_gaps_item,all_gaps_item;WindoW helpw[MAXHELPW];int numhelp=0;PopuP modetext,flisttext;ButtoN pscrolltext;ButtoN selFonts;PopuP show_seg_toggle;PrompT residue_cutofftext;PrompT length_cutofftext;PrompT scorescaletext;PrompT segmentdnascaletext;#define MAXFONTS 6int nfonts=6; /*shoud be MAXFONTS ................ ramu */int av_font[MAXFONTS]={8,10,12,14,18,24};int font_size=1;int ncolors=0;int ncolor_pars=0;color color_lut[MAXCOLORS+1];char def_protpar_file[]="colprot.par";char def_dnapar_file[]="coldna.par";char *explicit_par_file = NULL;char *par_file = NULL;int inverted = TRUE;int usebw=FALSE,usedefcolors=TRUE,useusercolors=FALSE;char ps_par_file[FILENAMELEN]="colprint.par";int pagesize=A4;int orientation=LANDSCAPE;Boolean ps_header=TRUE;Boolean ps_ruler=TRUE;Boolean resize=TRUE;int first_printres=0,last_printres=0,blocklen;Boolean ps_curve=TRUE;Boolean ps_resno=TRUE;PoinT display_pos;int namewidth,seqwidth; /* fixed widths of sequence display areas */Boolean realign_endgappenalties=TRUE;Boolean align_endgappenalties=FALSE;char helptext[MAXHELPLENGTH];/* ramu */#include <time.h>#include <math.h>#include <unistd.h>#include <pwd.h>#include <sys/times.h>float cputime(float *seconds); /* Ramu , need's reset function */float cputime(float *seconds){ struct tms buf; static time_t last=0, first; static int calls=0; int hertz=sysconf(_SC_CLK_TCK); time_t this; /* get the current number of user and system cpu ticks */ times(&buf); this = buf.tms_utime + buf.tms_stime; /* if this is the first call then this is time zero */ if ( !calls ) { first = this; calls = -1; } else this = this - first; if(seconds) *seconds = ((float)(this - last))/(float)hertz; last = this; return ((float)this)/(float)hertz;}/* Ramu *//* main subroutine called from clustalx.c, initialises windows and enters a forever loop monitoring user input */void x_menu(void){ int i,n; char font[30]; char tstr[30]; int height; PrompT fsize; RecT wr,r,r1; /* make the pulldown menu bar */#ifdef WIN_MAC MenU m; m=AppleMenu (NULL); DeskAccGroup (m); make_menu_headers(NULL);#endif#ifndef UNIX ProcessUpdatesFirst(FALSE);#endif sprintf(tstr,"Clustal%s",revision_level);/*#ifdef WIN_MSWIN mainw = FixedWindow (-50,-33,-10,-10,tstr,QuitWinW);#else*/ mainw = DocumentWindow (-50,-33,-10,-10,tstr,QuitWinW,ResizeWindowProc);/*#endif*/ SetGroupSpacing(mainw,0,10); SetGroupSpacing(mainw,0,10); x_menus=TRUE;#ifndef WIN_MAC make_menu_headers(mainw);#endif/* decide if we're starting in profile or sequence mode */ if (!profile1_empty) aln_mode=PROFILEM; else aln_mode=MULTIPLEM; make_file_menu(); make_edit_menu(); make_align_menu(); make_tree_menu(); make_color_menu(); make_score_menu(); make_help_menu();/* add a button to switch between multiple and profile alignment modes */ modetext=PopupList(mainw,TRUE,set_aln_mode); PopupItem(modetext,"Multiple Alignment Mode"); PopupItem(modetext,"Profile Alignment Mode"); if(aln_mode==MULTIPLEM) SetValue(modetext,1); else SetValue(modetext,2); sprintf(font, "%s,%d,%c", "courier", av_font[font_size], 'm'); datafont=ParseFont(font); sprintf(font, "%s,%d,%c", "courier", 10, 'm'); helpfont=ParseFont(font); Advance(mainw); shift(mainw,20,0);/* add a button to select font size */ fsize=StaticPrompt(mainw,"Font Size:",0,dialogTextHeight,systemFont,'r'); Advance(mainw); flisttext=PopupList(mainw,TRUE,set_font_size); for(i=0;i<nfonts;i++) { sprintf(tstr,"%d",av_font[i]); PopupItem(flisttext,tstr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -