X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=preclustercommand.cpp;h=14409f5a0a6aa86a166f42ff6f99423777237759;hb=6973be461c47c057531f447de22003a30cabc193;hp=a7f211345697a72c18b6fa0aaa1ac40200c46d94;hpb=afcbef163b4f32d0ff25a834cb9af8eef8d06ffa;p=mothur.git diff --git a/preclustercommand.cpp b/preclustercommand.cpp index a7f2113..14409f5 100644 --- a/preclustercommand.cpp +++ b/preclustercommand.cpp @@ -12,13 +12,61 @@ //********************************************************************************************************************** inline bool comparePriority(seqPNode first, seqPNode second) { return (first.numIdentical > second.numIdentical); } //********************************************************************************************************************** +vector PreClusterCommand::getValidParameters(){ + try { + string Array[] = {"fasta", "name", "diffs", "outputdir","inputdir"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "PreClusterCommand", "getValidParameters"); + exit(1); + } +} +//********************************************************************************************************************** +PreClusterCommand::PreClusterCommand(){ + try { + abort = true; calledHelp = true; + vector tempOutNames; + outputTypes["fasta"] = tempOutNames; + outputTypes["name"] = tempOutNames; + } + catch(exception& e) { + m->errorOut(e, "PreClusterCommand", "PreClusterCommand"); + exit(1); + } +} +//********************************************************************************************************************** +vector PreClusterCommand::getRequiredParameters(){ + try { + string Array[] = {"fasta"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "PreClusterCommand", "getRequiredParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector PreClusterCommand::getRequiredFiles(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "PreClusterCommand", "getRequiredFiles"); + exit(1); + } +} +//********************************************************************************************************************** PreClusterCommand::PreClusterCommand(string option) { try { - abort = false; + abort = false; calledHelp = false; //allow user to run help - if(option == "help") { help(); abort = true; } + if(option == "help") { help(); abort = true; calledHelp = true; } else { //valid paramters for this command @@ -36,6 +84,11 @@ PreClusterCommand::PreClusterCommand(string option) { if (validParameter.isValidParameter(it2->first, myArray, it2->second) != true) { abort = true; } } + //initialize outputTypes + vector tempOutNames; + outputTypes["fasta"] = tempOutNames; + outputTypes["name"] = 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 = ""; } @@ -113,7 +166,7 @@ void PreClusterCommand::help(){ int PreClusterCommand::execute(){ try { - if (abort == true) { return 0; } + if (abort == true) { if (calledHelp) { return 0; } return 2; } int start = time(NULL); @@ -189,8 +242,8 @@ int PreClusterCommand::execute(){ m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); - m->mothurOut(newFastaFile); m->mothurOutEndLine(); - m->mothurOut(newNamesFile); m->mothurOutEndLine(); + m->mothurOut(newFastaFile); m->mothurOutEndLine(); outputNames.push_back(newFastaFile); outputTypes["fasta"].push_back(newFastaFile); + m->mothurOut(newNamesFile); m->mothurOutEndLine(); outputNames.push_back(newNamesFile); outputTypes["name"].push_back(newNamesFile); m->mothurOutEndLine(); return 0;