]> git.donarmstrong.com Git - mothur.git/blobdiff - suffixtree.cpp
added groups option to read.otu, added qtrim option to trim.seqs, fixed bug in get...
[mothur.git] / suffixtree.cpp
index 492460d4dd68f4f025504b58acbc80fad09b09b7..53a6d3f8bc690ffec892d31eec5cb47a59ecd0e2 100644 (file)
@@ -41,16 +41,17 @@ SuffixTree::SuffixTree(){}
 
 SuffixTree::~SuffixTree(){
        for(int i=0;i<nodeVector.size();i++){   delete nodeVector[i];   }       
+       nodeVector.clear();
 }
 
 //********************************************************************************************************************
 
-void SuffixTree::loadSequence(Sequence* seq){
+void SuffixTree::loadSequence(Sequence seq){
        nodeCounter = 0;                                                        //      initially there are 0 nodes in the tree
        activeStartPosition = 0;
        activeEndPosition = -1;                                         
-       seqName = seq->getName();
-       sequence = seq->convert2ints();
+       seqName = seq.getName();
+       sequence = seq.convert2ints();
        sequence += '5';                                                        //      this essentially concatenates a '$' to the end of the sequence to
        int seqLength = sequence.length();                      //      make it a cononical suffix tree
        
@@ -74,7 +75,7 @@ string SuffixTree::getSeqName()       {
 void SuffixTree::print(){
        vector<SuffixNode*> hold = nodeVector;
        sort(hold.begin(), hold.end(), compareParents);
-       cout << "Address\t\tParent\tNode\tSuffix\tStartC\tEndC\tSuffix" << endl;
+       mothurOut("Address\t\tParent\tNode\tSuffix\tStartC\tEndC\tSuffix"); mothurOutEndLine();
        for(int i=1;i<=nodeCounter;i++){
                hold[i]->print(sequence, i);
        }