else {
//valid paramters for this command
- string Array[] = {"label","calc","abund","size"};
+ string Array[] = {"label","calc","abund","size","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
//make sure the user has already run the read.otu command
if ((globaldata->getSharedFile() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { mothurOut("You must read a list, sabund, rabund or shared file before you can use the summary.single command."); mothurOutEndLine(); abort = true; }
-
+
+ //if the user changes the output directory command factory will send this info to us in the output parameter
+ outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){
+ outputDir = "";
+ outputDir += hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it
+ }
+
//check for optional parameter and set defaults
// ...at some point should added some additional type checking...
label = validParameter.validFile(parameters, "label", false);
for (int p = 0; p < inputFileNames.size(); p++) {
- string fileNameRoot = getRootName(inputFileNames[p]) + "summary";
+ string fileNameRoot = outputDir + getRootName(getSimpleName(inputFileNames[p])) + "summary";
globaldata->inputFileName = inputFileNames[p];
if (inputFileNames.size() > 1) {
mothurOutEndLine(); mothurOut("Processing group " + groups[p]); mothurOutEndLine(); mothurOutEndLine();
}
+ sumCalculators.clear();
validCalculator = new ValidCalculators();