]> git.donarmstrong.com Git - mothur.git/blobdiff - suffixtree.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / suffixtree.cpp
index 2842b366b3360f4b43ad32dd28603073266dcdfa..fd18109513bea9f59590e16a1c705128f61ca43e 100644 (file)
@@ -33,9 +33,28 @@ inline bool compareParents(SuffixNode* left, SuffixNode* right){//   this is neces
        return (left->getParentNode() < right->getParentNode());        //      nodes in order of their parent
 }
 
+//********************************************************************************************************************
+SuffixTree::SuffixTree(const SuffixTree& st) : root(st.root), activeEndPosition(st.activeEndPosition), activeStartPosition(st.activeStartPosition), activeNode(st.activeNode),
+                                                                                               nodeCounter(st.nodeCounter), seqName(st.seqName), sequence(st.sequence) { 
+       try {
+               m = MothurOut::getInstance(); 
+               
+               for (int i = 0; i < st.nodeVector.size(); i++) {
+                       SuffixNode* temp = new SuffixBranch(*((SuffixBranch*)st.nodeVector[i]));
+                       nodeVector.push_back(temp);
+               }
+               
+               
+       }catch(exception& e) {
+               m->errorOut(e, "SuffixTree", "SuffixTree");
+               exit(1);
+       }
+}
 //********************************************************************************************************************
 
-SuffixTree::SuffixTree(){}
+SuffixTree::SuffixTree(){ m = MothurOut::getInstance(); }
 
 //********************************************************************************************************************
 
@@ -75,7 +94,7 @@ string SuffixTree::getSeqName()       {
 void SuffixTree::print(){
        vector<SuffixNode*> hold = nodeVector;
        sort(hold.begin(), hold.end(), compareParents);
-       mothurOut("Address\t\tParent\tNode\tSuffix\tStartC\tEndC\tSuffix"); mothurOutEndLine();
+       m->mothurOut("Address\t\tParent\tNode\tSuffix\tStartC\tEndC\tSuffix"); m->mothurOutEndLine();
        for(int i=1;i<=nodeCounter;i++){
                hold[i]->print(sequence, i);
        }