]> git.donarmstrong.com Git - mothur.git/blobdiff - treemap.cpp
added logfile feature
[mothur.git] / treemap.cpp
index 5880b0c593fdd0dc96808e485921d96871e865d6..044e87ca6c603f8762edc863e5adf827ede73bad 100644 (file)
@@ -17,7 +17,7 @@
 }
 
 /************************************************************/
- TreeMap::~TreeMap(){};
+ TreeMap::~TreeMap(){}
 
 /************************************************************/
 void TreeMap::readMap() {
@@ -116,11 +116,7 @@ bool TreeMap::isValidGroup(string groupname) {
                return false;
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function isValidGroup. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the TreeMap class function isValidGroup. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "TreeMap", "isValidGroup");
                exit(1);
        }
 }
@@ -134,11 +130,7 @@ void TreeMap::print(ostream& output){
                }
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the TreeMap class Function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the TreeMap class function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               errorOut(e, "TreeMap", "print");
                exit(1);
        }
 }
@@ -152,7 +144,7 @@ void TreeMap::makeSim(GroupMap* groupmap) {
                //set names of seqs to names of groups
                namesOfSeqs = groupmap->namesOfGroups;
                
-               // make map where key and value are both the group name since that what the tree.groups command wants
+               // 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;
@@ -162,13 +154,36 @@ 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";
+               errorOut(e, "TreeMap", "makeSim");
                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";
+}
+/************************************************************/
+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) {
+               errorOut(e, "TreeMap", "makeSim");
                exit(1);
        }
 }
+
 /************************************************************/