X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sensspeccommand.cpp;h=b62bb00548f3e1ee66f0c1cf2b4bee117c5416cf;hb=ea4f373c28543cd1002b0dd7dc6e55c526647d59;hp=55d90bdd2ce1debc857ddb33a47969e0c3f66933;hpb=110ed3a070bf6b602cccef89c8626cce033315d3;p=mothur.git diff --git a/sensspeccommand.cpp b/sensspeccommand.cpp index 55d90bd..b62bb00 100644 --- a/sensspeccommand.cpp +++ b/sensspeccommand.cpp @@ -14,7 +14,6 @@ vector SensSpecCommand::setParameters(){ try { CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(plist); CommandParameter pphylip("phylip", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "none",false,false); parameters.push_back(pphylip); - //CommandParameter pname("name", "InputTypes", "", "", "none", "none", "ColumnName",false,false); parameters.push_back(pname); CommandParameter pcolumn("column", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "none",false,false); parameters.push_back(pcolumn); CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel); CommandParameter pcutoff("cutoff", "Number", "", "-1.00", "", "", "",false,false); parameters.push_back(pcutoff); @@ -45,6 +44,26 @@ string SensSpecCommand::getHelpString(){ } } //********************************************************************************************************************** +string SensSpecCommand::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 == "sensspec") { outputFileName = "sensspec"; } + 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, "SensSpecCommand", "getOutputFileNameTag"); + exit(1); + } +} +//********************************************************************************************************************** SensSpecCommand::SensSpecCommand(){ try { abort = true; calledHelp = true; @@ -116,16 +135,7 @@ SensSpecCommand::SensSpecCommand(string option) { path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["column"] = inputDir + it->second; } - } - - //it = parameters.find("name"); - //user has given a template file - //if(it != parameters.end()){ - //path = m->hasPath(it->second); - //if the user has not given a path then, add inputdir. else leave path alone. - //if (path == "") { parameters["name"] = inputDir + it->second; } - //} - + } } //check for required parameters listFile = validParameter.validFile(parameters, "list", true); @@ -176,12 +186,6 @@ SensSpecCommand::SensSpecCommand(string option) { else if(!m->isTrue(temp)) { hard = 0; } else if(m->isTrue(temp)) { hard = 1; } -// temp = validParameter.validFile(parameters, "name", true); -// if (temp == "not found") { nameFile = ""; } -// else if(temp == "not open") { abort = true; } -// else { nameFile = temp; } -// cout << "name:\t" << nameFile << endl; - temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { temp = "-1.00"; } m->mothurConvert(temp, cutoff); // cout << cutoff << endl; @@ -197,7 +201,7 @@ SensSpecCommand::SensSpecCommand(string option) { else { allLines = 1; } } - sensSpecFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + "sensspec"; + sensSpecFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + getOutputFileNameTag("sensspec"); } } catch(exception& e) {