X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=otuhierarchycommand.cpp;h=e32e0b6c339c5b80108a3e874ce9c990ef5a2376;hb=cc19310422f125d6628980bd1148e1e816792382;hp=2f99aa6091452933f6796f21aa043449bfce1dd4;hpb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;p=mothur.git diff --git a/otuhierarchycommand.cpp b/otuhierarchycommand.cpp index 2f99aa6..e32e0b6 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("otuheirarchy"); m->openOutputFile(outputFileName, out); //go through each bin in "big" otu and output the bins in "little" otu which created it