]> git.donarmstrong.com Git - mothur.git/blobdiff - qualityscores.cpp
small bug with trimming of quality scores over a window. lost last base if sequence...
[mothur.git] / qualityscores.cpp
index 520d0bb56eae9c66a936311ca71aa5330bf29aa1..ae85d86199c3ce9fbec09aac5525b17db3c4297a 100644 (file)
@@ -286,23 +286,26 @@ bool QualityScores::stripQualWindowAverage(Sequence& sequence, int stepSize, int
 
                if(seqLength < windowSize) {    return 0;       }
                        
-               while(start < seqLength){
+               while((start+windowSize) < seqLength){
                        double windowSum = 0.0000;
 
                        for(int i=start;i<end;i++){
                                windowSum += qScores[i];
                        }
                        double windowAverage = windowSum / (double)(end-start);
-                       
+                               
                        if(windowAverage < qThreshold){
                                end = end - stepSize;
                                break;
                        }
+                       
                        start += stepSize;
                        end = start + windowSize;
-                       if(end >= seqLength){   end = seqLength - 1;    }
+                               
+                       if(end >= seqLength){   end = seqLength;        }
+                               
                }
-               
+       
                if(end == -1){  end = seqLength;        }
                
                //failed first window