]> git.donarmstrong.com Git - mothur.git/commitdiff
skip cases where scores.size is less than the base map
authorDon Armstrong <don@donarmstrong.com>
Fri, 11 Apr 2014 18:38:52 +0000 (11:38 -0700)
committerDon Armstrong <don@donarmstrong.com>
Fri, 11 Apr 2014 18:38:52 +0000 (11:38 -0700)
makecontigscommand.cpp

index 15f002bffdbdc96e65ba18522955d500aa0fa8b0..e633a9c92a8b2647a97c1cf2bcf74ab6dc6a7bb0 100644 (file)
@@ -1059,7 +1059,8 @@ int MakeContigsCommand::driver(vector<string> files, string outputFasta, string
                     }else { contig += seq1[i]; } //with no quality info, then we keep it?
                 }else if (((seq1[i] != '-') && (seq1[i] != '.')) && ((seq2[i] != '-') && (seq2[i] != '.'))) { //both bases choose one with better quality
                     if (thisfqualfile != "") {
-                        if (abs(scores1[ABaseMap[i]] - scores2[BBaseMap[i]]) >= deltaq) { //is the difference in qual scores >= deltaq, if yes choose base with higher score
+                      if (ABaseMap[i] <= scores1.size() && BBaseMap[i] <= scores2.size() && // this check is dumb; we should determine this earlier
+                          abs(scores1[ABaseMap[i]] - scores2[BBaseMap[i]]) >= deltaq) { //is the difference in qual scores >= deltaq, if yes choose base with higher score
                             char c = seq1[i];
                             if (scores1[ABaseMap[i]] < scores2[BBaseMap[i]]) { c = seq2[i]; }
                             contig += c;