]> git.donarmstrong.com Git - mothur.git/blobdiff - decalc.cpp
tracking down chimera.slayer issue
[mothur.git] / decalc.cpp
index 1442bd8ec8865f0574d338675d5899332814d8a8..2a1736a7344e312e4d2cdb4371fc943335d6970b 100644 (file)
@@ -821,7 +821,7 @@ vector<Sequence*> DeCalculator::findClosest(Sequence* querySeq, vector<Sequence*
                
 //             cout << "lastLeft\t" << lastLeft << endl;
                
-               //add in dups
+               //add in sequences with same distance as last sequence added
                lasti++;
                int i = lasti;
                while (i < distsLeft.size()) {  
@@ -840,7 +840,7 @@ vector<Sequence*> DeCalculator::findClosest(Sequence* querySeq, vector<Sequence*
                }
                
 //             cout << "lastRight\t" << lastRight << endl;
-
+               //add in sequences with same distance as last sequence added
                i = lasti;
                while (i < distsRight.size()) {  
                        if (distsRight[i].dist == lastRight) {
@@ -868,10 +868,13 @@ vector<Sequence*> DeCalculator::findClosest(Sequence* querySeq, vector<Sequence*
                for (int i = 0; i < numWanted; i++) {
 //                     cout << db[dists[i].index]->getName() << '\t' << dists[i].dist << endl;
 
-                       Sequence* temp = new Sequence(db[dists[i].index]->getName(), db[dists[i].index]->getAligned()); //have to make a copy so you can trim and filter without stepping on eachother.
+                       if (db[dists[i].index]->getName() != querySeq->getName()) {
+                               Sequence* temp = new Sequence(db[dists[i].index]->getName(), db[dists[i].index]->getAligned()); //have to make a copy so you can trim and filter without stepping on eachother.
                        
-                       seqsMatches.push_back(temp);
-                       indexes.push_back(dists[i].index);
+                               seqsMatches.push_back(temp);
+                               indexes.push_back(dists[i].index);
+                       }
+
                }
                
                return seqsMatches;