⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmenu.c

📁 经典生物信息学多序列比对工具clustalw
💻 C
📖 第 1 页 / 共 5 页
字号:
        	SetValue(format_list,3);		strcat(path,"msf");	}	else if (save_format==PHYLIP)	{        	SetValue(format_list,4);		strcat(path,"phy");	}	else if (save_format==GDE)	{        	SetValue(format_list,5);		strcat(path,"gde");	} 	else if (save_format==NEXUS)	{        	SetValue(format_list,6);		strcat(path,"nxs");	} 	else if (save_format==FASTA)	{        	SetValue(format_list,7);		strcat(path,"fasta");	}	maing=HiddenGroup(savealnw,0,0,NULL);	SetGroupSpacing(maing,0,10);	case_toggle=make_toggle(maing,"GDE output case :","Lower","Upper",&lowercase,set_case);	Break(maing);	snos_toggle=make_toggle(maing,"CLUSTALW sequence numbers :","ON","OFF",&cl_seq_numbers,set_snos);	Break(maing);        make_prompt(maing, "Save range from  :");	Advance(maing);	firstres = 0; /* init always ramu */	lastres = 0; /* init always ramu */	sprintf(str,"%5d",firstres);        DialogText(maing, str, 5,set_fres);	Advance(maing);        make_prompt(maing, "to :");	Advance(maing);	sprintf(str,"%5d",lastres);        DialogText(maing, str, 5,set_lres);	/* <Ramu> */	Advance(maing);	seqRange_toggle=make_toggle(maing,"  and include range numbers :","ON","OFF",&seqRange,setRange);	/*</Ramu>*/	Break(maing);	shift(savealnw, 0, 20);	make_prompt(savealnw, prompt);        stdLineHeight=18;        SelectFont(programFont);	Break(savealnw);	savealntext=DialogText(savealnw, "", 35, NULL);	Break(savealnw);	savegr=HiddenGroup(savealnw, 2, 0, NULL);	shift(savegr, 60, 20);	save_ok=PushButton(savegr, "  OK  ", save_proc);	shift(savegr, 20,0);	save_can=PushButton(savegr, "CANCEL", CancelWin);	SetTitle(savealntext, path);	Show(savealnw);}static void read_file_window(char *title,char *prompt,char *filename,void read_proc(ButtoN but)){	GrouP readgr;	ButtoN read_ok, read_can;	GrouP maing;	SelectFont(systemFont);	stdCharWidth=CharWidth('A');	stdLineHeight=LineHeight();	readfilew=FixedWindow(-50, -33, -10, -10, title,RemoveWin);	maing=HiddenGroup(readfilew,2,0,NULL);	SetGroupSpacing(maing,0,10);	shift(readfilew, 0, 20);	make_prompt(readfilew, prompt);        stdLineHeight=18;        SelectFont(programFont);	Break(readfilew);	readfiletext=DialogText(readfilew, "", 35, NULL);	if (filename != NULL) SetTitle(readfiletext, filename);	Break(readfilew);	readgr=HiddenGroup(readfilew, 2, 0, NULL);	shift(readgr, 60, 20);	read_ok=PushButton(readgr, "  OK  ", read_proc);	shift(readgr, 20,0);	read_can=PushButton(readgr, "CANCEL", CancelWin);	Show(readfilew);}static void CancelWin (ButtoN but){	Remove(ParentWindow(but));}static void SearchStr(ButtoN but){/* reset the current position */	find_pos.seq=0;	find_pos.res=-1;/* find the next occurrence of the string */	SearchStringAgain(but);}static void SearchStringAgain(ButtoN but){	int i,j,ix,length;	int seq,res,start_res;	Boolean in_string,found;	panel_data ndata,sdata;	GetTitle(findtext, filename, FILENAMELEN);	stripspace(filename);	strncpy(find_string,filename,MAXFINDSTR);	length=strlen(find_string);	if(length==0) return;	for(i=0;i<length;i++)		find_string[i]=toupper(find_string[i]);        GetPanelExtra(active_panel.names,&ndata);        GetPanelExtra(active_panel.seqs,&sdata);	in_string=FALSE;	found=FALSE;	start_res=0;	ix=0;	seq=find_pos.seq;	res=find_pos.res+1;        while (seq<ndata.nseqs)	{                if(ndata.selected[seq]==TRUE)                {        		while (res<sdata.ncols)			{				if(sdata.lines[seq][res]==find_string[ix])				{					if(in_string==FALSE) 						start_res=res;					ix++;					in_string=TRUE;				}				else if(in_string==TRUE)				{					res=start_res;					ix=0;					in_string=FALSE;				}				if(ix==length)				{					find_pos.seq=seq;					find_pos.res=start_res;					found=TRUE;					break;				}				res++;				while(res<sdata.ncols && sdata.lines[seq][res]=='-')					res++;			}                }		if(found) break;		seq++;		res=0;	}	if(found==FALSE)		info("String %s not found",find_string);	else	{		info("String %s in sequence %s, column %d",find_string,names[find_pos.seq+1],find_pos.res+1);	}}static void SavePSSeqFile(ButtoN but){	char *ps_file;	GetTitle(savepstext, filename, FILENAMELEN);	stripspace(filename);        ps_file=(char *)ckalloc(FILENAMELEN*sizeof(char));	strcpy(ps_file,filename); 	GetTitle(pspartext, filename, FILENAMELEN);	stripspace(filename);	strcpy(ps_par_file,filename); 	write_ps_file(seq_panel,ps_file,ps_par_file,pagesize,orientation,		ps_header,ps_ruler,ps_resno,		resize,first_printres,last_printres,blocklen,ps_curve);	info("Postscript file %s written",ps_file);	ckfree(ps_file);}static void SavePSPrf1File(ButtoN but){	char *ps_file;	char *ps_par_file;	GetTitle(savepstext, filename, FILENAMELEN);	stripspace(filename);        ps_file=(char *)ckalloc(FILENAMELEN*sizeof(char));	strcpy(ps_file,filename); 	GetTitle(pspartext, filename, FILENAMELEN);	stripspace(filename);        ps_par_file=(char *)ckalloc(FILENAMELEN*sizeof(char));	strcpy(ps_par_file,filename); 	write_ps_file(prf_panel[0],ps_file,ps_par_file,pagesize,orientation,		ps_header,ps_ruler,ps_resno,		resize,first_printres,last_printres,blocklen,ps_curve);	info("Postscript file %s written",ps_file);	ckfree(ps_file);}static void SavePSPrf2File(ButtoN but){	char *ps_file;	char *ps_par_file;	GetTitle(savepstext, filename, FILENAMELEN);	stripspace(filename);        ps_file=(char *)ckalloc(FILENAMELEN*sizeof(char));	strcpy(ps_file,filename); 	GetTitle(pspartext, filename, FILENAMELEN);	stripspace(filename);        ps_par_file=(char *)ckalloc(FILENAMELEN*sizeof(char));	strcpy(ps_par_file,filename); 	write_ps_file(prf_panel[1],ps_file,ps_par_file,pagesize,orientation,		ps_header,ps_ruler,ps_resno,		resize,first_printres,last_printres,blocklen,ps_curve);	info("Postscript file %s written",ps_file);	ckfree(ps_file);}static void SaveSeqFile(ButtoN but){	write_file(1,nseqs,firstres,lastres);	seq_panel.modified=FALSE;	info("File %s saved",filename);}static void SavePrf1File(ButtoN but){	write_file(1,profile1_nseqs,firstres,lastres);	prf_panel[0].modified=FALSE;	info("File %s saved",filename);}static void SavePrf2File(ButtoN but){	write_file(profile1_nseqs+1,nseqs,firstres,lastres);	prf_panel[1].modified=FALSE;	info("File %s saved",filename);}/* this is equivalent to open_alignment_output(), but uses the windowinterface to input file names */static Boolean open_aln_files(void){	char path[FILENAMELEN];	if(!output_clustal && !output_nbrf && !output_gcg &&		 !output_phylip && !output_gde && !output_nexus) {                error("You must select an alignment output format");                return FALSE;        }	if(output_clustal) {		GetTitle(cl_outtext,filename,FILENAMELEN);		stripspace(filename);		if((clustal_outfile = open_explicit_file(			filename))==NULL) return FALSE;	}	if(output_nbrf) {		GetTitle(pir_outtext,filename,FILENAMELEN);		stripspace(filename);		if((nbrf_outfile = open_explicit_file(			filename))==NULL) return FALSE;	}	if(output_gcg) {		GetTitle(msf_outtext,filename,FILENAMELEN);		stripspace(filename);		if((gcg_outfile = open_explicit_file(			filename))==NULL) return FALSE;	}	if(output_phylip) {		GetTitle(phylip_outtext,filename,FILENAMELEN);		stripspace(filename);		if((phylip_outfile = open_explicit_file(			filename))==NULL) return FALSE;	}	if(output_gde) {		GetTitle(gde_outtext,filename,FILENAMELEN);		stripspace(filename);		if((gde_outfile = open_explicit_file(			filename))==NULL) return FALSE;	}	if(output_nexus) {		GetTitle(nexus_outtext,filename,FILENAMELEN);		stripspace(filename);		if((nexus_outfile = open_explicit_file(			filename))==NULL) return FALSE;	}/* <Ramu> */	if(output_fasta) {		GetTitle(fasta_outtext,filename,FILENAMELEN);		stripspace(filename);		if((fasta_outfile = open_explicit_file(			filename))==NULL) return FALSE;	}/* </Ramu> */	if(save_log)	{        	get_path(seqname,path);        	strcpy(save_log_filename,path);        	strcat(save_log_filename,"log");		if ((save_log_fd=fopen(save_log_filename,"a"))==NULL)			error("Cannot open log file %s",save_log_filename);	}	return TRUE;}static void write_file(int fseq, int lseq, int fres, int lres){	int i,length=0;	FILE *outfile;	GetTitle(savealntext, filename, FILENAMELEN);	stripspace(filename);	outfile=open_explicit_file(filename);         for (i=fseq;i<=lseq;i++)           if (length < seqlen_array[i]) length = seqlen_array[i];	if(fres<1) fres=1;	if(lres<1) lres=length;	length=lres-fres+1;         if(save_format==CLUSTAL) {                clustal_out(outfile, fres, length, fseq, lseq);                fclose(outfile);                info("CLUSTAL format file created  [%s]",filename);        }        else if(save_format==PIR)  {                nbrf_out(outfile, fres, length, fseq, lseq);                fclose(outfile);                info("NBRF/PIR format file created  [%s]",filename);        }        else if(save_format==MSF)  {                gcg_out(outfile, fres, length, fseq, lseq);                fclose(outfile);                info("GCG/MSF format file created  [%s]",filename);        }        else if(save_format==PHYLIP)  {                phylip_out(outfile, fres, length, fseq, lseq);                fclose(outfile);                info("PHYLIP format file created  [%s]",filename);        }        else if(save_format==GDE)  {                gde_out(outfile, fres, length, fseq, lseq);                fclose(outfile);                info("GDE format file created  [%s]",filename);        }        else if(save_format==NEXUS)  {                nexus_out(outfile, fres, length, fseq, lseq);                fclose(outfile);                info("NEXUS format file created  [%s]",filename);        }/* <Ramu> */        else if(save_format==FASTA)  {                fasta_out(outfile, fres, length, fseq, lseq);                fclose(outfile);                info("FASTA format file created  [%s]",filename);        }/* </Ramu> */	if (Visible(savealnw))	{		Remove(savealnw);		savealnw=NULL;	}}static void SaveTreeWin (IteM item){	GrouP savegr;	ButtoN save_ok, save_can;	char path[FILENAMELEN];	if (empty)	{		error("No file loaded");		return;	}        if (nseqs < 2)	{                error("Alignment has only %d sequences",nseqs);                return;        }	SelectFont(systemFont);	stdCharWidth=CharWidth('A');	stdLineHeight=LineHeight();	savetreew=FixedWindow(-50, -33, -10, -10, "CREATE TREE",RemoveWin);	shift(savetreew, 0, 20);	make_prompt(savetreew, "SAVE TREE AS :");	Advance(savetreew);	shift(savetreew, 0, -10);	stdLineHeight=18;	SelectFont(programFont);	savetreetext=DialogText(savetreew, "", 35, NULL);	SelectFont(systemFont);	stdLineHeight=15;	Break(savetreew);	savegr=HiddenGroup(savetreew, 2, 0, NULL);	shift(savegr, 140, 20);	save_ok=PushButton(savegr, "  OK  ", CreateAlignTree);	shift(savegr, 20, 0);	save_can=PushButton(savegr, "CANCEL", CancelWin);	get_path(seqname,path);	strcat(path,"dnd");  	SetTitle(savetreetext, path);	Show(savetreew);}static void DrawTreeWin (IteM item){	GrouP drawgr;	GrouP output_list;	ButtoN draw_ok, draw_can;	char path[FILENAMELEN];	char name[FILENAMELEN];	if (empty)	{		error("No file loaded");		return;	}        if (nseqs < 2)	{                error("Alignment has only %d sequences",nseqs);                return;        }	get_path(seqname,path);	SelectFont(systemFont);	stdCharWidth=CharWidth('A');	stdLineHeight=LineHeight();	drawtreew=FixedWindow(-50, -33, -10, -10, "DRAW TREE",RemoveWin);	output_list=HiddenGroup(drawtreew, 2, 0, NULL);	if (output_tree_clustal)	{		make_prompt(output_list, "SAVE CLUSTAL TREE AS :");		drawnjtreetext=DialogText(output_list, "", 35, NULL);		strcpy(name,path);        	strcat(name,"nj");		SetTitle(drawnjtreetext, name);		Break(output_list);	}	if (output_tree_phylip)	{		make_prompt(output_list, "SAVE PHYLIP TREE AS :");		drawphtreetext=DialogText(output_list, "", 35, NULL);		strcpy(name,path);        	strcat(name,"ph");		SetTitle(drawphtreetext, name);		Break(output_list);	}	if (output_tree_distances)	{		make_prompt(output_list, "SAVE DISTANCE MATRIX AS :");		drawdsttreetext=DialogText(output_list, "", 35, NULL);		strcpy(name,path);        	strcat(name,"dst");		SetTitle(drawdsttreetext, name);		Break(output_list);	}	if (output_tree_nexus)	{		make_prompt(output_list, "SAVE NEXUS TREE AS :");		drawnxstreetext=DialogText(output_list, "", 35, NULL);		strcpy(name,path);        	strcat(name,"tre");		SetTitle(drawnxstreetext, name);		Break(output_list);	}	if (output_pim)	{		make_prompt(output_list, "SAVE % IDENTITY MATRIX AS :");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -