From: westcott Date: Wed, 23 Sep 2009 13:32:40 +0000 (+0000) Subject: added get.sharedotu command X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=d2fc851cdaf57874b3ac8261b220fad35750daad added get.sharedotu command --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 7f74d48..59291a3 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -165,6 +165,7 @@ A70DECD91063D8B40057C03C /* secondarystructurecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70DECD81063D8B40057C03C /* secondarystructurecommand.cpp */; }; A7283FF81056CAE100D0CC69 /* chimeracheckrdp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7283FF71056CAE100D0CC69 /* chimeracheckrdp.cpp */; }; A75B887E104C16860083C454 /* ccode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75B887B104C16860083C454 /* ccode.cpp */; }; + A7E4A783106913F900688F62 /* getsharedotucommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E4A782106913F900688F62 /* getsharedotucommand.cpp */; }; EB1216880F619B83004A865F /* bergerparker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB1216870F619B83004A865F /* bergerparker.cpp */; }; EB1216E50F61ACFB004A865F /* bstick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB1216E40F61ACFB004A865F /* bstick.cpp */; }; EB1217230F61C9AC004A865F /* sharedkstest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB1217220F61C9AC004A865F /* sharedkstest.cpp */; }; @@ -522,6 +523,8 @@ A7283FF71056CAE100D0CC69 /* chimeracheckrdp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeracheckrdp.cpp; sourceTree = SOURCE_ROOT; }; A75B887B104C16860083C454 /* ccode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ccode.cpp; sourceTree = SOURCE_ROOT; }; A75B887C104C16860083C454 /* ccode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccode.h; sourceTree = SOURCE_ROOT; }; + A7E4A781106913F900688F62 /* getsharedotucommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getsharedotucommand.h; sourceTree = ""; }; + A7E4A782106913F900688F62 /* getsharedotucommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getsharedotucommand.cpp; sourceTree = ""; }; C6859E8B029090EE04C91782 /* Mothur.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Mothur.1; sourceTree = ""; }; EB1216860F619B83004A865F /* bergerparker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bergerparker.h; sourceTree = SOURCE_ROOT; }; EB1216870F619B83004A865F /* bergerparker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bergerparker.cpp; sourceTree = SOURCE_ROOT; }; @@ -835,6 +838,8 @@ 3749271C0FD58C840031C06B /* getsabundcommand.cpp */, 37B73CA41004D89A008C4B41 /* getseqscommand.h */, 37B73CA51004D89A008C4B41 /* getseqscommand.cpp */, + A7E4A781106913F900688F62 /* getsharedotucommand.h */, + A7E4A782106913F900688F62 /* getsharedotucommand.cpp */, 375873F10F7D64800040F377 /* heatmapcommand.h */, 375873F00F7D64800040F377 /* heatmapcommand.cpp */, 378598640FDD497000EF9D03 /* heatmapsimcommand.h */, @@ -1185,6 +1190,7 @@ A75B887E104C16860083C454 /* ccode.cpp in Sources */, A7283FF81056CAE100D0CC69 /* chimeracheckrdp.cpp in Sources */, A70DECD91063D8B40057C03C /* secondarystructurecommand.cpp in Sources */, + A7E4A783106913F900688F62 /* getsharedotucommand.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/commandfactory.cpp b/commandfactory.cpp index dd5b363..4337024 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -55,6 +55,7 @@ #include "removeseqscommand.h" #include "systemcommand.h" #include "secondarystructurecommand.h" +#include "getsharedotucommand.h" /***********************************************************/ @@ -108,6 +109,7 @@ CommandFactory::CommandFactory(){ commands["remove.seqs"] = "get.seqs"; commands["system"] = "system"; commands["align.check"] = "align.check"; + commands["get.sharedotu"] = "get.sharedotu"; commands["quit"] = "quit"; } @@ -171,6 +173,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "merge.files") { command = new MergeFileCommand(optionString); } else if(commandName == "system") { command = new SystemCommand(optionString); } else if(commandName == "align.check") { command = new AlignCheckCommand(optionString); } + else if(commandName == "get.sharedotu") { command = new GetSharedOTUCommand(optionString); } else { command = new NoCommand(optionString); } return command; diff --git a/getsharedotucommand.cpp b/getsharedotucommand.cpp new file mode 100644 index 0000000..3def8bc --- /dev/null +++ b/getsharedotucommand.cpp @@ -0,0 +1,352 @@ +/* + * getsharedotucommand.cpp + * Mothur + * + * Created by westcott on 9/22/09. + * Copyright 2009 Schloss Lab. All rights reserved. + * + */ + +#include "getsharedotucommand.h" + +//********************************************************************************************************************** + +GetSharedOTUCommand::GetSharedOTUCommand(string option){ + try { + + globaldata = GlobalData::getInstance(); + abort = false; + allLines = 1; + labels.clear(); + + //allow user to run help + if(option == "help") { help(); abort = true; } + + else { + //valid paramters for this command + string Array[] = {"label","groups","fasta","list","group","output"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + + OptionParser parser(option); + map parameters = parser.getParameters(); + + ValidParameters validParameter; + + //check to make sure all parameters are valid for command + for (map::iterator it = parameters.begin(); it != parameters.end(); it++) { + if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } + } + + //check for required parameters + listfile = validParameter.validFile(parameters, "list", true); + if (listfile == "not open") { abort = true; } + else if (listfile == "not found") { listfile = ""; } + else { globaldata->setListFile(listfile); globaldata->setFormat("list"); } + + groupfile = validParameter.validFile(parameters, "group", true); + if (groupfile == "not open") { abort = true; } + else if (groupfile == "not found") { groupfile = ""; } + + if ((listfile == "") || (groupfile == "")) { mothurOut("The list and group parameters are required."); mothurOutEndLine(); abort = true; } + + //check for optional parameter and set defaults + // ...at some point should added some additional type checking... + label = validParameter.validFile(parameters, "label", false); + if (label == "not found") { label = ""; } + else { + if(label != "all") { splitAtDash(label, labels); allLines = 0; } + else { allLines = 1; } + } + + output = validParameter.validFile(parameters, "output", false); + if (output == "not found") { output = ""; } + + groups = validParameter.validFile(parameters, "groups", false); + if (groups == "not found") { groups = ""; } + else { + splitAtDash(groups, Groups); + globaldata->Groups = Groups; + } + + fastafile = validParameter.validFile(parameters, "fasta", true); + if (fastafile == "not open") { abort = true; } + else if (fastafile == "not found") { fastafile = ""; } + + } + + } + catch(exception& e) { + errorOut(e, "GetSharedOTUCommand", "GetSharedOTUCommand"); + exit(1); + } +} +//********************************************************************************************************************** + +void GetSharedOTUCommand::help(){ + try { + mothurOut("The get.sharedotu command parameters are list, group, label, groups, output and fasta. The list and group parameters are required.\n"); + mothurOut("The label parameter allows you to select what distance levels you would like output files for, and are separated by dashes.\n"); + mothurOut("The groups parameter allows you to select groups you would like to know the shared info for, and are separated by dashes.\n"); + mothurOut("The fasta parameter allows you to input a fasta file and outputs a fasta file for each distance level containing only the sequences that are in OTUs shared by the groups specified.\n"); + mothurOut("The output parameter allows you to output the list of names without the group and bin number added. \n"); + mothurOut("With this option you can use the names file as an input in get.seqs and remove.seqs commands. To do this enter output=accnos. \n"); + mothurOut("The get.sharedotu command outputs a .names file for each distance level containing a list of sequences in the OTUs shared by the groups specified.\n"); + mothurOut("The get.sharedotu command should be in the following format: get.sabund(label=yourLabels, groups=yourGroups, fasta=yourFastafile, output=yourOutput).\n"); + mothurOut("Example get.sharedotu(label=unique-0.01, group=forest-pasture, fasta=amazon.fasta, output=accnos).\n"); + mothurOut("The default value for label is all labels in your inputfile. The default for groups is all groups in your file.\n"); + mothurOut("Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n"); + } + catch(exception& e) { + errorOut(e, "GetSharedOTUCommand", "help"); + exit(1); + } +} + +//********************************************************************************************************************** + +GetSharedOTUCommand::~GetSharedOTUCommand(){} + +//********************************************************************************************************************** + +int GetSharedOTUCommand::execute(){ + try { + + if (abort == true) { return 0; } + + groupMap = new GroupMap(groupfile); + groupMap->readMap(); + globaldata->gGroupmap = groupMap; + + if (Groups.size() == 0) { + Groups = groupMap->namesOfGroups; + } + + //put groups in map to find easier + for(int i = 0; i < Groups.size(); i++) { + groupFinder[Groups[i]] = Groups[i]; + } + + if (fastafile != "") { + ifstream inFasta; + openInputFile(fastafile, inFasta); + + while(!inFasta.eof()) { + Sequence seq(inFasta); + seqs.push_back(seq); + } + inFasta.close(); + } + + ListVector* lastlist = NULL; + string lastLabel = ""; + + //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. + set processedLabels; + set userLabels = labels; + + ifstream in; + openInputFile(listfile, in); + + //as long as you are not at the end of the file or done wih the lines you want + while((!in.eof()) && ((allLines == 1) || (userLabels.size() != 0))) { + + list = new ListVector(in); + + if(allLines == 1 || labels.count(list->getLabel()) == 1){ + mothurOut(list->getLabel()); + process(list); + + processedLabels.insert(list->getLabel()); + userLabels.erase(list->getLabel()); + } + + if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { + + mothurOut(lastlist->getLabel()); + process(lastlist); + + processedLabels.insert(lastlist->getLabel()); + userLabels.erase(lastlist->getLabel()); + } + + lastLabel = list->getLabel(); + + if (lastlist != NULL) { delete lastlist; } + lastlist = list; + } + + in.close(); + + //output error messages about any remaining user labels + set::iterator it; + bool needToRun = false; + for (it = userLabels.begin(); it != userLabels.end(); it++) { + mothurOut("Your file does not include the label " + *it); + if (processedLabels.count(lastLabel) != 1) { + mothurOut(". I will use " + lastLabel + "."); mothurOutEndLine(); + needToRun = true; + }else { + mothurOut(". Please refer to " + lastLabel + "."); mothurOutEndLine(); + } + } + + //run last label if you need to + if (needToRun == true) { + mothurOut(lastlist->getLabel()); + process(lastlist); + + processedLabels.insert(lastlist->getLabel()); + userLabels.erase(lastlist->getLabel()); + } + + + //reset groups parameter + globaldata->Groups.clear(); + + if (lastlist != NULL) { delete lastlist; } + return 0; + } + + catch(exception& e) { + errorOut(e, "GetSharedOTUCommand", "execute"); + exit(1); + } +} +/***********************************************************/ +void GetSharedOTUCommand::process(ListVector* shared) { + try { + + map fastaMap; + + ofstream outNames; + string outputFileNames = getRootName(listfile) + shared->getLabel() + ".names"; + openOutputFile(outputFileNames, outNames); + + bool wroteSomething = false; + + //go through each bin, find out if shared + for (int i = 0; i < shared->getNumBins(); i++) { + + bool sharedByAll = true; + + map atLeastOne; + for (int m = 0; m < Groups.size(); m++) { + atLeastOne[Groups[m]] = 0; + } + + vector namesOfSeqsInThisBin; + + string names = shared->get(i); + while ((names.find_first_of(',') != -1) && sharedByAll) { + string name = names.substr(0,names.find_first_of(',')); + names = names.substr(names.find_first_of(',')+1, names.length()); + + //find group + string seqGroup = groupMap->getGroup(name); + if (output != "accnos") { + namesOfSeqsInThisBin.push_back((name + "|" + seqGroup + "|" + toString(i))); + }else { namesOfSeqsInThisBin.push_back(name); } + + if (seqGroup == "not found") { mothurOut(name + " is not in your groupfile. Please correct."); mothurOutEndLine(); exit(1); } + + //is this seq in one of hte groups we care about + it = groupFinder.find(seqGroup); + if (it == groupFinder.end()) { sharedByAll = false; } //you have a sequence from a group you don't want + else { atLeastOne[seqGroup]++; } + } + + //get last name + //find group + if (sharedByAll) { + string seqGroup = groupMap->getGroup(names); + if (output != "accnos") { + namesOfSeqsInThisBin.push_back((names + "|" + seqGroup + "|" + toString(i))); + }else { namesOfSeqsInThisBin.push_back(names); } + + if (seqGroup == "not found") { mothurOut(names + " is not in your groupfile. Please correct."); mothurOutEndLine(); exit(1); } + + //is this seq in one of hte groups we care about + it = groupFinder.find(seqGroup); + if (it == groupFinder.end()) { sharedByAll = false; } //you have a sequence from a group you don't want + else { atLeastOne[seqGroup]++; } + } + + //make sure you have at least one seq from each group you want + map::iterator it2; + for (it2 = atLeastOne.begin(); it2 != atLeastOne.end(); it2++) { + if (it2->second == 0) { sharedByAll = false; } + } + + //if shared, save names of seqs in that bin + if (sharedByAll) { + + wroteSomething = true; + + //output list of names + for (int j = 0; j < namesOfSeqsInThisBin.size(); j++) { + outNames << namesOfSeqsInThisBin[j] << endl; + + if (fastafile != "") { + if (output != "accnos") { + string seqName = namesOfSeqsInThisBin[j].substr(0,namesOfSeqsInThisBin[j].find_last_of('|')); + seqName = seqName.substr(0,seqName.find_last_of('|')); + fastaMap[seqName] = namesOfSeqsInThisBin[j]; //fastaMap needs to contain just the seq name for output later + }else { + fastaMap[namesOfSeqsInThisBin[j]] = namesOfSeqsInThisBin[j]; + } + } + } + } + + + + } + + outNames.close(); + + if (!wroteSomething) { + remove(outputFileNames.c_str()); + string outputString = " - No otus shared by groups"; + + string groupString = ""; + for (int h = 0; h < Groups.size(); h++) { + groupString += " " + Groups[h]; + } + + outputString += groupString + "."; + mothurOut(outputString); mothurOutEndLine(); + }else { mothurOutEndLine(); } + + //if fasta file provided output new fasta file + if ((fastafile != "") && wroteSomething) { + string outputFileFasta = getRootName(fastafile) + shared->getLabel() + ".fasta"; + ofstream outFasta; + openOutputFile(outputFileFasta, outFasta); + + for (int k = 0; k < seqs.size(); k++) { + //if this is a sequence we want, output it + it = fastaMap.find(seqs[k].getName()); + if (it != fastaMap.end()) { + + if (output != "accnos") { + outFasta << ">" << it->second << endl; + }else { + outFasta << ">" << it->first << endl; + } + + outFasta << seqs[k].getAligned() << endl; + } + } + + outFasta.close(); + } + + + } + catch(exception& e) { + errorOut(e, "GetSharedOTUCommand", "process"); + exit(1); + } +} + +//********************************************************************************************************************** diff --git a/getsharedotucommand.h b/getsharedotucommand.h new file mode 100644 index 0000000..6470961 --- /dev/null +++ b/getsharedotucommand.h @@ -0,0 +1,49 @@ +#ifndef GETSHAREDOTUCOMMAND_H +#define GETSHAREDOTUCOMMAND_H + +/* + * getsharedotucommand.h + * Mothur + * + * Created by westcott on 9/22/09. + * Copyright 2009 Schloss Lab. All rights reserved. + * + */ + +#include "command.hpp" +#include "listvector.hpp" +#include "sequence.hpp" +#include "groupmap.h" +#include "globaldata.hpp" + +//********************************************************************************************************************** +class GetSharedOTUCommand : public Command { + + public: + + GetSharedOTUCommand(string); + ~GetSharedOTUCommand(); + int execute(); + void help(); + + private: + + GlobalData* globaldata; + ListVector* list; + GroupMap* groupMap; + + set labels; + string fastafile, label, groups, listfile, groupfile, output; + bool abort, allLines; + vector Groups; + map groupFinder; + map::iterator it; + vector seqs; + + void process(ListVector*); + +}; +//********************************************************************************************************************** + +#endif + diff --git a/summarysharedcommand.h b/summarysharedcommand.h index 119a75c..63197e1 100644 --- a/summarysharedcommand.h +++ b/summarysharedcommand.h @@ -33,10 +33,7 @@ private: vector sumCalculators; InputData* input; ValidCalculators* validCalculator; - SharedListVector* SharedList; - OptionParser* parser; - map parameters; - map::iterator it; + bool abort, allLines, mult; set labels; //holds labels to be used string label, calc, groups; diff --git a/venn.cpp b/venn.cpp index bd40869..82020d4 100644 --- a/venn.cpp +++ b/venn.cpp @@ -306,12 +306,12 @@ void Venn::getPic(vector lookup, vector vCalcs 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 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]); if (numA.size() == 3) { outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]) + "\n"; @@ -389,9 +389,9 @@ void Venn::getPic(vector lookup, vector vCalcs 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 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]); if (numA.size() == 3) { outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]) + "\n"; @@ -546,17 +546,17 @@ void Venn::getPic(vector lookup, vector vCalcs 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 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 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"; + 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"; //make adjustments sharedABC = sharedABC - sharedABCD;