//if the user changes the output directory command factory will send this info to us in the output parameter
outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){
outputDir = "";
- outputDir += hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it
+ outputDir += m->hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it
}
//check for optional parameter and set defaults
label = validParameter.validFile(parameters, "label", false);
if (label == "not found") { label = ""; }
else {
- if(label != "all") { splitAtDash(label, labels); allLines = 0; }
+ if(label != "all") { m->splitAtDash(label, labels); allLines = 0; }
else { allLines = 1; }
}
groups = validParameter.validFile(parameters, "groups", false);
if (groups == "not found") { groups = ""; }
else {
- splitAtDash(groups, Groups);
+ m->splitAtDash(groups, Groups);
globaldata->Groups = Groups;
}
else { calc = "sharedsobs"; }
}
}
- splitAtDash(calc, Estimators);
+ m->splitAtDash(calc, Estimators);
string temp;
temp = validParameter.validFile(parameters, "abund", false); if (temp == "not found") { temp = "10"; }
}
}
- venn = new Venn(outputDir);
+ //if the users entered no valid calculators don't execute command
+ if (vennCalculators.size() == 0) { m->mothurOut("No valid calculators given, please correct."); m->mothurOutEndLine(); abort = true; }
+ else { venn = new Venn(outputDir); }
}
+
}
delete read;
delete venn;
globaldata->sabund = NULL;
+ delete validCalculator;
}
}
string lastLabel;
vector<string> outputNames;
- //if the users entered no valid calculators don't execute command
- if (vennCalculators.size() == 0) { return 0; }
-
if (format == "sharedfile") {
//you have groups
read = new ReadOTUFile(globaldata->inputFileName);
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
+
+ if (m->control_pressed) {
+ for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
+ for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
+ globaldata->Groups.clear();
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ return 0;
+ }
if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){
m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
}
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
}
- if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+ if ((m->anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
string saveLabel = lookup[0]->getLabel();
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
}
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
//restore real lastlabel to save below
lookup[0]->setLabel(saveLabel);
lookup = input->getSharedRAbundVectors();
}
+ if (m->control_pressed) {
+ for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
+ globaldata->Groups.clear();
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ return 0;
+ }
+
+
//output error messages about any remaining user labels
set<string>::iterator it;
bool needToRun = false;
for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
}
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
}
//reset groups parameter
globaldata->Groups.clear();
+ if (m->control_pressed) {
+ for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ return 0;
+ }
+
+
}else{
while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
+
+ if (m->control_pressed) {
+ for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
+ delete sabund;
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ return 0;
+ }
if(allLines == 1 || labels.count(sabund->getLabel()) == 1){
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
}
- if ((anyLabelsToProcess(sabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+ if ((m->anyLabelsToProcess(sabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
string saveLabel = sabund->getLabel();
delete sabund;
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
processedLabels.insert(sabund->getLabel());
sabund = input->getSAbundVector();
}
+ if (m->control_pressed) {
+ for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ return 0;
+ }
+
//output error messages about any remaining user labels
set<string>::iterator it;
bool needToRun = false;
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
delete sabund;
}
+ if (m->control_pressed) {
+ for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
+ for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ return 0;
+ }
}
for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }