X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=corraxescommand.cpp;fp=corraxescommand.cpp;h=f8083cc01c10a23b4626c6ea2ccd285a15f59c87;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=c27eb4b9ac335112f19244c708cee9bb8630feda;hpb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;p=mothur.git diff --git a/corraxescommand.cpp b/corraxescommand.cpp index c27eb4b..f8083cc 100644 --- a/corraxescommand.cpp +++ b/corraxescommand.cpp @@ -56,12 +56,32 @@ string CorrAxesCommand::getHelpString(){ } } //********************************************************************************************************************** +string CorrAxesCommand::getOutputFileNameTag(string type, string inputName=""){ + try { + string outputFileName = ""; + map >::iterator it; + + //is this a type this command creates + it = outputTypes.find(type); + if (it == outputTypes.end()) { m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); } + else { + if (type == "corraxes") { outputFileName = "corr.axes"; } + else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; } + } + return outputFileName; + } + catch(exception& e) { + m->errorOut(e, "CorrAxesCommand", "getOutputFileNameTag"); + exit(1); + } +} +//********************************************************************************************************************** CorrAxesCommand::CorrAxesCommand(){ try { abort = true; calledHelp = true; setParameters(); vector tempOutNames; - outputTypes["corr.axes"] = tempOutNames; + outputTypes["corraxes"] = tempOutNames; } catch(exception& e) { m->errorOut(e, "CorrAxesCommand", "CorrAxesCommand"); @@ -92,7 +112,7 @@ CorrAxesCommand::CorrAxesCommand(string option) { } vector tempOutNames; - outputTypes["corr.axes"] = tempOutNames; + outputTypes["corraxes"] = tempOutNames; //if the user changes the input directory command factory will send this info to us in the output parameter string inputDir = validParameter.validFile(parameters, "inputdir", false); @@ -266,8 +286,8 @@ int CorrAxesCommand::execute(){ // calc the r values // /************************************************************************************/ - string outputFileName = outputDir + m->getRootName(m->getSimpleName(inputFileName)) + method + ".corr.axes"; - outputNames.push_back(outputFileName); outputTypes["corr.axes"].push_back(outputFileName); + string outputFileName = outputDir + m->getRootName(m->getSimpleName(inputFileName)) + method + "." + getOutputFileNameTag("corraxes"); + outputNames.push_back(outputFileName); outputTypes["corraxes"].push_back(outputFileName); ofstream out; m->openOutputFile(outputFileName, out); out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint);