]> git.donarmstrong.com Git - mothur.git/commitdiff
changes to read.tree
authorpschloss <pschloss>
Thu, 26 Aug 2010 20:48:56 +0000 (20:48 +0000)
committerpschloss <pschloss>
Thu, 26 Aug 2010 20:48:56 +0000 (20:48 +0000)
readtreecommand.cpp
tree.cpp

index deae495a2171c6af3d117436920558f2e10e7a27..0a86f36dfdced49cb6151205e82c0372556e1209 100644 (file)
@@ -153,38 +153,46 @@ int ReadTreeCommand::execute(){
                        T[i]->assembleTree();
                }
 
+               
+//             Sarah, isn't this checking already done when assigning the sequences to the groups?  it makes read.tree
+//             wicked slow...  For some reason my tree is coming in here eventhough the number of sequences in the tree
+//             agrees with the number of lines in the name file and the number of sequences represented by the name file
+//             agrees with the number of sequences in the group file
+
                //output any names that are in group file but not in tree
-               if (globaldata->Treenames.size() < treeMap->getNumSeqs()) {
-                       for (int i = 0; i < treeMap->namesOfSeqs.size(); i++) {
-                               //is that name in the tree?
-                               int count = 0;
-                               for (int j = 0; j < globaldata->Treenames.size(); j++) {
-                                       if (treeMap->namesOfSeqs[i] == globaldata->Treenames[j]) { break; } //found it
-                                       count++;
-                               }
-                               
-                               if (m->control_pressed) {  
-                                       for (int i = 0; i < T.size(); i++) {  delete T[i];  }
-                                       globaldata->gTree.clear();
-                                       delete globaldata->gTreemap;
-                                       return 0;
-                               }
-                               
-                               //then you did not find it so report it 
-                               if (count == globaldata->Treenames.size()) { 
-                                       //if it is in your namefile then don't remove
-                                       map<string, string>::iterator it = nameMap.find(treeMap->namesOfSeqs[i]);
-                                       
-                                       if (it == nameMap.end()) {
-                                               m->mothurOut(treeMap->namesOfSeqs[i] + " is in your groupfile and not in your tree. It will be disregarded."); m->mothurOutEndLine();
-                                               treeMap->removeSeq(treeMap->namesOfSeqs[i]);
-                                               i--; //need this because removeSeq removes name from namesOfSeqs
-                                       }
-                               }
-                       }
-                       
-                       globaldata->gTreemap = treeMap;
-               }
+               
+//             if (globaldata->Treenames.size() < treeMap->getNumSeqs()) {
+//                     cout << "in here" << endl;
+//                     for (int i = 0; i < treeMap->namesOfSeqs.size(); i++) {
+//                             //is that name in the tree?
+//                             int count = 0;
+//                             for (int j = 0; j < globaldata->Treenames.size(); j++) {
+//                                     if (treeMap->namesOfSeqs[i] == globaldata->Treenames[j]) { break; } //found it
+//                                     count++;
+//                             }
+//                             
+//                             if (m->control_pressed) {  
+//                                     for (int i = 0; i < T.size(); i++) {  delete T[i];  }
+//                                     globaldata->gTree.clear();
+//                                     delete globaldata->gTreemap;
+//                                     return 0;
+//                             }
+//                             
+//                             //then you did not find it so report it 
+//                             if (count == globaldata->Treenames.size()) { 
+//                                     //if it is in your namefile then don't remove
+//                                     map<string, string>::iterator it = nameMap.find(treeMap->namesOfSeqs[i]);
+//                                     
+//                                     if (it == nameMap.end()) {
+//                                             m->mothurOut(treeMap->namesOfSeqs[i] + " is in your groupfile and not in your tree. It will be disregarded."); m->mothurOutEndLine();
+//                                             treeMap->removeSeq(treeMap->namesOfSeqs[i]);
+//                                             i--; //need this because removeSeq removes name from namesOfSeqs
+//                                     }
+//                             }
+//                     }
+//                     
+//                     globaldata->gTreemap = treeMap;
+//             }
                
                return 0;
        }
index 14d86e6daf211b625931c3d52a127cd441086267..a104477d0a90280a528d5cea4deb80ba2133ba09 100644 (file)
--- a/tree.cpp
+++ b/tree.cpp
@@ -69,6 +69,9 @@ void Tree::addNamesToCounts() {
 
                                
                //go through each leaf and update its pcounts and pgroups
+               
+               float A = clock();
+
                for (int i = 0; i < numLeaves; i++) {
 
                        string name = tree[i].getName();
@@ -132,7 +135,11 @@ void Tree::addNamesToCounts() {
                                tree[i].setGroup(nodeGroups);
                                
                        }//end else
-               }//end for                                      
+               }//end for              
+               
+               float B = clock();
+               cout << "addNamesToCounts\t" << (B - A) / CLOCKS_PER_SEC << endl;       
+
        }
        catch(exception& e) {
                m->errorOut(e, "Tree", "addNamesToCounts");
@@ -168,7 +175,8 @@ void Tree::setIndex(string searchName, int index) {
 /*****************************************************************/
 int Tree::assembleTree() {
        try {
-       
+               float A = clock();
+
                //if user has given a names file we want to include that info in the pgroups and pcount info.
                if(globaldata->names.size() != 0) {  addNamesToCounts();  }
                
@@ -179,7 +187,8 @@ int Tree::assembleTree() {
                        tree[i].pGroups = (mergeGroups(i));
                        tree[i].pcount = (mergeGcounts(i));
                }
-               
+               float B = clock();
+               cout << "assembleTree\t" << (B-A) / CLOCKS_PER_SEC << endl;
                return 0;
        }
        catch(exception& e) {