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
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
//pass numSeqs to parent
ofstream out;
- string tempFile = outputDir + toString(getpid()) + ".weightedcommand.results.temp";
+ string tempFile = outputDir + m->mothurGetpid(process) + ".weightedcommand.results.temp";
m->openOutputFile(tempFile, out);
for (int i = lines[process].start; i < (lines[process].start + lines[process].num); i++) { out << scores[i][(scores[i].size()-1)] << '\t'; } out << endl;
out.close();