From: Sarah Westcott Date: Tue, 1 May 2012 15:17:36 +0000 (-0400) Subject: bug in dist.shared and tree.shared with new subsampling code when groups were elimina... X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=2b11c674bb4d57c4542ecb89989e1590dd9f07a7 bug in dist.shared and tree.shared with new subsampling code when groups were eliminated the numgroups and lines were not updated. --- diff --git a/matrixoutputcommand.cpp b/matrixoutputcommand.cpp index 0bfb009..c879d1b 100644 --- a/matrixoutputcommand.cpp +++ b/matrixoutputcommand.cpp @@ -298,13 +298,6 @@ int MatrixOutputCommand::execute(){ set userLabels = labels; if (lookup.size() < 2) { m->mothurOut("You have not provided enough valid groups. I cannot run the command."); m->mothurOutEndLine(); delete input; for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } 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); - } if (subsample) { if (subsampleSize == -1) { //user has not set size, set size = smallest samples size @@ -330,8 +323,17 @@ int MatrixOutputCommand::execute(){ 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; delete input; 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); + } + if (m->control_pressed) { delete input; for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->clearGroups(); return 0; } //as long as you are not at the end of the file or done wih the lines you want diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 2542431..c26199d 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -570,13 +570,6 @@ vector< vector > 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 processedLabels; set userLabels = labels;