X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=venn.cpp;h=378e004ac4524d78088b054a91947d604ca32768;hb=f598bd8389840cf030d61f5da7d0b2c3e37c06ba;hp=dfa551966c66c46df5e28d48cce90eff7848986d;hpb=260ae19c36cb11a53ddc5a75b5e507f8dd8b31d6;p=mothur.git diff --git a/venn.cpp b/venn.cpp index dfa5519..378e004 100644 --- a/venn.cpp +++ b/venn.cpp @@ -11,12 +11,13 @@ #include "ace.h" #include "sobs.h" #include "chao1.h" +#include "nseqs.h" #include "sharedchao1.h" #include "sharedsobscollectsummary.h" //********************************************************************************************************************** -Venn::Venn(string o) : outputDir(o) { +Venn::Venn(string o, bool n) : outputDir(o), nseqs(n) { try { globaldata = GlobalData::getInstance(); m = MothurOut::getInstance(); @@ -59,6 +60,10 @@ vector Venn::getPic(SAbundVector* sabund, vector vCalcs) { 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 << "\n\n"; outsvg.close(); } @@ -119,7 +124,11 @@ vector Venn::getPic(vector lookup, vectorThe 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 << "\n\n"; outsvg.close(); delete singleCalc; @@ -159,6 +168,19 @@ vector Venn::getPic(vector lookup, vector data = nseqsCalc->getValues(lookup); + + sharedVal = data[0] + data[1]; + numSeqsA = sabundA->getNumSeqs(); + numSeqsB = sabundB->getNumSeqs(); + + delete nseqsCalc; + } + + //get estimates for numA vector numA = singleCalc->getValues(sabundA); @@ -171,7 +193,7 @@ 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"; @@ -179,19 +201,27 @@ vector Venn::getPic(vector lookup, vectorgetGroup().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 << "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]) + "\n"; - }else { outsvg << "\n"; } + 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]) + "\n"; - }else { outsvg << "\n"; } + 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 sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(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"; + 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 << "\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 outsvg << "\n\n"; @@ -203,6 +233,8 @@ vector Venn::getPic(vector lookup, vector Venn::getPic(vector lookup, vectorcontrol_pressed) { outsvg.close(); return outputNames; } + int sharedVal, sharedABVal, sharedACVal, sharedBCVal, numSeqsA, numSeqsB, numSeqsC; + + if (nseqs) { + NSeqs* nseqsCalc = new NSeqs(); + vector sharedData = nseqsCalc->getValues(lookup); + + vector mysubset; mysubset.push_back(lookup[0]); mysubset.push_back(lookup[1]); + vector sharedAB = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[2]); + vector sharedAC = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[2]); + vector sharedBC = nseqsCalc->getValues(mysubset); + + sharedVal = sharedData[0] + sharedData[1] + sharedData[2]; + sharedABVal = sharedAB[0] + sharedAB[1]; + sharedACVal = sharedAC[0] + sharedAC[1]; + sharedBCVal = sharedBC[0] + sharedBC[1]; + numSeqsA = sabundA->getNumSeqs(); + numSeqsB = sabundB->getNumSeqs(); + numSeqsC = sabundC->getNumSeqs(); + + delete nseqsCalc; + } + + if (vCalcs[i]->getName() == "sharedace") { singleCalc = new Ace(10); @@ -312,51 +371,65 @@ vector Venn::getPic(vector lookup, vector\n"; + outsvg << "\n"; outsvg << "\n"; //draw circles outsvg << ""; - 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(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 << "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]) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC[0]) + "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC[0]) + "\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 " + 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]); + 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]); + 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]); if (numA.size() == 3) { - outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]) + "\n"; - }else { outsvg << "\n"; } + 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]) + "\n"; - }else { outsvg << "\n"; } + 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]) + "\n"; - }else { outsvg << "\n"; } + 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) + "\n"; - outsvg << "The total shared richness is " + toString(sharedABC) + "\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); + if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedVal); } + outsvg << "\n"; delete singleCalc; @@ -395,52 +468,65 @@ vector Venn::getPic(vector lookup, vector sharedabc = vCalcs[i]->getValues(subset); //image window - outsvg << "\n"; + outsvg << "\n"; outsvg << "\n"; //draw circles outsvg << ""; - 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]) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedac[0]) + "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedbc[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 " + 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]); + 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]); + 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]); if (numA.size() == 3) { - outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]) + "\n"; - }else { outsvg << "\n"; } + 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]) + "\n"; - }else { outsvg << "\n"; } - - outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC[0]); + 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]); if (numC.size() == 3) { - outsvg << " the lci is " + toString(numC[1]) + " and the hci is " + toString(numC[2]) + "\n"; - }else { 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]) + "\n"; + 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]); + if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedVal); } + outsvg << "\n"; } - //close file outsvg << "\n\n"; @@ -454,6 +540,8 @@ vector Venn::getPic(vector lookup, vector Venn::getPic(vector lookup, vectorgetValues(lookup); sharedABCD = data[0]; //cout << "num abcd = " << sharedABCD << endl << endl; - - + int sharedVal, sharedABCVal, sharedABDVal, sharedACDVal, sharedBCDVal, sharedABVal, sharedACVal, sharedADVal, sharedBCVal, sharedBDVal, sharedCDVal, numSeqsA, numSeqsB, numSeqsC, numSeqsD; + + if (nseqs) { + NSeqs* nseqsCalc = new NSeqs(); + vector sharedData = nseqsCalc->getValues(lookup); + + vector mysubset; mysubset.push_back(lookup[0]); mysubset.push_back(lookup[1]); + vector sharedAB = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[2]); + vector sharedAC = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[3]); + vector sharedAD = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[2]); + vector sharedBC = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[3]); + vector sharedBD = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[2]); mysubset.push_back(lookup[3]); + vector sharedCD = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[2]); + vector sharedABC = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[3]); + vector sharedABD = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[2]); mysubset.push_back(lookup[3]); + vector sharedACD = nseqsCalc->getValues(mysubset); + + mysubset.clear(); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[2]); mysubset.push_back(lookup[3]); + vector sharedBCD = nseqsCalc->getValues(mysubset); + + sharedVal = sharedData[0] + sharedData[1] + sharedData[2] + sharedData[3]; + sharedABCVal = sharedABC[0] + sharedABC[1] + sharedABC[2]; + sharedABDVal = sharedABD[0] + sharedABD[1] + sharedABD[2]; + sharedACDVal = sharedACD[0] + sharedACD[1] + sharedACD[2]; + sharedBCDVal = sharedBCD[0] + sharedBCD[1] + sharedBCD[2]; + sharedABVal = sharedAB[0] + sharedAB[1]; + sharedACVal = sharedAC[0] + sharedAC[1]; + sharedADVal = sharedAD[0] + sharedAD[1]; + sharedBCVal = sharedBC[0] + sharedBC[1]; + sharedBDVal = sharedBD[0] + sharedBD[1]; + sharedCDVal = sharedCD[0] + sharedCD[1]; + numSeqsA = sabundA->getNumSeqs(); + numSeqsB = sabundB->getNumSeqs(); + numSeqsC = sabundC->getNumSeqs(); + numSeqsD = sabundD->getNumSeqs(); + + delete nseqsCalc; + } + //image window - outsvg << "\n"; + outsvg << "\n"; outsvg << "\n"; - outsvg << ""; + outsvg << ""; outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; - outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA) + "\n"; - outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB) + "\n"; - outsvg << "The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC) + "\n"; - outsvg << "The number of species in group " + lookup[3]->getGroup() + " is " + toString(numD) + "\n"; + 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); + 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); + 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); + 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) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedAD) + "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC) + "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBD) + "\n"; - outsvg << "The number of species shared between groups " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedCD) + "\n"; + 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); + 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); + 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); + 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); + 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); + 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) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedABD) + "\n"; - outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedACD) + "\n"; - outsvg << "The number of species shared between groups " + lookup[1]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBCD) + "\n"; + 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); + 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); + 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); + if (nseqs) { outsvg << ", and the number of squences is " + toString(sharedBCDVal); } + outsvg << "\n"; //make adjustments sharedABC = sharedABC - sharedABCD; @@ -646,11 +815,10 @@ vector Venn::getPic(vector lookup, vector" + 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)); + if (nseqs) { outsvg << ", and the number of squences in the otus shared by all groups is " + toString(sharedVal); } + outsvg << "\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)) + "\n"; - - outsvg << "\n\n"; outsvg.close(); delete singleCalc;