X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=otuhierarchycommand.cpp;h=389879634e9ea1c003bde25604652187f8f460cb;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=2f99aa6091452933f6796f21aa043449bfce1dd4;hpb=19fcbbdba99658f5eca244803280f9ee7f9f6607;p=mothur.git diff --git a/otuhierarchycommand.cpp b/otuhierarchycommand.cpp index 2f99aa6..3898796 100644 --- a/otuhierarchycommand.cpp +++ b/otuhierarchycommand.cpp @@ -46,7 +46,26 @@ string OtuHierarchyCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string OtuHierarchyCommand::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 == "otuheirarchy") { outputFileName = "otu.hierarchy"; } + 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, "OtuHierarchyCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** OtuHierarchyCommand::OtuHierarchyCommand(){ try { @@ -180,7 +199,7 @@ int OtuHierarchyCommand::execute(){ } ofstream out; - string outputFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + lists[0].getLabel() + "-" + lists[1].getLabel() + ".otu.hierarchy"; + string outputFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + lists[0].getLabel() + "-" + lists[1].getLabel() + "." + getOutputFileNameTag("otuhierarchy"); m->openOutputFile(outputFileName, out); //go through each bin in "big" otu and output the bins in "little" otu which created it