X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getgroupcommand.cpp;h=8dae3f30092d0ae94e8b709119e933252f946f4a;hb=2c97dd48b8e27ee0a6a86c7a082f4c504c3357c6;hp=194e8e16b1e388bdb8d01ac372fbc884cbc92e43;hpb=19fcbbdba99658f5eca244803280f9ee7f9f6607;p=mothur.git diff --git a/getgroupcommand.cpp b/getgroupcommand.cpp index 194e8e1..8dae3f3 100644 --- a/getgroupcommand.cpp +++ b/getgroupcommand.cpp @@ -8,6 +8,7 @@ */ #include "getgroupcommand.h" +#include "inputdata.h" //********************************************************************************************************************** vector GetgroupCommand::setParameters(){ @@ -121,55 +122,20 @@ int GetgroupCommand::execute(){ try { if (abort == true) { if (calledHelp) { return 0; } return 2; } - - //open shared file - m->openInputFile(sharedfile, in); //open output file outputFile = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + "bootGroups"; m->openOutputFile(outputFile, out); - - int num, inputData, count; - count = 0; - string holdLabel, nextLabel, groupN, label; - - //read in first row since you know there is at least 1 group. - in >> label >> groupN >> num; - holdLabel = label; - - //output first group - m->mothurOut(groupN); m->mothurOutEndLine(); - out << groupN << '\t' << groupN << endl; - - //get rest of line - for(int i=0;i> inputData; - } - if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); m->mothurRemove(outputFile); return 0; } - - if (in.eof() != true) { in >> nextLabel; } + InputData input(sharedfile, "sharedfile"); + vector lookup = input.getSharedRAbundVectors(); - //read the rest of the groups info in - while ((nextLabel == holdLabel) && (in.eof() != true)) { - if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); m->mothurRemove(outputFile); return 0; } - - in >> groupN >> num; - count++; - - //output next group - m->mothurOut(groupN); m->mothurOutEndLine(); - out << groupN << '\t' << groupN << endl; - - //fill vector. - for(int i=0;i> inputData; - } - - if (in.eof() != true) { in >> nextLabel; } + for (int i = 0; i < lookup.size(); i++) { + out << lookup[i]->getGroup() << '\t' << lookup[i]->getGroup() << endl; + m->mothurOut(lookup[i]->getGroup()); m->mothurOutEndLine(); + delete lookup[i]; } - in.close(); out.close(); if (m->control_pressed) { m->mothurRemove(outputFile); return 0; }