X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=otuhierarchycommand.cpp;fp=otuhierarchycommand.cpp;h=022ff3af04dcc23933b05f4b7a76d3131db20ac2;hb=8bc3e5b38c2317a1715f53be22fa96455868c281;hp=2c71cd56aa8a6341def135ec0a7ddcb092993885;hpb=f663afa231c9bc1b5e18e0ea3bdd2b2ee784f5b2;p=mothur.git diff --git a/otuhierarchycommand.cpp b/otuhierarchycommand.cpp index 2c71cd5..022ff3a 100644 --- a/otuhierarchycommand.cpp +++ b/otuhierarchycommand.cpp @@ -9,6 +9,53 @@ #include "otuhierarchycommand.h" +//********************************************************************************************************************** +vector OtuHierarchyCommand::getValidParameters(){ + try { + string Array[] = {"list","label","output","outputdir","inputdir"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "OtuHierarchyCommand", "getValidParameters"); + exit(1); + } +} +//********************************************************************************************************************** +OtuHierarchyCommand::OtuHierarchyCommand(){ + try { + //initialize outputTypes + vector tempOutNames; + outputTypes["otuheirarchy"] = tempOutNames; + } + catch(exception& e) { + m->errorOut(e, "OtuHierarchyCommand", "OtuHierarchyCommand"); + exit(1); + } +} +//********************************************************************************************************************** +vector OtuHierarchyCommand::getRequiredParameters(){ + try { + string Array[] = {"list","label"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "OtuHierarchyCommand", "getRequiredParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector OtuHierarchyCommand::getRequiredFiles(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "OtuHierarchyCommand", "getRequiredFiles"); + exit(1); + } +} //********************************************************************************************************************** OtuHierarchyCommand::OtuHierarchyCommand(string option) { try { @@ -33,6 +80,10 @@ OtuHierarchyCommand::OtuHierarchyCommand(string option) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } + //initialize outputTypes + vector tempOutNames; + outputTypes["otuheirarchy"] = tempOutNames; + //if the user changes the input directory command factory will send this info to us in the output parameter string inputDir = validParameter.validFile(parameters, "inputdir", false); if (inputDir == "not found"){ inputDir = ""; } @@ -110,7 +161,7 @@ int OtuHierarchyCommand::execute(){ //get listvectors that correspond to labels requested, (or use smart distancing to get closest listvector) vector lists = getListVectors(); - if (m->control_pressed) { return 0; } + if (m->control_pressed) { outputTypes.clear(); return 0; } //determine which is little and which is big, putting little first if (lists.size() == 2) { @@ -148,7 +199,7 @@ int OtuHierarchyCommand::execute(){ //go through each bin in "big" otu and output the bins in "little" otu which created it for (int i = 0; i < lists[1].getNumBins(); i++) { - if (m->control_pressed) { out.close(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { outputTypes.clear(); out.close(); remove(outputFileName.c_str()); return 0; } string names = lists[1].get(i); @@ -181,11 +232,11 @@ int OtuHierarchyCommand::execute(){ out.close(); - if (m->control_pressed) { remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; } m->mothurOutEndLine(); m->mothurOut("Output File Name: "); m->mothurOutEndLine(); - m->mothurOut(outputFileName); m->mothurOutEndLine(); + m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["otuheirarchy"].push_back(outputFileName); m->mothurOutEndLine(); return 0;