- //draw circles
- outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"800\" height=\"800\"/>";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"265\" y=\"30\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
- outsvg << "<circle fill=\"rgb(255,0,0)\" opacity=\".3\" stroke=\"black\" cx=\"230\" cy=\"200\" r=\"150\"/>";
- outsvg << "<circle fill=\"rgb(0,255,0)\" opacity=\".3\" stroke=\"black\" cx=\"455\" cy=\"200\" r=\"150\"/>";
- outsvg << "<circle fill=\"rgb(0,0,255)\" opacity=\".3\" stroke=\"black\" cx=\"343\" cy=\"400\" r=\"150\"/>";
-
- //place labels within overlaps
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(200 - ((int)toString(numA[0]-sharedAwithBC[0]).length() / 2)) + "\" y=\"170\">" + toString(numA[0]-sharedAwithBC[0]) + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(200 - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"150\">" + lookup[0]->getGroup() + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(sharedAB[0] - sharedABC).length() / 2)) + "\" y=\"170\">" + toString(sharedAB[0] - sharedABC) + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(485 - ((int)toString(numB[0]-sharedBwithAC[0]).length() / 2)) + "\" y=\"170\">" + toString(numB[0]-sharedBwithAC[0]) + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(485 - ((int)lookup[1]->getGroup().length() / 2)) + "\" y=\"150\">" + lookup[1]->getGroup() + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(268 - ((int)toString(sharedAC[0] - sharedABC).length() / 2)) + "\" y=\"305\">" + toString(sharedAC[0] - sharedABC) + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(numC[0]-sharedCwithAB[0]).length() / 2)) + "\" y=\"430\">" + toString(numC[0]-sharedCwithAB[0]) + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)lookup[2]->getGroup().length() / 2)) + "\" y=\"410\">" + lookup[2]->getGroup() + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(408 - ((int)toString(sharedBC[0] - sharedABC).length() / 2)) + "\" y=\"305\">" + toString(sharedBC[0] - sharedABC) + "</text>\n";
- outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(sharedABC).length() / 2)) + "\" y=\"280\">" + toString(sharedABC) + "</text>\n";
+ subset.clear();
+ subset.push_back(lookup[0]); subset.push_back(lookup[1]);
+ vector<string> labels;
+ vector<double> sharedab = vCalcs[i]->getValues(subset, labels);
+ if (sharedOtus && (vCalcs[i]->getName() == "sharedsobs") && (labels.size() != 0)) {
+ outShared << lookup[0]->getGroup() + "-" + lookup[1]->getGroup() << '\t' << labels.size() << '\t';
+ for (int k = 0; k < labels.size()-1; k++) {
+ outShared << labels[k] << ",";
+ }
+ if (labels.size() != 0) { outShared << labels[labels.size()-1]; }
+ outShared << endl;
+ }
+
+ subset.clear();
+ subset.push_back(lookup[0]); subset.push_back(lookup[2]);
+ vector<double> sharedac = vCalcs[i]->getValues(subset, labels);
+ if (sharedOtus && (vCalcs[i]->getName() == "sharedsobs") && (labels.size() != 0)) {
+ outShared << lookup[0]->getGroup() + "-" + lookup[2]->getGroup() << '\t'<< labels.size() << '\t';
+ for (int k = 0; k < labels.size()-1; k++) {
+ outShared << labels[k] << ",";
+ }
+ if (labels.size() != 0) { outShared << labels[labels.size()-1]; }
+ outShared << endl;
+ }
+
+ subset.clear();
+ subset.push_back(lookup[1]); subset.push_back(lookup[2]);
+ vector<double> sharedbc = vCalcs[i]->getValues(subset, labels);
+ if (sharedOtus && (vCalcs[i]->getName() == "sharedsobs") && (labels.size() != 0)) {
+ outShared << lookup[1]->getGroup() + "-" + lookup[2]->getGroup() << '\t'<< labels.size() << '\t';
+ for (int k = 0; k < labels.size()-1; k++) {
+ outShared << labels[k] << ",";
+ }
+ if (labels.size() != 0) { outShared << labels[labels.size()-1]; }
+ outShared << endl;
+ }
+
+
+ subset.clear();
+ subset.push_back(lookup[0]); subset.push_back(lookup[1]); subset.push_back(lookup[2]);
+ vector<double> sharedabc = vCalcs[i]->getValues(subset, labels);
+ if (sharedOtus && (vCalcs[i]->getName() == "sharedsobs") && (labels.size() != 0)) {
+ outShared << lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + "-" + lookup[2]->getGroup() << '\t'<< labels.size() << '\t';
+ for (int k = 0; k < labels.size()-1; k++) {
+ outShared << labels[k] << ",";
+ }
+ if (labels.size() != 0) { outShared << labels[labels.size()-1]; }
+ outShared << endl;
+ outShared.close();
+ }
+
+ //image window
+ outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(width) + " " + toString(windowSize) + " \" >\n";
+ outsvg << "<g>\n";
+
+ //draw circles
+ outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(width) + "\" height=\"" + toString(height) + "\"/>";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.40 * width)) + "\" y=\"" + toString(int(0.05 * height)) + "\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
+ outsvg << "<circle fill=\"rgb(255,0,0)\" opacity=\".3\" stroke=\"black\" cx=\"" + toString(int(0.33 * width)) + "\" cy=\"" + toString(int(0.25 * height)) + "\" r=\"" + toString(int(0.22 * width)) + "\"/>";
+ outsvg << "<circle fill=\"rgb(0,255,0)\" opacity=\".3\" stroke=\"black\" cx=\"" + toString(int(0.65 * width)) + "\" cy=\"" + toString(int(0.25 * height)) + "\" r=\"" + toString(int(0.22 * width)) + "\"/>";
+ outsvg << "<circle fill=\"rgb(0,0,255)\" opacity=\".3\" stroke=\"black\" cx=\"" + toString(int(0.5 * width)) + "\" cy=\"" + toString(int(0.5 * height)) + "\" r=\"" + toString(int(0.22 * width)) + "\"/>";
+
+ //place labels within overlaps
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.29 * width) - ((int)toString(numA[0]-sharedab[0]-sharedac[0]+sharedabc[0]).length() / 2)) + "\" y=\"" + toString(int(0.22 * height)) + "\">" + toString(numA[0]-sharedab[0]-sharedac[0]+sharedabc[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.29 * width) - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[0]->getGroup() + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedab[0] - sharedabc[0]).length() / 2)) + "\" y=\"" + toString(int(0.22 * height)) + "\">" + toString(sharedab[0] - sharedabc[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.68 * width) - ((int)toString(numB[0]-sharedab[0]-sharedbc[0]+sharedabc[0]).length() / 2)) + "\" y=\"" + toString(int(0.22 * height)) + "\">" + toString(numB[0]-sharedab[0]-sharedbc[0]+sharedabc[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.68 * width) - ((int)lookup[1]->getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[1]->getGroup() + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.38 * width) - ((int)toString(sharedac[0] - sharedabc[0]).length() / 2)) + "\" y=\"" + toString(int(0.38 * height)) + "\">" + toString(sharedac[0] - sharedabc[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.5 * width) - ((int)toString(numC[0]-sharedac[0]-sharedbc[0]+sharedabc[0]).length() / 2)) + "\" y=\"" + toString(int(0.54 * height)) + "\">" + toString(numC[0]-sharedac[0]-sharedbc[0]+sharedabc[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.5 * width) - ((int)lookup[2]->getGroup().length() / 2)) + "\" y=\"" + toString(int(0.51 * height)) + "\">" + lookup[2]->getGroup() + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.59 * width) - ((int)toString(sharedbc[0] - sharedabc[0]).length() / 2)) + "\" y=\"" + toString(int(0.38 * height)) + "\">" + toString(sharedbc[0] - sharedabc[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedabc[0]).length() / 2)) + "\" y=\"" + toString(int(0.35 * height)) + "\">" + toString(sharedabc[0]) + "</text>\n";
+
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.825 * height)) + "\">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 << "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.85 * height)) + "\">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 << "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.875 * height)) + "\">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 << "</text>\n";
+
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"" + toString(fontSize) + "\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.725 * height)) + "\">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 << "</text>\n";