X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mantelcommand.cpp;h=f3259e6096c3e0c1373e1c091078c9ceac377f82;hb=28bcfc4a41b8b82f66636587e0d4d355d07cbdd1;hp=0c0163b538a747ca5b9b4eb82ef57a06ca302b91;hpb=1d898dc6edaf9e9f287fab53bf1f21fb29757a17;p=mothur.git diff --git a/mantelcommand.cpp b/mantelcommand.cpp index 0c0163b..f3259e6 100644 --- a/mantelcommand.cpp +++ b/mantelcommand.cpp @@ -50,6 +50,26 @@ string MantelCommand::getHelpString(){ } } //********************************************************************************************************************** +string MantelCommand::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 == "mantel") { outputFileName = "mantel"; } + 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, "MantelCommand", "getOutputFileNameTag"); + exit(1); + } +} +//********************************************************************************************************************** MantelCommand::MantelCommand(){ try { abort = true; calledHelp = true; @@ -69,6 +89,7 @@ MantelCommand::MantelCommand(string option) { //allow user to run help if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} else { vector myArray = setParameters(); @@ -124,7 +145,7 @@ MantelCommand::MantelCommand(string option) { method = validParameter.validFile(parameters, "method", false); if (method == "not found"){ method = "pearson"; } string temp = validParameter.validFile(parameters, "iters", false); if (temp == "not found") { temp = "1000"; } - convert(temp, iters); + m->mothurConvert(temp, iters); if ((method != "pearson") && (method != "spearman") && (method != "kendall")) { m->mothurOut(method + " is not a valid method. Valid methods are pearson, spearman, and kendall."); m->mothurOutEndLine(); abort = true; } } @@ -205,7 +226,7 @@ int MantelCommand::execute(){ if (m->control_pressed) { return 0; } - string outputFile = outputDir + m->getRootName(m->getSimpleName(phylipfile1)) + "mantel"; + string outputFile = outputDir + m->getRootName(m->getSimpleName(phylipfile1)) + getOutputFileNameTag("mantel"); outputNames.push_back(outputFile); outputTypes["mantel"].push_back(outputFile); ofstream out;