X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=removelineagecommand.cpp;h=1a3de32088d3bf1351b1005c654ac612fcd27732;hb=8173238f9f94af9baab8471de58bed7c8830948d;hp=d3160194fa5bea985ae0fd96e7cad8de3e73020a;hpb=ca0785e447ca7aa7e2f0ab8bb1155db126b551ea;p=mothur.git diff --git a/removelineagecommand.cpp b/removelineagecommand.cpp index d316019..1a3de32 100644 --- a/removelineagecommand.cpp +++ b/removelineagecommand.cpp @@ -12,7 +12,59 @@ #include "listvector.hpp" //********************************************************************************************************************** - +vector RemoveLineageCommand::getValidParameters(){ + try { + string Array[] = {"fasta","name", "group", "alignreport", "taxon", "dups", "list","taxonomy","outputdir","inputdir"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "RemoveLineageCommand", "getValidParameters"); + exit(1); + } +} +//********************************************************************************************************************** +RemoveLineageCommand::RemoveLineageCommand(){ + try { + abort = true; + //initialize outputTypes + vector tempOutNames; + outputTypes["fasta"] = tempOutNames; + outputTypes["taxonomy"] = tempOutNames; + outputTypes["name"] = tempOutNames; + outputTypes["group"] = tempOutNames; + outputTypes["alignreport"] = tempOutNames; + outputTypes["list"] = tempOutNames; + } + catch(exception& e) { + m->errorOut(e, "RemoveLineageCommand", "RemoveLineageCommand"); + exit(1); + } +} +//********************************************************************************************************************** +vector RemoveLineageCommand::getRequiredParameters(){ + try { + string Array[] = {"taxonomy"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "RemoveLineageCommand", "getRequiredParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector RemoveLineageCommand::getRequiredFiles(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "RemoveLineageCommand", "getRequiredFiles"); + exit(1); + } +} +//********************************************************************************************************************** RemoveLineageCommand::RemoveLineageCommand(string option) { try { abort = false; @@ -36,6 +88,15 @@ RemoveLineageCommand::RemoveLineageCommand(string option) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } + //initialize outputTypes + vector tempOutNames; + outputTypes["fasta"] = tempOutNames; + outputTypes["taxonomy"] = tempOutNames; + outputTypes["name"] = tempOutNames; + outputTypes["group"] = tempOutNames; + outputTypes["alignreport"] = tempOutNames; + outputTypes["list"] = tempOutNames; + //if the user changes the output directory command factory will send this info to us in the output parameter outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; } @@ -120,7 +181,11 @@ RemoveLineageCommand::RemoveLineageCommand(string option) { else if (taxfile == "not found") { taxfile = ""; m->mothurOut("The taxonomy parameter is required for the get.lineage command."); m->mothurOutEndLine(); abort = true; } string usedDups = "true"; - string temp = validParameter.validFile(parameters, "dups", false); if (temp == "not found") { temp = "false"; usedDups = ""; } + string temp = validParameter.validFile(parameters, "dups", false); + if (temp == "not found") { + if (namefile != "") { temp = "true"; } + else { temp = "false"; usedDups = ""; } + } dups = m->isTrue(temp); taxons = validParameter.validFile(parameters, "taxon", false); @@ -237,7 +302,7 @@ int RemoveLineageCommand::readFasta(){ out.close(); if (wroteSomething == false) { m->mothurOut("Your fasta file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); } - outputNames.push_back(outputFileName); + outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName); return 0; @@ -308,7 +373,7 @@ int RemoveLineageCommand::readList(){ out.close(); if (wroteSomething == false) { m->mothurOut("Your list file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); } - outputNames.push_back(outputFileName); + outputNames.push_back(outputFileName); outputTypes["list"].push_back(outputFileName); return 0; @@ -394,7 +459,7 @@ int RemoveLineageCommand::readName(){ out.close(); if (wroteSomething == false) { m->mothurOut("Your name file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); } - outputNames.push_back(outputFileName); + outputNames.push_back(outputFileName); outputTypes["name"].push_back(outputFileName); return 0; } @@ -438,7 +503,7 @@ int RemoveLineageCommand::readGroup(){ out.close(); if (wroteSomething == false) { m->mothurOut("Your group file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); } - outputNames.push_back(outputFileName); + outputNames.push_back(outputFileName); outputTypes["group"].push_back(outputFileName); return 0; } @@ -492,7 +557,7 @@ int RemoveLineageCommand::readTax(){ out.close(); if (!wroteSomething) { m->mothurOut("Your taxonomy file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); } - outputNames.push_back(outputFileName); + outputNames.push_back(outputFileName); outputTypes["taxonomy"].push_back(outputFileName); return 0; @@ -582,7 +647,7 @@ int RemoveLineageCommand::readAlign(){ out.close(); if (wroteSomething == false) { m->mothurOut("Your align file contains only sequences from " + taxons + "."); m->mothurOutEndLine(); } - outputNames.push_back(outputFileName); + outputNames.push_back(outputFileName); outputTypes["alignreport"].push_back(outputFileName); return 0;