else {
//valid paramters for this command
- string Array[] = {"random","groups","iters"};
+ string Array[] = {"random","groups","iters","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
if (globaldata->gTree.size() == 0) {
mothurOut("You must read a treefile and a groupfile or set the randomtree parameter to the output filename you wish, before you may execute the parsimony command."); mothurOutEndLine(); 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 = ""; }
+
//check for optional parameter and set defaults
// ...at some point should added some additional type checking...
groups = validParameter.validFile(parameters, "groups", false);
- if (groups == "not found") { groups = ""; }
+ if (groups == "not found") { groups = ""; globaldata->Groups.clear(); }
else {
splitAtDash(groups, Groups);
globaldata->Groups = Groups;
if (randomtree == "") {
T = globaldata->gTree;
tmap = globaldata->gTreemap;
- output = new ColumnFile(globaldata->getTreeFile() + ".parsimony", itersString);
- sumFile = globaldata->getTreeFile() + ".psummary";
+
+ if(outputDir == "") { outputDir += hasPath(globaldata->getTreeFile()); }
+ output = new ColumnFile(outputDir + getSimpleName(globaldata->getTreeFile()) + ".parsimony", itersString);
+
+ sumFile = outputDir + getSimpleName(globaldata->getTreeFile()) + ".psummary";
openOutputFile(sumFile, outSum);
}else { //user wants random distribution
savetmap = globaldata->gTreemap;
getUserInput();
- output = new ColumnFile(randomtree, itersString);
+
+ if(outputDir == "") { outputDir += hasPath(randomtree); }
+ output = new ColumnFile(outputDir+ getSimpleName(randomtree), itersString);
}
//set users groups to analyze
util = new SharedUtil();
- util->setGroups(globaldata->Groups, tmap->namesOfGroups, allGroups, numGroups, "unweighted"); //sets the groups the user wants to analyze
+ util->setGroups(globaldata->Groups, tmap->namesOfGroups, allGroups, numGroups, "parsimony"); //sets the groups the user wants to analyze
util->getCombos(groupComb, globaldata->Groups, numComp);
if (numGroups == 1) { numComp++; groupComb.push_back(allGroups); }