]> git.donarmstrong.com Git - mothur.git/blobdiff - filterseqscommand.cpp
paralellized rarefaction.single
[mothur.git] / filterseqscommand.cpp
index addc5f338c9202811a7d6e341167c8a097e03ea0..ffffe4e4224c64f0b6b78d4019f8486b47d8511c 100644 (file)
@@ -147,13 +147,14 @@ void FilterSeqsCommand::help(){
        try {
                                
                m->mothurOut("The filter.seqs command reads a file containing sequences and creates a .filter and .filter.fasta file.\n");
-               m->mothurOut("The filter.seqs command parameters are fasta, trump, soft, hard and vertical. \n");
+               m->mothurOut("The filter.seqs command parameters are fasta, trump, soft, hard, processors and vertical. \n");
                m->mothurOut("The fasta parameter is required. You may enter several fasta files to build the filter from and filter, by separating their names with -'s.\n");
                m->mothurOut("For example: fasta=abrecovery.fasta-amazon.fasta \n");
                m->mothurOut("The trump parameter .... The default is ...\n");
                m->mothurOut("The soft parameter .... The default is ....\n");
                m->mothurOut("The hard parameter allows you to enter a file containing the filter you want to use.\n");
                m->mothurOut("The vertical parameter removes columns where all sequences contain a gap character. The default is T.\n");
+               m->mothurOut("The processors parameter allows you to specify the number of processors to use. The default is 1.\n");
                m->mothurOut("The filter.seqs command should be in the following format: \n");
                m->mothurOut("filter.seqs(fasta=yourFastaFile, trump=yourTrump) \n");
                m->mothurOut("Example filter.seqs(fasta=abrecovery.fasta, trump=.).\n");
@@ -198,7 +199,11 @@ int FilterSeqsCommand::execute() {
                
                ofstream outFilter;
                
-               string filterFile = outputDir + filterFileName + ".filter";
+               //prevent giantic file name
+               string filterFile;
+               if (fastafileNames.size() > 3) { filterFile = outputDir + "merge.filter"; }
+               else {  filterFile = outputDir + filterFileName + ".filter";  }
+               
                m->openOutputFile(filterFile, outFilter);
                outFilter << filter << endl;
                outFilter.close();
@@ -863,7 +868,7 @@ int FilterSeqsCommand::MPICreateFilter(int start, int num, Filters& F, MPI_File&
 int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename) {
        try {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
-               int process = 0;
+               int process = 1;
                int num = 0;
                processIDS.clear();
                
@@ -904,13 +909,16 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename)
                        }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
                }
                
+               //parent do your part
+               num = driverCreateFilter(F, filename, lines[0]);
+               
                //force parent to wait until all the processes are done
-               for (int i=0;i<processors;i++) { 
+               for (int i=0;i<(processors-1);i++) { 
                        int temp = processIDS[i];
                        wait(&temp);
                }
                
-               //parent reads in and combine Filter info
+               //parent reads in and combines Filter info
                for (int i = 0; i < processIDS.size(); i++) {
                        string tempFilename = filename + toString(processIDS[i]) + "filterValues.temp";
                        ifstream in;