X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=unifracweightedcommand.cpp;h=541131efd5b15401c229a21966655d39e320a496;hb=006601d68abe8d0061f77e8d28323b160750e343;hp=cbec7490bfe028ea02de0b4a1e024b1ce2d89e1f;hpb=6c2b1e530a5c0bb87040e58a3e410097acdfcc3d;p=mothur.git diff --git a/unifracweightedcommand.cpp b/unifracweightedcommand.cpp index cbec749..541131e 100644 --- a/unifracweightedcommand.cpp +++ b/unifracweightedcommand.cpp @@ -305,7 +305,8 @@ int UnifracWeightedCommand::execute() { string s; //to make work with setgroups Groups = m->getGroups(); vector nameGroups = ct->getNamesOfGroups(); - util.setGroups(Groups, nameGroups, s, numGroups, "weighted"); //sets the groups the user wants to analyze + if (nameGroups.size() < 2) { m->mothurOut("[ERROR]: You cannot run unifrac.weighted with less than 2 groups, aborting.\n"); delete ct; for (int i = 0; i < T.size(); i++) { delete T[i]; } return 0; } + util.setGroups(Groups, nameGroups, s, numGroups, "weighted"); //sets the groups the user wants to analyze m->setGroups(Groups); if (m->control_pressed) { delete ct; for (int i = 0; i < T.size(); i++) { delete T[i]; } return 0; } @@ -384,16 +385,20 @@ int UnifracWeightedCommand::execute() { //subsample loop vector< vector > calcDistsTotals; //each iter, each groupCombos dists. this will be used to make .dist files for (int thisIter = 0; thisIter < subsampleIters; thisIter++) { //subsampleIters=0, if subsample=f. - if (m->control_pressed) { break; } //copy to preserve old one - would do this in subsample but memory cleanup becomes messy. CountTable* newCt = new CountTable(); + int sampleTime = 0; + if (m->debug) { sampleTime = time(NULL); } + //uses method of setting groups to doNotIncludeMe SubSample sample; Tree* subSampleTree = sample.getSample(T[i], ct, newCt, subsampleSize); - + + if (m->debug) { m->mothurOut("[DEBUG]: iter " + toString(thisIter) + " took " + toString(time(NULL) - sampleTime) + " seconds to sample tree.\n"); } + //call new weighted function vector iterData; iterData.resize(numComp,0); Weighted thisWeighted(includeRoot);