]> git.donarmstrong.com Git - mothur.git/blobdiff - treegroupscommand.cpp
bug in dist.shared and tree.shared with new subsampling code when groups were elimina...
[mothur.git] / treegroupscommand.cpp
index 2542431f111f85b5bc344d93388662364045a509..c26199d673088b5b64872b672ab8e64ca780e616 100644 (file)
@@ -570,13 +570,6 @@ vector< vector<double> > TreeGroupCommand::makeSimsDist() {
 int TreeGroupCommand::makeSimsShared() {
        try {
         
-        numGroups = lookup.size();
-               lines.resize(processors);
-               for (int i = 0; i < processors; i++) {
-                       lines[i].start = int (sqrt(float(i)/float(processors)) * numGroups);
-                       lines[i].end = int (sqrt(float(i+1)/float(processors)) * numGroups);
-               }       
-        
         if (subsample) { 
             if (subsampleSize == -1) { //user has not set size, set size = smallest samples size
                 subsampleSize = lookup[0]->getNumSeqs();
@@ -601,8 +594,17 @@ int TreeGroupCommand::makeSimsShared() {
                 lookup = temp;
                 m->setGroups(Groups);
             }
+            
+            if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups.  I cannot run the command."); m->mothurOutEndLine(); m->control_pressed = true; return 0; }
         }
         
+        numGroups = lookup.size();
+               lines.resize(processors);
+               for (int i = 0; i < processors; i++) {
+                       lines[i].start = int (sqrt(float(i)/float(processors)) * numGroups);
+                       lines[i].end = int (sqrt(float(i+1)/float(processors)) * numGroups);
+               }       
+        
                set<string> processedLabels;
                set<string> userLabels = labels;