if(option == "help") { help(); abort = true; }
else {
- if (option != "") { mothurOut("There are no valid parameters for the get.group command."); mothurOutEndLine(); abort = true; }
+ //valid paramters for this command
+ string Array[] = {"outputdir","inputdir"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+
+ OptionParser parser(option);
+ map<string,string> parameters = parser.getParameters();
+
+ ValidParameters validParameter;
+ //check to make sure all parameters are valid for command
+ for (map<string,string>::iterator it = parameters.begin(); it != parameters.end(); it++) {
+ if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
+ }
+
+ //if the user changes the output directory command factory will send this info to us in the output parameter
+ string outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; }
if ((globaldata->getSharedFile() == "")) { mothurOut("You must use the read.otu command to read a groupfile or a sharedfile before you can use the get.group command."); mothurOutEndLine(); abort = true; }
openInputFile(sharedfile, in);
//open output file
- outputFile = getRootName(sharedfile) + "bootGroups";
+ if (outputDir == "") { outputDir += hasPath(sharedfile); }
+ outputFile = outputDir + getRootName(getSimpleName(sharedfile)) + "bootGroups";
openOutputFile(outputFile, out);
}
void GetgroupCommand::help(){
try {
mothurOut("The get.group command can only be executed after a successful read.otu command.\n");
- //mothurOut("The get.group command outputs a .bootGroups file to you can use in addition to the tree file generated by the bootstrap.shared command to run the concensus command.\n");
+ //mothurOut("The get.group command outputs a .bootGroups file to you can use in addition to the tree file generated by the bootstrap.shared command to run the consensus command.\n");
mothurOut("You may not use any parameters with the get.group command.\n");
mothurOut("The get.group command should be in the following format: \n");
mothurOut("get.group()\n");