]> git.donarmstrong.com Git - mothur.git/commitdiff
added cluster.fragments command as well as the nseqs parameter to the venn command
authorwestcott <westcott>
Thu, 23 Sep 2010 15:31:47 +0000 (15:31 +0000)
committerwestcott <westcott>
Thu, 23 Sep 2010 15:31:47 +0000 (15:31 +0000)
13 files changed:
Mothur.xcodeproj/project.pbxproj
clustercommand.cpp
clusterfragmentscommand.cpp [new file with mode: 0644]
clusterfragmentscommand.h [new file with mode: 0644]
commandfactory.cpp
kmerdb.cpp
mothur
mothurout.cpp
validcalculator.cpp
venn.cpp
venn.h
venncommand.cpp
venncommand.h

index cd981c30961e93ac75d67e262743334fcb212c22..2721d0897cc58238a0281b1c3aeb147f1194389b 100644 (file)
@@ -49,6 +49,8 @@
                A747E79C1163442A00FB9042 /* chimeracheckcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeracheckcommand.cpp; sourceTree = "<group>"; };
                A747E81C116365E000FB9042 /* chimeraslayercommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chimeraslayercommand.h; sourceTree = "<group>"; };
                A747E81D116365E000FB9042 /* chimeraslayercommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeraslayercommand.cpp; sourceTree = "<group>"; };
+               A74A9C03124B72DB000D5D25 /* clusterfragmentscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clusterfragmentscommand.h; sourceTree = "<group>"; };
+               A74A9C04124B72DB000D5D25 /* clusterfragmentscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clusterfragmentscommand.cpp; sourceTree = "<group>"; };
                A7639F8D1175DF35008F5578 /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = "<group>"; };
                A768D95D1248FEAA008AB1D0 /* mothur */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = mothur; sourceTree = "<group>"; };
                A76AAD02117F322B003D8DA1 /* phylosummary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = phylosummary.h; sourceTree = "<group>"; };
                                A7D215C911996C6E00F13F13 /* clearcutcommand.cpp */,
                                A7DA2021113FECD400BF472F /* clustercommand.cpp */,
                                A7DA2022113FECD400BF472F /* clustercommand.h */,
+                               A74A9C03124B72DB000D5D25 /* clusterfragmentscommand.h */,
+                               A74A9C04124B72DB000D5D25 /* clusterfragmentscommand.cpp */,
                                A71D924311AEB42400D00CBC /* clustersplitcommand.h */,
                                A71D924211AEB42400D00CBC /* clustersplitcommand.cpp */,
                                A7DA2026113FECD400BF472F /* collectcommand.h */,
index 6df5faad98cd9a0cd1a78644794cecc3eef0df7d..2f9c36e0ff84c4b67af8f9e4d50e77edd62d414a 100644 (file)
@@ -158,7 +158,7 @@ int ClusterCommand::execute(){
                double saveCutoff = cutoff;
                
                while (matrix->getSmallDist() < cutoff && matrix->getNNodes() > 0){
-               
+       cout << matrix->getSmallDist() << '\t' << cutoff << '\t' << matrix->getNNodes() << endl;        
                        if (m->control_pressed) { //clean up
                                delete globaldata->gSparseMatrix;  globaldata->gSparseMatrix = NULL;
                                delete globaldata->gListVector;  globaldata->gListVector = NULL;
diff --git a/clusterfragmentscommand.cpp b/clusterfragmentscommand.cpp
new file mode 100644 (file)
index 0000000..0c4dec3
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ *  ryanscommand.cpp
+ *  Mothur
+ *
+ *  Created by westcott on 9/23/10.
+ *  Copyright 2010 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "clusterfragmentscommand.h"
+
+//**********************************************************************************************************************
+//sort by unaligned
+inline bool comparePriority(seqRNode first, seqRNode second) {  
+       bool better = false;
+       
+       if (first.length > second.length) { 
+               better = true;
+       }else if (first.length == second.length) {
+               if (first.numIdentical > second.numIdentical) {
+                       better = true;
+               }
+       }
+       
+       return better; 
+}
+//**********************************************************************************************************************
+ClusterFragmentsCommand::ClusterFragmentsCommand(string option) {
+       try {
+               abort = false;
+               
+               //allow user to run help
+               if(option == "help") { help(); abort = true; }
+               
+               else {
+                       //valid paramters for this command
+                       string Array[] =  {"fasta","name","outputdir","inputdir"};
+                       vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+                       
+                       OptionParser parser(option);
+                       map<string, string> parameters = parser.getParameters();
+                       
+                       ValidParameters validParameter;
+                       map<string, string>::iterator it;
+               
+                       //check to make sure all parameters are valid for command
+                       for (map<string, string>::iterator it2 = parameters.begin(); it2 != parameters.end(); it2++) { 
+                               if (validParameter.isValidParameter(it2->first, myArray, it2->second) != true) {  abort = true;  }
+                       }
+                       
+                       //if the user changes the input directory command factory will send this info to us in the output parameter 
+                       string inputDir = validParameter.validFile(parameters, "inputdir", false);              
+                       if (inputDir == "not found"){   inputDir = "";          }
+                       else {
+                               string path;
+                               it = parameters.find("fasta");
+                               //user has given a template file
+                               if(it != parameters.end()){ 
+                                       path = m->hasPath(it->second);
+                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                       if (path == "") {       parameters["fasta"] = inputDir + it->second;            }
+                               }
+                               
+                               it = parameters.find("name");
+                               //user has given a template file
+                               if(it != parameters.end()){ 
+                                       path = m->hasPath(it->second);
+                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                       if (path == "") {       parameters["name"] = inputDir + it->second;             }
+                               }
+                       }
+
+                       //check for required parameters
+                       fastafile = validParameter.validFile(parameters, "fasta", true);
+                       if (fastafile == "not found") { m->mothurOut("fasta is a required parameter for the cluster.fragments command."); m->mothurOutEndLine(); abort = true; }
+                       else if (fastafile == "not open") { abort = true; }     
+                       
+                       //if the user changes the output directory command factory will send this info to us in the output parameter 
+                       outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = m->hasPath(fastafile);      }
+
+                       //check for optional parameter and set defaults
+                       // ...at some point should added some additional type checking...
+                       namefile = validParameter.validFile(parameters, "name", true);
+                       if (namefile == "not found") { namefile =  "";  }
+                       else if (namefile == "not open") { abort = true; }      
+                       else {  readNameFile();  }
+               }
+                               
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ClusterFragmentsCommand", "ClusterFragmentsCommand");
+               exit(1);
+       }
+}
+
+//**********************************************************************************************************************
+ClusterFragmentsCommand::~ClusterFragmentsCommand(){}  
+//**********************************************************************************************************************
+void ClusterFragmentsCommand::help(){
+       try {
+               m->mothurOut("The cluster.fragments command groups sequences that are part of a larger sequence.\n");
+               m->mothurOut("The cluster.fragments command outputs a new fasta and name file.\n");
+               m->mothurOut("The cluster.fragments command parameters are fasta and name. The fasta parameter is required. \n");
+               m->mothurOut("The names parameter allows you to give a list of seqs that are identical. This file is 2 columns, first column is name or representative sequence, second column is a list of its identical sequences separated by commas.\n");
+               m->mothurOut("The cluster.fragments command should be in the following format: \n");
+               m->mothurOut("cluster.fragments(fasta=yourFastaFile, names=yourNamesFile) \n");
+               m->mothurOut("Example cluster.fragments(fasta=amazon.fasta).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ClusterFragmentsCommand", "help");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+int ClusterFragmentsCommand::execute(){
+       try {
+               
+               if (abort == true) { return 0; }
+               
+               int start = time(NULL);
+               
+               //reads fasta file and return number of seqs
+               int numSeqs = readFASTA(); //fills alignSeqs and makes all seqs active
+               
+               if (m->control_pressed) { return 0; }
+       
+               if (numSeqs == 0) { m->mothurOut("Error reading fasta file...please correct."); m->mothurOutEndLine(); return 0;  }
+               
+               //sort seqs by length of unaligned sequence
+               sort(alignSeqs.begin(), alignSeqs.end(), comparePriority);
+       
+               int count = 0;
+
+               //think about running through twice...
+               for (int i = 0; i < numSeqs; i++) {
+                       
+                       if (alignSeqs[i].active) {  //this sequence has not been merged yet
+                               
+                               string iBases = alignSeqs[i].seq.getUnaligned();
+                               
+                               //try to merge it with all smaller seqs
+                               for (int j = i+1; j < numSeqs; j++) {
+                                       
+                                       if (m->control_pressed) { return 0; }
+                                       
+                                       if (alignSeqs[j].active) {  //this sequence has not been merged yet
+                                               
+                                               string jBases = alignSeqs[j].seq.getUnaligned();
+                                               
+                                               int pos = iBases.find(jBases);
+                                                                                               
+                                               if (pos != string::npos) {
+                                                       //merge
+                                                       alignSeqs[i].names += ',' + alignSeqs[j].names;
+                                                       alignSeqs[i].numIdentical += alignSeqs[j].numIdentical;
+
+                                                       alignSeqs[j].active = 0;
+                                                       alignSeqs[j].numIdentical = 0;
+                                                       count++;
+                                               }
+                                       }//end if j active
+                               }//end if i != j
+                       
+                               //remove from active list 
+                               alignSeqs[i].active = 0;
+                               
+                       }//end if active i
+                       if(i % 100 == 0)        { m->mothurOut(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); m->mothurOutEndLine(); }
+               }
+               
+               if(numSeqs % 100 != 0)  { m->mothurOut(toString(numSeqs) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); m->mothurOutEndLine();   }
+       
+               
+               string fileroot = outputDir + m->getRootName(m->getSimpleName(fastafile));
+               
+               string newFastaFile = fileroot + "fragclust.fasta";
+               string newNamesFile = fileroot + "names";
+               
+               if (m->control_pressed) { return 0; }
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Total number of sequences before cluster.fragments was " + toString(alignSeqs.size()) + "."); m->mothurOutEndLine();
+               m->mothurOut("cluster.fragments removed " + toString(count) + " sequences."); m->mothurOutEndLine(); m->mothurOutEndLine(); 
+               
+               printData(newFastaFile, newNamesFile);
+               
+               m->mothurOut("It took " + toString(time(NULL) - start) + " secs to cluster " + toString(numSeqs) + " sequences."); m->mothurOutEndLine(); 
+               
+               if (m->control_pressed) { remove(newFastaFile.c_str()); remove(newNamesFile.c_str()); return 0; }
+               
+               m->mothurOutEndLine();
+               m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+               m->mothurOut(newFastaFile); m->mothurOutEndLine();      
+               m->mothurOut(newNamesFile); m->mothurOutEndLine();      
+               m->mothurOutEndLine();
+
+               return 0;
+               
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ClusterFragmentsCommand", "execute");
+               exit(1);
+       }
+}
+
+/**************************************************************************************************/
+int ClusterFragmentsCommand::readFASTA(){
+       try {
+       
+               ifstream inFasta;
+               m->openInputFile(fastafile, inFasta);
+               
+               while (!inFasta.eof()) {
+                       
+                       if (m->control_pressed) { inFasta.close(); return 0; }
+                       
+                       Sequence seq(inFasta);  m->gobble(inFasta);
+                       
+                       if (seq.getName() != "") {  //can get "" if commented line is at end of fasta file
+                               if (namefile != "") {
+                                       itSize = sizes.find(seq.getName());
+                                       
+                                       if (itSize == sizes.end()) { m->mothurOut(seq.getName() + " is not in your names file, please correct."); m->mothurOutEndLine(); exit(1); }
+                                       else{
+                                               seqRNode tempNode(itSize->second, seq, names[seq.getName()], seq.getUnaligned().length());
+                                               alignSeqs.push_back(tempNode);
+                                       }       
+                               }else { //no names file, you are identical to yourself 
+                                       seqRNode tempNode(1, seq, seq.getName(), seq.getUnaligned().length());
+                                       alignSeqs.push_back(tempNode);
+                               }
+                       }
+               }
+               
+               inFasta.close();
+               return alignSeqs.size();
+       }
+       
+       catch(exception& e) {
+               m->errorOut(e, "ClusterFragmentsCommand", "readFASTA");
+               exit(1);
+       }
+}
+/**************************************************************************************************/
+void ClusterFragmentsCommand::printData(string newfasta, string newname){
+       try {
+               ofstream outFasta;
+               ofstream outNames;
+               
+               m->openOutputFile(newfasta, outFasta);
+               m->openOutputFile(newname, outNames);
+               
+               for (int i = 0; i < alignSeqs.size(); i++) {
+                       if (alignSeqs[i].numIdentical != 0) {
+                               alignSeqs[i].seq.printSequence(outFasta); 
+                               outNames << alignSeqs[i].seq.getName() << '\t' << alignSeqs[i].names << endl;
+                       }
+               }
+               
+               outFasta.close();
+               outNames.close();
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ClusterFragmentsCommand", "printData");
+               exit(1);
+       }
+}
+/**************************************************************************************************/
+
+void ClusterFragmentsCommand::readNameFile(){
+       try {
+               ifstream in;
+               m->openInputFile(namefile, in);
+               string firstCol, secondCol;
+                               
+               while (!in.eof()) {
+                       in >> firstCol >> secondCol; m->gobble(in);
+                       names[firstCol] = secondCol;
+                       int size = 1;
+
+                       for(int i=0;i<secondCol.size();i++){
+                               if(secondCol[i] == ','){        size++; }
+                       }
+                       sizes[firstCol] = size;
+               }
+               in.close();
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ClusterFragmentsCommand", "readNameFile");
+               exit(1);
+       }
+}
+
+/**************************************************************************************************/
+
diff --git a/clusterfragmentscommand.h b/clusterfragmentscommand.h
new file mode 100644 (file)
index 0000000..9bdbc44
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef CLUSTERFRAGMENTSCOMMAND_H
+#define CLUSTERFRAGMENTSCOMMAND_H
+
+/*
+ *  clusterfragmentscommand.h
+ *  Mothur
+ *
+ *  Created by westcott on 9/23/10.
+ *  Copyright 2010 Schloss Lab. All rights reserved.
+ *
+ */
+
+
+#include "command.hpp"
+#include "sequence.hpp"
+
+/************************************************************/
+struct seqRNode {
+       int numIdentical;
+       int length;
+       Sequence seq;
+       string names;
+       bool active;
+       seqRNode() {}
+       seqRNode(int n, Sequence s, string nm, int l) : numIdentical(n), seq(s), names(nm), active(1), length(l) {}
+       ~seqRNode() {}
+};
+/************************************************************/
+
+class ClusterFragmentsCommand : public Command {
+       
+public:
+       ClusterFragmentsCommand(string);
+       ~ClusterFragmentsCommand();
+       int execute();  
+       void help();
+       
+private:
+       bool abort;
+       string fastafile, namefile, outputDir;
+       vector<seqRNode> alignSeqs; 
+       map<string, string> names; //represents the names file first column maps to second column
+       map<string, int> sizes;  //this map a seq name to the number of identical seqs in the names file
+       map<string, int>::iterator itSize; 
+       
+       int readFASTA();
+       void readNameFile();
+       void printData(string, string); //fasta filename, names file name
+       
+};
+
+/************************************************************/
+
+#endif
+
index 45f89060e62307a463a6637ec89913577f450b72..4651a07e4ab462aab2c409b53d5ae387543638bf 100644 (file)
@@ -88,6 +88,7 @@
 #include "normalizesharedcommand.h"
 #include "metastatscommand.h"
 #include "splitgroupscommand.h"
+#include "clusterfragmentscommand.h"
 
 /*******************************************************/
 
@@ -180,6 +181,7 @@ CommandFactory::CommandFactory(){
        commands["normalize.shared"]    = "normalize.shared";
        commands["metastats"]                   = "metastats";
        commands["split.groups"]                = "split.groups";
+       commands["cluster.fragments"]   = "cluster.fragments";
        commands["classify.seqs"]               = "MPIEnabled"; 
        commands["dist.seqs"]                   = "MPIEnabled";
        commands["filter.seqs"]                 = "MPIEnabled";
@@ -315,6 +317,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){
                else if(commandName == "normalize.shared")              {       command = new NormalizeSharedCommand(optionString);                     }
                else if(commandName == "metastats")                             {       command = new MetaStatsCommand(optionString);                           }
                else if(commandName == "split.groups")                  {       command = new SplitGroupCommand(optionString);                          }
+               else if(commandName == "cluster.fragments")             {       command = new ClusterFragmentsCommand(optionString);            }
                else                                                                                    {       command = new NoCommand(optionString);                                          }
 
                return command;
index 29265933d8c22ea32c1f943a877b3b6cf62ccfe0..108b207d87c469b9f95df83921332b1bf5a756ae 100644 (file)
@@ -110,7 +110,7 @@ void KmerDB::generateDB(){
                m->openOutputFile(kmerDBName, kmerFile);                                        //      to a file
                
                //output version
-               kmerFile << m->getVersion() << endl;
+               kmerFile << "#" << m->getVersion() << endl;
                
                for(int i=0;i<maxKmer;i++){                                                             //      step through all of the possible kmer numbers
                        kmerFile << i << ' ' << kmerLocations[i].size();        //      print the kmer number and the number of sequences with
diff --git a/mothur b/mothur
index d499a6ac25ab19368160605955e6a1e319bf7f51..7bf5ba30b99fe799c4b6a337553b64c3f60594f7 100755 (executable)
Binary files a/mothur and b/mothur differ
index aab9945230f680e4ce106e4266ff66ba5ee7c34e..67c62c1bed469a387462f5decac8252971dda43e 100644 (file)
@@ -502,19 +502,29 @@ string MothurOut::getFullPathName(string fileName){
                #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)   
                        
                        if (path.find("~") != -1) { //go to home directory
-                               string homeDir = getenv ("HOME");
+                               string homeDir;
+                       
+                               char *homepath = NULL;
+                               homepath = getenv ("HOME");
+                               if ( homepath != NULL) { homeDir = homepath; }
+                               else { homeDir = "";  }
+
                                newFileName = homeDir + fileName.substr(fileName.find("~")+1);
                                return newFileName;
                        }else { //find path
                                if (path.rfind("./") == -1) { return fileName; } //already complete name
                                else { newFileName = fileName.substr(fileName.rfind("./")+2); } //save the complete part of the name
                                
-                               char* cwdpath = new char[1024];
+                               //char* cwdpath = new char[1024];
+                               //size_t size;
+                               //cwdpath=getcwd(cwdpath,size);
+                               //cwd = cwdpath;
+                               
+                               char *cwdpath = NULL;
+                               cwdpath = getcwd(NULL, 0); // or _getcwd
+                               if ( cwdpath != NULL) { cwd = cwdpath; }
+                               else { cwd = "";  }
 
-                               size_t size;
-                               cwdpath=getcwd(cwdpath,size);
-                       
-                               cwd = cwdpath;
                                
                                //rip off first '/'
                                string simpleCWD;
index cf783f30f82db5a0b5e3c2fa040775fb85463f46..bc8c4b8d7ab4b753cfa3f75a7c7da0b8ba740bc0 100644 (file)
@@ -386,7 +386,6 @@ void ValidCalculators::initialVennSingle() {
                vennsingle["chao"]                  = "chao";
                vennsingle["ace"]                       = "ace";
                vennsingle["jack"]                  = "jack";
-               vennsingle["nseqs"]                 = "nseqs";
                vennsingle["default"]           = "default";
        }
        catch(exception& e) {
@@ -401,7 +400,6 @@ void ValidCalculators::initialVennShared() {
                vennshared["sharedsobs"]        = "sharedsobs";
                vennshared["sharedchao"]        = "sharedchao";
                vennshared["sharedace"]         = "sharedace";
-               vennshared["nseqs"]                     = "nseqs";
                vennshared["default"]           = "default";
        }
        catch(exception& e) {
index 9d117d618cde35f6cd1275c4577722e8716b2f38..378e004ac4524d78088b054a91947d604ca32768 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
@@ -17,7 +17,7 @@
 
 
 //**********************************************************************************************************************
-Venn::Venn(string o) : outputDir(o) {
+Venn::Venn(string o, bool n) : outputDir(o), nseqs(n) {
        try {
                globaldata = GlobalData::getInstance();
                m = MothurOut::getInstance();
@@ -60,6 +60,10 @@ vector<string> Venn::getPic(SAbundVector* sabund, vector<Calculator*> vCalcs) {
                                outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.35 * width)) +  "\" y=\"" +  toString(int(0.645 * height)) +  "\">The upper bound of the confidence interval is " + toString(data[2]) + "</text>\n";
                        }
                        
+                       if (nseqs) {
+                               outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.35 * width)) +  "\" y=\"" +  toString(int(0.70 * height)) +  "\">The number of sequences represented is " + toString(sabund->getNumSeqs()) + "</text>\n";
+                       }
+                       
                        outsvg << "</g>\n</svg>\n";
                        outsvg.close();
                }
@@ -102,8 +106,6 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                        singleCalc = new Chao1();
                                }else if (vCalcs[i]->getName() == "sharedace") {
                                        singleCalc = new Ace(10);
-                               }else if (vCalcs[i]->getName() == "nseqs") {
-                                       singleCalc = new NSeqs();
                                }
                                
                                vector<double> data = singleCalc->getValues(sabund);
@@ -122,7 +124,11 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                        outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.35 * width)) +  "\" y=\"" +  toString(int(0.60 * height)) +  "\" >The lower bound of the confidence interval is " + toString(data[1]) + "</text>\n";
                                        outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.35 * width)) +  "\" y=\"" +  toString(int(0.645 * height)) +  "\">The upper bound of the confidence interval is " + toString(data[2]) + "</text>\n";
                                }
-                       
+                               
+                               if (nseqs) {
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.35 * width)) +  "\" y=\"" +  toString(int(0.70 * height)) +  "\">The number of sequences represented is " + toString(sabund->getNumSeqs()) + "</text>\n";
+                               }
+                               
                                outsvg << "</g>\n</svg>\n";
                                outsvg.close();
                                delete singleCalc;
@@ -151,63 +157,71 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                if (m->control_pressed) { outsvg.close(); return outputNames; }
                                
                                //get estimates for sharedAB
-                               vector<double> results = vCalcs[i]->getValues(subset);
+                               vector<double> shared = vCalcs[i]->getValues(subset);
                                
                                //in essence you want to run it like a single 
                                if (vCalcs[i]->getName() == "sharedsobs") {
                                        singleCalc = new Sobs();
                                }else if (vCalcs[i]->getName() == "sharedchao") {
                                        singleCalc = new Chao1();
-                               }else if (vCalcs[i]->getName() == "nseqs") {
-                                       singleCalc = new NSeqs();
                                }//else if (vCalcs[i]->getName() == "sharedace") {
                                        //singleCalc = new Ace(10);
                                //}
                                
+                               int sharedVal, numSeqsA, numSeqsB;
+                               if (nseqs) {
+                                       NSeqs* nseqsCalc = new NSeqs();
+                                       vector<double> data = nseqsCalc->getValues(lookup);
+                                       
+                                       sharedVal = data[0] + data[1];
+                                       numSeqsA = sabundA->getNumSeqs();
+                                       numSeqsB = sabundB->getNumSeqs();
+                                       
+                                       delete nseqsCalc;
+                               }
+                               
+                               
                                //get estimates for numA
-                               vector<double> resultsA = singleCalc->getValues(sabundA);
+                               vector<double> numA = singleCalc->getValues(sabundA);
 
                                //get estimates for numB
-                               vector<double> resultsB = singleCalc->getValues(sabundB);
-                               
-                               double numA, numB, shared;
-                               if (vCalcs[i]->getName() == "nseqs") { 
-                                       shared = results[0] + results[1]; //add both groups sequences
-                                       numA = resultsA[0] - results[0]; //what's in A - the number of species in A that are in shared otus
-                                       numB = resultsB[0] - results[1]; //what's in B - the number of species in B that are in shared otus
-                               }else{
-                                       shared = results[0];
-                                       numA = resultsA[0] - shared;
-                                       numB = resultsB[0] - shared;
-                               }
+                               vector<double> numB = singleCalc->getValues(sabundB);
                                                
                                //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(height) + " \" >\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=\"24\" x=\"" +  toString(int(0.40 * width)) +  "\" y=\"" +  toString(int(0.05 * height)) +  "\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
+                               outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" 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.36 * width)) +  "\" cy=\"" +  toString(int(0.29 * height)) +  "\" r=\"" +  toString(int(0.22 * width)) +  "\"/>"; 
                                outsvg << "<circle fill=\"rgb(0,255,0)\" opacity=\".3\" stroke=\"black\" cx=\"" +  toString(int(0.62 * width)) +  "\" cy=\"" +  toString(int(0.29 * height)) +  "\" r=\"" +  toString(int(0.22 * width)) +  "\"/>"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.29 * width) - ((int)toString(numA).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(numA) + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)toString(numB).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(numB) + "</text>\n"; 
+                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.29 * width) - ((int)toString(numA[0]).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(numA[0] - shared[0]) + "</text>\n";
+                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)toString(numB[0]).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(numB[0] - shared[0]) + "</text>\n"; 
                                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.29 * width) - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"" +  toString(int(0.25 * height)) +  "\">" + lookup[0]->getGroup() + "</text>\n";
                                outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)lookup[1]->getGroup().length() / 2)) + "\" y=\"" +  toString(int(0.25 * height)) +  "\">" + lookup[1]->getGroup() + "</text>\n"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(shared).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(shared) + "</text>\n";  
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.66 * height)) +  "\">The number of species in group " + lookup[0]->getGroup() + " is " + toString(resultsA[0]);
-                               if (resultsA.size() == 3) { 
-                                       outsvg << " the lci is " + toString(resultsA[1]) + " and the hci is " + toString(resultsA[2]) + "</text>\n";
-                               }else { outsvg << "</text>\n"; }
+                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(shared[0]).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(shared[0]) + "</text>\n";  
+                               outsvg << "<text fill=\"black\" class=\"seri\"   font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.66 * 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";
                
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.69 * height)) +  "\">The number of species in group " + lookup[1]->getGroup() + " is " + toString(resultsB[0]);
-                               if (resultsB.size() == 3) { 
-                                       outsvg << " the lci is " + toString(resultsB[1]) + " and the hci is " + toString(resultsB[2]) + "</text>\n";
-                               }else { outsvg << "</text>\n"; }
-
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.72 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(shared) + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">Percentage of species that are shared in groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString((shared / (float)(numA + numB + shared))*100) + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.78 * height)) +  "\">The total richness for all groups is " + toString((float)(numA + numB + shared)) + "</text>\n";
+                               outsvg << "<text fill=\"black\" class=\"seri\"   font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.69 * height)) +  "\">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 << "</text>\n";
+
+                               outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.72 * height)) +  "\">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 << "</text>\n";
+                               
+                               outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">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) + "</text>\n";
+                               outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.78 * height)) +  "\">The total richness for all groups is " + toString((float)(numA[0] + numB[0] - shared[0]))+ "</text>\n";;
+                               
                                
                                //close file
                                outsvg << "</g>\n</svg>\n";
@@ -219,6 +233,8 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                }else if (lookup.size() == 3) {
                        
                        height = 1600;
+                       int windowSize = height;
+       
                        
                        //get sabund vector pointers so you can use the single calculators
                        //one for each group
@@ -238,6 +254,33 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                
                                if (m->control_pressed) { outsvg.close(); return outputNames; }
                                
+                               int sharedVal, sharedABVal, sharedACVal, sharedBCVal, numSeqsA, numSeqsB, numSeqsC;
+                               
+                               if (nseqs) {
+                                       NSeqs* nseqsCalc = new NSeqs();
+                                       vector<double> sharedData = nseqsCalc->getValues(lookup);
+                                               
+                                       vector<SharedRAbundVector*> mysubset; mysubset.push_back(lookup[0]); mysubset.push_back(lookup[1]);
+                                       vector<double> sharedAB = nseqsCalc->getValues(mysubset);
+                                               
+                                       mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[2]);
+                                       vector<double> sharedAC = nseqsCalc->getValues(mysubset);
+                                               
+                                       mysubset.clear(); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[2]);
+                                       vector<double> 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);
@@ -270,8 +313,7 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                        vector<double> sharedCwithAB;
                                        
                                        //find possible sharedABC values
-                                       double sharedABC1 = 0.0; double sharedABC2 = 0.0; double sharedABC3 = 0.0; double sharedABC = 0.0;
-                                       vector<double> = resultsNseqs;
+                                       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
@@ -322,74 +364,72 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                                else if ((sharedABC3 < sharedABC1) && (sharedABC3 < sharedABC2)) { sharedABC = sharedABC3; }    
                                        }else{
                                                vector<double> data = vCalcs[i]->getValues(lookup);
-                                               resultsNseqs = data;
                                                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);
                                        }
                                        
-                                       double numA, numB, numC, numAB, numAC, numBC, numABC;
-                                       if (vCalcs[i]->getName() == "nseqs") { 
-                                               numABC = resultsNseqs[0] + resultsNseqs[1] + resultsNseqs[2];
-                                               numBC = sharedBC[0] + sharedBC[1] - (resultsNseqs[1] + resultsNseqs[2]);
-                                       
-                                       }else{
-                                               numABC = sharedABC;
-                                               numBC = sharedBC[0] - sharedABC;
-                                               numAB = sharedAB[0] - sharedABC;
-                                               numAC = sharedAC[0] - sharedABC;
-                                               numA = numA[0]-sharedAwithBC[0];
-                                               numB = numB[0]-sharedBwithAC[0];
-                                               numC = numC[0]-sharedCwithAB[0];
-                                       }
-                                       
                                        //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(height) + " \" >\n";
+                                       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=\"24\" x=\"" +  toString(int(0.40 * width)) +  "\" y=\"" +  toString(int(0.44 * height)) +  "\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.40 * width)) +  "\" y=\"" +  toString(int(0.44 * 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=\"24\" x=\"" + toString(int(0.33 * width) - ((int)toString(numA[0]-sharedAwithBC[0]).length() / 2)) + "\" y=\"" +  toString(int(0.22 * height)) +  "\">" + toString(numA[0]-sharedAwithBC[0]) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.33 * 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=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedAB[0] - sharedABC).length() / 2)) + "\"  y=\"" +  toString(int(0.22 * height)) +  "\">" + toString(sharedAB[0] - sharedABC) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)toString(numB[0]-sharedBwithAC[0]).length() / 2)) + "\"  y=\"" +  toString(int(0.22 * height)) +  "\">" + toString(numB[0]-sharedBwithAC[0]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * 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=\"24\" x=\"" + toString(int(0.33 * width) - ((int)toString(numA[0]-sharedAwithBC[0]).length() / 2)) + "\" y=\"" +  toString(int(0.22 * height)) +  "\">" + toString(numA[0]-sharedAwithBC[0]) + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" + toString(int(0.33 * 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=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedAB[0] - sharedABC).length() / 2)) + "\"  y=\"" +  toString(int(0.22 * height)) +  "\">" + toString(sharedAB[0] - sharedABC) + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)toString(numB[0]-sharedBwithAC[0]).length() / 2)) + "\"  y=\"" +  toString(int(0.22 * height)) +  "\">" + toString(numB[0]-sharedBwithAC[0]) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" + toString(int(0.7 * 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=\"24\" x=\"" + toString(int(0.38 * width) - ((int)toString(sharedAC[0] - sharedABC).length() / 2)) + "\"  y=\"" +  toString(int(0.38 * height)) +  "\">" + toString(sharedAC[0] - sharedABC) + "</text>\n";  
                                        outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\"  x=\"" + toString(int(0.5 * width) - ((int)toString(numC[0]-sharedCwithAB[0]).length() / 2)) + "\"   y=\"" +  toString(int(0.54 * height)) +  "\">" + toString(numC[0]-sharedCwithAB[0]) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\"  x=\"" + toString(int(0.5 * width) - ((int)lookup[2]->getGroup().length() / 2)) + "\"   y=\"" +  toString(int(0.52 * height)) +  "\">" + lookup[2]->getGroup() + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.58 * width) - ((int)toString(sharedBC[0] - sharedABC).length() / 2)) + "\" y=\"" +  toString(int(0.38 * height)) +  "\">" + toString(sharedBC[0] - sharedABC) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedABC).length() / 2)) + "\"  y=\"" +  toString(int(0.34 * height)) +  "\">" + toString(sharedABC) + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\"  x=\"" + toString(int(0.5 * width) - ((int)lookup[2]->getGroup().length() / 2)) + "\"   y=\"" +  toString(int(0.52 * height)) +  "\">" + lookup[2]->getGroup() + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" + toString(int(0.58 * width) - ((int)toString(sharedBC[0] - sharedABC).length() / 2)) + "\" y=\"" +  toString(int(0.38 * height)) +  "\">" + toString(sharedBC[0] - sharedABC) + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedABC).length() / 2)) + "\"  y=\"" +  toString(int(0.34 * height)) +  "\">" + toString(sharedABC) + "</text>\n"; 
                                
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" 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]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" 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]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" 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]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.9 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + " and combined groups " + lookup[1]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedAwithBC[0]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.925 * height)) +  "\">The number of species shared between groups " + lookup[1]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedBwithAC[0]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.95 * height)) +  "\">The number of species shared between groups " + lookup[2]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[1]->getGroup() + " is " + toString(sharedCwithAB[0]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" 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]);
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.9 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + " and combined groups " + lookup[1]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedAwithBC[0]) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.925 * height)) +  "\">The number of species shared between groups " + lookup[1]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedBwithAC[0]) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.95 * height)) +  "\">The number of species shared between groups " + lookup[2]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[1]->getGroup() + " is " + toString(sharedCwithAB[0]) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" 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]) + "</text>\n";
-                                       }else { outsvg << "</text>\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 << "</text>\n";
                        
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]);
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">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]) + "</text>\n";
-                                       }else { outsvg << "</text>\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 << "</text>\n";
                                        
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.775 * height)) +  "\">The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC[0]);
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.775 * height)) +  "\">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]) + "</text>\n";
-                                       }else { outsvg << "</text>\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 << "</text>\n";
 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.80 * height)) +  "\">The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedAB[0] - sharedAC[0] - sharedBC[0] + sharedABC) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.975 * height)) +  "\">The total shared richness is " + toString(sharedABC) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.80 * height)) +  "\">The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedAB[0] - sharedAC[0] - sharedBC[0] + sharedABC) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.975 * height)) +  "\">The total shared richness is " + toString(sharedABC);
+                                       if (nseqs) {  outsvg << ", and the number of squences is " + toString(sharedVal);  }  
+                                       outsvg << "</text>\n";
                                        
                                        delete singleCalc;
                                        
@@ -428,52 +468,65 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                        vector<double> sharedabc =  vCalcs[i]->getValues(subset);
                                        
                                        //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(height) + " \" >\n";
+                                       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=\"24\" x=\"" +  toString(int(0.40 * width)) +  "\" y=\"" +  toString(int(0.05 * height)) +  "\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\"  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=\"24\"  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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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=\"24\"  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=\"24\"  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=\"24\" 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=\"24\" 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=\"24\" 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]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" 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]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" 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]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" 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]);
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" 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=\"24\" 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=\"24\" 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=\"24\" 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]) + "</text>\n";
-                                       }else { outsvg << "</text>\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 << "</text>\n";
                        
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]);
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">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]) + "</text>\n";
-                                       }else { outsvg << "</text>\n"; }
-                                       
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.775 * height)) +  "\">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 << "</text>\n";
+                                                                               
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.775 * height)) +  "\">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]) + "</text>\n";
-                                       }else { outsvg << "</text>\n"; }
-
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.8 * height)) +  "\">The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedab[0] - sharedac[0] - sharedbc[0] + sharedabc[0]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.9 * height)) +  "\">The total shared richness is " + toString(sharedabc[0]) + "</text>\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 << "</text>\n";
 
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.8 * height)) +  "\">The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedab[0] - sharedac[0] - sharedbc[0] + sharedabc[0]) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.9 * height)) +  "\">The total shared richness is " + toString(sharedabc[0]);
+                                       if (nseqs) {  outsvg << ", and the number of squences is " + toString(sharedVal);  }  
+                                       outsvg << "</text>\n";
 
                                }
-               
                                                                
                                //close file
                                outsvg << "</g>\n</svg>\n";
@@ -487,6 +540,8 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                }else if (lookup.size() == 4) {
                        
                        height = 1600;
+                       
+                       int windowSize = height;
                
                        //calc the shared otu
                        float sharedABCD = 0;
@@ -508,7 +563,7 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                        //make a file for each calculator
                        for(int i=0;i<vCalcs.size();i++){
                                
-                               if ((vCalcs[i]->getName() != "sharedsobs") && (vCalcs[i]->getName() != "sharedchao") && (vCalcs[i]->getName() != "nseqs")) { m->mothurOut(vCalcs[i]->getName() + " is not a valid calculator with four groups.  It will be disregarded. "); m->mothurOutEndLine(); }
+                               if ((vCalcs[i]->getName() != "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";
                                        outputNames.push_back(filenamesvg);
@@ -521,10 +576,7 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                                singleCalc = new Sobs();
                                        }else if (vCalcs[i]->getName() == "sharedchao") {
                                                singleCalc = new Chao1();
-                                       }else if (vCalcs[i]->getName() == "nseqs") {
-                                               singleCalc = new NSeqs();
                                        }
-
                                
                                        //get estimates for numA
                                        data = singleCalc->getValues(sabundA);
@@ -601,31 +653,112 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                        data = vCalcs[i]->getValues(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<double> sharedData = nseqsCalc->getValues(lookup);
+                                               
+                                               vector<SharedRAbundVector*> mysubset; mysubset.push_back(lookup[0]); mysubset.push_back(lookup[1]);
+                                               vector<double> sharedAB = nseqsCalc->getValues(mysubset);
+                                               
+                                               mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[2]);
+                                               vector<double> sharedAC = nseqsCalc->getValues(mysubset);
+                                               
+                                               mysubset.clear(); mysubset.push_back(lookup[0]); mysubset.push_back(lookup[3]);
+                                               vector<double> sharedAD = nseqsCalc->getValues(mysubset);
+                                               
+                                               mysubset.clear(); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[2]);
+                                               vector<double> sharedBC = nseqsCalc->getValues(mysubset);
+                                               
+                                               mysubset.clear(); mysubset.push_back(lookup[1]); mysubset.push_back(lookup[3]);
+                                               vector<double> sharedBD = nseqsCalc->getValues(mysubset);
+                                               
+                                               mysubset.clear(); mysubset.push_back(lookup[2]); mysubset.push_back(lookup[3]);
+                                               vector<double> sharedCD = nseqsCalc->getValues(mysubset);
+                                               
+                                               mysubset.clear(); mysubset.push_back(lookup[0]);  mysubset.push_back(lookup[1]); mysubset.push_back(lookup[2]);
+                                               vector<double> sharedABC = nseqsCalc->getValues(mysubset);
+                                               
+                                               mysubset.clear(); mysubset.push_back(lookup[0]);  mysubset.push_back(lookup[1]); mysubset.push_back(lookup[3]);
+                                               vector<double> sharedABD = nseqsCalc->getValues(mysubset);
+
+                                               mysubset.clear(); mysubset.push_back(lookup[0]);  mysubset.push_back(lookup[2]); mysubset.push_back(lookup[3]);
+                                               vector<double> sharedACD = nseqsCalc->getValues(mysubset);
+
+                                               mysubset.clear(); mysubset.push_back(lookup[1]);  mysubset.push_back(lookup[2]); mysubset.push_back(lookup[3]);
+                                               vector<double> 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 << "<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(height) + " \" >\n";
+                                       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";
-                                       outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" +  toString(width) +  "\" height=\"" +  toString(height) +  "\"/>"; 
+                                       outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" +  toString(width) +  "\" height=\"" +  toString(windowSize) +  "\"/>"; 
                                        outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.40 * width)) +  "\" y=\"" +  toString(int(0.05 * height)) +  "\" >Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.625 * height)) +  "\">The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.65 * height)) +  "\">The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.675 * height)) +  "\">The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.7 * height)) +  "\">The number of species in group " + lookup[3]->getGroup() + " is " + toString(numD) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\"  y=\"" +  toString(int(0.625 * height)) +  "\">The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA); 
+                                       if (nseqs) {  outsvg << ", and the number of squences is " + toString(numSeqsA);  }  
+                                       outsvg << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.65 * height)) +  "\">The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB);
+                                       if (nseqs) {  outsvg << ", and the number of squences is " + toString(numSeqsB);  }  
+                                       outsvg << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.675 * height)) +  "\">The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC);
+                                       if (nseqs) {  outsvg << ", and the number of squences is " + toString(numSeqsC);  }  
+                                       outsvg << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.7 * height)) +  "\">The number of species in group " + lookup[3]->getGroup() + " is " + toString(numD);
+                                       if (nseqs) {  outsvg << ", and the number of squences is " + toString(numSeqsD);  }  
+                                       outsvg << "</text>\n";
                                        
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.725 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.775 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedAD) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.8 * height)) +  "\">The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.825 * height)) +  "\">The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBD) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.85 * height)) +  "\">The number of species shared between groups " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedCD) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.725 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.75 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.775 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.8 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.825 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.85 * height)) +  "\">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 << "</text>\n";
                                        
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.875 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedABC) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.9 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[1]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedABD) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.925 * height)) +  "\">The number of species shared between groups " + lookup[0]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedACD) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.95 * height)) +  "\">The number of species shared between groups " + lookup[1]->getGroup() + ", " + lookup[2]->getGroup() + " and " + lookup[3]->getGroup() + " is " + toString(sharedBCD) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.875 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.9 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.925 * height)) +  "\">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 << "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.95 * height)) +  "\">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 << "</text>\n";
                                                                        
                                        //make adjustments
                                        sharedABC = sharedABC - sharedABCD;
@@ -682,11 +815,10 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                        outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.63 * width) - ((int)toString(sharedABC).length() / 2)) + "\"  y=\"" +  toString(int(0.3 * height)) +  "\">" + toString(sharedABC) + "</text>\n"; 
                                        outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedABCD).length() / 2)) + "\"  y=\"" +  toString(int(0.4 * height)) +  "\">" + toString(sharedABCD) + "</text>\n"; 
                                        
+                                       outsvg << "<text fill=\"black\"  class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.975 * height)) +  "\">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 << "</text>\n";
                                        
-                                                                               
-                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" +  toString(int(0.25 * width)) +  "\" y=\"" +  toString(int(0.975 * height)) +  "\">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)) + "</text>\n";
-                                       
-
                                        outsvg << "</g>\n</svg>\n";
                                        outsvg.close();
                                        delete singleCalc;
diff --git a/venn.h b/venn.h
index d3a3f05b841e768554746b14fa087d0baef28bfe..33935e6a2c9496fd984b8328cf33326dbeb23fa1 100644 (file)
--- a/venn.h
+++ b/venn.h
@@ -20,7 +20,7 @@
 
 class Venn {
 public:
-       Venn(string);
+       Venn(string, bool);
        ~Venn(){};
 
        vector<string> getPic(SAbundVector*, vector<Calculator*>);
@@ -32,6 +32,7 @@ private:
        string groupComb, outputDir;
        ofstream outsvg;
        MothurOut* m;
+       bool nseqs;
 };
 
 /***********************************************************************/
index 8b617d8881000bd7e837e901fc1765b18592d6b4..5fa06aa98d0eeed0783c9d53eb5f3663e0405c14 100644 (file)
@@ -32,7 +32,7 @@ VennCommand::VennCommand(string option)  {
                
                else {
                        //valid paramters for this command
-                       string AlignArray[] =  {"groups","label","calc", "abund","outputdir","inputdir"};
+                       string AlignArray[] =  {"groups","label","calc", "abund","nseqs","outputdir","inputdir"};
                        vector<string> myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -95,6 +95,10 @@ VennCommand::VennCommand(string option)  {
                        string temp;
                        temp = validParameter.validFile(parameters, "abund", false);            if (temp == "not found") { temp = "10"; }
                        convert(temp, abund); 
+                       
+                       temp = validParameter.validFile(parameters, "nseqs", false);                    if (temp == "not found"){       temp = "f";                             }
+                       nseqs = m->isTrue(temp); 
+
 
                        if (abort == false) {
                                validCalculator = new ValidCalculators();
@@ -112,8 +116,6 @@ VennCommand::VennCommand(string option)  {
                                                                if(abund < 5)
                                                                        abund = 10;
                                                                vennCalculators.push_back(new Ace(abund));
-                                                       }else if (Estimators[i] == "nseqs") { 
-                                                               vennCalculators.push_back(new NSeqs());
                                                        }
                                                }
                                        }
@@ -126,8 +128,6 @@ VennCommand::VennCommand(string option)  {
                                                                vennCalculators.push_back(new SharedChao1());
                                                        }else if (Estimators[i] == "sharedace") { 
                                                                vennCalculators.push_back(new SharedAce());
-                                                       }else if (Estimators[i] == "nseqs") { 
-                                                               vennCalculators.push_back(new NSeqs());
                                                        }
                                                }
                                        }
@@ -135,7 +135,7 @@ VennCommand::VennCommand(string option)  {
                                
                                //if the users entered no valid calculators don't execute command
                                if (vennCalculators.size() == 0) { m->mothurOut("No valid calculators given, please correct."); m->mothurOutEndLine(); abort = true;  }
-                               else {  venn = new Venn(outputDir);  }
+                               else {  venn = new Venn(outputDir, nseqs);  }
                        }
                        
                }
@@ -154,7 +154,7 @@ VennCommand::VennCommand(string option)  {
 void VennCommand::help(){
        try {
                m->mothurOut("The venn command can only be executed after a successful read.otu command.\n");
-               m->mothurOut("The venn command parameters are groups, calc, abund and label.  No parameters are required.\n");
+               m->mothurOut("The venn command parameters are groups, calc, abund, nseqs and label.  No parameters are required.\n");
                m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like included in your venn diagram, you may only use a maximum of 4 groups.\n");
                m->mothurOut("The group names are separated by dashes. The label allows you to select what distance levels you would like a venn diagram created for, and are also separated by dashes.\n");
                m->mothurOut("The venn command should be in the following format: venn(groups=yourGroups, calc=yourCalcs, label=yourLabels, abund=yourAbund).\n");
@@ -162,7 +162,8 @@ void VennCommand::help(){
                m->mothurOut("The default value for groups is all the groups in your groupfile up to 4, and all labels in your inputfile will be used.\n");
                m->mothurOut("The default value for calc is sobs if you have only read a list file or if you have selected only one group, and sharedsobs if you have multiple groups.\n");
                m->mothurOut("The default available estimators for calc are sobs, chao and ace if you have only read a list file, and sharedsobs, sharedchao and sharedace if you have read a list and group file or a shared file.\n");
-               m->mothurOut("The only estmiator available four 4 groups is sharedsobs.\n");
+               m->mothurOut("The nseqs parameter will output the number of sequences represented by the otus in the picture, default=F.\n");
+               m->mothurOut("The only estimators available four 4 groups are sharedsobs and sharedchao.\n");
                m->mothurOut("The venn command outputs a .svg file for each calculator you specify at each distance you choose.\n");
                m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
        }
index aa1e8562343f899fcaf1e1d60295c47799b533c1..a159356e44466f13913242128be47c0377e7806d 100644 (file)
@@ -40,7 +40,7 @@ private:
        SAbundVector* sabund;
        int abund;
        
-       bool abort, allLines;
+       bool abort, allLines, nseqs;
        set<string> labels; //holds labels to be used
        string format, groups, calc, label, outputDir;
        vector<string> Estimators, Groups;