]> git.donarmstrong.com Git - mothur.git/commitdiff
created blank accnos in chimera commands if no seqs are deemed chimeric. modified...
authorwestcott <westcott>
Thu, 24 Jun 2010 17:18:38 +0000 (17:18 +0000)
committerwestcott <westcott>
Thu, 24 Jun 2010 17:18:38 +0000 (17:18 +0000)
13 files changed:
chimerabellerophoncommand.cpp
chimeraccodecommand.cpp
chimeraccodecommand.h
chimerapintailcommand.cpp
chimerapintailcommand.h
chimeraslayercommand.cpp
chimeraslayercommand.h
getseqscommand.cpp
mgclustercommand.cpp
mothur.h
nameassignment.cpp
readblast.cpp
removeseqscommand.cpp

index d7f60e7901322b44d3548db5200bce9d723407e9..2a38438fdfb4e71b68ac007dde4221a152acd6cf 100644 (file)
@@ -164,7 +164,6 @@ int ChimeraBellerophonCommand::execute(){
                                        
                        string outputFileName = outputDir + getRootName(getSimpleName(fastaFileNames[i])) +  "bellerophon.chimeras";
                        string accnosFileName = outputDir + getRootName(getSimpleName(fastaFileNames[i])) + "bellerophon.accnos";
-                       bool hasAccnos = true;
                        
                        chimera->getChimeras();
                        
@@ -206,13 +205,10 @@ int ChimeraBellerophonCommand::execute(){
                        
                        if (m->control_pressed) { remove(accnosFileName.c_str()); remove(outputFileName.c_str()); for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } delete chimera;       return 0;       }
                        
-                       //delete accnos file if its blank 
-                       if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
-                       
                        m->mothurOutEndLine(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine(); m->mothurOutEndLine();
                        
                        outputNames.push_back(outputFileName);
-                       if (hasAccnos) {  outputNames.push_back(accnosFileName);  }
+                       outputNames.push_back(accnosFileName);
                        
                        delete chimera;
                }
index 2b46f2bcda9246b865759f832e070fbc27d8fe0d..3d3c9aea99401c492676e210173d7b397e205a70 100644 (file)
@@ -211,7 +211,6 @@ int ChimeraCcodeCommand::execute(){
                        }
 
                        string mapInfo = outputDir + getRootName(getSimpleName(fastaFileNames[s])) + "mapinfo";
-                       bool hasAccnos = true;
                        
                        if (m->control_pressed) { delete chimera;  for (int j = 0; j < outputNames.size(); j++) {       remove(outputNames[j].c_str()); }  return 0;    }
                        
@@ -220,8 +219,7 @@ int ChimeraCcodeCommand::execute(){
                                int pid, end, numSeqsPerProcessor; 
                                int tag = 2001;
                                vector<long> MPIPos;
-                               MPIWroteAccnos = false;
-                               
+                                                               
                                MPI_Status status; 
                                MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
                                MPI_Comm_size(MPI_COMM_WORLD, &processors); 
@@ -278,11 +276,6 @@ int ChimeraCcodeCommand::execute(){
                                        
                                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  remove(outputFileName.c_str());  remove(accnosFileName.c_str());  for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); }  delete chimera; return 0;  }
 
-                                       for (int i = 1; i < processors; i++) {
-                                               bool tempResult;
-                                               MPI_Recv(&tempResult, 1, MPI_INT, i, tag, MPI_COMM_WORLD, &status);
-                                               if (tempResult != 0) { MPIWroteAccnos = true; }
-                                       }
                                }else{ //you are a child process
                                        MPI_Recv(&numSeqs, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
                                        MPIPos.resize(numSeqs+1);
@@ -298,8 +291,6 @@ int ChimeraCcodeCommand::execute(){
                                        driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, outMPIAccnos, MPIPos);
                                        
                                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  for (int j = 0; j < outputNames.size(); j++) {   remove(outputNames[j].c_str()); }  delete chimera; return 0;  }
-                                       
-                                       MPI_Send(&MPIWroteAccnos, 1, MPI_INT, 0, tag, MPI_COMM_WORLD); 
                                }
                                
                                //close files 
@@ -308,14 +299,6 @@ int ChimeraCcodeCommand::execute(){
                                MPI_File_close(&outMPIAccnos);
                                
                                MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
-                               
-                               //delete accnos file if blank
-                               if (pid == 0) {
-                                       if (!MPIWroteAccnos) { 
-                                               hasAccnos = false;      
-                                               remove(accnosFileName.c_str()); 
-                                       }
-                               }
                                        
                #else
                        ofstream outHeader;
@@ -348,9 +331,6 @@ int ChimeraCcodeCommand::execute(){
                                                return 0;
                                        }
                                        
-                                       //delete accnos file if its blank 
-                                       if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
-                                                                       
                                }else{
                                        vector<int> positions;
                                        processIDS.resize(0);
@@ -383,6 +363,7 @@ int ChimeraCcodeCommand::execute(){
                                        createProcesses(outputFileName, fastaFileNames[s], accnosFileName); 
                                
                                        rename((outputFileName + toString(processIDS[0]) + ".temp").c_str(), outputFileName.c_str());
+                                       rename((accnosFileName + toString(processIDS[0]) + ".temp").c_str(), accnosFileName.c_str());
                                                
                                        //append output files
                                        for(int i=1;i<processors;i++){
@@ -390,24 +371,12 @@ int ChimeraCcodeCommand::execute(){
                                                remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
                                        }
                                        
-                                       vector<string> nonBlankAccnosFiles;
-                                       //delete blank accnos files generated with multiple processes
-                                       for(int i=0;i<processors;i++){  
-                                               if (!(isBlank(accnosFileName + toString(processIDS[i]) + ".temp"))) {
-                                                       nonBlankAccnosFiles.push_back(accnosFileName + toString(processIDS[i]) + ".temp");
-                                               }else { remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());  }
+                                       //append output files
+                                       for(int i=1;i<processors;i++){
+                                               appendFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
+                                               remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
                                        }
                                        
-                                       //append accnos files
-                                       if (nonBlankAccnosFiles.size() != 0) { 
-                                               rename(nonBlankAccnosFiles[0].c_str(), accnosFileName.c_str());
-                                               
-                                               for (int h=1; h < nonBlankAccnosFiles.size(); h++) {
-                                                       appendFiles(nonBlankAccnosFiles[h], accnosFileName);
-                                                       remove(nonBlankAccnosFiles[h].c_str());
-                                               }
-                                       }else{ hasAccnos = false;  }
-                                       
                                        if (m->control_pressed) { 
                                                remove(outputFileName.c_str()); 
                                                remove(accnosFileName.c_str());
@@ -438,8 +407,6 @@ int ChimeraCcodeCommand::execute(){
                                                return 0;
                                }
                                
-                               //delete accnos file if its blank 
-                               if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
                        #endif
        
                        appendFiles(outputFileName, tempHeader);
@@ -452,7 +419,7 @@ int ChimeraCcodeCommand::execute(){
                        
                        outputNames.push_back(outputFileName);
                        outputNames.push_back(mapInfo);
-                       if (hasAccnos) { outputNames.push_back(accnosFileName); }
+                       outputNames.push_back(accnosFileName); 
                        
                        for (int i = 0; i < lines.size(); i++) {  delete lines[i];  }  lines.clear();
                        
@@ -565,7 +532,6 @@ int ChimeraCcodeCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File
                
                                        //print results
                                        bool isChimeric = chimera->print(outMPI, outAccMPI);
-                                       if (isChimeric) { MPIWroteAccnos = true;  }
                                }
                        }
                        delete candidateSeq;
index a07178e720ba59716c22d8d685624db2e3d83c0b..c3d71c920ee2d84e8c6a2738e21cbcb840d4a8c5 100644 (file)
@@ -42,7 +42,7 @@ private:
        int driverMPI(int, int, MPI_File&, MPI_File&, MPI_File&, vector<long>&);
        #endif
 
-       bool abort, filter, MPIWroteAccnos;
+       bool abort, filter;
        string fastafile, templatefile, outputDir, maskfile;
        int processors, window, numwanted, numSeqs, templateSeqsLength;
        Chimera* chimera;
index 4cfc3bca93a1939c9432bd3ed14873c2834963fa..6cf581b9308f21159186ece928bcbdf8e4142803 100644 (file)
@@ -253,7 +253,6 @@ int ChimeraPintailCommand::execute(){
                                outputFileName = outputDir + getRootName(getSimpleName(fastaFileNames[s]))  + "pintail.chimeras";
                                accnosFileName = outputDir + getRootName(getSimpleName(fastaFileNames[s]))  + "pintail.accnos";
                        }
-                       bool hasAccnos = true;
                        
                        if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) {        remove(outputNames[j].c_str()); }  return 0;    }
                        
@@ -268,7 +267,6 @@ int ChimeraPintailCommand::execute(){
                        int pid, end, numSeqsPerProcessor; 
                                int tag = 2001;
                                vector<long> MPIPos;
-                               MPIWroteAccnos = false;
                                
                                MPI_Status status; 
                                MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
@@ -316,11 +314,6 @@ int ChimeraPintailCommand::execute(){
                                        
                                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  remove(outputFileName.c_str());  remove(accnosFileName.c_str());  for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); }  delete chimera; return 0;  }
                                        
-                                       for (int i = 1; i < processors; i++) {
-                                               bool tempResult;
-                                               MPI_Recv(&tempResult, 1, MPI_INT, i, tag, MPI_COMM_WORLD, &status);
-                                               if (tempResult != 0) { MPIWroteAccnos = true; }
-                                       }
                                }else{ //you are a child process
                                        MPI_Recv(&numSeqs, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
                                        MPIPos.resize(numSeqs+1);
@@ -335,8 +328,6 @@ int ChimeraPintailCommand::execute(){
                                        driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, outMPIAccnos, MPIPos);
                                        
                                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  for (int j = 0; j < outputNames.size(); j++) {   remove(outputNames[j].c_str()); }  delete chimera; return 0;  }
-
-                                       MPI_Send(&MPIWroteAccnos, 1, MPI_INT, 0, tag, MPI_COMM_WORLD); 
                                }
                                
                                //close files 
@@ -344,15 +335,6 @@ int ChimeraPintailCommand::execute(){
                                MPI_File_close(&outMPI);
                                MPI_File_close(&outMPIAccnos);
                                MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
-                               
-                               //delete accnos file if blank
-                               if (pid == 0) {
-                                       if (!MPIWroteAccnos) { 
-                                               hasAccnos = false;      
-                                               remove(accnosFileName.c_str()); 
-                                       }
-                               }
-
                #else
                
                        //break up file
@@ -376,9 +358,6 @@ int ChimeraPintailCommand::execute(){
                                                return 0;
                                        }
                                        
-                                       //delete accnos file if its blank 
-                                       if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
-                                                                       
                                }else{
                                        vector<int> positions;
                                        processIDS.resize(0);
@@ -410,6 +389,7 @@ int ChimeraPintailCommand::execute(){
                                        createProcesses(outputFileName, fastaFileNames[s], accnosFileName); 
                                
                                        rename((outputFileName + toString(processIDS[0]) + ".temp").c_str(), outputFileName.c_str());
+                                       rename((accnosFileName + toString(processIDS[0]) + ".temp").c_str(), accnosFileName.c_str());
                                                
                                        //append output files
                                        for(int i=1;i<processors;i++){
@@ -417,24 +397,12 @@ int ChimeraPintailCommand::execute(){
                                                remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
                                        }
                                        
-                                       vector<string> nonBlankAccnosFiles;
-                                       //delete blank accnos files generated with multiple processes
-                                       for(int i=0;i<processors;i++){  
-                                               if (!(isBlank(accnosFileName + toString(processIDS[i]) + ".temp"))) {
-                                                       nonBlankAccnosFiles.push_back(accnosFileName + toString(processIDS[i]) + ".temp");
-                                               }else { remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());  }
+                                       //append output files
+                                       for(int i=1;i<processors;i++){
+                                               appendFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
+                                               remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
                                        }
-                                       
-                                       //append accnos files
-                                       if (nonBlankAccnosFiles.size() != 0) { 
-                                               rename(nonBlankAccnosFiles[0].c_str(), accnosFileName.c_str());
-                                               
-                                               for (int h=1; h < nonBlankAccnosFiles.size(); h++) {
-                                                       appendFiles(nonBlankAccnosFiles[h], accnosFileName);
-                                                       remove(nonBlankAccnosFiles[h].c_str());
-                                               }
-                                       }else{ hasAccnos = false;  }
-                                       
+                                                                               
                                        if (m->control_pressed) { 
                                                remove(outputFileName.c_str()); 
                                                remove(accnosFileName.c_str());
@@ -462,9 +430,6 @@ int ChimeraPintailCommand::execute(){
                                                delete chimera;
                                                return 0;
                                }
-                               
-                               //delete accnos file if its blank 
-                               if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
                        #endif
                        
                #endif  
@@ -473,7 +438,7 @@ int ChimeraPintailCommand::execute(){
                        for (int i = 0; i < lines.size(); i++) {  delete lines[i];  }  lines.clear();
                        
                        outputNames.push_back(outputFileName);
-                       if (hasAccnos) { outputNames.push_back(accnosFileName); }
+                       outputNames.push_back(accnosFileName); 
                        
                        m->mothurOutEndLine();
                        m->mothurOutEndLine(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
@@ -584,7 +549,6 @@ int ChimeraPintailCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_Fi
                
                                        //print results
                                        bool isChimeric = chimera->print(outMPI, outAccMPI);
-                                       if (isChimeric) { MPIWroteAccnos = true;  }
                                }
                        }
                        delete candidateSeq;
index b0dcceb4d766e693a9d9c32819352690740c9946..65e67fe0f92fb86df0abd757c4b06167dc024992 100644 (file)
@@ -43,7 +43,7 @@ private:
        int driverMPI(int, int, MPI_File&, MPI_File&, MPI_File&, vector<long>&);
        #endif
 
-       bool abort, filter, MPIWroteAccnos;
+       bool abort, filter;
        string fastafile, templatefile, consfile, quanfile, maskfile, outputDir, inputDir;
        int processors, window, increment, numSeqs, templateSeqsLength;
        Chimera* chimera;
index 35b0433152da0f2c590c4822fa5879d136938377..ae98ff3075e691e0db5c5fcedd288f10da14cb9f 100644 (file)
@@ -177,7 +177,7 @@ void ChimeraSlayerCommand::help(){
                m->mothurOut("This command was modeled after the chimeraSlayer written by the Broad Institute.\n");
                m->mothurOut("The chimera.slayer command parameters are fasta, template, processors, ksize, window, match, mismatch, divergence. minsim, mincov, minbs, minsnp, parents, search, iters, increment and numwanted.\n"); //realign,
                m->mothurOut("The fasta parameter allows you to enter the fasta file containing your potentially chimeric sequences, and is required. \n");
-               m->mothurOut("You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amzon.fasta \n");
+               m->mothurOut("You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amazon.fasta \n");
                m->mothurOut("The template parameter allows you to enter a template file containing known non-chimeric sequences, and is required. \n");
                m->mothurOut("The processors parameter allows you to specify how many processors you would like to use.  The default is 1. \n");
                #ifdef USE_MPI
@@ -230,7 +230,6 @@ int ChimeraSlayerCommand::execute(){
                                                        
                        string outputFileName = outputDir + getRootName(getSimpleName(fastaFileNames[s])) + "slayer.chimeras";
                        string accnosFileName = outputDir + getRootName(getSimpleName(fastaFileNames[s]))  + "slayer.accnos";
-                       bool hasAccnos = true;
                        
                        if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) {        remove(outputNames[j].c_str()); }  return 0;    }
                        
@@ -245,7 +244,6 @@ int ChimeraSlayerCommand::execute(){
                        int pid, end, numSeqsPerProcessor; 
                                int tag = 2001;
                                vector<long> MPIPos;
-                               MPIWroteAccnos = false;
                                
                                MPI_Status status; 
                                MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
@@ -306,11 +304,6 @@ int ChimeraSlayerCommand::execute(){
                                        
                                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  for (int j = 0; j < outputNames.size(); j++) {   remove(outputNames[j].c_str()); }  remove(outputFileName.c_str());  remove(accnosFileName.c_str());  delete chimera; return 0;  }
 
-                                       for (int i = 1; i < processors; i++) {
-                                               bool tempResult;
-                                               MPI_Recv(&tempResult, 1, MPI_INT, i, tag, MPI_COMM_WORLD, &status);
-                                               if (tempResult != 0) { MPIWroteAccnos = true; }
-                                       }
                                }else{ //you are a child process
                                        MPI_Recv(&numSeqs, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
                                        MPIPos.resize(numSeqs+1);
@@ -325,8 +318,6 @@ int ChimeraSlayerCommand::execute(){
                                        driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, outMPIAccnos, MPIPos);
                                        
                                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  for (int j = 0; j < outputNames.size(); j++) {   remove(outputNames[j].c_str()); }  delete chimera; return 0;  }
-
-                                       MPI_Send(&MPIWroteAccnos, 1, MPI_INT, 0, tag, MPI_COMM_WORLD); 
                                }
                                
                                //close files 
@@ -335,14 +326,6 @@ int ChimeraSlayerCommand::execute(){
                                MPI_File_close(&outMPIAccnos);
                                MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
                                
-                               //delete accnos file if blank
-                               if (pid == 0) {
-                                       if (!MPIWroteAccnos) { 
-                                               hasAccnos = false;      
-                                               remove(accnosFileName.c_str()); 
-                                       }
-                               }
-                       
                #else
                        ofstream outHeader;
                        string tempHeader = outputDir + getRootName(getSimpleName(fastaFileNames[s])) + "slayer.chimeras.tempHeader";
@@ -373,9 +356,6 @@ int ChimeraSlayerCommand::execute(){
                                                return 0;
                                        }
                                        
-                                       //delete accnos file if its blank 
-                                       if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
-                                                                       
                                }else{
                                        vector<int> positions;
                                        processIDS.resize(0);
@@ -407,6 +387,7 @@ int ChimeraSlayerCommand::execute(){
                                        createProcesses(outputFileName, fastaFileNames[s], accnosFileName); 
                                
                                        rename((outputFileName + toString(processIDS[0]) + ".temp").c_str(), outputFileName.c_str());
+                                       rename((accnosFileName + toString(processIDS[0]) + ".temp").c_str(), accnosFileName.c_str());
                                                
                                        //append output files
                                        for(int i=1;i<processors;i++){
@@ -414,24 +395,12 @@ int ChimeraSlayerCommand::execute(){
                                                remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
                                        }
                                        
-                                       vector<string> nonBlankAccnosFiles;
-                                       //delete blank accnos files generated with multiple processes
-                                       for(int i=0;i<processors;i++){  
-                                               if (!(isBlank(accnosFileName + toString(processIDS[i]) + ".temp"))) {
-                                                       nonBlankAccnosFiles.push_back(accnosFileName + toString(processIDS[i]) + ".temp");
-                                               }else { remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());  }
+                                       //append output files
+                                       for(int i=1;i<processors;i++){
+                                               appendFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
+                                               remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
                                        }
                                        
-                                       //append accnos files
-                                       if (nonBlankAccnosFiles.size() != 0) { 
-                                               rename(nonBlankAccnosFiles[0].c_str(), accnosFileName.c_str());
-                                               
-                                               for (int h=1; h < nonBlankAccnosFiles.size(); h++) {
-                                                       appendFiles(nonBlankAccnosFiles[h], accnosFileName);
-                                                       remove(nonBlankAccnosFiles[h].c_str());
-                                               }
-                                       }else{ hasAccnos = false;  }
-                                       
                                        if (m->control_pressed) { 
                                                remove(outputFileName.c_str()); 
                                                remove(accnosFileName.c_str());
@@ -462,8 +431,6 @@ int ChimeraSlayerCommand::execute(){
                                                return 0;
                                }
                                
-                               //delete accnos file if its blank 
-                               if (isBlank(accnosFileName)) {  remove(accnosFileName.c_str());  hasAccnos = false; }
                        #endif
                        
                        appendFiles(outputFileName, tempHeader);
@@ -478,10 +445,10 @@ int ChimeraSlayerCommand::execute(){
                        for (int i = 0; i < lines.size(); i++) {  delete lines[i];  }  lines.clear();
                        
                        outputNames.push_back(outputFileName);
-                       if (hasAccnos) { outputNames.push_back(accnosFileName); }
+                       outputNames.push_back(accnosFileName); 
                        
                        m->mothurOutEndLine(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
-                       }
+               }
                
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
@@ -589,8 +556,6 @@ int ChimeraSlayerCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_Fil
                //cout << "about to print" << endl;
                                        //print results
                                        bool isChimeric = chimera->print(outMPI, outAccMPI);
-                                       if (isChimeric) { MPIWroteAccnos = true;  }
-       
                                }
                        }
                        delete candidateSeq;
index 7ae956a6ec6fff3ebea1a95393a1752974a9bfec..7c20fb912bd321a121a410da45ed9abc87fce474 100644 (file)
@@ -42,7 +42,7 @@ private:
        int driverMPI(int, int, MPI_File&, MPI_File&, MPI_File&, vector<long>&);
        #endif
 
-       bool abort, realign, MPIWroteAccnos;
+       bool abort, realign;
        string fastafile, templatefile, outputDir, search;
        int processors, window, iters, increment, numwanted, ksize, match, mismatch, parents, minSimilarity, minCoverage, minBS, minSNP, numSeqs, templateSeqsLength;
        float divR;
index 8bf93ce68db55f9b380307feb73d83ecf3700c5d..5e77a1d296b1d740f9ecd58209f555f33c8ac73f 100644 (file)
@@ -238,10 +238,8 @@ int GetSeqsCommand::readFasta(){
                in.close();     
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else {  outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
 
@@ -311,10 +309,8 @@ int GetSeqsCommand::readList(){
                in.close();     
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else {  outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
 
@@ -405,10 +401,8 @@ int GetSeqsCommand::readName(){
                in.close();
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else {  outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
                
@@ -454,10 +448,8 @@ int GetSeqsCommand::readGroup(){
                in.close();
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else {  outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
 
@@ -500,11 +492,9 @@ int GetSeqsCommand::readTax(){
                in.close();
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else {  outputNames.push_back(outputFileName); }
-               
+               if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
+                       
                return 0;
 
        }
@@ -569,10 +559,8 @@ int GetSeqsCommand::readAlign(){
                in.close();
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else {  outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
                
index f8f3c78e6fc68c507bcc896bf0789a2ba2d7e373..182e78dc31502fb6c9a75e1703c8f17ffe4ba0fb 100644 (file)
@@ -166,6 +166,13 @@ int MGClusterCommand::execute(){
                
                list = new ListVector(nameMap->getListVector());
                RAbundVector* rabund = new RAbundVector(list->getRAbundVector());
+for (int i = 0; i < list->getNumBins(); i++) {
+string bin = list->get(i);
+if(bin == "") {
+cout << "bin " << i << " is blank."<< endl;
+}
+}
+cout << "after outputting blank bins." << endl;
                
                if (m->control_pressed) { delete nameMap; delete read; delete list; delete rabund; return 0; }
                
@@ -208,7 +215,7 @@ int MGClusterCommand::execute(){
                                listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
                                return 0; 
                        }
-                       
+       int count = 0;          
                        //cluster using cluster classes
                        while (distMatrix->getSmallDist() < cutoff && distMatrix->getNNodes() > 0){
                                
@@ -227,11 +234,12 @@ int MGClusterCommand::execute(){
                                }else{
                                        rndDist = roundDist(dist, precision); 
                                }
-
+cout << "here " << count << '\t' << dist << endl;
                                
                                if(previousDist <= 0.0000 && dist != previousDist){
                                        oldList.setLabel("unique");
                                        printData(&oldList);
+                                       Seq2Bin = cluster->getSeqtoBin();
                                }
                                else if(rndDist != rndPreviousDist){
                                        if (merge) {
@@ -252,9 +260,9 @@ int MGClusterCommand::execute(){
                                                printData(&oldList);
                                        }
                                }
-                               
+       //cout << "after merge " << count << '\t' << dist << endl;      
+       count++;                
                                previousDist = dist;
-       cout << "prev distance = " << previousDist << " dist = " << dist << endl;
                                rndPreviousDist = rndDist;
                                oldList = *list;
                                oldSeq2Bin = Seq2Bin;
@@ -263,6 +271,7 @@ int MGClusterCommand::execute(){
                        if(previousDist <= 0.0000){
                                oldList.setLabel("unique");
                                printData(&oldList);
+                               Seq2Bin = cluster->getSeqtoBin();
                        }
                        else if(rndPreviousDist<cutoff){
                                if (merge) {
@@ -356,6 +365,7 @@ int MGClusterCommand::execute(){
                                                if((previousDist <= 0.0000) && (seqs[i].dist != previousDist)){
                                                        oldList.setLabel("unique");
                                                        printData(&oldList);
+                                                       Seq2Bin = hcluster->getSeqtoBin();
                                                }
                                                else if((rndDist != rndPreviousDist)){
                                                        if (merge) {
@@ -415,8 +425,8 @@ int MGClusterCommand::execute(){
                        }
                        
                        delete hcluster;
-                       //remove(distFile.c_str());
-                       //remove(overlapFile.c_str());
+                       remove(distFile.c_str());
+                       remove(overlapFile.c_str());
                }
                
                delete list; 
@@ -475,6 +485,17 @@ ListVector* MGClusterCommand::mergeOPFs(map<string, int> binInfo, float dist){
        try {
                //create new listvector so you don't overwrite the clustering
                ListVector* newList = new ListVector(oldList);
+for (int i = 0; i < newList->getNumBins(); i++) {
+string bin = newList->get(i);
+if(bin == "") {
+cout << "bin " << i << " is blank."<< endl;
+for (map<string, int>::iterator itBin = binInfo.begin(); itBin != binInfo.end(); itBin++) {
+       if (itBin->second == i) { cout << itBin->first << " maps to an empty bin." << endl; }
+}
+}
+}
+cout << "after outputting blank bins." << endl;                
+
                bool done = false;
                ifstream inOverlap;
                int count = 0;
@@ -525,16 +546,17 @@ ListVector* MGClusterCommand::mergeOPFs(map<string, int> binInfo, float dist){
                                
                                if(itBin1 == binInfo.end()){  cerr << "AAError: Sequence '" << name1 << "' does not have any bin info.\n"; exit(1);  }
                                if(itBin2 == binInfo.end()){  cerr << "ABError: Sequence '" << name2 << "' does not have any bin info.\n"; exit(1);  }
-
+cout << overlapNode.dist << '\t' << dist << endl;
                                int binKeep = itBin1->second;
                                int binRemove = itBin2->second;
-                               
+                       
                                //if not merge bins and update binInfo
                                if(binKeep != binRemove) {
-               
+       cout << "bin keep = " << binKeep << " bin remove = " << binRemove << endl;              
                                        //save names in old bin
                                        string names = newList->get(binRemove);
-                                       
+                       cout << names << endl << endl << endl;  
+                       cout << newList->get(binKeep) << endl << endl << endl;  
                                        //merge bins into name1s bin
                                        newList->set(binKeep, newList->get(binRemove)+','+newList->get(binKeep));
                                        newList->set(binRemove, "");    
index a7946fde756a68a5eeeabec8aa63e72ec53d1df7..c3f61b4268b613da53a567f0fa6239983a19311e 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -577,7 +577,7 @@ inline int openInputFile(string fileName, ifstream& fileHandle){
        else {
                //check for blank file
                gobble(fileHandle);
-               if (fileHandle.eof()) { cout << completeFileName << " is blank. Please correct." << endl;  return 1;  }
+               if (fileHandle.eof()) { cout << completeFileName << " is blank. Please correct." << endl;   }
                
                return 0;
        }
index 641be4e626fb9c52b9035a979acd95dbe654e35a..0a62a032077fd58c5ee92c3801662a9e280f6df7 100644 (file)
@@ -76,6 +76,7 @@ void NameAssignment::print(ostream& out){
 //cout << (*this).size() << endl;
                for(it = (*this).begin(); it!=(*this).end(); it++){
                        out << it->first << '\t' <<  it->second << endl;  //prints out keys and values of the map this.
+                       //out << it->first << '\t' <<  it->first << endl;
                }
        }
        catch(exception& e) {
index 4833d0125d8a286e0116be5ae0644c33f5443803..c3dfd4884f0d01d6c9dbb98c17aa9a8341a44c5d 100644 (file)
@@ -177,8 +177,7 @@ int ReadBlast::read(NameAssignment* nameMap) {
                                                
                                                //if we have it then compare
                                                if (itDist != dists[it->first].end()) {
-               if (distance < 0.0) { cout << currentRow << '\t' << nameMap->get(it->first) << '\t' << "score = " << it->second << " refscore = " << refScore << " distance = " << distance << " distance = " << itDist->second << endl;        }
-
+       
                                                        //if you want the minimum blast score ratio, then pick max distance
                                                        if(minWanted) {  distance = max(itDist->second, distance);  }
                                                        else{   distance = min(itDist->second, distance);  }
@@ -314,8 +313,8 @@ int ReadBlast::readNames(NameAssignment* nameMap) {
                ifstream in;
                openInputFile(blastfile, in);
                
-               ofstream outName;
-               openOutputFile("tempOutNames", outName);
+               //ofstream outName;
+               //openOutputFile((blastfile + ".tempOutNames"), outName);
                
                //read first line
                in >> prevName;
@@ -351,6 +350,7 @@ int ReadBlast::readNames(NameAssignment* nameMap) {
                //openOutputFile(outNames, out);
                //nameMap->print(out);
                //out.close();
+               
                if (m->control_pressed) { return 0; }
                
                m->mothurOut(toString(num) + " names read."); m->mothurOutEndLine();
index 5816cfd0ab07d7718c73e66a7fc2c9e0c1c61187..afd9dd4acf22e8fc417fd6aeacb507a120987db8 100644 (file)
@@ -236,10 +236,8 @@ int RemoveSeqsCommand::readFasta(){
                in.close();     
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else { outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) {  m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
                
@@ -307,11 +305,9 @@ int RemoveSeqsCommand::readList(){
                in.close();     
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else { outputNames.push_back(outputFileName); }
-               
+               if (wroteSomething == false) {  m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
+                               
                return 0;
 
        }
@@ -395,11 +391,9 @@ int RemoveSeqsCommand::readName(){
                in.close();
                out.close();
 
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else { outputNames.push_back(outputFileName); }
-               
+               if (wroteSomething == false) {  m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
+                               
                return 0;
        }
        catch(exception& e) {
@@ -439,10 +433,8 @@ int RemoveSeqsCommand::readGroup(){
                in.close();
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else { outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) {  m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
        }
@@ -482,10 +474,8 @@ int RemoveSeqsCommand::readTax(){
                in.close();
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else { outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) {  m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;
        }
@@ -548,10 +538,8 @@ int RemoveSeqsCommand::readAlign(){
                in.close();
                out.close();
                
-               if (wroteSomething == false) {
-                       m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();
-                       remove(outputFileName.c_str()); 
-               }else { outputNames.push_back(outputFileName); }
+               if (wroteSomething == false) {  m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine();  }
+               outputNames.push_back(outputFileName); 
                
                return 0;