]> git.donarmstrong.com Git - mothur.git/blobdiff - treemap.cpp
added subsample and consensus parameters to unifrac.weighted command
[mothur.git] / treemap.cpp
index 1fc5c01b796a67bd948a70147fa4dead9320ea08..450d8fba67b8beafe7c824b6a18b479705b3875c 100644 (file)
@@ -229,6 +229,60 @@ void TreeMap::makeSim(ListVector* list) {
                exit(1);
        }
 }
+/************************************************************/
+int TreeMap::getCopy(TreeMap* copy){
+       try {
+         
+        namesOfGroups = copy->getNamesOfGroups();
+               numGroups = copy->getNumGroups();
+        namesOfSeqs = copy->namesOfSeqs;
+        seqsPerGroup = copy->seqsPerGroup;
+        treemap = copy->treemap;
+        
+        return 0;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "TreeMap", "getCopy");
+               exit(1);
+       }
+}
+/************************************************************/
+vector<string> TreeMap::getNamesSeqs(){
+       try {
+        
+               vector<string> names;
+               
+        for(it = treemap.begin(); it != treemap.end(); it++){
+            names.push_back(it->first);
+               }
+               
+               return names;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "TreeMap", "getNamesSeqs");
+               exit(1);
+       }
+}
+/************************************************************/
+vector<string> TreeMap::getNamesSeqs(vector<string> picked){
+       try {
+               
+               vector<string> names;
+               
+               for(it = treemap.begin(); it != treemap.end(); it++){
+                       //if you are belong to one the the groups in the picked vector add you
+                       if (m->inUsersGroups(it->second.groupname, picked)) {
+                               names.push_back(it->first);
+                       }
+               }
+               
+               return names;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "TreeMap", "getNamesSeqs");
+               exit(1);
+       }
+}
 
 /************************************************************/