X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=suffixdb.cpp;h=4fc342dd8bd26f7809ef93ce57da1b5563ee4ad1;hp=5bcd8e96c0be725ee978ba74a4d32bb36b3aa4e0;hb=050a3ff02473a3d4c0980964e1a9ebe52e55d6b8;hpb=510b1cfc25cd79391d6973ca20c5ec25fb1bb3b2 diff --git a/suffixdb.cpp b/suffixdb.cpp index 5bcd8e9..4fc342d 100644 --- a/suffixdb.cpp +++ b/suffixdb.cpp @@ -22,41 +22,64 @@ /**************************************************************************************************/ -SuffixDB::SuffixDB(string fastaFileName) : Database(fastaFileName) { - +SuffixDB::SuffixDB(int numSeqs) : Database() { suffixForest.resize(numSeqs); - mothurOut("Generating the suffix tree database...\t"); cout.flush(); - for(int i=0;iconvert2ints(); // the candidate sequence needs to be a string of ints - for(int i=0;i SuffixDB::findClosestSequences(Sequence* candidateSeq, int num){ + try { + vector topMatches; + string processedSeq = candidateSeq->convert2ints(); // the candidate sequence needs to be a string of ints + + vector seqMatches; + for(int i=0;ierrorOut(e, "SuffixDB", "findClosestSequences"); + exit(1); + } +} +/**************************************************************************************************/ +//adding the sequences generates the db +void SuffixDB::addSequence(Sequence seq) { + try { + suffixForest[count].loadSequence(seq); + count++; + } + catch(exception& e) { + m->errorOut(e, "SuffixDB", "addSequence"); + exit(1); } - searchScore = 100 * (1. - minValue / (float)processedSeq.length()); - return templateSequences[closestSequenceNo]; // return the Sequence object that has the minimum score - } - /**************************************************************************************************/ SuffixDB::~SuffixDB(){ - for (int i = (suffixForest.size()-1); i >= 0; i--) { suffixForest.pop_back(); } - // templateSequences.clear(); - } /**************************************************************************************************/