X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=countgroupscommand.cpp;h=ccf8988e39308fd2816f6eb0a6ff0454ab944d19;hb=078d7227da8dda9ae8620822fa32d51ec2706fc3;hp=af9993c8ef6f8ee794be8bf7b3825aa34d1a44e7;hpb=d3aed959ca3b68890eeb7b815e24210bcfeb256c;p=mothur.git diff --git a/countgroupscommand.cpp b/countgroupscommand.cpp index af9993c..ccf8988 100644 --- a/countgroupscommand.cpp +++ b/countgroupscommand.cpp @@ -34,7 +34,7 @@ vector CountGroupsCommand::setParameters(){ string CountGroupsCommand::getHelpString(){ try { string helpString = ""; - helpString += "The count.groups command counts sequences from a specfic group or set of groups from the following file types: group or shared file.\n"; + helpString += "The count.groups command counts sequences from a specific group or set of groups from the following file types: group or shared file.\n"; helpString += "The count.groups command parameters are accnos, group, shared and groups. You must provide a group or shared file.\n"; helpString += "The accnos parameter allows you to provide a file containing the list of groups.\n"; helpString += "The groups parameter allows you to specify which of the groups in your groupfile you would like. You can separate group names with dashes.\n"; @@ -127,7 +127,7 @@ CountGroupsCommand::CountGroupsCommand(string option) { if (groups == "not found") { groups = ""; } else { m->splitAtDash(groups, Groups); - m->Groups = Groups; + m->setGroups(Groups); } sharedfile = validParameter.validFile(parameters, "shared", true); @@ -153,7 +153,7 @@ CountGroupsCommand::CountGroupsCommand(string option) { } } - if ((accnosfile == "") && (Groups.size() == 0)) { Groups.push_back("all"); m->Groups = Groups; } + if ((accnosfile == "") && (Groups.size() == 0)) { Groups.push_back("all"); m->setGroups(Groups); } } } @@ -170,7 +170,7 @@ int CountGroupsCommand::execute(){ if (abort == true) { if (calledHelp) { return 0; } return 2; } //get groups you want to remove - if (accnosfile != "") { readAccnos(); } + if (accnosfile != "") { m->readAccnos(accnosfile, Groups); m->setGroups(Groups); } if (groupfile != "") { GroupMap groupMap(groupfile); @@ -179,7 +179,8 @@ int CountGroupsCommand::execute(){ //make sure groups are valid //takes care of user setting groupNames that are invalid or setting groups=all SharedUtil util; - util.setGroups(Groups, groupMap.namesOfGroups); + vector nameGroups = groupMap.getNamesOfGroups(); + util.setGroups(Groups, nameGroups); for (int i = 0; i < Groups.size(); i++) { m->mothurOut(Groups[i] + " contains " + toString(groupMap.getNumSeqs(Groups[i])) + "."); m->mothurOutEndLine(); @@ -207,31 +208,5 @@ int CountGroupsCommand::execute(){ } } //********************************************************************************************************************** -void CountGroupsCommand::readAccnos(){ - try { - Groups.clear(); - - ifstream in; - m->openInputFile(accnosfile, in); - string name; - - while(!in.eof()){ - in >> name; - - Groups.push_back(name); - - m->gobble(in); - } - in.close(); - - m->Groups = Groups; - - } - catch(exception& e) { - m->errorOut(e, "CountGroupsCommand", "readAccnos"); - exit(1); - } -} -//**********************************************************************************************************************