X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=decalc.cpp;h=f0b1ecc4fb1d31cbb79837579604cffaf84863e9;hb=d8ed98e71c2da5b39b8a778e2c694a4ddff677eb;hp=9894adbda2aab2f4ddac2b786c69bffc8778335f;hpb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;p=mothur.git diff --git a/decalc.cpp b/decalc.cpp index 9894adb..f0b1ecc 100644 --- a/decalc.cpp +++ b/decalc.cpp @@ -780,7 +780,7 @@ vector DeCalculator::findClosest(Sequence* querySeq, vector seen; map::iterator it; @@ -825,12 +825,17 @@ vector DeCalculator::findClosest(Sequence* querySeq, vector dists.size()) { m->mothurOut("numwanted is larger than the number of template sequences, adjusting numwanted."); m->mothurOutEndLine(); numWanted = dists.size(); } + if (numWanted > dists.size()) { + //m->mothurOut("numwanted is larger than the number of template sequences, adjusting numwanted."); m->mothurOutEndLine(); + numWanted = dists.size(); + } //cout << numWanted << endl; for (int i = 0; i < numWanted; i++) { //cout << dists[i].seq->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. + seqsMatches.push_back(temp); indexes.push_back(dists[i].index); } @@ -952,7 +957,6 @@ map DeCalculator::trimSeqs(Sequence* query, vector topMatch map trimmedPos; //check to make sure that is not whole seq if ((rearPos - frontPos - 1) <= 0) { - //m->mothurOut("[ERROR]: when I trim " + query->getName() + ", the entire sequence is trimmed. Skipping."); m->mothurOutEndLine(); query->setAligned(""); //trim topMatches for (int i = 0; i < topMatches.size(); i++) {