//**********************************************************************************************************************
-Venn::Venn(){
+Venn::Venn(string o) : outputDir(o) {
try {
globaldata = GlobalData::getInstance();
+ m = MothurOut::getInstance();
}
catch(exception& e) {
- errorOut(e, "Venn", "Venn");
+ m->errorOut(e, "Venn", "Venn");
exit(1);
}
}
//**********************************************************************************************************************
-void Venn::getPic(SAbundVector* sabund, vector<Calculator*> vCalcs) {
+vector<string> Venn::getPic(SAbundVector* sabund, vector<Calculator*> vCalcs) {
try {
-
+
+ vector<string> outputNames;
+
for(int i=0;i<vCalcs.size();i++){
- string filenamesvg = globaldata->inputFileName + ".venn." + sabund->getLabel() + vCalcs[i]->getName() + ".svg";
+ string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + ".venn." + sabund->getLabel() + vCalcs[i]->getName() + ".svg";
+ outputNames.push_back(filenamesvg);
openOutputFile(filenamesvg, outsvg);
+
+ if (m->control_pressed) { outsvg.close(); return outputNames; }
vector<double> data = vCalcs[i]->getValues(sabund);
outsvg << "</g>\n</svg>\n";
outsvg.close();
}
+
+ return outputNames;
}
catch(exception& e) {
- errorOut(e, "Venn", "getPic");
+ m->errorOut(e, "Venn", "getPic");
exit(1);
}
}
//**********************************************************************************************************************
-void Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs) {
+vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculator*> vCalcs) {
try {
vector<SharedRAbundVector*> subset;
+ vector<string> outputNames;
/******************* 1 Group **************************/
if (lookup.size() == 1) {
//make a file for each calculator
for(int i=0;i<vCalcs.size();i++){
- string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ outputNames.push_back(filenamesvg);
openOutputFile(filenamesvg, outsvg);
-
+
+ if (m->control_pressed) { outsvg.close(); return outputNames; }
+
//in essence you want to run it like a single
if (vCalcs[i]->getName() == "sharedsobs") {
singleCalc = new Sobs();
//make a file for each calculator
for(int i=0;i<vCalcs.size();i++){
- string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ outputNames.push_back(filenamesvg);
openOutputFile(filenamesvg, outsvg);
+ if (m->control_pressed) { outsvg.close(); return outputNames; }
+
//get estimates for sharedAB
vector<double> shared = vCalcs[i]->getValues(subset);
//make a file for each calculator
for(int i=0;i<vCalcs.size();i++){
-
- string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ outputNames.push_back(filenamesvg);
openOutputFile(filenamesvg, outsvg);
+ if (m->control_pressed) { outsvg.close(); return outputNames; }
+
if (vCalcs[i]->getName() == "sharedace") {
singleCalc = new Ace(10);
//make a file for each calculator
for(int i=0;i<vCalcs.size();i++){
- if ((vCalcs[i]->getName() != "sharedsobs") && (vCalcs[i]->getName() != "sharedchao")) { mothurOut(vCalcs[i]->getName() + " is not a valid calculator with four groups. It will be disregarded. "); mothurOutEndLine(); }
+ if ((vCalcs[i]->getName() != "sharedsobs") && (vCalcs[i]->getName() != "sharedchao")) { m->mothurOut(vCalcs[i]->getName() + " is not a valid calculator with four groups. It will be disregarded. "); m->mothurOutEndLine(); }
else{
- string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ string filenamesvg = outputDir + getSimpleName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg";
+ outputNames.push_back(filenamesvg);
openOutputFile(filenamesvg, outsvg);
-
+ if (m->control_pressed) { outsvg.close(); return outputNames; }
+
//in essence you want to run it like a single
if (vCalcs[i]->getName() == "sharedsobs") {
singleCalc = new Sobs();
}
}
+ return outputNames;
+
}
catch(exception& e) {
- errorOut(e, "Venn", "getPic");
+ m->errorOut(e, "Venn", "getPic");
exit(1);
}
}