X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=venn.cpp;h=7cb2134fb475b76284c6dcfd857dac5a67f9f4b1;hp=217dd3594081703b6cf7a28857cd553b62bcfaec;hb=3abb236c602eb168ee112f080b563ebe2c705029;hpb=0f297d3c211acbdfd4d941ef193a6702c5046dd1 diff --git a/venn.cpp b/venn.cpp index 217dd35..7cb2134 100644 --- a/venn.cpp +++ b/venn.cpp @@ -133,9 +133,9 @@ void Venn::getPic(vector lookup, vector vCalcs singleCalc = new Sobs(); }else if (vCalcs[i]->getName() == "sharedchao") { singleCalc = new Chao1(); - }else if (vCalcs[i]->getName() == "sharedace") { - singleCalc = new Ace(10); - } + }//else if (vCalcs[i]->getName() == "sharedace") { + //singleCalc = new Ace(10); + //} //get estimates for numA vector numA = singleCalc->getValues(sabundA); @@ -190,154 +190,234 @@ void Venn::getPic(vector lookup, vector vCalcs //make a file for each calculator for(int i=0;igetName() == "sharedsobs") { - singleCalc = new Sobs(); - }else if (vCalcs[i]->getName() == "sharedchao") { - singleCalc = new Chao1(); - }else if (vCalcs[i]->getName() == "sharedace") { - singleCalc = new Ace(10); - } + + string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg"; + openOutputFile(filenamesvg, outsvg); - //get estimates for numA - vector numA = singleCalc->getValues(sabundA); + if (vCalcs[i]->getName() == "sharedace") { + + singleCalc = new Ace(10); + + //get estimates for numA + vector numA = singleCalc->getValues(sabundA); - //get estimates for numB - vector numB = singleCalc->getValues(sabundB); + //get estimates for numB + vector numB = singleCalc->getValues(sabundB); - //get estimates for numC - vector numC = singleCalc->getValues(sabundC); + //get estimates for numC + vector numC = singleCalc->getValues(sabundC); - - string filenamesvg = getRootName(globaldata->inputFileName) + lookup[0]->getLabel() + ".venn." + vCalcs[i]->getName() + ".svg"; - openOutputFile(filenamesvg, outsvg); - //get estimates for sharedAB, sharedAC and sharedBC - subset.clear(); - subset.push_back(lookup[0]); subset.push_back(lookup[1]); - vector sharedAB = vCalcs[i]->getValues(subset); - - subset.clear(); - subset.push_back(lookup[0]); subset.push_back(lookup[2]); - vector sharedAC = vCalcs[i]->getValues(subset); - - subset.clear(); - subset.push_back(lookup[1]); subset.push_back(lookup[2]); - vector sharedBC = vCalcs[i]->getValues(subset); - - vector sharedAwithBC; - vector sharedBwithAC; - vector sharedCwithAB; - - //find possible sharedABC values - float sharedABC1 = 0.0; float sharedABC2 = 0.0; float sharedABC3 = 0.0; float sharedABC = 0.0; + //get estimates for sharedAB, sharedAC and sharedBC + subset.clear(); + subset.push_back(lookup[0]); subset.push_back(lookup[1]); + vector sharedAB = vCalcs[i]->getValues(subset); + + subset.clear(); + subset.push_back(lookup[0]); subset.push_back(lookup[2]); + vector sharedAC = vCalcs[i]->getValues(subset); + + subset.clear(); + subset.push_back(lookup[1]); subset.push_back(lookup[2]); + vector sharedBC = vCalcs[i]->getValues(subset); + + vector sharedAwithBC; + vector sharedBwithAC; + vector sharedCwithAB; + + //find possible sharedABC values + float sharedABC1 = 0.0; float sharedABC2 = 0.0; float sharedABC3 = 0.0; float sharedABC = 0.0; - if (vCalcs[i]->getMultiple() == false) { - //merge BC and estimate with shared with A - SharedRAbundVector* merge = new SharedRAbundVector(); - for (int j = 0; j < lookup[1]->size(); j++) { - merge->push_back((lookup[1]->getAbundance(j) + lookup[2]->getAbundance(j)), j, ""); - } + if (vCalcs[i]->getMultiple() == false) { + //merge BC and estimate with shared with A + SharedRAbundVector* merge = new SharedRAbundVector(); + for (int j = 0; j < lookup[1]->size(); j++) { + merge->push_back((lookup[1]->getAbundance(j) + lookup[2]->getAbundance(j)), j, ""); + } + + subset.clear(); + subset.push_back(lookup[0]); subset.push_back(merge); + sharedAwithBC = vCalcs[i]->getValues(subset); - subset.clear(); - subset.push_back(lookup[0]); subset.push_back(merge); - sharedAwithBC = vCalcs[i]->getValues(subset); - - delete merge; - //merge AC and estimate with shared with B - merge = new SharedRAbundVector(); - for (int j = 0; j < lookup[0]->size(); j++) { - merge->push_back((lookup[0]->getAbundance(j) + lookup[2]->getAbundance(j)), j, ""); - } + delete merge; + //merge AC and estimate with shared with B + merge = new SharedRAbundVector(); + for (int j = 0; j < lookup[0]->size(); j++) { + merge->push_back((lookup[0]->getAbundance(j) + lookup[2]->getAbundance(j)), j, ""); + } + + subset.clear(); + subset.push_back(merge); subset.push_back(lookup[1]); + sharedBwithAC = vCalcs[i]->getValues(subset); - subset.clear(); - subset.push_back(merge); subset.push_back(lookup[1]); - sharedBwithAC = vCalcs[i]->getValues(subset); + delete merge; + //merge AB and estimate with shared with C + merge = new SharedRAbundVector(); + for (int j = 0; j < lookup[0]->size(); j++) { + merge->push_back((lookup[0]->getAbundance(j) + lookup[1]->getAbundance(j)), j, ""); + } + + subset.clear(); + subset.push_back(lookup[2]); subset.push_back(merge); + sharedCwithAB = vCalcs[i]->getValues(subset); + delete merge; + + sharedABC1 = sharedAB[0] + sharedAC[0] - sharedAwithBC[0]; + sharedABC2 = sharedAB[0] + sharedBC[0] - sharedBwithAC[0]; + sharedABC3 = sharedAC[0] + sharedBC[0] - sharedCwithAB[0]; + + //if any of the possible m's are - throw them out + if (sharedABC1 < 0.00001) { sharedABC1 = 0; } + if (sharedABC2 < 0.00001) { sharedABC2 = 0; } + if (sharedABC3 < 0.00001) { sharedABC3 = 0; } - delete merge; - //merge AB and estimate with shared with C - merge = new SharedRAbundVector(); - for (int j = 0; j < lookup[0]->size(); j++) { - merge->push_back((lookup[0]->getAbundance(j) + lookup[1]->getAbundance(j)), j, ""); + //sharedABC is the minimum of the 3 possibilities + if ((sharedABC1 < sharedABC2) && (sharedABC1 < sharedABC3)) { sharedABC = sharedABC1; } + else if ((sharedABC2 < sharedABC1) && (sharedABC2 < sharedABC3)) { sharedABC = sharedABC2; } + else if ((sharedABC3 < sharedABC1) && (sharedABC3 < sharedABC2)) { sharedABC = sharedABC3; } + }else{ + vector data = vCalcs[i]->getValues(lookup); + sharedABC = data[0]; + sharedAwithBC.push_back(sharedAB[0] + sharedAC[0] - sharedABC); + sharedBwithAC.push_back(sharedAB[0] + sharedBC[0] - sharedABC); + sharedCwithAB.push_back(sharedAC[0] + sharedBC[0] - sharedABC); } + + //image window + outsvg << "\n"; + outsvg << "\n"; + + //draw circles + outsvg << ""; + 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=\"150\">" + lookup[0]->getGroup() + "\n"; + outsvg << "" + toString(sharedAB[0] - sharedABC) + "\n"; + outsvg << "" + toString(numB[0]-sharedBwithAC[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"150\">" + lookup[1]->getGroup() + "\n"; + outsvg << "" + toString(sharedAC[0] - sharedABC) + "\n"; + outsvg << "" + toString(numC[0]-sharedCwithAB[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"410\">" + lookup[2]->getGroup() + "\n"; + outsvg << "" + toString(sharedBC[0] - sharedABC) + "\n"; + outsvg << "" + toString(sharedABC) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB[0]) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC[0]) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC[0]) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and combined groups " + lookup[1]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedAwithBC[0]) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[1]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedBwithAC[0]) + "\n"; + outsvg << "The number of sepecies 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 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]); + 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) + "\n"; + outsvg << "The total shared richness is " + toString(sharedABC) + "\n"; + + delete singleCalc; + + }else { //sharedchao and sharedsobs are multigroup + + vector subset; + + //get estimates for numA + subset.push_back(lookup[0]); + vector numA = vCalcs[i]->getValues(subset); + + //get estimates for numB subset.clear(); - subset.push_back(lookup[2]); subset.push_back(merge); - sharedCwithAB = vCalcs[i]->getValues(subset); - delete merge; - - sharedABC1 = sharedAB[0] + sharedAC[0] - sharedAwithBC[0]; - sharedABC2 = sharedAB[0] + sharedBC[0] - sharedBwithAC[0]; - sharedABC3 = sharedAC[0] + sharedBC[0] - sharedCwithAB[0]; - - //if any of the possible m's are - throw them out - if (sharedABC1 < 0.00001) { sharedABC1 = 0; } - if (sharedABC2 < 0.00001) { sharedABC2 = 0; } - if (sharedABC3 < 0.00001) { sharedABC3 = 0; } - - //sharedABC is the minimum of the 3 possibilities - if ((sharedABC1 < sharedABC2) && (sharedABC1 < sharedABC3)) { sharedABC = sharedABC1; } - else if ((sharedABC2 < sharedABC1) && (sharedABC2 < sharedABC3)) { sharedABC = sharedABC2; } - else if ((sharedABC3 < sharedABC1) && (sharedABC3 < sharedABC2)) { sharedABC = sharedABC3; } - }else{ - vector data = vCalcs[i]->getValues(lookup); - sharedABC = data[0]; - sharedAwithBC.push_back(sharedAB[0] + sharedAC[0] - sharedABC); - sharedBwithAC.push_back(sharedAB[0] + sharedBC[0] - sharedABC); - sharedCwithAB.push_back(sharedAC[0] + sharedBC[0] - sharedABC); - } - - //image window - outsvg << "\n"; - outsvg << "\n"; + subset.push_back(lookup[1]); + vector numB = vCalcs[i]->getValues(subset); + + //get estimates for numC + subset.clear(); + subset.push_back(lookup[2]); + vector numC = vCalcs[i]->getValues(subset); - //draw circles - outsvg << ""; - outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; - outsvg << ""; - outsvg << ""; - outsvg << ""; + subset.clear(); + subset.push_back(lookup[0]); subset.push_back(lookup[1]); + vector sharedab = vCalcs[i]->getValues(subset); + + subset.clear(); + subset.push_back(lookup[0]); subset.push_back(lookup[2]); + vector sharedac = vCalcs[i]->getValues(subset); + + subset.clear(); + subset.push_back(lookup[1]); subset.push_back(lookup[2]); + vector sharedbc = vCalcs[i]->getValues(subset); + + subset.clear(); + subset.push_back(lookup[0]); subset.push_back(lookup[1]); subset.push_back(lookup[2]); + vector sharedabc = vCalcs[i]->getValues(subset); + + //image window + outsvg << "\n"; + outsvg << "\n"; - //place labels within overlaps - outsvg << "" + toString(numA[0]-sharedAwithBC[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"150\">" + lookup[0]->getGroup() + "\n"; - outsvg << "" + toString(sharedAB[0] - sharedABC) + "\n"; - outsvg << "" + toString(numB[0]-sharedBwithAC[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"150\">" + lookup[1]->getGroup() + "\n"; - outsvg << "" + toString(sharedAC[0] - sharedABC) + "\n"; - outsvg << "" + toString(numC[0]-sharedCwithAB[0]) + "\n"; - outsvg << "getGroup().length() / 2)) + "\" y=\"410\">" + lookup[2]->getGroup() + "\n"; - outsvg << "" + toString(sharedBC[0] - sharedABC) + "\n"; - outsvg << "" + toString(sharedABC) + "\n"; - - outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB[0]) + "\n"; - outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC[0]) + "\n"; - outsvg << "The number of sepecies shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC[0]) + "\n"; - outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and combined groups " + lookup[1]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedAwithBC[0]) + "\n"; - outsvg << "The number of sepecies shared between groups " + lookup[1]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedBwithAC[0]) + "\n"; - outsvg << "The number of sepecies 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 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]); - if (numC.size() == 3) { - outsvg << " the lci is " + toString(numC[1]) + " and the hci is " + toString(numC[2]) + "\n"; - }else { outsvg << "\n"; } + //draw circles + outsvg << ""; + outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; + outsvg << ""; + outsvg << ""; + outsvg << ""; - 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"; + //place labels within overlaps + outsvg << "" + toString(numA[0]-sharedab[0]-sharedac[0]+sharedabc[0]) + "\n"; + outsvg << "getGroup().length() / 2)) + "\" y=\"150\">" + 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=\"150\">" + 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=\"410\">" + lookup[2]->getGroup() + "\n"; + outsvg << "" + toString(sharedbc[0] - sharedabc[0]) + "\n"; + outsvg << "" + toString(sharedabc[0]) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedab[0]) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedac[0]) + "\n"; + outsvg << "The number of sepecies 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]); + if (numA.size() == 3) { + outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]) + "\n"; + }else { outsvg << "\n"; } + + 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]); + 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"; + + + } + + //close file outsvg << "\n\n"; outsvg.close(); - delete singleCalc; + } @@ -451,7 +531,33 @@ void Venn::getPic(vector lookup, vector vCalcs //get estimate for all four data = vCalcs[i]->getValues(lookup); sharedABCD = data[0]; - //cout << "num abcd = " << sharedABCD << endl << endl; + //cout << "num abcd = " << sharedABCD << endl << endl; + + + + //image window + outsvg << "\n"; + outsvg << "\n"; + 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 sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedAD) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBD) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedCD) + "\n"; + + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedABC) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedABD) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedACD) + "\n"; + outsvg << "The number of sepecies shared between groups " + lookup[1]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBCD) + "\n"; + //make adjustments sharedABC = sharedABC - sharedABCD; //cout << "num abc = " << sharedABC << endl; @@ -462,13 +568,12 @@ void Venn::getPic(vector lookup, vector vCalcs sharedBCD = sharedBCD - sharedABCD; //cout << "num bcd = " << sharedBCD << endl; - sharedAB = sharedAB - sharedABC - sharedABCD - sharedABD; // cout << "num ab = " << sharedAB << endl; - sharedAC = sharedAC - sharedABC - sharedABCD - sharedACD; // cout << "num ac = " << sharedAC << endl; - sharedAD = sharedAD - sharedABD - sharedABCD - sharedACD; // cout << "num ad = " << sharedAD << endl; - - sharedBC = sharedBC - sharedABC - sharedABCD - sharedBCD; // cout << "num bc = " << sharedBC << endl; + sharedAB = sharedAB - sharedABC - sharedABCD - sharedABD; //cout << "num ab = " << sharedAB << endl; + sharedAC = sharedAC - sharedABC - sharedABCD - sharedACD; //cout << "num ac = " << sharedAC << endl; + sharedAD = sharedAD - sharedABD - sharedABCD - sharedACD; //cout << "num ad = " << sharedAD << endl; + sharedBC = sharedBC - sharedABC - sharedABCD - sharedBCD; //cout << "num bc = " << sharedBC << endl; sharedBD = sharedBD - sharedABD - sharedABCD - sharedBCD; // cout << "num bd = " << sharedBD << endl; - sharedCD = sharedCD - sharedACD - sharedABCD - sharedBCD; // cout << "num cd = " << sharedCD << endl; + sharedCD = sharedCD - sharedACD - sharedABCD - sharedBCD; //cout << "num cd = " << sharedCD << endl; numA = numA - sharedAB - sharedAC - sharedAD - sharedABCD - sharedABC - sharedACD - sharedABD; //cout << "num a = " << numA << endl; @@ -479,13 +584,7 @@ void Venn::getPic(vector lookup, vector vCalcs numD = numD - sharedAD - sharedBD - sharedCD - sharedABCD - sharedBCD - sharedACD - sharedABD; //cout << "num d = " << numD << endl; - //image window - outsvg << "\n"; - outsvg << "\n"; - //draw circles - outsvg << ""; - outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; outsvg << "\n "; outsvg << "\n "; outsvg << "\n "; @@ -494,27 +593,31 @@ void Venn::getPic(vector lookup, vector vCalcs //A = red, B = green, C = blue, D = yellow //place labels within overlaps - outsvg << "" + toString(numA) + "\n"; + outsvg << "" + toString(numA) + "\n"; outsvg << "getGroup().length() / 2)) + "\" y=\"90\">" + lookup[0]->getGroup() + "\n"; outsvg << "" + toString(sharedAB) + "\n"; - outsvg << "" + toString(numB) + "\n"; + outsvg << "" + toString(numB) + "\n"; outsvg << "getGroup().length() / 2)) + "\" y=\"90\">" + lookup[1]->getGroup() + "\n"; outsvg << "" + toString(sharedAC) + "\n"; outsvg << "" + toString(numC) + "\n"; outsvg << "getGroup().length() / 2)) + "\" y=\"210\">" + lookup[2]->getGroup() + "\n"; - outsvg << "" + toString(sharedBC) + "\n"; + outsvg << "" + toString(sharedBD) + "\n"; outsvg << "" + toString(numD) + "\n"; outsvg << "getGroup().length() / 2)) + "\" y=\"210\">" + lookup[3]->getGroup() + "\n"; outsvg << "" + toString(sharedAD) + "\n"; - outsvg << "" + toString(sharedBD) + "\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)) + "\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;