]> git.donarmstrong.com Git - mothur.git/blobdiff - trimseqscommand.cpp
sens.spec changes
[mothur.git] / trimseqscommand.cpp
index 71cf7143c55392208523c390cfb3924304eeede9..cbf5e13603ced805d185196fad9129eacb573d22 100644 (file)
@@ -283,6 +283,7 @@ int TrimSeqsCommand::execute(){
                                                                                
                for(int i=0;i<fastaFileNames.size();i++){
                        if (isBlank(fastaFileNames[i])) { remove(fastaFileNames[i].c_str()); }
+                       else if (filesToRemove.count(fastaFileNames[i]) > 0) { remove(fastaFileNames[i].c_str()); }
                        else {
                                ifstream inFASTA;
                                string seqName;
@@ -377,7 +378,7 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                        int success = 1;
                        
                        Sequence currSeq(inFASTA);
-       cout << i << '\t' << currSeq.getName() << endl;
+
                        string origSeq = currSeq.getUnaligned();
                        if (origSeq != "") {
                                int groupBar, groupPrime;
@@ -443,7 +444,6 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                                                        }
                                                }
                                                outGroups << currSeq.getName() << '\t' << thisGroup << endl;
-                                               
                                                if(allFiles){
                                                        currSeq.printSequence(*fastaFileNames[indexToFastaFile]);                                       
                                                }
@@ -617,9 +617,11 @@ void TrimSeqsCommand::getOligos(vector<string>& outFASTAVec){ //vector<ofstream*
                                        groupVector.push_back(group);
                                        
                                        if(allFiles){
-                                               if (group != "") { //there is a group for this primer
+                                               outFASTAVec.push_back((outputDir + getRootName(getSimpleName(fastaFile)) + toString(index) + "." + group + ".fasta"));
+                                               if (group == "") { //if there is not a group for this primer, then this file will not get written to, but we add it to keep the indexes correct
+                                                       filesToRemove.insert((outputDir + getRootName(getSimpleName(fastaFile)) + toString(index) + "." + group + ".fasta"));
+                                               }else {
                                                        outputNames.push_back((outputDir + getRootName(getSimpleName(fastaFile)) + toString(index) + "." + group + ".fasta"));
-                                                       outFASTAVec.push_back((outputDir + getRootName(getSimpleName(fastaFile)) + toString(index) + "." + group + ".fasta"));
                                                }
                                        }