📄 interface.c
字号:
exit(1);
}
strcpy(seqname, param_arg[setinfile]);
}
if(*seqname != EOS) {
profile_no = 0;
nseqs = readseqs((sint)1);
if(nseqs < 2) {
if(nseqs < 0) cl_error_code = 2;
else if(nseqs == 0) cl_error_code = 3;
else cl_error_code = 4;
fprintf(stdout,
"\nNo. of seqs. read = %d. No alignment!\n",(pint)nseqs);
exit(cl_error_code);
}
for(i = 1; i<=nseqs; i++)
info("Sequence %d: %-*s %6.d %s",
(pint)i,max_names,names[i],(pint)seqlen_array[i],dnaflag?"bp":"aa");
empty = FALSE;
do_something = TRUE;
}
set_optional_param();
/*********************************************************/
/* Look for /profile1=file.ext AND /profile2=file2.ext */
/* You must give both file names OR neither. */
/*********************************************************/
if(setprofile1 != -1) {
if(strlen(param_arg[setprofile1]) <= 0) {
error("Bad profile 1 file name");
exit(1);
}
strcpy(seqname, param_arg[setprofile1]);
profile_no = 1;
profile_input();
if(nseqs <= 0) {
if(nseqs<0) cl_error_code=2;
else if(nseqs==0) cl_error_code=3;
exit(cl_error_code);
}
strcpy(profile1_name,seqname);
}
if(setprofile2 != -1) {
if(strlen(param_arg[setprofile2]) <= 0) {
error("Bad profile 2 file name");
exit(1);
}
if(profile1_empty) {
error("Only 1 profile file (profile 2) specified.");
exit(1);
}
strcpy(seqname, param_arg[setprofile2]);
profile_no = 2;
profile_input();
if(nseqs > profile1_nseqs)
do_something = do_profile = TRUE;
else {
if(nseqs<0) cl_error_code=2;
else if(nseqs==0) cl_error_code=3;
error("No sequences read from profile 2");
exit(cl_error_code);
}
strcpy(profile2_name,seqname);
}
/*************************************************************************/
/* Look for /tree or /bootstrap or /align or /usetree ******************/
/*************************************************************************/
if (setbatch != -1)
interactive=FALSE;
if (setinteractive != -1)
interactive=TRUE;
if (interactive) {
settree = -1;
setbootstrap = -1;
setalign = -1;
setusetree = -1;
setusetree1 = -1;
setusetree2 = -1;
setnewtree = -1;
setconvert = -1;
}
if(settree != -1 )
if(empty) {
error("Cannot draw tree. No input alignment file");
exit(1);
}
else
do_tree = TRUE;
if(setbootstrap != -1)
if(empty) {
error("Cannot bootstrap tree. No input alignment file");
exit(1);
}
else {
temp = 0;
if(param_arg[setbootstrap] != NULL)
if (sscanf(param_arg[setbootstrap],"%d",&temp)!=1) {
fprintf(stdout,"Bad option for /bootstrap (must be integer)\n");
temp = 0;
};
if(temp > 0) boot_ntrials = temp;
do_boot = TRUE;
}
if(setalign != -1)
if(empty) {
error("Cannot align sequences. No input file");
exit(1);
}
else
do_align = TRUE;
if(setconvert != -1)
if(empty) {
error("Cannot convert sequences. No input file");
exit(1);
}
else
do_convert = TRUE;
if(setusetree != -1)
if(empty) {
error("Cannot align sequences. No input file");
exit(1);
}
else {
if(strlen(param_arg[setusetree]) == 0) {
error("Cannot align sequences. No tree file specified");
exit(1);
}
else {
strcpy(phylip_tree_name, param_arg[setusetree]);
}
use_tree_file = TRUE;
do_align_only = TRUE;
}
if(setnewtree != -1)
if(empty) {
error("Cannot align sequences. No input file");
exit(1);
}
else {
if(strlen(param_arg[setnewtree]) == 0) {
error("Cannot align sequences. No tree file specified");
exit(1);
}
else {
strcpy(phylip_tree_name, param_arg[setnewtree]);
}
new_tree_file = TRUE;
do_tree_only = TRUE;
}
if(setusetree1 != -1)
if(profile1_empty) {
error("Cannot align profiles. No input file");
exit(1);
}
else if(profile_type == SEQUENCE) {
error("Invalid option /usetree1.");
exit(1);
}
else {
if(strlen(param_arg[setusetree1]) == 0) {
error("Cannot align profiles. No tree file specified");
exit(1);
}
else {
strcpy(p1_tree_name, param_arg[setusetree1]);
}
use_tree1_file = TRUE;
do_align_only = TRUE;
}
if(setnewtree1 != -1)
if(profile1_empty) {
error("Cannot align profiles. No input file");
exit(1);
}
else if(profile_type == SEQUENCE) {
error("Invalid option /newtree1.");
exit(1);
}
else {
if(strlen(param_arg[setnewtree1]) == 0) {
error("Cannot align profiles. No tree file specified");
exit(1);
}
else {
strcpy(p1_tree_name, param_arg[setnewtree1]);
}
new_tree1_file = TRUE;
}
if(setusetree2 != -1)
if(profile2_empty) {
error("Cannot align profiles. No input file");
exit(1);
}
else if(profile_type == SEQUENCE) {
error("Invalid option /usetree2.");
exit(1);
}
else {
if(strlen(param_arg[setusetree2]) == 0) {
error("Cannot align profiles. No tree file specified");
exit(1);
}
else {
strcpy(p2_tree_name, param_arg[setusetree2]);
}
use_tree2_file = TRUE;
do_align_only = TRUE;
}
if(setnewtree2 != -1)
if(profile2_empty) {
error("Cannot align profiles. No input file");
exit(1);
}
else if(profile_type == SEQUENCE) {
error("Invalid option /newtree2.");
exit(1);
}
else {
if(strlen(param_arg[setnewtree2]) == 0) {
error("Cannot align profiles. No tree file specified");
exit(1);
}
else {
strcpy(p2_tree_name, param_arg[setnewtree2]);
}
new_tree2_file = TRUE;
}
if( (!do_tree) && (!do_boot) && (!empty) && (!do_profile) && (!do_align_only) && (!do_tree_only) && (!do_convert))
do_align = TRUE;
/*** ? /quicktree */
if(setquicktree != -1)
quick_pairalign = TRUE;
if(dnaflag) {
gap_open = dna_gap_open;
gap_extend = dna_gap_extend;
pw_go_penalty = dna_pw_go_penalty;
pw_ge_penalty = dna_pw_ge_penalty;
ktup = dna_ktup;
window = dna_window;
signif = dna_signif;
wind_gap = dna_wind_gap;
}
else {
gap_open = prot_gap_open;
gap_extend = prot_gap_extend;
pw_go_penalty = prot_pw_go_penalty;
pw_ge_penalty = prot_pw_ge_penalty;
ktup = prot_ktup;
window = prot_window;
signif = prot_signif;
wind_gap = prot_wind_gap;
}
if(interactive) {
if (!xmenus) usemenu = TRUE;
return;
}
if(!do_something) {
error("No input file(s) specified");
exit(1);
}
/****************************************************************************/
/* Now do whatever has been requested ***************************************/
/****************************************************************************/
if(do_profile) {
if (profile_type == PROFILE) profile_align(p1_tree_name,p2_tree_name);
else new_sequence_align(phylip_tree_name);
}
else if(do_align)
align(phylip_tree_name);
else if(do_convert) {
get_path(seqname,path);
if(!open_alignment_output(path)) exit(1);
create_alignment_output(1,nseqs);
}
else if (do_align_only)
get_tree(phylip_tree_name);
else if(do_tree_only)
make_tree(phylip_tree_name);
else if(do_tree)
phylogenetic_tree(phylip_tree_name,clustal_tree_name,dist_tree_name,nexus_tree_name);
else if(do_boot)
bootstrap_tree(phylip_tree_name,clustal_tree_name,nexus_tree_name);
fprintf(stdout,"\n");
exit(0);
/*******whew!***now*go*home****/
}
Boolean user_mat(char *str, short *mat, short *xref)
{
sint maxres;
FILE *infile;
if(usemenu)
getstr("Enter name of the matrix file",lin2);
else
strcpy(lin2,str);
if(*lin2 == EOS) return FALSE;
if((infile=fopen(lin2,"r"))==NULL) {
error("Cannot find matrix file [%s]",lin2);
return FALSE;
}
strcpy(str, lin2);
maxres = read_user_matrix(str, mat, xref);
if (maxres <= 0) return FALSE;
return TRUE;
}
Boolean user_mat_series(char *str, short *mat, short *xref)
{
sint maxres;
FILE *infile;
if(usemenu)
getstr("Enter name of the matrix file",lin2);
else
strcpy(lin2,str);
if(*lin2 == EOS) return FALSE;
if((infile=fopen(lin2,"r"))==NULL) {
error("Cannot find matrix file [%s]",lin2);
return FALSE;
}
strcpy(str, lin2);
maxres = read_matrix_series(str, mat, xref);
if (maxres <= 0) return FALSE;
return TRUE;
}
sint seq_input(Boolean append)
{
sint i;
sint local_nseqs;
if(usemenu) {
fprintf(stdout,"\n\nSequences should all be in 1 file.\n");
fprintf(stdout,"\n7 formats accepted: \n");
fprintf(stdout,
"NBRF/PIR, EMBL/SwissProt, Pearson (Fasta), GDE, Clustal, GCG/MSF, RSF.\n\n\n");
/*fprintf(stdout,
"\nGCG users should use TOPIR to convert their sequence files before use.\n\n\n");*/
}
if (append)
local_nseqs = readseqs(nseqs+(sint)1);
else
local_nseqs = readseqs((sint)1); /* 1 is the first seq to be read */
if(local_nseqs < 0) /* file could not be opened */
{
return local_nseqs;
}
else if(local_nseqs == 0) /* no sequences */
{
error("No sequences in file! Bad format?");
return local_nseqs;
}
else
{
struct_penalties1 = struct_penalties2 = NONE;
if (sec_struct_mask1 != NULL) sec_struct_mask1=ckfree(sec_struct_mask1);
if (sec_struct_mask2 != NULL) sec_struct_mask2=ckfree(sec_struct_mask2);
if (gap_penalty_mask1 != NULL) gap_penalty_mask1=ckfree(gap_penalty_mask1);
if (gap_penalty_mask2 != NULL) gap_penalty_mask2=ckfree(gap_penalty_mask2);
if (ss_name1 != NULL) ss_name1=ckfree(ss_name1);
if (ss_name2 != NULL) ss_name2=ckfree(ss_name2);
if(append) nseqs+=local_nseqs;
else nseqs=local_nseqs;
info("Sequences assumed to be %s",
dnaflag?"DNA":"PROTEIN");
if (usemenu) {
fprintf(stdout,"\n\n");
for(i=1; i<=nseqs; i++) {
/* DES fprintf(stdout,"%s: = ",names[i]); */
info("Sequence %d: %-*s %6.d %s",
(pint)i,max_names,names[i],(pint)seqlen_array[i],dnaflag?"bp":"aa");
}
}
if(dnaflag) {
gap_open = dna_gap_open;
gap_extend = dna_gap_extend;
}
else {
gap_open = prot_gap_open;
gap_extend = prot_gap_extend;
}
empty=FALSE;
}
return local_nseqs;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -