X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=venn.cpp;h=32ebb3c9c8b4f96b0ad556450e9505f08dc2546d;hb=4542a79d20176ff0ee830b0f9d4f4c92637439d9;hp=378e004ac4524d78088b054a91947d604ca32768;hpb=61798fe609675abfedf511e542cc48c56a531199;p=mothur.git diff --git a/venn.cpp b/venn.cpp index 378e004..32ebb3c 100644 --- a/venn.cpp +++ b/venn.cpp @@ -17,11 +17,9 @@ //********************************************************************************************************************** -Venn::Venn(string o, bool n) : outputDir(o), nseqs(n) { +Venn::Venn(string o, bool n, string f, int fs) : outputDir(o), nseqs(n), inputfile(f), fontSize(fs) { try { - globaldata = GlobalData::getInstance(); m = MothurOut::getInstance(); - } catch(exception& e) { m->errorOut(e, "Venn", "Venn"); @@ -33,9 +31,9 @@ vector Venn::getPic(SAbundVector* sabund, vector vCalcs) { try { vector outputNames; - + for(int i=0;igetRootName(m->getSimpleName(globaldata->inputFileName)) + "." + sabund->getLabel() + "." + vCalcs[i]->getName() + ".svg"; + string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + "." + sabund->getLabel() + "." + vCalcs[i]->getName() + ".svg"; outputNames.push_back(filenamesvg); m->openOutputFile(filenamesvg, outsvg); @@ -51,17 +49,17 @@ vector Venn::getPic(SAbundVector* sabund, vector vCalcs) { outsvg << "\n"; outsvg << ""; - outsvg << "Venn Diagram at distance " + sabund->getLabel() + "\n"; + outsvg << "Venn Diagram at distance " + sabund->getLabel() + "\n"; outsvg << ""; - outsvg << "" + toString(data[0]) + "\n"; + outsvg << "" + toString(data[0]) + "\n"; if (data.size() == 3) { - outsvg << "The lower bound of the confidence interval is " + toString(data[1]) + "\n"; - outsvg << "The upper bound of the confidence interval is " + toString(data[2]) + "\n"; + outsvg << "The lower bound of the confidence interval is " + toString(data[1]) + "\n"; + outsvg << "The upper bound of the confidence interval is " + toString(data[2]) + "\n"; } if (nseqs) { - outsvg << "The number of sequences represented is " + toString(sabund->getNumSeqs()) + "\n"; + outsvg << "The number of sequences represented is " + toString(sabund->getNumSeqs()) + "\n"; } outsvg << "\n\n"; @@ -78,7 +76,7 @@ vector Venn::getPic(SAbundVector* sabund, vector vCalcs) { //********************************************************************************************************************** vector Venn::getPic(vector lookup, vector vCalcs) { try { - + vector subset; vector outputNames; @@ -93,7 +91,7 @@ vector Venn::getPic(vector lookup, vectorgetRootName(m->getSimpleName(globaldata->inputFileName)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + ".svg"; + string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + ".svg"; outputNames.push_back(filenamesvg); m->openOutputFile(filenamesvg, outsvg); @@ -115,18 +113,18 @@ vector Venn::getPic(vector lookup, vector\n"; outsvg << ""; - outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; + outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; outsvg << ""; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.24 * height)) + "\">" + lookup[0]->getGroup() + "\n"; - outsvg << "" + toString(data[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.24 * height)) + "\">" + lookup[0]->getGroup() + "\n"; + outsvg << "" + toString(data[0]) + "\n"; if (data.size() == 3) { - outsvg << "The lower bound of the confidence interval is " + toString(data[1]) + "\n"; - outsvg << "The upper bound of the confidence interval is " + toString(data[2]) + "\n"; + outsvg << "The lower bound of the confidence interval is " + toString(data[1]) + "\n"; + outsvg << "The upper bound of the confidence interval is " + toString(data[2]) + "\n"; } if (nseqs) { - outsvg << "The number of sequences represented is " + toString(sabund->getNumSeqs()) + "\n"; + outsvg << "The number of sequences represented is " + toString(sabund->getNumSeqs()) + "\n"; } outsvg << "\n\n"; @@ -149,7 +147,7 @@ vector Venn::getPic(vector lookup, vectorgetRootName(m->getSimpleName(globaldata->inputFileName)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + ".svg"; + string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + ".svg"; outputNames.push_back(filenamesvg); m->openOutputFile(filenamesvg, outsvg); @@ -168,14 +166,16 @@ vector Venn::getPic(vector lookup, vector data = nseqsCalc->getValues(lookup); - + cout << data[0] << '\t' << data[1] << endl; sharedVal = data[0] + data[1]; numSeqsA = sabundA->getNumSeqs(); numSeqsB = sabundB->getNumSeqs(); + uniqSeqsToA = numSeqsA-data[0]; + uniqSeqsToB = numSeqsB-data[1]; delete nseqsCalc; } @@ -193,34 +193,35 @@ vector Venn::getPic(vector lookup, vector"; - outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; + outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; outsvg << ""; outsvg << ""; - outsvg << "" + toString(numA[0] - shared[0]) + "\n"; - outsvg << "" + toString(numB[0] - shared[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.25 * height)) + "\">" + lookup[0]->getGroup() + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.25 * height)) + "\">" + lookup[1]->getGroup() + "\n"; - outsvg << "" + toString(shared[0]) + "\n"; - outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]); + outsvg << "" + toString(numA[0] - shared[0]) + "\n"; + outsvg << "" + toString(numB[0] - shared[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.25 * height)) + "\">" + lookup[0]->getGroup() + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.25 * height)) + "\">" + lookup[1]->getGroup() + "\n"; + outsvg << "" + toString(shared[0]) + "\n"; + outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]); if (numA.size() == 3) { outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]); } - if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsA); } + if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsA) + "; " + toString(uniqSeqsToA) + " sequences are not shared"; } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]); + outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]); if (numB.size() == 3) { outsvg << " the lci is " + toString(numB[1]) + " and the hci is " + toString(numB[2]); } - if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsB); } + if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsB) + "; " + toString(uniqSeqsToB) + " sequences are not shared"; } outsvg << "\n"; - outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(shared[0]); - if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedVal); } + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(shared[0]); + if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedVal) + "; " + toString((sharedVal / (float)(numSeqsA + numSeqsB))*100) + "% of these sequences are shared"; } outsvg << "\n"; - outsvg << "Percentage of species that are shared in groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString((shared[0] / (float)(numA[0] + numB[0] - shared[0]))*100) + "\n"; - outsvg << "The total richness for all groups is " + toString((float)(numA[0] + numB[0] - shared[0]))+ "\n";; + outsvg << "Percentage of species that are shared in groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString((shared[0] / (float)(numA[0] + numB[0] - shared[0]))*100) + "\n"; + + outsvg << "The total richness for all groups is " + toString((float)(numA[0] + numB[0] - shared[0]))+ "\n";; //close file @@ -247,14 +248,14 @@ vector Venn::getPic(vector lookup, vectorgetRootName(m->getSimpleName(globaldata->inputFileName)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + "-" + lookup[2]->getGroup() + ".svg"; + string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + "-" + lookup[2]->getGroup() + ".svg"; outputNames.push_back(filenamesvg); m->openOutputFile(filenamesvg, outsvg); if (m->control_pressed) { outsvg.close(); return outputNames; } - int sharedVal, sharedABVal, sharedACVal, sharedBCVal, numSeqsA, numSeqsB, numSeqsC; + int sharedVal, sharedABVal, sharedACVal, sharedBCVal, numSeqsA, numSeqsB, numSeqsC, uniqSeqsToA, uniqSeqsToB, uniqSeqsToC; if (nseqs) { NSeqs* nseqsCalc = new NSeqs(); @@ -276,6 +277,9 @@ vector Venn::getPic(vector lookup, vectorgetNumSeqs(); numSeqsB = sabundB->getNumSeqs(); numSeqsC = sabundC->getNumSeqs(); + uniqSeqsToA = numSeqsA-sharedData[0]; + uniqSeqsToB = numSeqsC-sharedData[1]; + uniqSeqsToC = numSeqsB-sharedData[1]; delete nseqsCalc; } @@ -376,58 +380,58 @@ vector Venn::getPic(vector lookup, vector"; - outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; + outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; outsvg << ""; outsvg << ""; outsvg << ""; //place labels within overlaps - outsvg << "" + toString(numA[0]-sharedAwithBC[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[0]->getGroup() + "\n"; - outsvg << "" + toString(sharedAB[0] - sharedABC) + "\n"; - outsvg << "" + toString(numB[0]-sharedBwithAC[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[1]->getGroup() + "\n"; - outsvg << "" + toString(sharedAC[0] - sharedABC) + "\n"; - outsvg << "" + toString(numC[0]-sharedCwithAB[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.52 * height)) + "\">" + lookup[2]->getGroup() + "\n"; - outsvg << "" + toString(sharedBC[0] - sharedABC) + "\n"; - outsvg << "" + toString(sharedABC) + "\n"; + outsvg << "" + toString(numA[0]-sharedAwithBC[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[0]->getGroup() + "\n"; + outsvg << "" + toString(sharedAB[0] - sharedABC) + "\n"; + outsvg << "" + toString(numB[0]-sharedBwithAC[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[1]->getGroup() + "\n"; + outsvg << "" + toString(sharedAC[0] - sharedABC) + "\n"; + outsvg << "" + toString(numC[0]-sharedCwithAB[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.52 * height)) + "\">" + lookup[2]->getGroup() + "\n"; + outsvg << "" + toString(sharedBC[0] - sharedABC) + "\n"; + outsvg << "" + toString(sharedABC) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB[0]); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB[0]); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedABVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC[0]); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC[0]); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedACVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC[0]); + outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC[0]); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedBCVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and combined groups " + lookup[1]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedAwithBC[0]) + "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedBwithAC[0]) + "\n"; - outsvg << "The number of species shared between groups " + lookup[2]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[1]->getGroup() + " is " + toString(sharedCwithAB[0]) + "\n"; - outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and combined groups " + lookup[1]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedAwithBC[0]) + "\n"; + outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedBwithAC[0]) + "\n"; + outsvg << "The number of species shared between groups " + lookup[2]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[1]->getGroup() + " is " + toString(sharedCwithAB[0]) + "\n"; + outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]); if (numA.size() == 3) { outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]); } - if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsA); } + if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsA) + "; " + toString(uniqSeqsToA) + " sequences are not shared"; } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]); + outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]); if (numB.size() == 3) { outsvg << " the lci is " + toString(numB[1]) + " and the hci is " + toString(numB[2]); } - if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsB); } + if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsB) + "; " + toString(uniqSeqsToB) + " sequences are not shared"; } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC[0]); + outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC[0]); if (numC.size() == 3) { outsvg << " the lci is " + toString(numC[1]) + " and the hci is " + toString(numC[2]); } - if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsC); } + if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsC) + "; " + toString(uniqSeqsToC) + " sequences are not shared"; } outsvg << "\n"; - outsvg << "The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedAB[0] - sharedAC[0] - sharedBC[0] + sharedABC) + "\n"; - outsvg << "The total shared richness is " + toString(sharedABC); + outsvg << "The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedAB[0] - sharedAC[0] - sharedBC[0] + sharedABC) + "\n"; + outsvg << "The total shared richness is " + toString(sharedABC); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedVal); } outsvg << "\n"; @@ -473,56 +477,56 @@ vector Venn::getPic(vector lookup, vector"; - outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; + outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; outsvg << ""; outsvg << ""; outsvg << ""; //place labels within overlaps - outsvg << "" + toString(numA[0]-sharedab[0]-sharedac[0]+sharedabc[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[0]->getGroup() + "\n"; - outsvg << "" + toString(sharedab[0] - sharedabc[0]) + "\n"; - outsvg << "" + toString(numB[0]-sharedab[0]-sharedbc[0]+sharedabc[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[1]->getGroup() + "\n"; - outsvg << "" + toString(sharedac[0] - sharedabc[0]) + "\n"; - outsvg << "" + toString(numC[0]-sharedac[0]-sharedbc[0]+sharedabc[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.51 * height)) + "\">" + lookup[2]->getGroup() + "\n"; - outsvg << "" + toString(sharedbc[0] - sharedabc[0]) + "\n"; - outsvg << "" + toString(sharedabc[0]) + "\n"; + outsvg << "" + toString(numA[0]-sharedab[0]-sharedac[0]+sharedabc[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[0]->getGroup() + "\n"; + outsvg << "" + toString(sharedab[0] - sharedabc[0]) + "\n"; + outsvg << "" + toString(numB[0]-sharedab[0]-sharedbc[0]+sharedabc[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[1]->getGroup() + "\n"; + outsvg << "" + toString(sharedac[0] - sharedabc[0]) + "\n"; + outsvg << "" + toString(numC[0]-sharedac[0]-sharedbc[0]+sharedabc[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.51 * height)) + "\">" + lookup[2]->getGroup() + "\n"; + outsvg << "" + toString(sharedbc[0] - sharedabc[0]) + "\n"; + outsvg << "" + toString(sharedabc[0]) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedab[0]); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedab[0]); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedABVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedac[0]); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedac[0]); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedACVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedbc[0]); + outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedbc[0]); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedBCVal); } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]); + outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]); if (numA.size() == 3) { outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]); } if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsA); } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]); + outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]); if (numB.size() == 3) { outsvg << " the lci is " + toString(numB[1]) + " and the hci is " + toString(numB[2]); } if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsB); } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC[0]); + outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC[0]); if (numC.size() == 3) { outsvg << " the lci is " + toString(numC[1]) + " and the hci is " + toString(numC[2]); } if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsC); } outsvg << "\n"; - outsvg << "The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedab[0] - sharedac[0] - sharedbc[0] + sharedabc[0]) + "\n"; - outsvg << "The total shared richness is " + toString(sharedabc[0]); + outsvg << "The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedab[0] - sharedac[0] - sharedbc[0] + sharedabc[0]) + "\n"; + outsvg << "The total shared richness is " + toString(sharedabc[0]); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedVal); } outsvg << "\n"; @@ -565,7 +569,7 @@ vector Venn::getPic(vector lookup, vectorgetName() != "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 = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + "-" + lookup[2]->getGroup() + "-" + lookup[3]->getGroup() + ".svg"; + string filenamesvg = outputDir + m->getRootName(m->getSimpleName(inputfile)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + "-" + lookup[2]->getGroup() + "-" + lookup[3]->getGroup() + ".svg"; outputNames.push_back(filenamesvg); m->openOutputFile(filenamesvg, outsvg); @@ -713,50 +717,50 @@ vector Venn::getPic(vector lookup, vector\n"; outsvg << "\n"; outsvg << ""; - outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; + outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; - outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA); + outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA); if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsA); } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB); + outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB); if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsB); } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC); + outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC); if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsC); } outsvg << "\n"; - outsvg << "The number of species in group " + lookup[3]->getGroup() + " is " + toString(numD); + outsvg << "The number of species in group " + lookup[3]->getGroup() + " is " + toString(numD); if (nseqs) { outsvg << ", and the number of squences is " + toString(numSeqsD); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedABVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedACVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedAD); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedAD); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedADVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC); + outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedBCVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBD); + outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBD); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedBDVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedCD); + outsvg << "The number of species shared between groups " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedCD); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedCDVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedABC); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedABC); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedABCVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedABD); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedABD); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedABDVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedACD); + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedACD); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedACDVal); } outsvg << "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBCD); + outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBCD); if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedBCDVal); } outsvg << "\n"; @@ -795,27 +799,27 @@ vector Venn::getPic(vector lookup, vector" + toString(numA) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.11 * height)) + "\">" + lookup[0]->getGroup() + "\n"; - outsvg << "" + toString(sharedAB) + "\n"; - outsvg << "" + toString(numB) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.11 * height)) + "\">" + lookup[1]->getGroup() + "\n"; - outsvg << "" + toString(sharedAC) + "\n"; - outsvg << "" + toString(numC) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.26 * height)) + "\">" + lookup[2]->getGroup() + "\n"; - outsvg << "" + toString(sharedBD) + "\n"; - outsvg << "" + toString(numD) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.26 * height)) + "\">" + lookup[3]->getGroup() + "\n"; - outsvg << "" + toString(sharedAD) + "\n"; - outsvg << "" + toString(sharedBC) + "\n"; - outsvg << "" + toString(sharedCD) + "\n"; - outsvg << "" + toString(sharedABD) + "\n"; - outsvg << "" + toString(sharedBCD) + "\n"; - outsvg << "" + toString(sharedACD) + "\n"; - outsvg << "" + toString(sharedABC) + "\n"; - outsvg << "" + toString(sharedABCD) + "\n"; + outsvg << "" + toString(numA) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.11 * height)) + "\">" + lookup[0]->getGroup() + "\n"; + outsvg << "" + toString(sharedAB) + "\n"; + outsvg << "" + toString(numB) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.11 * height)) + "\">" + lookup[1]->getGroup() + "\n"; + outsvg << "" + toString(sharedAC) + "\n"; + outsvg << "" + toString(numC) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.26 * height)) + "\">" + lookup[2]->getGroup() + "\n"; + outsvg << "" + toString(sharedBD) + "\n"; + outsvg << "" + toString(numD) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.26 * height)) + "\">" + lookup[3]->getGroup() + "\n"; + outsvg << "" + toString(sharedAD) + "\n"; + outsvg << "" + toString(sharedBC) + "\n"; + outsvg << "" + toString(sharedCD) + "\n"; + outsvg << "" + toString(sharedABD) + "\n"; + outsvg << "" + toString(sharedBCD) + "\n"; + outsvg << "" + toString(sharedACD) + "\n"; + outsvg << "" + toString(sharedABC) + "\n"; + outsvg << "" + toString(sharedABCD) + "\n"; - outsvg << "The total richness of all the groups is " + toString((float)(numA + numB + numC + numD + sharedAB + sharedAC + sharedAD + sharedBC + sharedBD + sharedCD + sharedABC + sharedABD + sharedACD + sharedBCD + sharedABCD)); + outsvg << "The total richness of all the groups is " + toString((float)(numA + numB + numC + numD + sharedAB + sharedAC + sharedAD + sharedBC + sharedBD + sharedCD + sharedABC + sharedABD + sharedACD + sharedBCD + sharedABCD)); if (nseqs) { outsvg << ", and the number of squences in the otus shared by all groups is " + toString(sharedVal); } outsvg << "\n";