Skip to content

Commit

Permalink
(OK) v0.3.2: make the whole program faster
Browse files Browse the repository at this point in the history
  • Loading branch information
wym6912 committed Oct 26, 2021
1 parent 791cc15 commit 8b52263
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
7 changes: 7 additions & 0 deletions function.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion function.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
char *get_exe_path(char *buf, int count); // find the program path
int movefile(); // move file, the command is written on the cmdstr
35 changes: 26 additions & 9 deletions msa_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#if REPORTCOSTS
#include <time.h>
#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

Expand All @@ -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");
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8b52263

Please sign in to comment.