#include "parsimonycommand.h"
+//**********************************************************************************************************************
+vector<string> ParsimonyCommand::getValidParameters(){
+ try {
+ string Array[] = {"random","groups","iters","outputdir","inputdir"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ParsimonyCommand", "getValidParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+ParsimonyCommand::ParsimonyCommand(){
+ try {
+ abort = true;
+ //initialize outputTypes
+ vector<string> tempOutNames;
+ outputTypes["parsimony"] = tempOutNames;
+ outputTypes["psummary"] = tempOutNames;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ParsimonyCommand", "ParsimonyCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> ParsimonyCommand::getRequiredParameters(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ParsimonyCommand", "getRequiredParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> ParsimonyCommand::getRequiredFiles(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ParsimonyCommand", "getRequiredFiles");
+ exit(1);
+ }
+}
/***********************************************************/
ParsimonyCommand::ParsimonyCommand(string option) {
try {
if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
}
+ //initialize outputTypes
+ vector<string> tempOutNames;
+ outputTypes["parsimony"] = tempOutNames;
+ outputTypes["psummary"] = tempOutNames;
+
randomtree = validParameter.validFile(parameters, "random", false); if (randomtree == "not found") { randomtree = ""; }
//are you trying to use parsimony without reading a tree or saying you want random distribution
if(outputDir == "") { outputDir += m->hasPath(globaldata->getTreeFile()); }
output = new ColumnFile(outputDir + m->getSimpleName(globaldata->getTreeFile()) + ".parsimony", itersString);
outputNames.push_back(outputDir + m->getSimpleName(globaldata->getTreeFile()) + ".parsimony");
+ outputTypes["parsimony"].push_back(outputDir + m->getSimpleName(globaldata->getTreeFile()) + ".parsimony");
sumFile = outputDir + m->getSimpleName(globaldata->getTreeFile()) + ".psummary";
m->openOutputFile(sumFile, outSum);
outputNames.push_back(sumFile);
+ outputTypes["psummary"].push_back(sumFile);
}else { //user wants random distribution
savetmap = globaldata->gTreemap;
getUserInput();
if(outputDir == "") { outputDir += m->hasPath(randomtree); }
output = new ColumnFile(outputDir+ m->getSimpleName(randomtree), itersString);
outputNames.push_back(outputDir+ m->getSimpleName(randomtree));
+ outputTypes["parsimony"].push_back(outputDir+ m->getSimpleName(randomtree));
}
//set users groups to analyze
if (m->control_pressed) {
delete reading; delete pars; delete util; delete output;
if (randomtree == "") { outSum.close(); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
globaldata->Groups.clear();
return 0;
}
if (m->control_pressed) {
delete reading; delete pars; delete util; delete output;
if (randomtree == "") { outSum.close(); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
globaldata->Groups.clear();
return 0;
}
if (m->control_pressed) {
delete reading; delete pars; delete util; delete output; delete randT;
if (randomtree == "") { outSum.close(); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
globaldata->Groups.clear();
return 0;
}
if (m->control_pressed) {
delete reading; delete pars; delete util; delete output; delete randT;
globaldata->gTreemap = savetmap;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
globaldata->Groups.clear();
return 0;
}
if (m->control_pressed) {
delete reading; delete pars; delete util; delete output; delete randT;
globaldata->gTreemap = savetmap;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
globaldata->Groups.clear();
return 0;
}
delete reading; delete pars; delete util; delete output;
if (randomtree == "") { outSum.close(); }
else { globaldata->gTreemap = savetmap; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
globaldata->Groups.clear();
return 0;
}
if (m->control_pressed) {
delete pars; delete util; delete output;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
return 0;
}