]> git.donarmstrong.com Git - mothur.git/blobdiff - preclustercommand.cpp
fixed filterseqscommand bug where trump wasn't being used
[mothur.git] / preclustercommand.cpp
index 5dc2f5a79e006e947791042c9296fd3e646448a1..cab29633c8528c30fe0ba032cc6d76bfea44eccb 100644 (file)
@@ -134,17 +134,16 @@ int PreClusterCommand::execute(){
 
                //sort seqs by number of identical seqs
                alignSeqs.sort(comparePriority);
-               
+
                int count = 0;
                int i = 0;
-               
                //think about running through twice...
                list<seqPNode>::iterator itList;
                list<seqPNode>::iterator itList2;
-               for (itList = alignSeqs.begin(); itList != alignSeqs.end(); itList++) {
+               for (itList = alignSeqs.begin(); itList != alignSeqs.end();) {
                        
                        //try to merge it with all smaller seqs
-                       for (itList2 = alignSeqs.begin(); itList2 != alignSeqs.end(); itList2++) {
+                       for (itList2 = alignSeqs.begin(); itList2 != alignSeqs.end();) {
                                
                                if (m->control_pressed) { outFasta.close(); outNames.close(); remove(newFastaFile.c_str()); remove(newNamesFile.c_str());  return 0; }
                                
@@ -153,17 +152,16 @@ int PreClusterCommand::execute(){
                                        //are you within "diff" bases
                                        
                                        int mismatch = calcMisMatches((*itList).seq.getAligned(), (*itList2).seq.getAligned());
-                                                                       
+
                                        if (mismatch <= diffs) {
                                                //merge
                                                (*itList).names += ',' + (*itList2).names;
                                                (*itList).numIdentical += (*itList2).numIdentical;
                                                
-                                               itList2 = alignSeqs.erase(itList2); 
-
+                                               itList2 = alignSeqs.erase(itList2); //itList2--;
                                                count++;
-                                       }
-                               }
+                                       }else{ itList2++; }
+                               }else{ itList2++; }
 
                        }