diff --git a/function.c b/function.c index 3869284..c7de2ea 100644 --- a/function.c +++ b/function.c @@ -118,6 +118,13 @@ int maketmpfolder() return system_spawn("/bin/sh", argv, NULL); } +int movefile() +{ + char *argv[] = {"sh", "-c", cmdstr, NULL}; + reporterr("Info: only one cluster in cluster alignment, moved the file into result.\n"); + return system_spawn("/bin/sh", argv, NULL); +} + void cleantmpfile() { sprintf(cmdstr, "rm -rf %s tmp", tmpdir); diff --git a/function.h b/function.h index 46c1bf8..6211ef8 100644 --- a/function.h +++ b/function.h @@ -9,4 +9,5 @@ int BLASTaligncommand(char *center, char *common, char *progfolder, char *progna void checkprofilealign(char *progfolder, char *programname); // check the existance profile align program int profilealigncommand(char *filelist, char *center, int alignmode, char *progfolder, char *progname); // profilealign command processor double naivepairscore11( char *seq1, char *seq2, int penal, int seq_type); // SP Scores (one by one) -char *get_exe_path(char *buf, int count); // find the program path \ No newline at end of file +char *get_exe_path(char *buf, int count); // find the program path +int movefile(); // move file, the command is written on the cmdstr diff --git a/msa_main.c b/msa_main.c index ba6ff1d..e405f1d 100644 --- a/msa_main.c +++ b/msa_main.c @@ -7,7 +7,7 @@ #if REPORTCOSTS #include #endif -#define VERSION "0.3.1" +#define VERSION "0.3.2" #define SHOWVERSION reporterr( "%s (%s, %d-bit) Version " VERSION "\n\n", "MSA align", (seq_type == 1) ? "nuc" : ((seq_type == 0) ? "unknown" : "aa"), sizeof(int *) * 8 ) // #define FILESAVE @@ -23,6 +23,7 @@ void print_help_message() reporterr("-T: use threads in cd-hit and staralign\n"); reporterr("-p: Calcuate SP Scores after alignment\n"); reporterr("-d: print debug info on profilealign, staralign and cd-hit*\n"); + reporterr("-v: only print version\n"); reporterr("== MAFFT common arguments ==\n"); reporterr("-V, -f, -S: ppenalty_dist, penalty, nmax_shift\n"); reporterr("-z, -w: fftthreshold, fftWinsize\n"); @@ -35,6 +36,11 @@ void print_help_message() reporterr("-M: max memory for CD-HIT\n"); } +void print_version() +{ + reporterr("WMSA verison %s\n", VERSION); +} + void arguments(int argc, char *argv[]) { if(argc == 1) @@ -143,6 +149,9 @@ void arguments(int argc, char *argv[]) case '?': print_help_message(); exit(0); + case 'v': + print_version(); + exit(0); default: reporterr( "Illegal option %c. Please type wmsa -H or -? to get help.\n", c ); argc = 0; @@ -242,14 +251,22 @@ int main(int argc, char **argv) fclose(cmdd); reporterr("\ndone. \n"); - /* Part 3: profile-profile align */ - reporterr("profile merging... "); - checkprofilealign(programfolder, "submafft/profilealign"); - sprintf(cmdstr3, "%scluster_order", tmpdir); - sprintf(cmdstr2, "%stmp", tmpdir); - profilealigncommand(cmdstr3, cmdstr2, alignmode, programfolder, "submafft/profilealign"); - reporterr("done. \n"); - + if(cluster_seq == 1) + { + /* no need to do part 3 */ + sprintf(cmdstr, "mv %stmp_0.clstr.res %s", tmpdir, outputfile); + if(movefile()) reporterr("Moving file failed\n"); + } + else + { + /* Part 3: profile-profile align */ + reporterr("profile merging... "); + checkprofilealign(programfolder, "submafft/profilealign"); + sprintf(cmdstr3, "%scluster_order", tmpdir); + sprintf(cmdstr2, "%stmp", tmpdir); + profilealigncommand(cmdstr3, cmdstr2, alignmode, programfolder, "submafft/profilealign"); + reporterr("done. \n"); + } #if REPORTCOSTS reporterr( "\nmsa align, real = %f min\n", (float)(time(NULL) - starttime)/60.0 ); #endif diff --git a/submafft b/submafft index 227172b..b39c6c1 160000 --- a/submafft +++ b/submafft @@ -1 +1 @@ -Subproject commit 227172b49616effc8dd97e5ba45adc529239579d +Subproject commit b39c6c1c9b6081b11ed97635e5a38495235e22b3