]> git.donarmstrong.com Git - mothur.git/commitdiff
1.10.0
authorwestcott <westcott>
Fri, 14 May 2010 18:50:27 +0000 (18:50 +0000)
committerwestcott <westcott>
Fri, 14 May 2010 18:50:27 +0000 (18:50 +0000)
24 files changed:
alignmentdb.cpp
alignmentdb.h
bayesian.cpp
bayesian.h
blastdb.cpp
classify.h
clearcutcommand.cpp
clearcutcommand.h
collect.cpp
collectcommand.cpp
collectsharedcommand.cpp
distancedb.hpp
knn.cpp
knn.h
mothur.cpp
mothur.h
phylodiversitycommand.cpp
rarefact.cpp
rarefactcommand.cpp
rarefactsharedcommand.cpp
seqsummarycommand.cpp
trimseqscommand.cpp
validparameter.cpp
venn.cpp

index 1ea1b9803e16b306bc2ea9deeb310eeff1d5fc06..364ef12588223c0300eccd767aac6f17e6630aa1 100644 (file)
@@ -194,65 +194,6 @@ Sequence AlignmentDB::findClosestSequence(Sequence* seq) {
                exit(1);\r
        }\r
 }\r
-#ifdef USE_MPI \r
-/**************************************************************************************************/\r
-int AlignmentDB::MPISend(int receiver) {\r
-       try {\r
-               \r
-               //send numSeqs - int\r
-               MPI_Send(&numSeqs, 1, MPI_INT, receiver, 2001, MPI_COMM_WORLD); \r
-                                                                       \r
-               //send longest - int\r
-               MPI_Send(&longest, 1, MPI_INT, receiver, 2001, MPI_COMM_WORLD); \r
-       \r
-               //send templateSequences\r
-               for (int i = 0; i < templateSequences.size(); i++) {\r
-                       templateSequences[i].MPISend(receiver);\r
-               }\r
-               \r
-               //send Database\r
-               search->MPISend(receiver);\r
-               \r
-               return 0;\r
-       }\r
-       catch(exception& e) {\r
-               m->errorOut(e, "AlignmentDB", "MPISend");\r
-               exit(1);\r
-       }\r
-}\r
-/**************************************************************************************************/\r
-int AlignmentDB::MPIRecv(int sender) {\r
-       try {\r
-               MPI_Status status;\r
-               //receive numSeqs - int\r
-               MPI_Recv(&numSeqs, 1, MPI_INT, sender, 2001, MPI_COMM_WORLD, &status);\r
-               \r
-               //receive longest - int\r
-               MPI_Recv(&longest, 1, MPI_INT, sender, 2001, MPI_COMM_WORLD, &status);\r
-\r
-               //receive templateSequences\r
-               templateSequences.resize(numSeqs);\r
-               for (int i = 0; i < templateSequences.size(); i++) {\r
-                       templateSequences[i].MPIRecv(sender);\r
-               }\r
-\r
-               //receive Database\r
-               search->MPIRecv(sender);\r
-       \r
-               for (int i = 0; i < templateSequences.size(); i++) {\r
-                       search->addSequence(templateSequences[i]);\r
-               }\r
-               search->generateDB();\r
-               search->setNumSeqs(numSeqs);\r
-\r
-               return 0;\r
-       }\r
-       catch(exception& e) {\r
-               m->errorOut(e, "AlignmentDB", "MPIRecv");\r
-               exit(1);\r
-       }\r
-}\r
-#endif\r
 /**************************************************************************************************/\r
 \r
 \r
index a69b917388fcabb052ab453a4c9e8e93e55e3fb6..22d2dd35c044a652fabafbc5deb1bef3f2022391 100644 (file)
@@ -27,8 +27,6 @@ public:
        Sequence findClosestSequence(Sequence*);
        float getSearchScore()  {  return search->getSearchScore();  }
        int getLongestBase()    {  return longest;  }
-       int MPISend(int);
-       int MPIRecv(int);
        
 private:
        int numSeqs, longest;
index a4229c6b3d331ca5a04ee49ac2385b2965963421..22eab72b60574679f61eca1f02990a3178aecd75 100644 (file)
@@ -177,6 +177,18 @@ Classify(), kmerSize(ksize), confidenceThreshold(cutoff), iters(i)  {
                exit(1);
        }
 }
+/**************************************************************************************************/
+Bayesian::~Bayesian() {
+       try {
+                delete phyloTree; 
+                if (database != NULL) {  delete database; }
+       }
+       catch(exception& e) {
+               m->errorOut(e, "Bayesian", "~Bayesian");
+               exit(1);
+       }
+}
+
 /**************************************************************************************************/
 string Bayesian::getTaxonomy(Sequence* seq) {
        try {
index 70757be9ecf2a4c6791fd0fec7c9f74ab8a13501..fa6590ab98a393d5d4907102db4401704071e5f9 100644 (file)
@@ -19,7 +19,7 @@ class Bayesian : public Classify {
        
 public:
        Bayesian(string, string, string, int, int, int);
-       ~Bayesian() {};
+       ~Bayesian();
        
        string getTaxonomy(Sequence*);
        
index 780afe0d485627fb63c3d7265f55b2aee19147fb..b52c82e58d0bb7c441e9b9df324461b4b9a8df60 100644 (file)
@@ -85,23 +85,6 @@ vector<int> BlastDB::findClosestSequences(Sequence* seq, int n) {
                }
                m8FileHandle.close();
                
-               string root = dbFileName;
-               string temp = dbFileName + ".nsq";
-               remove(temp.c_str());   
-               temp = dbFileName + ".nsi";
-               remove(temp.c_str());
-               
-               temp = dbFileName + ".nsd";
-               remove(temp.c_str());   
-
-               temp = dbFileName + ".nin";
-               remove(temp.c_str());   
-
-               temp = dbFileName + ".nhr";
-               remove(temp.c_str());   
-       
-
-               
                return topMatches;
        }
        catch(exception& e) {
@@ -167,7 +150,7 @@ void BlastDB::addSequence(Sequence seq) {
                unalignedFastaFile << '>' << count << endl;                                     //      sequences, which will be input to formatdb
                unalignedFastaFile << seq.getUnaligned() << endl;
                unalignedFastaFile.close();
-               
+       
                count++;
        }
        catch(exception& e) {
index a2401dde6c10feaa4f83c6f3f7a65b8ff885dafd..bd9f34bc7eb3f51b6b360ce4b4f18251f194e155 100644 (file)
@@ -27,11 +27,8 @@ class Classify {
 
 public:
        Classify();
-       
-       virtual ~Classify(){  delete phyloTree; if (database != NULL) {  delete database; } };
+       virtual ~Classify(){};
        virtual string getTaxonomy(Sequence*) = 0;
-       //virtual map<string, int> getConfidenceScores() { return taxConfidenceScore; }
-       //virtual vector<string> parseTax(string);
        virtual string getSimpleTax()  { return simpleTax;      }
        virtual void generateDatabaseAndNames(string, string, string, int, float, float, float, float);
        
index f8d389c60d81654f944e6b892ef7ad19a6d91859..34341c003b8725153659752016f114a65b4ca3fd 100644 (file)
-/*
- *  clearcutcommand.cpp
- *  Mothur
- *
- *  Created by westcott on 5/11/10.
- *  Copyright 2010 Schloss Lab. All rights reserved.
- *
- */
-
-#include "clearcutcommand.h"
-#include "globaldata.hpp"
-
-/**************************************************************************************/
-ClearcutCommand::ClearcutCommand(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","phylip","version","verbose","quiet","seed","norandom","shuffle","neighbor","expblen",
-                                                               "expdist","ntrees","matrixout","stdout","kimura","jukes","protein","DNA","stdin","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 (it = parameters.begin(); it != parameters.end(); it++) { 
-                               if (validParameter.isValidParameter(it->first, myArray, it->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 = 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("phylip");
-                               //user has given a template file
-                               if(it != parameters.end()){ 
-                                       path = hasPath(it->second);
-                                       //if the user has not given a path then, add inputdir. else leave path alone.
-                                       if (path == "") {       parameters["phylip"] = inputDir + it->second;           }
-                               }
-                       }
-
-                       //check for required parameters
-                       fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not open") { fastafile = ""; abort = true; }
-                       else if (fastafile == "not found") { fastafile = ""; }  
-                       else { inputFile = fastafile;  }
-                       
-                       phylipfile = validParameter.validFile(parameters, "phylip", true);
-                       if (phylipfile == "not open") { phylipfile = ""; abort = true; }
-                       else if (phylipfile == "not found") { phylipfile = ""; }
-                       else { inputFile = phylipfile;  }
-                               
-                       if ((phylipfile == "") && (fastafile == "")) {  m->mothurOut("You must provide either a phylip formatted distance matrix or an aligned fasta file."); m->mothurOutEndLine(); abort=true; }
-                       if ((phylipfile != "") && (fastafile != "")) {  m->mothurOut("You must provide either a phylip formatted distance matrix or an aligned fasta file, not BOTH."); m->mothurOutEndLine(); 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 = ""; }
-                       
-                       string temp;
-                       temp = validParameter.validFile(parameters, "version", false);          if (temp == "not found"){       temp = "F";                     }
-                       version = isTrue(temp);
-                       
-                       temp = validParameter.validFile(parameters, "verbose", false);          if (temp == "not found"){       temp = "F";                     }
-                       verbose = isTrue(temp); 
-                       
-                       temp = validParameter.validFile(parameters, "quiet", false);            if (temp == "not found"){       temp = "F";                     }
-                       quiet = isTrue(temp); 
-                       
-                       seed = validParameter.validFile(parameters, "seed", false);                     if (seed == "not found"){       seed = "*";                     }
-                       
-                       temp = validParameter.validFile(parameters, "norandom", false);         if (temp == "not found"){       temp = "F";                     }
-                       norandom = isTrue(temp); 
-                       
-                       temp = validParameter.validFile(parameters, "shuffle", false);          if (temp == "not found"){       temp = "F";                     }
-                       shuffle = isTrue(temp); 
-                       
-                       temp = validParameter.validFile(parameters, "neighbor", false);         if (temp == "not found"){       temp = "F";                     }
-                       neighbor = isTrue(temp); 
-                       
-                       temp = validParameter.validFile(parameters, "stdin", false);            if (temp == "not found"){       temp = "F";                     }
-                       stdin = isTrue(temp); 
-                       
-                       temp = validParameter.validFile(parameters, "DNA", false);                      if (temp == "not found"){       temp = "F";                     }
-                       DNA = isTrue(temp);
-                       
-                       temp = validParameter.validFile(parameters, "protein", false);          if (temp == "not found"){       temp = "F";                     }
-                       protein = isTrue(temp);
-                       
-                       temp = validParameter.validFile(parameters, "jukes", false);            if (temp == "not found"){       temp = "F";                     }
-                       jukes = isTrue(temp);
-                       
-                       temp = validParameter.validFile(parameters, "kimura", false);           if (temp == "not found"){       temp = "F";                     }
-                       kimura = isTrue(temp);
-                       
-                       temp = validParameter.validFile(parameters, "stdout", false);           if (temp == "not found"){       temp = "F";                     }
-                       stdout = isTrue(temp); 
-                       
-                       matrixout = validParameter.validFile(parameters, "matrixout", false);   if (matrixout == "not found"){  matrixout = "";         }
-                       
-                       ntrees = validParameter.validFile(parameters, "ntrees", false);         if (ntrees == "not found"){     ntrees = "1";           }
-                       
-                       temp = validParameter.validFile(parameters, "expblen", false);          if (temp == "not found"){       temp = "F";                     }
-                       expblen = isTrue(temp);
-                       
-                       temp = validParameter.validFile(parameters, "expdist", false);          if (temp == "not found"){       temp = "F";                     }
-                       expdist = isTrue(temp);
-                       
-                       if ((fastafile != "") && ((!DNA) && (!protein))) { m->mothurOut("You must specify the type of sequences you are using: DNA or protein"); m->mothurOutEndLine(); abort=true; }
-               }
-
-       }
-       catch(exception& e) {
-               m->errorOut(e, "ClearcutCommand", "ClearcutCommand");
-               exit(1);
-       }
-}
-//**********************************************************************************************************************
-
-void ClearcutCommand::help(){
-       try {
-               m->mothurOut("The clearcut command interfaces mothur with the clearcut program written by Initiative for Bioinformatics and Evolutionary Studies (IBEST) at the University of Idaho.\n");
-               m->mothurOut("For more information about clearcut refer to http://bioinformatics.hungry.com/clearcut/ \n");
-               m->mothurOut("The clearcut executable must be in a folder called clearcut in the same folder as your mothur executable, similar to mothur's requirements for using blast. \n");
-               m->mothurOut("The clearcut command parameters are phylip, fasta, version, verbose, quiet, seed, norandom, shuffle, neighbor, expblen, expdist, ntrees, matrixout, stdout, kimura, jukes, protein, DNA, stdin. \n");
-               m->mothurOut("The phylip parameter allows you to enter your phylip formatted distance matrix. \n");
-               m->mothurOut("The fasta parameter allows you to enter your aligned fasta file, if you enter a fastafile you specify if the sequences are DNA or protein using the DNA or protein parameters. \n");
-               
-               m->mothurOut("The version parameter prints out the version of clearcut you are using, default=F. \n");
-               m->mothurOut("The verbose parameter prints out more output from clearcut, default=F. \n");
-               m->mothurOut("The quiet parameter turns on silent operation mode, default=F. \n");
-               m->mothurOut("The seed parameter allows you to explicitly set the PRNG seed to a specific value. \n");
-               m->mothurOut("The norandom parameter allows you to attempt joins deterministically, default=F. \n");
-               m->mothurOut("The shuffle parameter allows you to randomly shuffle the distance matrix, default=F. \n");
-               m->mothurOut("The neighbor parameter allows you to use traditional Neighbor-Joining algorithm, default=F. \n");
-               
-               m->mothurOut("The stdin parameter reads input from STDIN, default=F. \n");
-               m->mothurOut("The DNA parameter allows you to indicate your fasta file contains DNA sequences, default=F. \n");
-               m->mothurOut("The protein parameter allows you to indicate your fasta file contains protein sequences, default=F. \n");
-               
-               m->mothurOut("The stdout parameter outputs your tree to STDOUT, default=F. \n");
-               m->mothurOut("The matrixout parameter allows you to specify a filename to output a distance matrix to. \n");
-               m->mothurOut("The ntrees parameter allows you to specify the number of output trees, default=1. \n");
-               m->mothurOut("The expblen parameter allows you to use exponential notation for branch lengths, default=F. \n");
-               m->mothurOut("The expdist parameter allows you to use exponential notation for distance outputs, default=F. \n");
-
-               m->mothurOut("The clearcut command should be in the following format: \n");
-               m->mothurOut("clearcut(phylip=yourDistanceFile) \n");
-               m->mothurOut("Example: clearcut(phylip=abrecovery.phylip.dist) \n");    
-       }
-       catch(exception& e) {
-               m->errorOut(e, "ClearcutCommand", "help");
-               exit(1);
-       }
-}
-
-/**************************************************************************************/
-int ClearcutCommand::execute() {       
-       try {
-               
-               if (abort == true) { return 0; }
-                               
-               //prepare filename
-               string outputName = outputDir + getRootName(getSimpleName(inputFile)) + "tre";
-               
-               //get location of clearcut
-               GlobalData* globaldata = GlobalData::getInstance();
-               string path = globaldata->argv;
-               path = path.substr(0, (path.find_last_of('m')));
-
-               string clearcutCommand = path + "clearcut/clearcut ";
-               
-               //you gave us a distance matrix
-               if (phylipfile != "") { clearcutCommand += "--distance ";       }
-               
-               //you gave us a fastafile
-               if (fastafile != "") { clearcutCommand += "--alignment ";       }
-               
-               if (version)                    {  clearcutCommand += "--version ";             }
-               if (verbose)                    {  clearcutCommand += "--verbose ";             }
-               if (quiet)                              {  clearcutCommand += "--quiet ";               }
-               if (seed != "*")                {  clearcutCommand += "--seed=" + seed + " "; }
-               if (norandom)                   {  clearcutCommand += "--norandom ";    }
-               if (shuffle)                    {  clearcutCommand += "--shuffle ";             }
-               if (neighbor)                   {  clearcutCommand += "--neighbor ";    }
-               
-               if (stdin)                              {  clearcutCommand += "--stdin ";               }
-               else                                    {  clearcutCommand += "--in=" + inputFile + " "; }
-               if (stdout)                             {  clearcutCommand += "--stdout ";              }
-               else                                    {  clearcutCommand += "--out=" + outputName + " "; }
-               
-               if (DNA)                                {  clearcutCommand += "--DNA ";                 }
-               if (protein)                    {  clearcutCommand += "--protein ";             }
-               if (jukes)                              {  clearcutCommand += "--jukes ";               }
-               if (kimura)                             {  clearcutCommand += "--kimura ";              }
-               if (matrixout != "")    {  clearcutCommand += "--matrixout=" + matrixout + " "; }
-               if (ntrees != "1")              {  clearcutCommand += "--ntrees=" + ntrees + " "; }
-               if (expblen)                    {  clearcutCommand += "--expblen ";             }
-               if (expdist)                    {  clearcutCommand += "--expdist ";             }
-               
-               //run clearcut
-               system(clearcutCommand.c_str());
-               
-               if (!stdout) {  
-                       m->mothurOutEndLine();
-                       m->mothurOut("Output File Names: "); m->mothurOutEndLine();
-                       m->mothurOut(outputName); m->mothurOutEndLine();        
-                       m->mothurOutEndLine();
-               }
-
-               return 0;
-       }
-       catch(exception& e) {
-               m->errorOut(e, "ClearcutCommand", "execute");
-               exit(1);
-       }
-}
-/**************************************************************************************/
-
-
-
-
+/*\r
+ *  clearcutcommand.cpp\r
+ *  Mothur\r
+ *\r
+ *  Created by westcott on 5/11/10.\r
+ *  Copyright 2010 Schloss Lab. All rights reserved.\r
+ *\r
+ */\r
+\r
+#include "clearcutcommand.h"\r
+\r
+/**************************************************************************************/\r
+ClearcutCommand::ClearcutCommand(string option)  {     \r
+       try {\r
+               abort = false;\r
+               \r
+               //allow user to run help\r
+               if(option == "help") { help(); abort = true; }\r
+               \r
+               else {\r
+                       //valid paramters for this command\r
+                       string Array[] =  {"fasta","phylip","version","verbose","quiet","seed","norandom","shuffle","neighbor","expblen",\r
+                                                               "expdist","ntrees","matrixout","stdout","kimura","jukes","protein","DNA","stdin","outputdir","inputdir"};\r
+                       vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));\r
+                       \r
+                       OptionParser parser(option);\r
+                       map<string,string> parameters = parser.getParameters();\r
+                       \r
+                       ValidParameters validParameter;\r
+                       map<string, string>::iterator it;\r
+               \r
+                       //check to make sure all parameters are valid for command\r
+                       for (it = parameters.begin(); it != parameters.end(); it++) { \r
+                               if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }\r
+                       }\r
+                       \r
+                       //if the user changes the input directory command factory will send this info to us in the output parameter \r
+                       string inputDir = validParameter.validFile(parameters, "inputdir", false);              \r
+                       if (inputDir == "not found"){   inputDir = "";          }\r
+                       else {\r
+                               string path;\r
+                               it = parameters.find("fasta");\r
+                               //user has given a template file\r
+                               if(it != parameters.end()){ \r
+                                       path = hasPath(it->second);\r
+                                       //if the user has not given a path then, add inputdir. else leave path alone.\r
+                                       if (path == "") {       parameters["fasta"] = inputDir + it->second;            }\r
+                               }\r
+                               \r
+                               it = parameters.find("phylip");\r
+                               //user has given a template file\r
+                               if(it != parameters.end()){ \r
+                                       path = hasPath(it->second);\r
+                                       //if the user has not given a path then, add inputdir. else leave path alone.\r
+                                       if (path == "") {       parameters["phylip"] = inputDir + it->second;           }\r
+                               }\r
+                       }\r
+\r
+                       //check for required parameters\r
+                       fastafile = validParameter.validFile(parameters, "fasta", true);\r
+                       if (fastafile == "not open") { fastafile = ""; abort = true; }\r
+                       else if (fastafile == "not found") { fastafile = ""; }  \r
+                       else { inputFile = fastafile;  }\r
+                       \r
+                       phylipfile = validParameter.validFile(parameters, "phylip", true);\r
+                       if (phylipfile == "not open") { phylipfile = ""; abort = true; }\r
+                       else if (phylipfile == "not found") { phylipfile = ""; }\r
+                       else { inputFile = phylipfile;  }\r
+                               \r
+                       if ((phylipfile == "") && (fastafile == "")) {  m->mothurOut("You must provide either a phylip formatted distance matrix or an aligned fasta file."); m->mothurOutEndLine(); abort=true; }\r
+                       if ((phylipfile != "") && (fastafile != "")) {  m->mothurOut("You must provide either a phylip formatted distance matrix or an aligned fasta file, not BOTH."); m->mothurOutEndLine(); abort=true; }\r
+\r
+                       \r
+                       //if the user changes the output directory command factory will send this info to us in the output parameter \r
+                       outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = ""; }\r
+                       \r
+                       string temp;\r
+                       temp = validParameter.validFile(parameters, "version", false);          if (temp == "not found"){       temp = "F";                     }\r
+                       version = isTrue(temp);\r
+                       \r
+                       temp = validParameter.validFile(parameters, "verbose", false);          if (temp == "not found"){       temp = "F";                     }\r
+                       verbose = isTrue(temp); \r
+                       \r
+                       temp = validParameter.validFile(parameters, "quiet", false);            if (temp == "not found"){       temp = "F";                     }\r
+                       quiet = isTrue(temp); \r
+                       \r
+                       seed = validParameter.validFile(parameters, "seed", false);                     if (seed == "not found"){       seed = "*";                     }\r
+                       \r
+                       temp = validParameter.validFile(parameters, "norandom", false);         if (temp == "not found"){       temp = "F";                     }\r
+                       norandom = isTrue(temp); \r
+                       \r
+                       temp = validParameter.validFile(parameters, "shuffle", false);          if (temp == "not found"){       temp = "F";                     }\r
+                       shuffle = isTrue(temp); \r
+                       \r
+                       temp = validParameter.validFile(parameters, "neighbor", false);         if (temp == "not found"){       temp = "F";                     }\r
+                       neighbor = isTrue(temp); \r
+                       \r
+                       temp = validParameter.validFile(parameters, "stdin", false);            if (temp == "not found"){       temp = "F";                     }\r
+                       stdinWanted = isTrue(temp); \r
+                       \r
+                       temp = validParameter.validFile(parameters, "DNA", false);                      if (temp == "not found"){       temp = "F";                     }\r
+                       DNA = isTrue(temp);\r
+                       \r
+                       temp = validParameter.validFile(parameters, "protein", false);          if (temp == "not found"){       temp = "F";                     }\r
+                       protein = isTrue(temp);\r
+                       \r
+                       temp = validParameter.validFile(parameters, "jukes", false);            if (temp == "not found"){       temp = "F";                     }\r
+                       jukes = isTrue(temp);\r
+                       \r
+                       temp = validParameter.validFile(parameters, "kimura", false);           if (temp == "not found"){       temp = "F";                     }\r
+                       kimura = isTrue(temp);\r
+                       \r
+                       temp = validParameter.validFile(parameters, "stdout", false);           if (temp == "not found"){       temp = "F";                     }\r
+                       stdoutWanted = isTrue(temp); \r
+                       \r
+                       matrixout = validParameter.validFile(parameters, "matrixout", false);   if (matrixout == "not found"){  matrixout = "";         }\r
+                       \r
+                       ntrees = validParameter.validFile(parameters, "ntrees", false);         if (ntrees == "not found"){     ntrees = "1";           }\r
+                       \r
+                       temp = validParameter.validFile(parameters, "expblen", false);          if (temp == "not found"){       temp = "F";                     }\r
+                       expblen = isTrue(temp);\r
+                       \r
+                       temp = validParameter.validFile(parameters, "expdist", false);          if (temp == "not found"){       temp = "F";                     }\r
+                       expdist = isTrue(temp);\r
+                       \r
+                       if ((fastafile != "") && ((!DNA) && (!protein))) { m->mothurOut("You must specify the type of sequences you are using: DNA or protein"); m->mothurOutEndLine(); abort=true; }\r
+               }\r
+\r
+       }\r
+       catch(exception& e) {\r
+               m->errorOut(e, "ClearcutCommand", "ClearcutCommand");\r
+               exit(1);\r
+       }\r
+}\r
+//**********************************************************************************************************************\r
+\r
+void ClearcutCommand::help(){\r
+       try {\r
+               m->mothurOut("The clearcut command interfaces mothur with the clearcut program written by Initiative for Bioinformatics and Evolutionary Studies (IBEST) at the University of Idaho.\n");\r
+               m->mothurOut("For more information about clearcut refer to http://bioinformatics.hungry.com/clearcut/ \n");\r
+               m->mothurOut("The clearcut executable must be in a folder called clearcut in the same folder as your mothur executable, similar to mothur's requirements for using blast. \n");\r
+               m->mothurOut("The clearcut command parameters are phylip, fasta, version, verbose, quiet, seed, norandom, shuffle, neighbor, expblen, expdist, ntrees, matrixout, stdoutWanted, kimura, jukes, protein, DNA, stdinWanted. \n");\r
+               m->mothurOut("The phylip parameter allows you to enter your phylip formatted distance matrix. \n");\r
+               m->mothurOut("The fasta parameter allows you to enter your aligned fasta file, if you enter a fastafile you specify if the sequences are DNA or protein using the DNA or protein parameters. \n");\r
+               \r
+               m->mothurOut("The version parameter prints out the version of clearcut you are using, default=F. \n");\r
+               m->mothurOut("The verbose parameter prints out more output from clearcut, default=F. \n");\r
+               m->mothurOut("The quiet parameter turns on silent operation mode, default=F. \n");\r
+               m->mothurOut("The seed parameter allows you to explicitly set the PRNG seed to a specific value. \n");\r
+               m->mothurOut("The norandom parameter allows you to attempt joins deterministically, default=F. \n");\r
+               m->mothurOut("The shuffle parameter allows you to randomly shuffle the distance matrix, default=F. \n");\r
+               m->mothurOut("The neighbor parameter allows you to use traditional Neighbor-Joining algorithm, default=F. \n");\r
+               \r
+               m->mothurOut("The stdinWanted parameter reads input from STDIN, default=F. \n");\r
+               m->mothurOut("The DNA parameter allows you to indicate your fasta file contains DNA sequences, default=F. \n");\r
+               m->mothurOut("The protein parameter allows you to indicate your fasta file contains protein sequences, default=F. \n");\r
+               \r
+               m->mothurOut("The stdoutWanted parameter outputs your tree to STDOUT, default=F. \n");\r
+               m->mothurOut("The matrixout parameter allows you to specify a filename to output a distance matrix to. \n");\r
+               m->mothurOut("The ntrees parameter allows you to specify the number of output trees, default=1. \n");\r
+               m->mothurOut("The expblen parameter allows you to use exponential notation for branch lengths, default=F. \n");\r
+               m->mothurOut("The expdist parameter allows you to use exponential notation for distance outputs, default=F. \n");\r
+\r
+               m->mothurOut("The clearcut command should be in the following format: \n");\r
+               m->mothurOut("clearcut(phylip=yourDistanceFile) \n");\r
+               m->mothurOut("Example: clearcut(phylip=abrecovery.phylip.dist) \n");    \r
+               \r
+       }\r
+       catch(exception& e) {\r
+               m->errorOut(e, "ClearcutCommand", "help");\r
+               exit(1);\r
+       }\r
+}\r
+\r
+/**************************************************************************************/\r
+int ClearcutCommand::execute() {       \r
+       try {\r
+               \r
+               if (abort == true) { return 0; }\r
+                               \r
+               //prepare filename\r
+               string outputName = outputDir + getRootName(getSimpleName(inputFile)) + "tre";\r
+               \r
+               //get location of clearcut\r
+               GlobalData* globaldata = GlobalData::getInstance();\r
+               string path = globaldata->argv;\r
+               path = path.substr(0, (path.find_last_of('m')));\r
+               \r
+               string clearcutCommand = "";\r
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+                       clearcutCommand = path + "clearcut/clearcut ";\r
+               #else\r
+                       clearcutCommand = path + "clearcut\\clearcut ";\r
+               #endif\r
+               \r
+               //you gave us a distance matrix\r
+               if (phylipfile != "") { clearcutCommand += "--distance ";       }\r
+               \r
+               //you gave us a fastafile\r
+               if (fastafile != "") { clearcutCommand += "--alignment ";       }\r
+               \r
+               if (version)                    {  clearcutCommand += "--version ";             }\r
+               if (verbose)                    {  clearcutCommand += "--verbose ";             }\r
+               if (quiet)                              {  clearcutCommand += "--quiet ";               }\r
+               if (seed != "*")                {  clearcutCommand += "--seed=" + seed + " "; }\r
+               if (norandom)                   {  clearcutCommand += "--norandom ";    }\r
+               if (shuffle)                    {  clearcutCommand += "--shuffle ";             }\r
+               if (neighbor)                   {  clearcutCommand += "--neighbor ";    }\r
+               \r
+               if (stdinWanted)                {  clearcutCommand += "--stdin ";               }\r
+               else{  \r
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+                               clearcutCommand += "--in=" + inputFile + " "; }\r
+                       #else\r
+                               clearcutCommand += "--in=\"" + inputFile + "\" "; }\r
+                       #endif\r
+               if (stdoutWanted)               {  clearcutCommand += "--stdout ";              }\r
+               else{  \r
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+                               clearcutCommand += "--out=" + outputName + " "; }\r
+                       #else\r
+                               clearcutCommand += "--out=\"" + outputName + "\" "; }\r
+                       #endif\r
+               \r
+               if (DNA)                                {  clearcutCommand += "--DNA ";                 }\r
+               if (protein)                    {  clearcutCommand += "--protein ";             }\r
+               if (jukes)                              {  clearcutCommand += "--jukes ";               }\r
+               if (kimura)                             {  clearcutCommand += "--kimura ";              }\r
+               if (matrixout != "")    {  clearcutCommand += "--matrixout=" + matrixout + " "; }\r
+               if (ntrees != "1")              {  clearcutCommand += "--ntrees=" + ntrees + " "; }\r
+               if (expblen)                    {  clearcutCommand += "--expblen ";             }\r
+               if (expdist)                    {  clearcutCommand += "--expdist ";             }\r
+       \r
+               //run clearcut\r
+               system(clearcutCommand.c_str());\r
+               \r
+               if (!stdoutWanted) {    \r
+                       m->mothurOutEndLine();\r
+                       m->mothurOut("Output File Names: "); m->mothurOutEndLine();\r
+                       m->mothurOut(outputName); m->mothurOutEndLine();        \r
+                       m->mothurOutEndLine();\r
+               }\r
+\r
+               return 0;\r
+       }\r
+       catch(exception& e) {\r
+               m->errorOut(e, "ClearcutCommand", "execute");\r
+               exit(1);\r
+       }\r
+}\r
+/**************************************************************************************/\r
+\r
+\r
+\r
+\r
index b3ac28e03a293df1acb1f946fcec755294d0ecf5..d6c0a57d9628a124c3bc900d6865f0ed4e7cc606 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #include "command.hpp"
-
+#include "globaldata.hpp"
 
 /* 
   Evans, J., L. Sheneman, and J.A. Foster (2006) Relaxed Neighbor-Joining: 
@@ -31,7 +31,7 @@ public:
        
 private:
        string outputDir, phylipfile, fastafile, matrixout, inputFile, seed, ntrees;
-       bool version, verbose, quiet, norandom, shuffle, neighbor, expblen, expdist, stdout, kimura, jukes, protein, DNA, stdin;
+       bool version, verbose, quiet, norandom, shuffle, neighbor, expblen, expdist, stdoutWanted, kimura, jukes, protein, DNA, stdinWanted;
        bool abort;
 };
 
index 379424c9155d7dcee7e0535644652ef852f19481..fa6f677a3be5c5f9d0e535acdc870aaae226c016 100644 (file)
@@ -24,7 +24,9 @@ int Collect::getCurve(float percentFreq = 0.01){
                 }   
                                
                                //convert freq percentage to number
-                               int increment = numSeqs * percentFreq;
+                               int increment = 1;
+                               if (percentFreq < 1.0) {  increment = numSeqs * percentFreq;  }
+                               else { increment = percentFreq;  }
                                                                                                                                                                                                                                                        
                 for(int i=0;i<numSeqs;i++){
                                                
@@ -101,7 +103,9 @@ try {
                 }
                 
                                //convert freq percentage to number
-                               int increment = numSeqs * percentFreq;
+                               int increment = 1;
+                               if (percentFreq < 1.0) {  increment = numSeqs * percentFreq;  }
+                               else { increment = percentFreq;  }
                                
                 //sample all the members
                 for(int i=0;i<numSeqs;i++){
index 1e2bf2fcd42e771e2b84e7f2d3f93abd2171a15a..88be43b9a283b3313eacb6093ffe4f496c6bc452 100644 (file)
@@ -86,7 +86,7 @@ CollectCommand::CollectCommand(string option)  {
                        splitAtDash(calc, Estimators);
 
                        string temp;
-                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "0.10"; }
+                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "100"; }
                        convert(temp, freq); 
                        
                        temp = validParameter.validFile(parameters, "abund", false);            if (temp == "not found") { temp = "10"; }
@@ -110,7 +110,7 @@ void CollectCommand::help(){
                m->mothurOut("The collect.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
                m->mothurOut("The collect.single command parameters are label, freq, calc and abund.  No parameters are required. \n");
                m->mothurOut("The collect.single command should be in the following format: \n");
-               m->mothurOut("The freq parameter is used indicate when to output your data.  It is a percentage of the number of sequences.  By default it is set to 0.10, meaning 10%. \n");
+               m->mothurOut("The freq parameter is used indicate when to output your data, by default it is set to 100. But you can set it to a percentage of the number of sequence. For example freq=0.10, means 10%. \n");
                m->mothurOut("collect.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
                m->mothurOut("Example collect(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-chao-ace-jack).\n");
                m->mothurOut("The default values for freq is 100, and calc are sobs-chao-ace-jack-shannon-npshannon-simpson.\n");
index 78ce5c400221d5620fd85447627dcb7a3b658994..40b911bb8c844ad252a714383ce93109772209a0 100644 (file)
@@ -104,7 +104,7 @@ CollectSharedCommand::CollectSharedCommand(string option)  {
                        globaldata->Groups = Groups;
                        
                        string temp;
-                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "0.10"; }
+                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "100"; }
                        convert(temp, freq); 
                        
                        temp = validParameter.validFile(parameters, "all", false);                              if (temp == "not found") { temp = "false"; }
@@ -208,7 +208,7 @@ void CollectSharedCommand::help(){
                m->mothurOut("Example collect.shared(label=unique-.01-.03, freq=10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n");
                m->mothurOut("The default values for freq is 100 and calc are sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan.\n");
                m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
-               m->mothurOut("The freq parameter is used indicate when to output your data.  It is a percentage of the number of sequences.  By default it is set to 0.10, meaning 10%. \n");
+               m->mothurOut("The freq parameter is used indicate when to output your data, by default it is set to 100. But you can set it to a percentage of the number of sequence. For example freq=0.10, means 10%. \n");
                validCalculator->printCalc("shared", cout);
                m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
                m->mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
index 47e5fd7b4911de428712bb9a5271fd61ce20b172..bfb5090bcda99d7396bfcf0092048c6d3e10eb49 100644 (file)
@@ -19,7 +19,7 @@ class DistanceDB : public Database {
 public:
        
        DistanceDB();
-       ~DistanceDB() {}
+       ~DistanceDB() { delete distCalculator; }
        
        void generateDB() {} //doesn't generate a search db 
        void addSequence(Sequence);  
diff --git a/knn.cpp b/knn.cpp
index 64b5b3a288db8ce2f1d6da7e08af90bd8e26e613..beee4aff06b91ff23c55fbc7253c0616b6a7f995 100644 (file)
--- a/knn.cpp
+++ b/knn.cpp
@@ -22,6 +22,17 @@ Knn::Knn(string tfile, string tempFile, string method, int kmerSize, float gapOp
        }
 }
 /**************************************************************************************************/
+Knn::~Knn() {
+       try {
+                delete phyloTree; 
+                if (database != NULL) {  delete database; }
+       }
+       catch(exception& e) {
+               m->errorOut(e, "Knn", "~Knn");
+               exit(1);
+       }
+}
+/**************************************************************************************************/
 string Knn::getTaxonomy(Sequence* seq) {
        try {
                string tax;
diff --git a/knn.h b/knn.h
index 2c809c289ab6c5c573a8820551de97cda65077fe..45cb0f1cf63b5a084417c5d7cb0fd0f59970f98f 100644 (file)
--- a/knn.h
+++ b/knn.h
@@ -19,7 +19,7 @@ class Knn : public Classify {
        
 public:
        Knn(string, string, string, int, float, float, float, float, int);
-       ~Knn() {};
+       ~Knn();
        
        string getTaxonomy(Sequence*);
        
index d674ff40470a6f485153d8ee90044ae878dfc427..43b838c2d94bad311204d26a82603901238687e1 100644 (file)
-/*
- *  interface.cpp
- *  
- *
- *  Created by Pat Schloss on 8/14/08.
- *  Copyright 2008 Patrick D. Schloss. All rights reserved.
- *
- */
-#include "mothur.h"
-#include "engine.hpp"
-#include "globaldata.hpp"
-#include "mothurout.h"
-
-
-/**************************************************************************************************/
-
-GlobalData* GlobalData::_uniqueInstance = 0;
-CommandFactory* CommandFactory::_uniqueInstance = 0;
-MothurOut* MothurOut::_uniqueInstance = 0;
-
-/***********************************************************************/
-volatile int ctrlc_pressed = 0;
-void ctrlc_handler ( int sig ) {
-       MothurOut* m = MothurOut::getInstance();
-    ctrlc_pressed = 1;
-       m->control_pressed = ctrlc_pressed;
-       
-       if (m->executing) { //if mid command quit execution, else quit mothur
-               m->mothurOutEndLine(); m->mothurOut("quitting command...");  m->mothurOutEndLine();
-       }else{
-               m->mothurOut("quitting mothur");  m->mothurOutEndLine();
-               exit(1);
-       }
-}
-/***********************************************************************/
-int main(int argc, char *argv[]){
-       MothurOut* m = MothurOut::getInstance();
-       try {
-               
-               signal(SIGINT, ctrlc_handler );
-                               
-               time_t ltime = time(NULL); /* calendar time */  
-               string logFileName = "mothur." + toString(ltime) + ".logfile";
-               
-               #ifdef USE_MPI
-                       MPI_Init(&argc, &argv); 
-               #endif
-
-               m->setFileName(logFileName);
-               
-                               
-               //version
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
-                       system("clear");
-                       #if defined (__APPLE__) || (__MACH__)
-                               m->mothurOutJustToLog("Mac version");
-                               m->mothurOutEndLine(); m->mothurOutEndLine();
-                       #else
-                               m->mothurOutJustToLog("Linux version");
-                               m->mothurOutEndLine(); m->mothurOutEndLine();
-                       #endif
-
-               #else
-                       system("CLS");
-                       m->mothurOutJustToLog("Windows version");
-                       m->mothurOutEndLine(); m->mothurOutEndLine();
-               #endif          
-               
-               #ifdef USE_READLINE
-                       m->mothurOutJustToLog("Using ReadLine");
-                       m->mothurOutEndLine(); m->mothurOutEndLine();
-               #endif
-               
-               //header
-               m->mothurOut("mothur v.1.9");
-               m->mothurOutEndLine();          
-               m->mothurOut("Last updated: 4/16/2010");
-               m->mothurOutEndLine();  
-               m->mothurOutEndLine();          
-               m->mothurOut("by");
-               m->mothurOutEndLine();          
-               m->mothurOut("Patrick D. Schloss");
-               m->mothurOutEndLine();
-               m->mothurOutEndLine();                  
-               m->mothurOut("Department of Microbiology & Immunology");
-               m->mothurOutEndLine();  
-               m->mothurOut("University of Michigan");
-               m->mothurOutEndLine();                  
-               m->mothurOut("pschloss@umich.edu");
-               m->mothurOutEndLine();          
-               m->mothurOut("http://www.mothur.org");
-               m->mothurOutEndLine();
-               m->mothurOutEndLine();
-               m->mothurOut("When using, please cite:");
-               m->mothurOutEndLine();
-               m->mothurOut("Schloss, P.D., et al., Introducing mothur: Open-source, platform-independent, community-supported software for describing and comparing microbial communities. Appl Environ Microbiol, 2009. 75(23):7537-41.");
-               m->mothurOutEndLine();  
-               m->mothurOutEndLine();          
-               m->mothurOut("Distributed under the GNU General Public License");
-               m->mothurOutEndLine();
-               m->mothurOutEndLine();                  
-               m->mothurOut("Type 'help()' for information on the commands that are available");
-               m->mothurOutEndLine();
-               m->mothurOutEndLine();                  
-               m->mothurOut("Type 'quit()' to exit program");
-               m->mothurOutEndLine();  
-               
-               #ifdef USE_MPI
-                       m->mothurOutJustToLog("Using MPI\tversion ");
-                       int version, subversion;
-                       MPI_Get_version(&version, &subversion);
-                       m->mothurOutJustToLog(toString(version) + "." + toString(subversion) + "\n");
-               #endif
-               
-               //srand(54321);
-               srand( (unsigned)time( NULL ) );
-               
-               Engine* mothur;
-               bool bail = 0;
-               string input;
-
-               if(argc>1){
-                       input = argv[1];
-
-                       if (input[0] == '#') {
-                               m->mothurOutJustToLog("Script Mode");
-                               m->mothurOutEndLine(); m->mothurOutEndLine();
-
-                               mothur = new ScriptEngine(argv[0], argv[1]);
-                       }else{
-                               m->mothurOutJustToLog("Batch Mode");
-                               m->mothurOutEndLine(); m->mothurOutEndLine();
-                               
-                               mothur = new BatchEngine(argv[0], argv[1]);
-                       }
-               }
-               else{
-                       m->mothurOutJustToLog("Interactive Mode");
-                       m->mothurOutEndLine(); m->mothurOutEndLine();
-                       
-                       mothur = new InteractEngine(argv[0]);   
-               }
-               
-               while(bail == 0)        {       bail = mothur->getInput();      }
-               
-               //closes logfile so we can rename
-               m->closeLog();
-               
-               string outputDir = mothur->getOutputDir();
-               string tempLog = mothur->getLogFileName();
-               bool append = mothur->getAppend();
-               
-               string newlogFileName;
-               if (tempLog != "") {
-                       newlogFileName = outputDir + tempLog;
-                       
-                       if (!append) {  
-                               //need this because m->mothurOut makes the logfile, but doesn't know where to put it
-                               rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp
-
-                       }else {
-                               ofstream outNewLog;
-                               openOutputFileAppend(newlogFileName, outNewLog);
-                               outNewLog << endl << endl << "*********************************************************************************" << endl << endl;
-                               outNewLog.close();
-                               
-                               appendFiles(logFileName, newlogFileName);
-                               remove(logFileName.c_str());
-                       }
-               }else{  
-                       newlogFileName = outputDir + logFileName;
-                       //need this because m->mothurOut makes the logfile, but doesn't know where to put it
-                       rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp
-               }
-               
-                               
-               delete mothur;
-               
-               #ifdef USE_MPI
-                       MPI_Finalize();
-               #endif
-               
-               return 0;
-       }
-       catch(exception& e) {
-               m->errorOut(e, "mothur", "main");
-               exit(1);
-       }
-}
-
-/**************************************************************************************************/
-
+/*\r
+ *  interface.cpp\r
+ *  \r
+ *\r
+ *  Created by Pat Schloss on 8/14/08.\r
+ *  Copyright 2008 Patrick D. Schloss. All rights reserved.\r
+ *\r
+ */\r
\r
+#include "mothur.h"\r
+#include "engine.hpp"\r
+#include "globaldata.hpp"\r
+#include "mothurout.h"\r
+\r
+\r
+/**************************************************************************************************/\r
+\r
+GlobalData* GlobalData::_uniqueInstance = 0;\r
+CommandFactory* CommandFactory::_uniqueInstance = 0;\r
+MothurOut* MothurOut::_uniqueInstance = 0;\r
+\r
+/***********************************************************************/\r
+volatile int ctrlc_pressed = 0;\r
+void ctrlc_handler ( int sig ) {\r
+       MothurOut* m = MothurOut::getInstance();\r
+    ctrlc_pressed = 1;\r
+       m->control_pressed = ctrlc_pressed;\r
+       \r
+       if (m->executing) { //if mid command quit execution, else quit mothur\r
+               m->mothurOutEndLine(); m->mothurOut("quitting command...");  m->mothurOutEndLine();\r
+       }else{\r
+               m->mothurOut("quitting mothur");  m->mothurOutEndLine();\r
+               exit(1);\r
+       }\r
+}\r
+/***********************************************************************/\r
+int main(int argc, char *argv[]){\r
+       MothurOut* m = MothurOut::getInstance();\r
+       try {\r
+               \r
+               signal(SIGINT, ctrlc_handler );\r
+                               \r
+               time_t ltime = time(NULL); /* calendar time */  \r
+               string logFileName = "mothur." + toString(ltime) + ".logfile";\r
+               \r
+               #ifdef USE_MPI\r
+                       MPI_Init(&argc, &argv); \r
+               #endif\r
+\r
+               m->setFileName(logFileName);\r
+               \r
+                               \r
+               //version\r
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)\r
+                       system("clear");\r
+                       #if defined (__APPLE__) || (__MACH__)\r
+                               m->mothurOutJustToLog("Mac version");\r
+                               m->mothurOutEndLine(); m->mothurOutEndLine();\r
+                       #else\r
+                               m->mothurOutJustToLog("Linux version");\r
+                               m->mothurOutEndLine(); m->mothurOutEndLine();\r
+                       #endif\r
+\r
+               #else\r
+                       system("CLS");\r
+                       m->mothurOutJustToLog("Windows version");\r
+                       m->mothurOutEndLine(); m->mothurOutEndLine();\r
+               #endif          \r
+               \r
+               #ifdef USE_READLINE\r
+                       m->mothurOutJustToLog("Using ReadLine");\r
+                       m->mothurOutEndLine(); m->mothurOutEndLine();\r
+               #endif\r
+               \r
+               //header\r
+               m->mothurOut("mothur v.1.10.0");\r
+               m->mothurOutEndLine();          \r
+               m->mothurOut("Last updated: 5/14/2010");\r
+               m->mothurOutEndLine();  \r
+               m->mothurOutEndLine();          \r
+               m->mothurOut("by");\r
+               m->mothurOutEndLine();          \r
+               m->mothurOut("Patrick D. Schloss");\r
+               m->mothurOutEndLine();\r
+               m->mothurOutEndLine();                  \r
+               m->mothurOut("Department of Microbiology & Immunology");\r
+               m->mothurOutEndLine();  \r
+               m->mothurOut("University of Michigan");\r
+               m->mothurOutEndLine();                  \r
+               m->mothurOut("pschloss@umich.edu");\r
+               m->mothurOutEndLine();          \r
+               m->mothurOut("http://www.mothur.org");\r
+               m->mothurOutEndLine();\r
+               m->mothurOutEndLine();\r
+               m->mothurOut("When using, please cite:");\r
+               m->mothurOutEndLine();\r
+               m->mothurOut("Schloss, P.D., et al., Introducing mothur: Open-source, platform-independent, community-supported software for describing and comparing microbial communities. Appl Environ Microbiol, 2009. 75(23):7537-41.");\r
+               m->mothurOutEndLine();  \r
+               m->mothurOutEndLine();          \r
+               m->mothurOut("Distributed under the GNU General Public License");\r
+               m->mothurOutEndLine();\r
+               m->mothurOutEndLine();                  \r
+               m->mothurOut("Type 'help()' for information on the commands that are available");\r
+               m->mothurOutEndLine();\r
+               m->mothurOutEndLine();                  \r
+               m->mothurOut("Type 'quit()' to exit program");\r
+               m->mothurOutEndLine();  \r
+               \r
+               #ifdef USE_MPI\r
+                       m->mothurOutJustToLog("Using MPI\tversion ");\r
+                       int version, subversion;\r
+                       MPI_Get_version(&version, &subversion);\r
+                       m->mothurOutJustToLog(toString(version) + "." + toString(subversion) + "\n");\r
+               #endif\r
+               \r
+               //srand(54321);\r
+               srand( (unsigned)time( NULL ) );\r
+               \r
+               Engine* mothur;\r
+               bool bail = 0;\r
+               string input;\r
+\r
+               if(argc>1){\r
+                       input = argv[1];\r
+\r
+                       if (input[0] == '#') {\r
+                               m->mothurOutJustToLog("Script Mode");\r
+                               m->mothurOutEndLine(); m->mothurOutEndLine();\r
+\r
+                               mothur = new ScriptEngine(argv[0], argv[1]);\r
+                       }else{\r
+                               m->mothurOutJustToLog("Batch Mode");\r
+                               m->mothurOutEndLine(); m->mothurOutEndLine();\r
+                               \r
+                               mothur = new BatchEngine(argv[0], argv[1]);\r
+                       }\r
+               }\r
+               else{\r
+                       m->mothurOutJustToLog("Interactive Mode");\r
+                       m->mothurOutEndLine(); m->mothurOutEndLine();\r
+                       \r
+                       mothur = new InteractEngine(argv[0]);   \r
+               }\r
+               \r
+               while(bail == 0)        {       bail = mothur->getInput();      }\r
+               \r
+               //closes logfile so we can rename\r
+               m->closeLog();\r
+               \r
+               string outputDir = mothur->getOutputDir();\r
+               string tempLog = mothur->getLogFileName();\r
+               bool append = mothur->getAppend();\r
+               \r
+               string newlogFileName;\r
+               if (tempLog != "") {\r
+                       newlogFileName = outputDir + tempLog;\r
+                       \r
+                       if (!append) {  \r
+                               //need this because m->mothurOut makes the logfile, but doesn't know where to put it\r
+                               rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp\r
+\r
+                       }else {\r
+                               ofstream outNewLog;\r
+                               openOutputFileAppend(newlogFileName, outNewLog);\r
+                               outNewLog << endl << endl << "*********************************************************************************" << endl << endl;\r
+                               outNewLog.close();\r
+                               \r
+                               appendFiles(logFileName, newlogFileName);\r
+                               remove(logFileName.c_str());\r
+                       }\r
+               }else{  \r
+                       newlogFileName = outputDir + logFileName;\r
+                       //need this because m->mothurOut makes the logfile, but doesn't know where to put it\r
+                       rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp\r
+               }\r
+               \r
+                               \r
+               delete mothur;\r
+               \r
+               #ifdef USE_MPI\r
+                       MPI_Finalize();\r
+               #endif\r
+               \r
+               return 0;\r
+       }\r
+       catch(exception& e) {\r
+               m->errorOut(e, "mothur", "main");\r
+               exit(1);\r
+       }\r
+}\r
+\r
+/**************************************************************************************************/\r
+\r
index f101d1f808fdb22d0fac7795dcc6388be6dacaf2..ca19aea53139b11da68420de6dc28c239990d626 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -487,7 +487,7 @@ inline string getFullPathName(string fileName){
                        }       
                #else
                        if (path.find("~") != -1) { //go to home directory
-                               string homeDir = getenv ("HOME");
+                               string homeDir = getenv ("HOMEPATH");
                                newFileName = homeDir + fileName.substr(fileName.find("~")+1);
                                return newFileName;
                        }else { //find path
index 7e0574e24b5d690bb2ebff9864b7682424faae16..19c65ce9a11c30e19d6d10a477165c1bcbe164c1 100644 (file)
@@ -41,7 +41,7 @@ PhyloDiversityCommand::PhyloDiversityCommand(string option)  {
                                m->mothurOut("You must execute the read.tree command, before you may execute the phylo.diversity command."); m->mothurOutEndLine(); abort = true;  }
 
                        string temp;
-                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "0.10"; }
+                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "100"; }
                        convert(temp, freq); 
                        
                        temp = validParameter.validFile(parameters, "iters", false);                    if (temp == "not found") { temp = "1000"; }
@@ -73,7 +73,7 @@ void PhyloDiversityCommand::help(){
                m->mothurOut("The phylo.diversity command parameters are groups, iters, freq and rarefy.  No parameters are required.\n");
                m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed. The group names are separated by dashes. By default all groups are used.\n");
                m->mothurOut("The iters parameter allows you to specify the number of randomizations to preform, by default iters=1000, if you set rarefy to true.\n");
-               m->mothurOut("The freq parameter is used indicate when to output your data.  It is a percentage of the number of sequences.  By default it is set to 0.10, meaning 10%. \n");
+               m->mothurOut("The freq parameter is used indicate when to output your data, by default it is set to 100. But you can set it to a percentage of the number of sequence. For example freq=0.10, means 10%. \n");
                m->mothurOut("The rarefy parameter allows you to create a rarefaction curve. The default is false.\n");
                m->mothurOut("The phylo.diversity command should be in the following format: phylo.diversity(groups=yourGroups, rarefy=yourRarefy, iters=yourIters).\n");
                m->mothurOut("Example phylo.diversity(groups=A-B-C, rarefy=T, iters=500).\n");
@@ -132,7 +132,9 @@ int PhyloDiversityCommand::execute(){
                        numLeafNodes = randomLeaf.size();  //reset the number of leaf nodes you are using 
                        
                        //convert freq percentage to number
-                       int increment = numLeafNodes * freq;
+                       int increment = 100;
+                       if (freq < 1.0) {  increment = numLeafNodes * freq;  }
+                       else { increment = freq;  }
                        
                        //each group, each sampling, if no rarefy iters = 1;
                        vector< vector<float> > diversity;
index 76f68296b209ec1eb8e2ff5a14668b32fd451b8b..691d01708bab5b5bef4118ab38662819280b56de 100644 (file)
@@ -20,8 +20,10 @@ int Rarefact::getCurve(float percentFreq = 0.01, int nIters = 1000){
                }
                
                //convert freq percentage to number
-               int increment = numSeqs * percentFreq;
-               
+               int increment = 1;
+               if (percentFreq < 1.0) {  increment = numSeqs * percentFreq;  }
+               else { increment = percentFreq;  }      
+                       
                for(int iter=0;iter<nIters;iter++){
                
                        for(int i=0;i<displays.size();i++){
@@ -91,7 +93,9 @@ try {
                if (globaldata->jumble == false)  {  nIters = 1;  }
                
                //convert freq percentage to number
-               int increment = numSeqs * percentFreq;
+               int increment = 1;
+               if (percentFreq < 1.0) {  increment = numSeqs * percentFreq;  }
+               else { increment = percentFreq;  }
                
                for(int iter=0;iter<nIters;iter++){
                
index f62cea1e5253ce0d1a970491d8eb25b0a73e6bb1..5d6b5d8b3160f0b6bc31199c1e7fc6e60f496254 100644 (file)
@@ -80,7 +80,7 @@ RareFactCommand::RareFactCommand(string option)  {
                        splitAtDash(calc, Estimators);
 
                        string temp;
-                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "0.10"; }
+                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "100"; }
                        convert(temp, freq); 
                        
                        temp = validParameter.validFile(parameters, "abund", false);                    if (temp == "not found") { temp = "10"; }
@@ -103,7 +103,7 @@ void RareFactCommand::help(){
                m->mothurOut("The rarefaction.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n");
                m->mothurOut("The rarefaction.single command can be executed after a successful cluster command.  It will use the .list file from the output of the cluster.\n");
                m->mothurOut("The rarefaction.single command parameters are label, iters, freq, calc and abund.  No parameters are required. \n");
-               m->mothurOut("The freq parameter is used indicate when to output your data.  It is a percentage of the number of sequences.  By default it is set to 0.10, meaning 10%. \n");
+               m->mothurOut("The freq parameter is used indicate when to output your data, by default it is set to 100. But you can set it to a percentage of the number of sequence. For example freq=0.10, means 10%. \n");
                m->mothurOut("The rarefaction.single command should be in the following format: \n");
                m->mothurOut("rarefaction.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
                m->mothurOut("Example rarefaction.single(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson).\n");
index 357bc8708289e37063d731315b7411c715a05f1a..324f02852189c175ec7383d44a4e498fa4ccc7d5 100644 (file)
@@ -84,7 +84,7 @@ RareFactSharedCommand::RareFactSharedCommand(string option)  {
                        globaldata->Groups = Groups;
                        
                        string temp;
-                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "0.10"; }
+                       temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "100"; }
                        convert(temp, freq); 
                        
                        temp = validParameter.validFile(parameters, "iters", false);                    if (temp == "not found") { temp = "1000"; }
@@ -133,7 +133,7 @@ void RareFactSharedCommand::help(){
                m->mothurOut("The rarefaction.shared command parameters are label, iters, groups, jumble and calc.  No parameters are required.\n");
                m->mothurOut("The rarefaction command should be in the following format: \n");
                m->mothurOut("rarefaction.shared(label=yourLabel, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n");
-               m->mothurOut("The freq parameter is used indicate when to output your data.  It is a percentage of the number of sequences.  By default it is set to 0.10, meaning 10%. \n");
+               m->mothurOut("The freq parameter is used indicate when to output your data, by default it is set to 100. But you can set it to a percentage of the number of sequence. For example freq=0.10, means 10%. \n");
                m->mothurOut("Example rarefaction.shared(label=unique-0.01-0.03,  iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n");
                m->mothurOut("The default values for iters is 1000, freq is 100, and calc is sharedobserved which calculates the shared rarefaction curve for the observed richness.\n");
                m->mothurOut("The default value for groups is all the groups in your groupfile, and jumble is true.\n");
index f630052dd58878cf75b80226b4fa2e0d118fed62..f551eddacd00dade4aff87526f0b5aca59ad2b58 100644 (file)
@@ -250,7 +250,7 @@ int SeqSummaryCommand::execute(){
                                if (m->control_pressed) {  return 0; }
                #else
                                ifstream inFASTA;
-                               openInputFile(fastafileNames[s], inFASTA);
+                               openInputFile(fastafile, inFASTA);
                                numSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
                                inFASTA.close();
                                
index a544733375b004e651409ef47c9db62bb0f0756d..ae9c436440950cca6cd33eb99e85c5b9b4db1062 100644 (file)
@@ -266,13 +266,13 @@ int TrimSeqsCommand::execute(){
                                if (m->control_pressed) {  return 0; }
                #else
                                ifstream inFASTA;
-                               openInputFile(fastafileNames[s], inFASTA);
-                               numSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
+                               openInputFile(fastaFile, inFASTA);
+                               int numSeqs=count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
                                inFASTA.close();
                                
                                lines.push_back(new linePair(0, numSeqs));
                                
-                               driverCreateSummary(fastafile, qFileName, trimSeqFile, scrapSeqFile, groupFile, fastaFileNames, lines[0], lines[0]);
+                               driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, groupFile, fastaFileNames, lines[0], lines[0]);
                                
                                if (m->control_pressed) {  return 0; }
                #endif
@@ -331,7 +331,11 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string
                if (oligoFile != "") {          
                        openOutputFile(groupFile, outGroups);   
                        for (int i = 0; i < fastaNames.size(); i++) {
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
                                fastaFileNames.push_back(new ofstream((fastaNames[i] + toString(getpid()) + ".temp").c_str(), ios::ate)); 
+                       #else
+                               fastaFileNames.push_back(new ofstream((fastaNames[i] + toString(i) + ".temp").c_str(), ios::ate));                      
+                       #endif
                        }
                }
                
@@ -674,12 +678,7 @@ int TrimSeqsCommand::stripBarcode(Sequence& seq, int& group){
                                }
                                oligo = oligo.substr(0,alnLength);
                                temp = temp.substr(0,alnLength);
-//                             cout << "barcode = " << oligo << " raw = " << rawSequence.substr(0,alnLength) << " raw aligned = " << temp << endl;                     
-                               cout << seq.getName() << endl;
-                               cout << temp << endl;
-                               cout << oligo << endl;
-                               cout << alnLength << endl;
-                               cout << endl;
+//                             
                                
                                int newStart=0;
                                int numDiff = countDiffs(oligo, temp);
@@ -789,13 +788,7 @@ int TrimSeqsCommand::stripForward(Sequence& seq){
                                }
                                oligo = oligo.substr(0,alnLength);
                                temp = temp.substr(0,alnLength);
-//                             cout << "barcode = " << oligo << " raw = " << rawSequence.substr(0,alnLength) << " raw aligned = " << temp << endl;                     
-                               cout << seq.getName() << endl;
-                               cout << temp << endl;
-                               cout << oligo << endl;
-                               cout << alnLength << endl;
-                               cout << endl;
-                               
+//                                                             
                                int newStart=0;
                                int numDiff = countDiffs(oligo, temp);
                                if(numDiff < minDiff){
index d693bcb721184c251896c917328f9d9d07b3fc18..4ea677f4df472014321ee8d00fc7bf45d5e322f3 100644 (file)
@@ -262,12 +262,6 @@ void ValidParameters::initParameterRanges() {
                string itersArray[] = {">=","10", "<","NA", "between"};
                parameterRanges["iters"] = addParameters(itersArray, rangeSize);
 
-               string freqArray[] = {">=","1", "<","NA", "between"};
-               parameterRanges["freq"] = addParameters(freqArray, rangeSize);
-
-               //string lineArray[] = {">=","1", "<","NA", "between"};
-               //parameterRanges["line"] = addParameters(lineArray, rangeSize);
-
                string abundArray[] = {">=","5", "<","NA", "between"};
                parameterRanges["abund"] = addParameters(abundArray, rangeSize);
                
index 638a12fa817e6737d453c25e85b5b50cc66562d8..7e2404997fc8ea4b02e89b870905cd832e123041 100644 (file)
--- a/venn.cpp
+++ b/venn.cpp
@@ -42,18 +42,21 @@ vector<string> Venn::getPic(SAbundVector* sabund, vector<Calculator*> vCalcs) {
 
                        vector<double> data = vCalcs[i]->getValues(sabund);
                        
+                       int width = 1500;
+                       int height = 1500;
+                       
                        //svg image
-                       outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 700 700\" >\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(height) + " \" >\n";
                        outsvg << "<g>\n";
                                
-                       outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"700\" height=\"700\"/>"; 
-                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"265\" y=\"30\">Venn Diagram at distance " + sabund->getLabel() + "</text>\n";
-                       outsvg << "<circle fill=\"red\" opacity=\".5\" stroke=\"black\" cx=\"350\" cy=\"200\" r=\"150\"/>"; 
-                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(data[0]).length() / 2)) + "\" y=\"195\">" + toString(data[0]) + "</text>\n";  
+                       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 " + sabund->getLabel() + "</text>\n";
+                       outsvg << "<circle fill=\"red\" opacity=\".5\" stroke=\"black\" cx=\"" +  toString(int(0.50 * width)) +  "\" cy=\"" +  toString(int(0.29 * height)) +  "\" r=\"" +  toString(int(0.22 * width)) +  "\"/>"; 
+                       outsvg << "<text fill=\"black\" class=\"seri\"  font-size=\"24\" x=\"" + toString((width / 2) - ((int)toString(data[0]).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(data[0]) + "</text>\n";  
                        
                        if (data.size() == 3) { 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"200\" y=\"380\">The lower bound of the confidence interval is " + toString(data[1]) + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"200\" y=\"410\">The upper bound of the confidence interval is " + toString(data[2]) + "</text>\n";
+                               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";
                        }
                        
                        outsvg << "</g>\n</svg>\n";
@@ -74,6 +77,9 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                vector<SharedRAbundVector*> subset;
                vector<string> outputNames;
                
+               int width = 1500;
+               int height = 1500;
+               
                /******************* 1 Group **************************/
                if (lookup.size() == 1) {
                                        
@@ -100,18 +106,18 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                vector<double> data = singleCalc->getValues(sabund);
                        
                                //svg image
-                               outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 700 700\" >\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(height) + " \">\n";
                                outsvg << "<g>\n";
                                
-                               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"700\" height=\"700\"/>"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"265\" y=\"30\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
-                               outsvg << "<circle fill=\"red\" opacity=\".5\" stroke=\"black\" cx=\"350\" cy=\"200\" r=\"150\"/>"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"165\">" + lookup[0]->getGroup() + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(data[0]).length() / 2)) + "\" y=\"195\">" + toString(data[0]) + "</text>\n";  
+                               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 << "<circle fill=\"red\" opacity=\".5\" stroke=\"black\" cx=\"" +  toString(int(0.50 * 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.50 * width) - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"" +  toString(int(0.24 * height)) +  "\">" + lookup[0]->getGroup() + "</text>\n";
+                               outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.50 * width) - ((int)toString(data[0]).length() / 2)) + "\" y=\"" +  toString(int(0.28 * height)) +  "\">" + toString(data[0]) + "</text>\n";  
                        
                                if (data.size() == 3) { 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"200\" y=\"380\">The lower bound of the confidence interval is " + toString(data[1]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"200\" y=\"410\">The upper bound of the confidence interval is " + toString(data[2]) + "</text>\n";
+                                       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";
                                }
                        
                                outsvg << "</g>\n</svg>\n";
@@ -159,32 +165,32 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                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 700 700\" >\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(height) + " \" >\n";
                                outsvg << "<g>\n";
 
                                //draw circles
-                               outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"700\" height=\"700\"/>"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"265\" y=\"30\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
-                               outsvg << "<circle fill=\"rgb(255,0,0)\" opacity=\".3\" stroke=\"black\" cx=\"250\" cy=\"200\" r=\"150\"/>"; 
-                               outsvg << "<circle fill=\"rgb(0,255,0)\" opacity=\".3\" stroke=\"black\" cx=\"435\" cy=\"200\" r=\"150\"/>"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(200 - ((int)toString(numA[0]).length() / 2)) + "\" y=\"195\">" + toString(numA[0] - shared[0]) + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(490 - ((int)toString(numB[0]).length() / 2)) + "\" y=\"195\">" + toString(numB[0] - shared[0]) + "</text>\n"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(200 - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"175\">" + lookup[0]->getGroup() + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(490 - ((int)lookup[1]->getGroup().length() / 2)) + "\" y=\"175\">" + lookup[1]->getGroup() + "</text>\n"; 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(shared[0]).length() / 2)) + "\" y=\"195\">" + toString(shared[0]) + "</text>\n";  
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"460\">The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]);
+                               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 << "<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[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[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]) + "</text>\n";
                                }else { outsvg << "</text>\n"; }
                
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"480\">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.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]) + "</text>\n";
                                }else { outsvg << "</text>\n"; }
 
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"500\">The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(shared[0]) + "</text>\n";
-                               outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"520\">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\" x=\"175\" y=\"540\">The total richness for all groups is " + toString((float)(numA[0] + numB[0] - shared[0])) + "</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]) + "</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";
@@ -194,6 +200,9 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                /******************* 3 Groups **************************/
                                                
                }else if (lookup.size() == 3) {
+                       
+                       height = 1600;
+                       
                        //get sabund vector pointers so you can use the single calculators
                        //one for each group
                        SAbundVector sA, sB, sC;
@@ -301,51 +310,51 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                        }
                                        
                                        //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 800 800\" >\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(height) + " \" >\n";
                                        outsvg << "<g>\n";
 
                                        //draw circles
-                                       outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"800\" height=\"800\"/>"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"265\" y=\"30\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
-                                       outsvg << "<circle fill=\"rgb(255,0,0)\" opacity=\".3\" stroke=\"black\" cx=\"230\" cy=\"200\" r=\"150\"/>"; 
-                                       outsvg << "<circle fill=\"rgb(0,255,0)\" opacity=\".3\" stroke=\"black\" cx=\"455\" cy=\"200\" r=\"150\"/>"; 
-                                       outsvg << "<circle fill=\"rgb(0,0,255)\" opacity=\".3\" stroke=\"black\" cx=\"343\" cy=\"400\" r=\"150\"/>"; 
+                                       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 << "<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\" x=\"" + toString(200 - ((int)toString(numA[0]-sharedAwithBC[0]).length() / 2)) + "\" y=\"170\">" + toString(numA[0]-sharedAwithBC[0]) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(200 - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"150\">" + lookup[0]->getGroup() + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(sharedAB[0] - sharedABC).length() / 2)) + "\"  y=\"170\">" + toString(sharedAB[0] - sharedABC) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(485 - ((int)toString(numB[0]-sharedBwithAC[0]).length() / 2)) + "\"  y=\"170\">" + toString(numB[0]-sharedBwithAC[0]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(485 - ((int)lookup[1]->getGroup().length() / 2)) + "\"  y=\"150\">" + lookup[1]->getGroup() + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(268 - ((int)toString(sharedAC[0] - sharedABC).length() / 2)) + "\"  y=\"305\">" + toString(sharedAC[0] - sharedABC) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(343 - ((int)toString(numC[0]-sharedCwithAB[0]).length() / 2)) + "\"   y=\"430\">" + toString(numC[0]-sharedCwithAB[0]) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(343 - ((int)lookup[2]->getGroup().length() / 2)) + "\"   y=\"410\">" + lookup[2]->getGroup() + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(408 - ((int)toString(sharedBC[0] - sharedABC).length() / 2)) + "\" y=\"305\">" + toString(sharedBC[0] - sharedABC) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(sharedABC).length() / 2)) + "\"  y=\"280\">" + toString(sharedABC) + "</text>\n"; 
+                                       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\" x=\"175\" y=\"660\">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\" x=\"175\" y=\"680\">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\" x=\"175\" y=\"700\">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\" x=\"175\" y=\"720\">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\" x=\"175\" y=\"740\">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\" x=\"175\" y=\"760\">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\" x=\"175\" y=\"580\">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]) + "</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]);
                                        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 << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"600\">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\" x=\"175\" y=\"620\">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 << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"640\">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\" x=\"175\" y=\"780\">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) + "</text>\n";
                                        
                                        delete singleCalc;
                                        
@@ -384,48 +393,48 @@ 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 800 800\" >\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(height) + " \" >\n";
                                        outsvg << "<g>\n";
 
                                        //draw circles
-                                       outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"800\" height=\"800\"/>"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"265\" y=\"30\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
-                                       outsvg << "<circle fill=\"rgb(255,0,0)\" opacity=\".3\" stroke=\"black\" cx=\"230\" cy=\"200\" r=\"150\"/>"; 
-                                       outsvg << "<circle fill=\"rgb(0,255,0)\" opacity=\".3\" stroke=\"black\" cx=\"455\" cy=\"200\" r=\"150\"/>"; 
-                                       outsvg << "<circle fill=\"rgb(0,0,255)\" opacity=\".3\" stroke=\"black\" cx=\"343\" cy=\"400\" r=\"150\"/>"; 
+                                       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 << "<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\" x=\"" + toString(200 - ((int)toString(numA[0]-sharedab[0]-sharedac[0]+sharedabc[0]).length() / 2)) + "\" y=\"170\">" + toString(numA[0]-sharedab[0]-sharedac[0]+sharedabc[0]) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(200 - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"150\">" + lookup[0]->getGroup() + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(sharedab[0] - sharedabc[0]).length() / 2)) + "\"  y=\"170\">" + toString(sharedab[0] - sharedabc[0]) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(485 - ((int)toString(numB[0]-sharedab[0]-sharedbc[0]+sharedabc[0]).length() / 2)) + "\"  y=\"170\">" + toString(numB[0]-sharedab[0]-sharedbc[0]+sharedabc[0]) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(485 - ((int)lookup[1]->getGroup().length() / 2)) + "\"  y=\"150\">" + lookup[1]->getGroup() + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(268 - ((int)toString(sharedac[0] - sharedabc[0]).length() / 2)) + "\"  y=\"305\">" + toString(sharedac[0] - sharedabc[0]) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(343 - ((int)toString(numC[0]-sharedac[0]-sharedbc[0]+sharedabc[0]).length() / 2)) + "\"   y=\"430\">" + toString(numC[0]-sharedac[0]-sharedbc[0]+sharedabc[0]) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(343 - ((int)lookup[2]->getGroup().length() / 2)) + "\"   y=\"410\">" + lookup[2]->getGroup() + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(408 - ((int)toString(sharedbc[0] - sharedabc[0]).length() / 2)) + "\" y=\"305\">" + toString(sharedbc[0] - sharedabc[0]) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(343 - ((int)toString(sharedabc[0]).length() / 2)) + "\"  y=\"280\">" + 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\" x=\"175\" y=\"660\">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\" x=\"175\" y=\"680\">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\" x=\"175\" y=\"700\">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\" x=\"175\" y=\"580\">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]) + "</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]);
                                        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 << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"600\">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\" x=\"175\" y=\"620\">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 << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"640\">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\" x=\"175\" y=\"720\">The total shared richness is " + toString(sharedabc[0]) + "</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";
 
 
                                }
@@ -441,6 +450,9 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                /******************* 4 Groups **************************/
                
                }else if (lookup.size() == 4) {
+                       
+                       height = 1600;
+               
                        //calc the shared otu
                        float sharedABCD = 0;
                        float numA = 0; float numB = 0; float numC = 0; float numD = 0;
@@ -555,27 +567,27 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                                
                                                
                                        //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 700 800\" >\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(height) + " \" >\n";
                                        outsvg << "<g>\n";
-                                       outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"700\" height=\"800\"/>"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"265\" y=\"30\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
+                                       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\" x=\"175\" y=\"490\">The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"510\">The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"530\">The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"175\" y=\"550\">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) + "</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\" x=\"175\" y=\"570\">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\" x=\"175\" y=\"590\">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\" x=\"175\" y=\"610\">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\" x=\"175\" y=\"630\">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\" x=\"175\" y=\"650\">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\" x=\"175\" y=\"670\">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) + "</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\" x=\"175\" y=\"690\">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\" x=\"175\" y=\"710\">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\" x=\"175\" y=\"730\">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\" x=\"175\" y=\"750\">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) + "</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";
                                                                        
                                        //make adjustments
                                        sharedABC = sharedABC - sharedABCD;
@@ -604,37 +616,37 @@ vector<string> Venn::getPic(vector<SharedRAbundVector*> lookup, vector<Calculato
                        //cout << "num d = " << numD << endl;           
                                        
                                        //draw circles
-                                       outsvg << "<ellipse fill=\"red\" stroke=\"black\" opacity=\".35\" transform=\"rotate(-45 355 215) \" cx=\"355\" cy=\"215\" rx=\"200\" ry=\"115\"/>\n "; 
-                                       outsvg << "<ellipse fill=\"green\" stroke=\"black\" opacity=\".35\" transform=\"rotate(+45 355 215) \" cx=\"355\" cy=\"215\" rx=\"200\" ry=\"115\"/>\n ";
-                                       outsvg << "<ellipse fill=\"blue\" stroke=\"black\" opacity=\".35\" transform=\"rotate(-40 440 315) \" cx=\"440\" cy=\"315\" rx=\"200\" ry=\"115\"/>\n ";
-                                       outsvg << "<ellipse fill=\"yellow\" stroke=\"black\" opacity=\".35\" transform=\"rotate(+40 270 315) \" cx=\"270\" cy=\"315\" rx=\"200\" ry=\"115\"/>\n ";
+                                       outsvg << "<ellipse fill=\"red\" stroke=\"black\" opacity=\".35\" transform=\"rotate(-45 " +  toString(int(0.51 * width)) +  " " +  toString(int(0.27 * height)) +  ") \" cx=\"" +  toString(int(0.51 * width)) +  "\" cy=\"" +  toString(int(0.27 * height)) +  "\" rx=\"" +  toString(int(0.29 * width)) +  "\" ry=\"" +  toString(int(0.14 * height)) +  "\"/>\n "; 
+                                       outsvg << "<ellipse fill=\"green\" stroke=\"black\" opacity=\".35\" transform=\"rotate(+45 " +  toString(int(0.51 * width)) +  " " +  toString(int(0.27 * height)) +  ") \" cx=\"" +  toString(int(0.51 * width)) +  "\" cy=\"" +  toString(int(0.27 * height)) +  "\" rx=\"" +  toString(int(0.29 * width)) +  "\" ry=\"" +  toString(int(0.14 * height)) +  "\"/>\n ";
+                                       outsvg << "<ellipse fill=\"blue\" stroke=\"black\" opacity=\".35\" transform=\"rotate(-40 " +  toString(int(0.63 * width)) +  " " +  toString(int(0.36 * height)) +  ") \" cx=\"" +  toString(int(0.63 * width)) +  "\" cy=\"" +  toString(int(0.36 * height)) +  "\" rx=\"" +  toString(int(0.29 * width)) +  "\" ry=\"" +  toString(int(0.14 * height)) +  "\"/>\n ";
+                                       outsvg << "<ellipse fill=\"yellow\" stroke=\"black\" opacity=\".35\" transform=\"rotate(+40 " +  toString(int(0.36 * width)) +  " " +  toString(int(0.36 * height)) +  ") \" cx=\"" +  toString(int(0.36 * width)) +  "\" cy=\"" +  toString(int(0.36 * height)) +  "\" rx=\"" +  toString(int(0.29 * width)) +  "\" ry=\"" +  toString(int(0.14 * height)) +  "\"/>\n ";
                        
                                        //A = red, B = green, C = blue, D = yellow
                        
                                        //place labels within overlaps
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(460 - ((int)toString(numA).length() / 2)) + "\" y=\"110\">" + toString(numA)  + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(460 - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"90\">" + lookup[0]->getGroup() + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(350 - ((int)toString(sharedAB).length() / 2)) + "\"  y=\"160\">" + toString(sharedAB) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(250 - ((int)toString(numB).length() / 2)) + "\"  y=\"110\">" + toString(numB)  + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(250 - ((int)lookup[1]->getGroup().length() / 2)) + "\"  y=\"90\">" + lookup[1]->getGroup() + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(490 - ((int)toString(sharedAC).length() / 2)) + "\"  y=\"190\">" + toString(sharedAC) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(550 - ((int)toString(numC).length() / 2)) + "\"   y=\"230\">" + toString(numC) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(550 - ((int)lookup[2]->getGroup().length() / 2)) + "\"   y=\"210\">" + lookup[2]->getGroup() + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(215 - ((int)toString(sharedBD).length() / 2)) + "\" y=\"190\">" + toString(sharedBD) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(150 - ((int)toString(numD).length() / 2)) + "\"   y=\"230\">" + toString(numD) + "</text>\n";  
-                                       outsvg << "<text fill=\"black\" class=\"seri\"  x=\"" + toString(150 - ((int)lookup[3]->getGroup().length() / 2)) + "\"   y=\"210\">" + lookup[3]->getGroup() + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(240 - ((int)toString(sharedAD).length() / 2)) + "\" y=\"325\">" + toString(sharedAD) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(470 - ((int)toString(sharedBC).length() / 2)) + "\" y=\"325\">" + toString(sharedBC) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(350 - ((int)toString(sharedCD).length() / 2)) + "\" y=\"430\">" + toString(sharedCD) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(275 - ((int)toString(sharedABD).length() / 2)) + "\" y=\"240\">" + toString(sharedABD) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(400 - ((int)toString(sharedBCD).length() / 2)) + "\" y=\"360\">" + toString(sharedBCD) + "</text>\n";
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(305 - ((int)toString(sharedACD).length() / 2)) + "\" y=\"360\">" + toString(sharedACD) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(440 - ((int)toString(sharedABC).length() / 2)) + "\"  y=\"240\">" + toString(sharedABC) + "</text>\n"; 
-                                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(350 - ((int)toString(sharedABCD).length() / 2)) + "\"  y=\"320\">" + toString(sharedABCD) + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.66 * width) - ((int)toString(numA).length() / 2)) + "\" y=\"" +  toString(int(0.14 * height)) +  "\">" + toString(numA)  + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.66 * width) - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"" +  toString(int(0.11 * height)) +  "\">" + lookup[0]->getGroup() + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedAB).length() / 2)) + "\"  y=\"" +  toString(int(0.2 * height)) +  "\">" + toString(sharedAB) + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.36 * width) - ((int)toString(numB).length() / 2)) + "\"  y=\"" +  toString(int(0.14 * height)) +  "\">" + toString(numB)  + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.36 * width) - ((int)lookup[1]->getGroup().length() / 2)) + "\"  y=\"" +  toString(int(0.11 * height)) +  "\">" + lookup[1]->getGroup() + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)toString(sharedAC).length() / 2)) + "\"  y=\"" +  toString(int(0.24 * height)) +  "\">" + toString(sharedAC) + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\"  x=\"" + toString(int(0.785 * width) - ((int)toString(numC).length() / 2)) + "\"   y=\"" +  toString(int(0.29 * height)) +  "\">" + toString(numC) + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\"  x=\"" + toString(int(0.785 * width) - ((int)lookup[2]->getGroup().length() / 2)) + "\"   y=\"" +  toString(int(0.26 * height)) +  "\">" + lookup[2]->getGroup() + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.31 * width) - ((int)toString(sharedBD).length() / 2)) + "\" y=\"" +  toString(int(0.24 * height)) +  "\">" + toString(sharedBD) + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\"  x=\"" + toString(int(0.22 * width) - ((int)toString(numD).length() / 2)) + "\"   y=\"" +  toString(int(0.29 * height)) +  "\">" + toString(numD) + "</text>\n";  
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\"  x=\"" + toString(int(0.22 * width) - ((int)lookup[3]->getGroup().length() / 2)) + "\"   y=\"" +  toString(int(0.26 * height)) +  "\">" + lookup[3]->getGroup() + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.34 * width) - ((int)toString(sharedAD).length() / 2)) + "\" y=\"" +  toString(int(0.41 * height)) +  "\">" + toString(sharedAD) + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.675 * width) - ((int)toString(sharedBC).length() / 2)) + "\" y=\"" +  toString(int(0.41 * height)) +  "\">" + toString(sharedBC) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedCD).length() / 2)) + "\" y=\"" +  toString(int(0.54 * height)) +  "\">" + toString(sharedCD) + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.39 * width) - ((int)toString(sharedABD).length() / 2)) + "\" y=\"" +  toString(int(0.3 * height)) +  "\">" + toString(sharedABD) + "</text>\n"; 
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.57 * width) - ((int)toString(sharedBCD).length() / 2)) + "\" y=\"" +  toString(int(0.45 * height)) +  "\">" + toString(sharedBCD) + "</text>\n";
+                                       outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.435 * width) - ((int)toString(sharedACD).length() / 2)) + "\" y=\"" +  toString(int(0.45 * height)) +  "\">" + toString(sharedACD) + "</text>\n"; 
+                                       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\" x=\"175\" y=\"770\">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 << "<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";