X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=unifracweightedcommand.cpp;h=1c146ac4d1b1168093cc6df20a8d37a930e1d56b;hb=250e3b11b1c9c1e1ad458ab6c7e71ac2e67e11d9;hp=f96264f4af2ad46a478ec9ada9b26ec03cea8865;hpb=bcb6728939694811bf6a00ae6d568f783840edfd;p=mothur.git diff --git a/unifracweightedcommand.cpp b/unifracweightedcommand.cpp index f96264f..1c146ac 100644 --- a/unifracweightedcommand.cpp +++ b/unifracweightedcommand.cpp @@ -359,7 +359,7 @@ int UnifracWeightedCommand::execute() { variables["[tag]"] = toString(i+1); string wFileName = getOutputFileName("weighted", variables); output = new ColumnFile(wFileName, itersString); - outputNames.push_back(wFileName); outputTypes["wweighted"].push_back(wFileName); + outputNames.push_back(wFileName); outputTypes["weighted"].push_back(wFileName); } userData = weighted.getValues(T[i], processors, outputDir); //userData[0] = weightedscore @@ -699,14 +699,16 @@ int UnifracWeightedCommand::runRandomCalcs(Tree* thisTree, vector usersS lines.clear(); //breakdown work between processors - int numPairs = namesOfGroupCombos.size(); - int numPairsPerProcessor = numPairs / processors; - - for (int i = 0; i < processors; i++) { - int startPos = i * numPairsPerProcessor; - if(i == processors - 1){ numPairsPerProcessor = numPairs - i * numPairsPerProcessor; } - lines.push_back(linePair(startPos, numPairsPerProcessor)); + int remainingPairs = namesOfGroupCombos.size(); + int startIndex = 0; + for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) { + int numPairs = remainingPairs; //case for last processor + if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); } + lines.push_back(linePair(startIndex, numPairs)); //startIndex, numPairs + startIndex = startIndex + numPairs; + remainingPairs = remainingPairs - numPairs; } + //get scores for random trees