X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getsabundcommand.cpp;h=5425c41a917f4b02d67c5b4dfcb63e1b2fc6159b;hb=f320651dfb5359e6bba597280753553de28a2154;hp=4ae2eaa004f9df9cc75c12b63626ffa7fad71ea7;hpb=19fcbbdba99658f5eca244803280f9ee7f9f6607;p=mothur.git diff --git a/getsabundcommand.cpp b/getsabundcommand.cpp index 4ae2eaa..5425c41 100644 --- a/getsabundcommand.cpp +++ b/getsabundcommand.cpp @@ -45,7 +45,26 @@ string GetSAbundCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string GetSAbundCommand::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 == "sabund") { outputFileName = "sabund"; } + 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, "GetSAbundCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** GetSAbundCommand::GetSAbundCommand(){ try { @@ -166,7 +185,7 @@ int GetSAbundCommand::execute(){ try { if (abort == true) { if (calledHelp) { return 0; } return 2; } - filename = outputDir + m->getRootName(m->getSimpleName(inputfile)) + "sabund"; + filename = outputDir + m->getRootName(m->getSimpleName(inputfile)) + getOutputFileNameTag("sabund"); m->openOutputFile(filename, out); input = new InputData(inputfile, format);