]> git.donarmstrong.com Git - mothur.git/blobdiff - treemap.cpp
fixed multiple bugs for 1.4 release
[mothur.git] / treemap.cpp
index 00ae0e664ff5fb7d289893b445be08b5fd20c89a..8e3fd58b94cbf6e9c16e9b0335fb71cbf5cd68bb 100644 (file)
@@ -162,13 +162,44 @@ void TreeMap::makeSim(GroupMap* groupmap) {
                
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function make. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function makeSim. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
        catch(...) {
-               cout << "An unknown error has occurred in the TreeMap class function make. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "An unknown error has occurred in the TreeMap class function makeSim. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
 }
 /************************************************************/
+void TreeMap::makeSim(ListVector* list) {
+       try {
+               //set names of groups
+               namesOfGroups.clear();
+               for(int i = 0; i < list->size(); i++) {
+                       namesOfGroups.push_back(list->get(i));
+               }
+               
+               //set names of seqs to names of groups
+               namesOfSeqs = namesOfGroups;
+               
+               // make map where key and value are both the group name since that what the tree.shared command wants
+               for (int i = 0; i < namesOfGroups.size(); i++) {
+                       treemap[namesOfGroups[i]].groupname = namesOfGroups[i];
+                       seqsPerGroup[namesOfGroups[i]] = 1;
+               }
+               
+               numGroups = namesOfGroups.size();
+               
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function makeSim. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the TreeMap class function makeSim. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+}
+
+/************************************************************/