]> git.donarmstrong.com Git - mothur.git/blobdiff - trimseqscommand.cpp
fixed trim.seqs bug with qtrim parameter and added num=1 special case to database...
[mothur.git] / trimseqscommand.cpp
index 20002049ce986b01f5395ed2b807471cf954133f..2dc07794be5abb2f239e4b228c3aacbf51c51b6e 100644 (file)
@@ -455,7 +455,7 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
        try {
                
                ofstream outFASTA;
-               int able = m->openOutputFile(trimFile, outFASTA);
+               m->openOutputFile(trimFile, outFASTA);
                
                ofstream scrapFASTA;
                m->openOutputFile(scrapFile, scrapFASTA);
@@ -556,16 +556,16 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
 
                                
                                if(qFileName != ""){
+                                       int origLength = currSeq.getNumBases();
                                        
                                        if(qThreshold != 0)                     {       success = currQual.stripQualThreshold(currSeq, qThreshold);                     }
                                        else if(qAverage != 0)          {       success = currQual.cullQualAverage(currSeq, qAverage);                          }
                                        else if(qRollAverage != 0)      {       success = currQual.stripQualRollingAverage(currSeq, qRollAverage);      }
                                        else if(qWindowAverage != 0){   success = currQual.stripQualWindowAverage(currSeq, qWindowStep, qWindowSize, qWindowAverage);   }
                                        else                                            {       success = 1;                            }
-
-//                                     if (qtrim == 1 && (origSeq.length() != currSeq.getUnaligned().length())) { 
-//                                             success = 0; //if you don't want to trim and the sequence does not meet quality requirements, move to scrap
-//                                     }
+                                       
+                                       //you don't want to trim, if it fails above then scrap it
+                                       if ((!qtrim) && (origLength != currSeq.getNumBases())) { success = 0; }
                                        
                                        if(!success)                            {       trashCode += 'q';       }
                                }                               
@@ -1095,7 +1095,6 @@ int TrimSeqsCommand::stripBarcode(Sequence& seq, QualityScores& qual, int& group
                                oligo = oligo.substr(0,alnLength);
                                temp = temp.substr(0,alnLength);
                                
-                               int newStart=0;
                                int numDiff = countDiffs(oligo, temp);
                                
 //                             cout << oligo << '\t' << temp << '\t' << numDiff << endl;                               
@@ -1220,7 +1219,6 @@ int TrimSeqsCommand::stripForward(Sequence& seq, QualityScores& qual, int& group
                                oligo = oligo.substr(0,alnLength);
                                temp = temp.substr(0,alnLength);
                                
-                               int newStart=0;
                                int numDiff = countDiffs(oligo, temp);
                                
 //                             cout << oligo << '\t' << temp << '\t' << numDiff << endl;