X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=parsimonycommand.cpp;h=ff1209287b4e17b2fcc58678703123aae2cadbc1;hb=c651c46022761aef61644f78462365d8f767ff0b;hp=a8c2d156be775455c729d9341386ecfb952323e4;hpb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;p=mothur.git diff --git a/parsimonycommand.cpp b/parsimonycommand.cpp index a8c2d15..ff12092 100644 --- a/parsimonycommand.cpp +++ b/parsimonycommand.cpp @@ -43,7 +43,7 @@ string ParsimonyCommand::getHelpString(){ helpString += "Example parsimony(random=out, iters=500).\n"; helpString += "The default value for random is "" (meaning you want to use the trees in your inputfile, randomtree=out means you just want the random distribution of trees outputted to out.rd_parsimony),\n"; helpString += "and iters is 1000. The parsimony command output two files: .parsimony and .psummary their descriptions are in the manual.\n"; - helpString += "Note: No spaces between parameter labels (i.e. random), '=' and parameters (i.e.yourOutputFilename).\n\n"; + helpString += "Note: No spaces between parameter labels (i.e. random), '=' and parameters (i.e.yourOutputFilename).\n"; return helpString; } catch(exception& e) { @@ -74,6 +74,7 @@ ParsimonyCommand::ParsimonyCommand(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(); @@ -125,6 +126,10 @@ ParsimonyCommand::ParsimonyCommand(string option) { } m->runParse = true; + m->Groups.clear(); + m->namesOfGroups.clear(); + m->Treenames.clear(); + m->names.clear(); outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; } @@ -139,16 +144,18 @@ ParsimonyCommand::ParsimonyCommand(string option) { treefile = m->getTreeFile(); if (treefile != "") { m->mothurOut("Using " + treefile + " as input file for the tree parameter."); m->mothurOutEndLine(); } else { m->mothurOut("You have no current tree file and the tree parameter is required."); m->mothurOutEndLine(); abort = true; } - } + }else { m->setTreeFile(treefile); } //check for required parameters groupfile = validParameter.validFile(parameters, "group", true); if (groupfile == "not open") { abort = true; } else if (groupfile == "not found") { groupfile = ""; } + else { m->setGroupFile(groupfile); } namefile = validParameter.validFile(parameters, "name", true); if (namefile == "not open") { abort = true; } else if (namefile == "not found") { namefile = ""; } + else { m->setNameFile(namefile); } } //if the user changes the output directory command factory will send this info to us in the output parameter @@ -188,6 +195,9 @@ int ParsimonyCommand::execute() { //randomtree will tell us if user had their own treefile or if they just want the random distribution //user has entered their own tree if (randomtree == "") { + + m->setTreeFile(treefile); + if (groupfile != "") { //read in group map info. tmap = new TreeMap(groupfile); @@ -231,7 +241,7 @@ int ParsimonyCommand::execute() { if (m->control_pressed) { delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; } - for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); + for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); m->Groups.clear(); return 0; } @@ -286,7 +296,7 @@ int ParsimonyCommand::execute() { delete reading; delete pars; delete output; delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; } if (randomtree == "") { outSum.close(); } - for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); + for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); m->Groups.clear(); return 0; } @@ -311,7 +321,7 @@ int ParsimonyCommand::execute() { delete reading; delete pars; delete output; delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; } if (randomtree == "") { outSum.close(); } - for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); + for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); m->Groups.clear(); return 0; } @@ -349,7 +359,7 @@ int ParsimonyCommand::execute() { if (m->control_pressed) { delete reading; delete pars; delete output; delete randT; if (randomtree == "") { outSum.close(); } - for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); + for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; } m->Groups.clear(); return 0; @@ -387,7 +397,7 @@ int ParsimonyCommand::execute() { if (m->control_pressed) { delete reading; delete pars; delete output; delete randT; delete tmap; - for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); + for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); m->Groups.clear(); return 0; } @@ -399,7 +409,7 @@ int ParsimonyCommand::execute() { if (m->control_pressed) { delete reading; delete pars; delete output; delete randT; delete tmap; - for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); + for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); m->Groups.clear(); return 0; } @@ -456,7 +466,7 @@ int ParsimonyCommand::execute() { delete reading; delete pars; delete output; delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; } if (randomtree == "") { outSum.close(); } - for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); + for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); m->Groups.clear(); return 0; } @@ -475,7 +485,7 @@ int ParsimonyCommand::execute() { delete pars; delete output; delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; } - if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); return 0;} + if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); return 0;} m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine();