]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed issue in tree.shared when shared file was not sorted
authorSarah Westcott <mothur.westcott@gmail.com>
Mon, 17 Dec 2012 18:07:31 +0000 (13:07 -0500)
committerSarah Westcott <mothur.westcott@gmail.com>
Mon, 17 Dec 2012 18:07:31 +0000 (13:07 -0500)
sharedutilities.cpp
treegroupscommand.cpp

index 71d7782cad87c7914c2d14071ec1cc657b2803d1..d9891db7966da9178ce0b0deaa177ddeb192fc79 100644 (file)
@@ -22,7 +22,9 @@ void SharedUtil::getSharedVectors(vector<string> Groups, vector<SharedRAbundVect
                }
                
                lookup.clear();
-               
+        
+               sort(Groups.begin(), Groups.end());
+        
                //create and initialize vector of sharedvectors, one for each group
                for (int i = 0; i < Groups.size(); i++) { 
                        SharedRAbundVector* temp = new SharedRAbundVector(order->getNumBins());
index 90d336da38f57f70fa0f5ddb59125cc2099ec346..0d014599fa794217233694f8a28ed707b99c86eb 100644 (file)
@@ -429,7 +429,10 @@ int TreeGroupCommand::execute(){
                        m->Treenames.clear();
                        
                        //fills globaldatas tree names
-                       m->Treenames = m->getGroups();
+                       //m->Treenames = m->getGroups();
+            for (int k = 0; k < lookup.size(); k++) {
+                m->Treenames.push_back(lookup[k]->getGroup());
+            }
                
                        if (m->control_pressed) { return 0; }
                        
@@ -463,7 +466,10 @@ int TreeGroupCommand::execute(){
 
                        list = readMatrix->getListVector();
                        SparseDistanceMatrix* dMatrix = readMatrix->getDMatrix();
-
+            
+            //clear globaldatas old tree names if any
+                       m->Treenames.clear();
+            
                        //make treemap
             if (ct != NULL) { delete ct; }
                        ct = new CountTable();
@@ -475,17 +481,12 @@ int TreeGroupCommand::execute(){
                 nameMap.insert(bin); 
                 gps.insert(bin); 
                 groupMap[bin] = bin;
+                m->Treenames.push_back(bin);
             }
             ct->createTable(nameMap, groupMap, gps);
                        
                        vector<string> namesGroups = ct->getNamesOfGroups();
                        m->setGroups(namesGroups);
-               
-                       //clear globaldatas old tree names if any
-                       m->Treenames.clear();
-            
-                       //fills globaldatas tree names
-                       m->Treenames = m->getGroups();
                        
                        //used in tree constructor 
                        m->runParse = false;