+ else {
+ //valid paramters for this command
+ string Array[] = {"label","sorted","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 = "";
+ outputDir += m->hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it
+ }
+
+ //initialize outputTypes
+ vector<string> tempOutNames;
+ outputTypes["rabund"] = tempOutNames;
+
+ //make sure the user has already run the read.otu command
+ if (globaldata->getListFile() == "") { m->mothurOut("You must read a listfile before you can use the get.rabund command."); m->mothurOutEndLine(); abort = true; }
+
+ //check for optional parameter and set defaults
+ // ...at some point should added some additional type checking...
+
+ string temp;
+ temp = validParameter.validFile(parameters, "sorted", false); if (temp == "not found") { temp = "T"; }
+ sorted = m->isTrue(temp);
+
+ label = validParameter.validFile(parameters, "label", false);
+ if (label == "not found") { label = ""; }
+ else {
+ if(label != "all") { m->splitAtDash(label, labels); allLines = 0; }
+ else { allLines = 1; }
+ }
+
+ //if the user has not specified any labels use the ones from read.otu
+ if(label == "") {
+ allLines = globaldata->allLines;
+ labels = globaldata->labels;
+ }
+
+ if (abort == false) {
+ filename = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + "rabund";
+ m->openOutputFile(filename, out);
+ }
+ }
+