X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=pcoacommand.cpp;h=2043a128bd94bc755cb7ef10f5a8b8d9bdb5a6be;hb=372fb21ea66ced432b109225851a1b80ef0491a3;hp=354826f8c0b27a359b1eb1530e6a0d7a9fbaf32f;hpb=f687723a8357916e86a05116978e6869b039ce36;p=mothur.git diff --git a/pcoacommand.cpp b/pcoacommand.cpp index 354826f..2043a12 100644 --- a/pcoacommand.cpp +++ b/pcoacommand.cpp @@ -15,10 +15,10 @@ //********************************************************************************************************************** vector PCOACommand::setParameters(){ try { - CommandParameter pphylip("phylip", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pphylip); - CommandParameter pmetric("metric", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pmetric); - CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); - CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); + CommandParameter pphylip("phylip", "InputTypes", "", "", "none", "none", "none","pcoa-loadings",false,true,true); parameters.push_back(pphylip); + CommandParameter pmetric("metric", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(pmetric); + CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); + CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); vector myArray; for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } @@ -45,29 +45,24 @@ string PCOACommand::getHelpString(){ exit(1); } } - //********************************************************************************************************************** -string PCOACommand::getOutputFileNameTag(string type, string inputName=""){ - try { - string outputFileName = ""; - map >::iterator it; +string PCOACommand::getOutputPattern(string type) { + try { + string pattern = ""; - //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 == "pcoa") { outputFileName = "pcoa.axes"; } - else if (type == "loadings") { outputFileName = "pcoa.loadings"; } - 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, "PCOACommand", "getOutputFileNameTag"); - exit(1); - } + if (type == "pcoa") { pattern = "[filename],pcoa.axes"; } + else if (type == "loadings") { pattern = "[filename],pcoa.loadings"; } + else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; } + + return pattern; + } + catch(exception& e) { + m->errorOut(e, "PCOACommand", "getOutputPattern"); + exit(1); + } } + //********************************************************************************************************************** PCOACommand::PCOACommand(){ try { @@ -251,7 +246,9 @@ void PCOACommand::output(string fnameRoot, vector name_list, vector variables; + variables["[filename]"] = fnameRoot; + string pcoaDataFile = getOutputFileName("pcoa",variables); m->openOutputFile(pcoaDataFile, pcaData); pcaData.setf(ios::fixed, ios::floatfield); pcaData.setf(ios::showpoint); @@ -259,7 +256,7 @@ void PCOACommand::output(string fnameRoot, vector name_list, vectoropenOutputFile(loadingsFile, pcaLoadings); pcaLoadings.setf(ios::fixed, ios::floatfield); pcaLoadings.setf(ios::showpoint);