#include "metastatscommand.h"
#include "sharedutilities.h"
+#include "sharedrabundfloatvector.h"
//**********************************************************************************************************************
int MetaStatsCommand::execute(){
try {
- if (abort == true) { if (calledHelp) { return 0; } return 2; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
//just used to convert files to test metastats online
/****************************************************/
convertSharedToInput = false;
if (convertInputToShared) { convertToShared(sharedfile); return 0; }
/****************************************************/
-
designMap = new GroupMap(designfile);
designMap->readDesignMap();
else if (numGroups < 2) { m->mothurOut("Not enough sets, I need at least 2 valid sets. Unable to complete command."); m->mothurOutEndLine(); m->control_pressed = true; }
if(processors != 1){
- 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;
}
}
string header = m->getline(in); m->gobble(in);
vector<string> groups = m->splitWhiteSpace(header);
- vector<SharedRAbundVector*> newLookup;
+ vector<SharedRAbundFloatVector*> newLookup;
+ cout << groups.size() << endl;
for (int i = 0; i < groups.size(); i++) {
- SharedRAbundVector* temp = new SharedRAbundVector();
+ cout << "creating group " << groups[i] << endl;
+ SharedRAbundFloatVector* temp = new SharedRAbundFloatVector();
temp->setLabel("0.03");
temp->setGroup(groups[i]);
newLookup.push_back(temp);
string otuname;
in >> otuname; m->gobble(in);
otuCount++;
-
+ cout << otuname << endl;
for (int i = 0; i < groups.size(); i++) {
- int temp;
+ double temp;
in >> temp; m->gobble(in);
newLookup[i]->push_back(temp, groups[i]);
}
out << subset[subset.size()-1]->getGroup() << endl;
for (int i = 0; i < subset[0]->getNumBins(); i++) {
- out << m->currentBinLabels[i] << '\t';
+ out << m->currentSharedBinLabels[i] << '\t';
for (int j = 0; j < subset.size()-1; j++) {
out << subset[j]->getAbundance(i) << '\t';
}
}
out.close();
+ cout << thisfilename+".matrix" << endl;
+
return 0;
}
catch(exception& e) {