#include "getgroupcommand.h"
+//**********************************************************************************************************************
+vector<string> GetgroupCommand::getValidParameters(){
+ try {
+ string Array[] = {"outputdir","inputdir"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetgroupCommand", "getValidParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+GetgroupCommand::GetgroupCommand(){
+ try {
+ abort = true;
+ //initialize outputTypes
+ vector<string> tempOutNames;
+ outputTypes["bootgroup"] = tempOutNames;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetgroupCommand", "GetgroupCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> GetgroupCommand::getRequiredParameters(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetgroupCommand", "getRequiredParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> GetgroupCommand::getRequiredFiles(){
+ try {
+ string Array[] = {"shared"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetgroupCommand", "getRequiredFiles");
+ exit(1);
+ }
+}
//**********************************************************************************************************************
GetgroupCommand::GetgroupCommand(string option) {
try {
if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
}
+ //initialize outputTypes
+ vector<string> tempOutNames;
+ outputTypes["bootgroup"] = tempOutNames;
+
//if the user changes the output directory command factory will send this info to us in the output parameter
string outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; }
if (abort == false) {
//open shared file
sharedfile = globaldata->getSharedFile();
- openInputFile(sharedfile, in);
+ m->openInputFile(sharedfile, in);
//open output file
- if (outputDir == "") { outputDir += hasPath(sharedfile); }
- outputFile = outputDir + getRootName(getSimpleName(sharedfile)) + "bootGroups";
- openOutputFile(outputFile, out);
+ if (outputDir == "") { outputDir += m->hasPath(sharedfile); }
+ outputFile = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + "bootGroups";
+ m->openOutputFile(outputFile, out);
}
}
in >> inputData;
}
- if (m->control_pressed) { in.close(); out.close(); remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); remove(outputFile.c_str()); return 0; }
if (in.eof() != true) { in >> nextLabel; }
//read the rest of the groups info in
while ((nextLabel == holdLabel) && (in.eof() != true)) {
- if (m->control_pressed) { in.close(); out.close(); remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); remove(outputFile.c_str()); return 0; }
in >> groupN >> num;
count++;
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
- m->mothurOut(outputFile); m->mothurOutEndLine();
+ m->mothurOut(outputFile); m->mothurOutEndLine(); outputNames.push_back(outputFile); outputTypes["bootgroup"].push_back(outputFile);
m->mothurOutEndLine();
return 0;