X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=rarefactcommand.cpp;h=612e3b4d2a8d1632e1c0f44937be52ce84d28fec;hb=cc19310422f125d6628980bd1148e1e816792382;hp=652ff4e49ecf163fc71dad48b40eb1485012b105;hpb=2009a1a1f47e7467094d844e7c07ab8ddf7bb447;p=mothur.git diff --git a/rarefactcommand.cpp b/rarefactcommand.cpp index 652ff4e..612e3b4 100644 --- a/rarefactcommand.cpp +++ b/rarefactcommand.cpp @@ -74,6 +74,39 @@ string RareFactCommand::getHelpString(){ exit(1); } } +//********************************************************************************************************************** +string RareFactCommand::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 == "rarefaction") { outputFileName = "rarefaction"; } + else if (type == "r_chao") { outputFileName = "r_chao"; } + else if (type == "r_ace") { outputFileName = "r_ace"; } + else if (type == "r_jack") { outputFileName = "r_jack"; } + else if (type == "r_shannon") { outputFileName = "r_shannon"; } + else if (type == "r_shannoneven") { outputFileName = "r_shannoneven"; } + else if (type == "r_smithwilson") { outputFileName = "r_smithwilson"; } + else if (type == "r_npshannon") { outputFileName = "r_npshannon"; } + else if (type == "r_simpson") { outputFileName = "r_simpson"; } + else if (type == "r_simpsoneven") { outputFileName = "r_simpsoneven"; } + else if (type == "r_invsimpson") { outputFileName = "r_invsimpson"; } + else if (type == "r_bootstrap") { outputFileName = "r_bootstrap"; } + else if (type == "r_coverage") { outputFileName = "r_coverage"; } + else if (type == "r_nseqs") { outputFileName = "r_nseqs"; } + 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, "RareFactCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** RareFactCommand::RareFactCommand(){ @@ -285,13 +318,8 @@ int RareFactCommand::execute(){ map > labelToEnds; if ((format != "sharedfile")) { inputFileNames.push_back(inputfile); } else { inputFileNames = parseSharedFile(sharedfile, labelToEnds); format = "rabund"; } - for (map >::iterator it = labelToEnds.begin(); it != labelToEnds.end(); it++) { - cout << it->first << endl; - for (set::iterator its = (it->second).begin(); its != (it->second).end(); its++) { - cout << (*its) << endl; - } - } - if (m->control_pressed) { return 0; } + + if (m->control_pressed) { return 0; } map file2Group; //index in outputNames[i] -> group for (int p = 0; p < inputFileNames.size(); p++) { @@ -310,52 +338,52 @@ int RareFactCommand::execute(){ for (i=0; i 1) { file2Group[outputNames.size()-1] = groups[p]; } }