]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed trim.seqs bug
authorwestcott <westcott>
Tue, 6 Jul 2010 15:51:21 +0000 (15:51 +0000)
committerwestcott <westcott>
Tue, 6 Jul 2010 15:51:21 +0000 (15:51 +0000)
trimseqscommand.cpp
trimseqscommand.h

index 5e0a6471010f6d66dafa82037adac1fdb5ab518a..1975f9ad26415f0b30e8dc0a15cec072b1eb0122 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 != "") {
@@ -444,7 +445,6 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                                                        }
                                                }
                                                outGroups << currSeq.getName() << '\t' << thisGroup << endl;
-                                               
                                                if(allFiles){
                                                        currSeq.printSequence(*fastaFileNames[indexToFastaFile]);                                       
                                                }
@@ -618,9 +618,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"));
                                                }
                                        }
 
index b5357b38e1e3bf892ef7f0cd9ffcfb7b7de4ec8a..fefe53490cc4b0c1275a006c0946f022c24e366a 100644 (file)
@@ -47,6 +47,7 @@ private:
        bool flip, allFiles, qtrim;
        int numFPrimers, numRPrimers, maxAmbig, maxHomoP, minLength, maxLength, qThreshold, qAverage, processors, tdiffs, bdiffs, pdiffs, comboStarts;
        vector<string> revPrimer, outputNames;
+       set<string> filesToRemove;
        map<string, int> barcodes;
        vector<string> groupVector;
        map<string, int> primers;