X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=chimerauchimecommand.cpp;h=7a48cf70d092f7d05c8b3bc3656bd66bf17c02d8;hp=422792a68525b495008694360c393e26ba358c09;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=af0a94ea8f02421b2b73e77e68753a2b4c37768e diff --git a/chimerauchimecommand.cpp b/chimerauchimecommand.cpp index 422792a..7a48cf7 100644 --- a/chimerauchimecommand.cpp +++ b/chimerauchimecommand.cpp @@ -569,6 +569,7 @@ ChimeraUchimeCommand::ChimeraUchimeCommand(string option) { if (hasName && (templatefile != "self")) { m->mothurOut("You have provided a namefile and the reference parameter is not set to self. I am not sure what reference you are trying to use, aborting."); m->mothurOutEndLine(); abort=true; } + if (hasCount && (templatefile != "self")) { m->mothurOut("You have provided a countfile and the reference parameter is not set to self. I am not sure what reference you are trying to use, aborting."); m->mothurOutEndLine(); abort=true; } if (hasGroup && (templatefile != "self")) { m->mothurOut("You have provided a group file and the reference parameter is not set to self. I am not sure what reference you are trying to use, aborting."); m->mothurOutEndLine(); abort=true; } //look for uchime exe @@ -674,7 +675,7 @@ int ChimeraUchimeCommand::execute(){ int error; if (hasCount) { CountTable ct; - ct.readTable(nameFile, true); + ct.readTable(nameFile, true, false); for(map::iterator it = seqs.begin(); it != seqs.end(); it++) { int num = ct.getNumSeqs(it->first); if (num == 0) { error = 1; } @@ -725,7 +726,7 @@ int ChimeraUchimeCommand::execute(){ if(processors == 1) { totalSeqs = driverGroups(outputFileName, newFasta, accnosFileName, alnsFileName, newCountFile, 0, groups.size(), groups); if (hasCount && dups) { - CountTable c; c.readTable(nameFile, true); + CountTable c; c.readTable(nameFile, true, false); if (!m->isBlank(newCountFile)) { ifstream in2; m->openInputFile(newCountFile, in2); @@ -755,7 +756,7 @@ int ChimeraUchimeCommand::execute(){ if (hasCount) { set doNotRemove; - CountTable c; c.readTable(newCountFile, true); + CountTable c; c.readTable(newCountFile, true, true); vector namesInTable = c.getNamesOfSeqs(); for (int i = 0; i < namesInTable.size(); i++) { int temp = c.getNumSeqs(namesInTable[i]); @@ -1795,21 +1796,23 @@ int ChimeraUchimeCommand::createProcessesGroups(string outputFName, string filen int num = 0; CountTable newCount; - if (hasCount && dups) { newCount.readTable(nameFile, true); } + if (hasCount && dups) { newCount.readTable(nameFile, true, false); } //sanity check if (groups.size() < processors) { processors = groups.size(); } //divide the groups between the processors vector lines; - int numGroupsPerProcessor = groups.size() / processors; - for (int i = 0; i < processors; i++) { - int startIndex = i * numGroupsPerProcessor; - int endIndex = (i+1) * numGroupsPerProcessor; - if(i == (processors - 1)){ endIndex = groups.size(); } - lines.push_back(linePair(startIndex, endIndex)); - } - + int remainingPairs = groups.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, (startIndex+numPairs))); //startIndex, endIndex + startIndex = startIndex + numPairs; + remainingPairs = remainingPairs - numPairs; + } + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) //loop through and create all the processes you want