X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getseqscommand.cpp;h=6b16111fdcda83099c0e36396543d40ee345c865;hb=e8e13c129ba8184ec5932a090773f353f3ae3406;hp=e0faef4cc07bd3fc6626fe186ec67fe05c512023;hpb=ea4f373c28543cd1002b0dd7dc6e55c526647d59;p=mothur.git diff --git a/getseqscommand.cpp b/getseqscommand.cpp index e0faef4..6b16111 100644 --- a/getseqscommand.cpp +++ b/getseqscommand.cpp @@ -10,6 +10,7 @@ #include "getseqscommand.h" #include "sequence.hpp" #include "listvector.hpp" +#include "counttable.h" //********************************************************************************************************************** vector GetSeqsCommand::setParameters(){ @@ -90,7 +91,7 @@ string GetSeqsCommand::getOutputFileNameTag(string type, string inputName=""){ if (type == "fasta") { outputFileName = "pick" + m->getExtension(inputName); } else if (type == "taxonomy") { outputFileName = "pick" + m->getExtension(inputName); } else if (type == "name") { outputFileName = "pick" + m->getExtension(inputName); } - else if (type == "count") { outputFileName = "pick.count.table"; } + else if (type == "count") { outputFileName = "pick.count_table"; } else if (type == "group") { outputFileName = "pick" + m->getExtension(inputName); } else if (type == "list") { outputFileName = "pick" + m->getExtension(inputName); } else if (type == "qfile") { outputFileName = "pick" + m->getExtension(inputName); } @@ -568,6 +569,13 @@ int GetSeqsCommand::readCount(){ } in.close(); out.close(); + + //check for groups that have been eliminated + CountTable ct; + if (ct.testGroups(outputFileName)) { + ct.readTable(outputFileName); + ct.printTable(outputFileName); + } if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); } outputTypes["count"].push_back(outputFileName); outputNames.push_back(outputFileName); @@ -617,19 +625,16 @@ int GetSeqsCommand::readList(){ //parse out names that are in accnos file string binnames = list.get(i); + vector bnames; + m->splitAtComma(binnames, bnames); string newNames = ""; - while (binnames.find_first_of(',') != -1) { - string name = binnames.substr(0,binnames.find_first_of(',')); - binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length()); - + for (int i = 0; i < bnames.size(); i++) { + string name = bnames[i]; //if that name is in the .accnos file, add it if (names.count(name) != 0) { newNames += name + ","; selectedCount++; if (m->debug) { sanity["list"].insert(name); } } } - //get last name - if (names.count(binnames) != 0) { newNames += binnames + ","; selectedCount++; if (m->debug) { sanity["list"].insert(binnames); } } - //if there are names in this bin add to new list if (newNames != "") { newNames = newNames.substr(0, newNames.length()-1); //rip off extra comma