]> git.donarmstrong.com Git - mothur.git/commitdiff
added bootstrap.shared command and fixed some bugs with heatmap
authorwestcott <westcott>
Fri, 17 Apr 2009 15:43:01 +0000 (15:43 +0000)
committerwestcott <westcott>
Fri, 17 Apr 2009 15:43:01 +0000 (15:43 +0000)
54 files changed:
Mothur.xcodeproj/project.pbxproj
bergerparker.cpp
bergerparker.h
bootstrapsharedcommand.cpp [new file with mode: 0644]
bootstrapsharedcommand.h [new file with mode: 0644]
bstick.cpp
bstick.h
commandfactory.cpp
errorchecking.cpp
errorchecking.h
fileoutput.cpp
fileoutput.h
geom.cpp
geom.h
getgroupcommand.cpp
getgroupcommand.h
getlabelcommand.cpp
getlabelcommand.h
getlinecommand.cpp
getlinecommand.h
globaldata.cpp
globaldata.hpp
heatmap.cpp
heatmap.h
helpcommand.cpp
helpcommand.h
logsd.cpp
logsd.h
parsimonycommand.cpp
parsimonycommand.h
qstat.cpp
qstat.h
raredisplay.cpp
sharedbdiversity.cpp
sharedbdiversity.h
sharedkstest.cpp
sharedkstest.h
sharedordervector.cpp
sharedrabundvector.cpp
sharedutilities.cpp
sharedutilities.h
tree.cpp
tree.h
treegroupscommand.cpp
treemap.cpp
treemap.h
unifracunweightedcommand.cpp
unifracunweightedcommand.h
unifracweightedcommand.cpp
unifracweightedcommand.h
validcalculator.cpp
validcalculator.h
validcommands.cpp
validparameter.cpp

index e9fbcfe29dd007362506740951d414752a1a9fb9..aaeab8d13b86103bf0b25ab11624342f2bd3433d 100644 (file)
@@ -7,6 +7,9 @@
        objects = {
 
 /* Begin PBXBuildFile section */
+               211C38320F961DD400FEE541 /* sharedutilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 211C38300F961DD400FEE541 /* sharedutilities.cpp */; };
+               211C38380F961E1F00FEE541 /* treegroupscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 211C38360F961E1F00FEE541 /* treegroupscommand.cpp */; };
+               21DDC01B0F97A8FE0060691C /* bootstrapsharedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21DDC01A0F97A8FE0060691C /* bootstrapsharedcommand.cpp */; };
                370B88070F8A4EE4005AB382 /* getoturepcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 370B88060F8A4EE4005AB382 /* getoturepcommand.cpp */; };
                372E12700F26365B0095CF7E /* readotucommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E126F0F26365B0095CF7E /* readotucommand.cpp */; };
                372E12960F263D5A0095CF7E /* readdistcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12950F263D5A0095CF7E /* readdistcommand.cpp */; };
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+               211C38300F961DD400FEE541 /* sharedutilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedutilities.cpp; sourceTree = "<group>"; };
+               211C38310F961DD400FEE541 /* sharedutilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedutilities.h; sourceTree = "<group>"; };
+               211C38360F961E1F00FEE541 /* treegroupscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = treegroupscommand.cpp; sourceTree = "<group>"; };
+               211C38370F961E1F00FEE541 /* treegroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = treegroupscommand.h; sourceTree = "<group>"; };
+               21DDC0190F97A8FE0060691C /* bootstrapsharedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootstrapsharedcommand.h; sourceTree = "<group>"; };
+               21DDC01A0F97A8FE0060691C /* bootstrapsharedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bootstrapsharedcommand.cpp; sourceTree = "<group>"; };
                370B88050F8A4EE4005AB382 /* getoturepcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getoturepcommand.h; sourceTree = "<group>"; };
                370B88060F8A4EE4005AB382 /* getoturepcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getoturepcommand.cpp; sourceTree = "<group>"; };
                372E126E0F26365B0095CF7E /* readotucommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readotucommand.h; sourceTree = "<group>"; };
                37D928490F21331F001D4494 /* summarydisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = summarydisplay.h; sourceTree = "<group>"; };
                37D9284A0F21331F001D4494 /* summarysharedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = summarysharedcommand.cpp; sourceTree = "<group>"; };
                37D9284B0F21331F001D4494 /* summarysharedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = summarysharedcommand.h; sourceTree = "<group>"; };
-               37D9284C0F21331F001D4494 /* utilities.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = utilities.hpp; sourceTree = "<group>"; };
                37D9284D0F21331F001D4494 /* uvest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = uvest.cpp; sourceTree = "<group>"; };
                37D9284E0F21331F001D4494 /* uvest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uvest.h; sourceTree = "<group>"; };
                37D9284F0F21331F001D4494 /* validcalculator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = validcalculator.cpp; sourceTree = "<group>"; };
                                37D9281C0F21331F001D4494 /* sequence.cpp */,
                                37D928210F21331F001D4494 /* shared.h */,
                                37D928200F21331F001D4494 /* shared.cpp */,
+                               211C38310F961DD400FEE541 /* sharedutilities.h */,
+                               211C38300F961DD400FEE541 /* sharedutilities.cpp */,
                                37D928420F21331F001D4494 /* singlelinkage.cpp */,
                                37D928480F21331F001D4494 /* summarydata.h */,
                                37D928490F21331F001D4494 /* summarydisplay.h */,
-                               37D9284C0F21331F001D4494 /* utilities.hpp */,
                                37519AB30F810FAE00FED5E8 /* venn.h */,
                                37519AB40F810FAE00FED5E8 /* venn.cpp */,
                        );
                                37D927CD0F21331F001D4494 /* command.hpp */,
                                37C1D9710F86506E0059E3F0 /* binsequencecommand.h */,
                                37C1D9720F86506E0059E3F0 /* binsequencecommand.cpp */,
+                               21DDC0190F97A8FE0060691C /* bootstrapsharedcommand.h */,
+                               21DDC01A0F97A8FE0060691C /* bootstrapsharedcommand.cpp */,
                                37D927C40F21331F001D4494 /* clustercommand.h */,
                                37D927C30F21331F001D4494 /* clustercommand.cpp */,
                                37D927C80F21331F001D4494 /* collectcommand.h */,
                                37D928460F21331F001D4494 /* summarycommand.cpp */,
                                37D9284B0F21331F001D4494 /* summarysharedcommand.h */,
                                37D9284A0F21331F001D4494 /* summarysharedcommand.cpp */,
+                               211C38370F961E1F00FEE541 /* treegroupscommand.h */,
+                               211C38360F961E1F00FEE541 /* treegroupscommand.cpp */,
                                3746109B0F40657600460C57 /* unifracunweightedcommand.h */,
                                3746109C0F40657600460C57 /* unifracunweightedcommand.cpp */,
                                374610760F40645300460C57 /* unifracweightedcommand.h */,
                                7E412F490F8D21B600381DD0 /* slibshuff.cpp in Sources */,
                                7E412FEA0F8D3E2C00381DD0 /* libshuff.cpp in Sources */,
                                7E4130F80F8E58FA00381DD0 /* dlibshuff.cpp in Sources */,
+                               211C38320F961DD400FEE541 /* sharedutilities.cpp in Sources */,
+                               211C38380F961E1F00FEE541 /* treegroupscommand.cpp in Sources */,
+                               21DDC01B0F97A8FE0060691C /* bootstrapsharedcommand.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 41e6e9fe97d193b4491fb33e3c5074b817516c8c..893f2a95dad68e6f9ba1638eb29be43071a711aa 100644 (file)
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/6/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index f164ec8b56128c03a90d1298de40461d9ba91611..a0fd2aaf2a3b5996d220e4533c4ec784144f9a4d 100644 (file)
@@ -5,7 +5,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/6/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
diff --git a/bootstrapsharedcommand.cpp b/bootstrapsharedcommand.cpp
new file mode 100644 (file)
index 0000000..b2a64ed
--- /dev/null
@@ -0,0 +1,309 @@
+/*
+ *  bootstrapsharedcommand.cpp
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 4/16/09.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "bootstrapsharedcommand.h"
+#include "sharedjabund.h"
+#include "sharedsorabund.h"
+#include "sharedjclass.h"
+#include "sharedsorclass.h"
+#include "sharedjest.h"
+#include "sharedsorest.h"
+#include "sharedthetayc.h"
+#include "sharedthetan.h"
+#include "sharedmorisitahorn.h"
+
+
+//**********************************************************************************************************************
+
+BootSharedCommand::BootSharedCommand(){
+       try {
+               globaldata = GlobalData::getInstance();
+               format = globaldata->getFormat();
+               convert(globaldata->getIters(), iters);
+               validCalculator = new ValidCalculators();
+               util = new SharedUtil();
+               
+               
+               int i;
+               for (i=0; i<globaldata->Estimators.size(); i++) {
+                       if (validCalculator->isValidCalculator("boot", globaldata->Estimators[i]) == true) { 
+                               if (globaldata->Estimators[i] == "jabund") {    
+                                       treeCalculators.push_back(new JAbund());
+                               }else if (globaldata->Estimators[i] == "sorensonabund") { 
+                                       treeCalculators.push_back(new SorAbund());
+                               }else if (globaldata->Estimators[i] == "jclass") { 
+                                       treeCalculators.push_back(new Jclass());
+                               }else if (globaldata->Estimators[i] == "sorclass") { 
+                                       treeCalculators.push_back(new SorClass());
+                               }else if (globaldata->Estimators[i] == "jest") { 
+                                       treeCalculators.push_back(new Jest());
+                               }else if (globaldata->Estimators[i] == "sorest") { 
+                                       treeCalculators.push_back(new SorEst());
+                               }else if (globaldata->Estimators[i] == "thetayc") { 
+                                       treeCalculators.push_back(new ThetaYC());
+                               }else if (globaldata->Estimators[i] == "thetan") { 
+                                       treeCalculators.push_back(new ThetaN());
+                               }else if (globaldata->Estimators[i] == "morisitahorn") { 
+                                       treeCalculators.push_back(new MorHorn());
+                               }
+                       }
+               }
+               
+               ofstream* temp;
+               for (int i=0; i < treeCalculators.size(); i++) {
+                       temp = new ofstream;
+                       out.push_back(temp);
+               }
+               
+               //reset calc for next command
+               globaldata->setCalc("");
+
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the BootSharedCommand class Function BootSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the BootSharedCommand class function BootSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
+//**********************************************************************************************************************
+
+BootSharedCommand::~BootSharedCommand(){
+       delete input;
+       delete read;
+       delete util;
+}
+
+//**********************************************************************************************************************
+
+int BootSharedCommand::execute(){
+       try {
+               int count = 1;  
+               EstOutput data;
+       
+               //if the users entered no valid calculators don't execute command
+               if (treeCalculators.size() == 0) { return 0; }
+
+               if (format == "sharedfile") {
+                       read = new ReadPhilFile(globaldata->inputFileName);     
+                       read->read(&*globaldata); 
+                       
+                       input = globaldata->ginput;
+                       order = input->getSharedOrderVector();
+               }else {
+                       //you are using a list and a groupfile
+                       read = new ReadPhilFile(globaldata->inputFileName);     
+                       read->read(&*globaldata); 
+               
+                       input = globaldata->ginput;
+                       SharedList = globaldata->gSharedList;
+                       order = SharedList->getSharedOrderVector();
+               }
+               
+               //set users groups
+               util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "treegroup");
+               numGroups = globaldata->Groups.size();
+               
+               //clear globaldatas old tree names if any
+               globaldata->Treenames.clear();
+               
+               //fills globaldatas tree names
+               globaldata->Treenames = globaldata->Groups;
+               
+               //create treemap class from groupmap for tree class to use
+               tmap = new TreeMap();
+               tmap->makeSim(globaldata->gGroupmap);
+               globaldata->gTreemap = tmap;
+                       
+               while(order != NULL){
+               
+                       if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){                       
+                               
+                               cout << order->getLabel() << '\t' << count << endl;
+                               
+                               //open an ostream for each calc to print to
+                               for (int z = 0; z < treeCalculators.size(); z++) {
+                                       //create a new filename
+                                       outputFile = getRootName(globaldata->inputFileName) + treeCalculators[z]->getName() + ".boot" + order->getLabel() + ".tre";
+                                       openOutputFile(outputFile, *(out[z]));
+                               }
+                               
+                               //create a file for each calculator with the 1000 trees in it.
+                               for (int p = 0; p < iters; p++) {
+                                       
+                                       util->getSharedVectorswithReplacement(globaldata->Groups, lookup, order);  //fills group vectors from order vector.
+                               
+                                       //for each calculator                                                                                           
+                                       for(int i = 0 ; i < treeCalculators.size(); i++) {
+                                       
+                                               //initialize simMatrix
+                                               simMatrix.clear();
+                                               simMatrix.resize(numGroups);
+                                               for (int m = 0; m < simMatrix.size(); m++)      {
+                                                       for (int j = 0; j < simMatrix.size(); j++)      {
+                                                               simMatrix[m].push_back(0.0);
+                                                       }
+                                               }
+                               
+                                               //initialize index
+                                               index.clear();
+                                               for (int g = 0; g < numGroups; g++) {   index[g] = g;   }
+                                                       
+                                               for (int k = 0; k < lookup.size(); k++) { // pass cdd each set of groups to commpare
+                                                       for (int l = k; l < lookup.size(); l++) {
+                                                               if (k != l) { //we dont need to similiarity of a groups to itself
+                                                                       //get estimated similarity between 2 groups
+                                                                       data = treeCalculators[i]->getValues(lookup[k], lookup[l]); //saves the calculator outputs
+                                                                       //save values in similarity matrix
+                                                                       simMatrix[k][l] = data[0];
+                                                                       simMatrix[l][k] = data[0];
+                                                               }
+                                                       }
+                                               }
+                                       
+                                               //creates tree from similarity matrix and write out file
+                                               createTree(out[i]);
+                                       }
+                               }
+                               //close ostream for each calc
+                               for (int z = 0; z < treeCalculators.size(); z++) { out[z]->close(); }
+                       }
+               
+                       //get next line to process
+                       if (format == "sharedfile") {
+                               order = input->getSharedOrderVector();
+                       }else {
+                               //you are using a list and a groupfile
+                               SharedList = input->getSharedListVector(); //get new list vector to process
+                               if (SharedList != NULL) {
+                                       order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
+                               }else {
+                                       break;
+                               }
+                       }
+                       count++;
+               }
+               
+               //reset groups parameter
+               globaldata->Groups.clear();  globaldata->setGroups("");
+
+               return 0;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the BootSharedCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the BootSharedCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }               
+}
+//**********************************************************************************************************************
+
+void BootSharedCommand::createTree(ostream* out){
+       try {
+               //create tree
+               t = new Tree();
+               
+               //do merges and create tree structure by setting parents and children
+               //there are numGroups - 1 merges to do
+               for (int i = 0; i < (numGroups - 1); i++) {
+                       
+                       float largest = 0.0;
+                       int row, column;
+                       //find largest value in sims matrix by searching lower triangle
+                       for (int j = 1; j < simMatrix.size(); j++) {
+                               for (int k = 0; k < j; k++) {
+                                       if (simMatrix[j][k] > largest) {  largest = simMatrix[j][k]; row = j; column = k;  }
+                               }
+                       }
+
+                       //set non-leaf node info and update leaves to know their parents
+                       //non-leaf
+                       t->tree[numGroups + i].setChildren(index[row], index[column]);
+                       
+                       //parents
+                       t->tree[index[row]].setParent(numGroups + i);
+                       t->tree[index[column]].setParent(numGroups + i);
+                       
+                       //blength = distance / 2;
+                       float blength = ((1.0 - largest) / 2);
+                       
+                       //branchlengths
+                       t->tree[index[row]].setBranchLength(blength - t->tree[index[row]].getLengthToLeaves());
+                       t->tree[index[column]].setBranchLength(blength - t->tree[index[column]].getLengthToLeaves());
+                       
+                       //set your length to leaves to your childs length plus branchlength
+                       t->tree[numGroups + i].setLengthToLeaves(t->tree[index[row]].getLengthToLeaves() + t->tree[index[row]].getBranchLength());
+                       
+                       
+                       //update index 
+                       index[row] = numGroups+i;
+                       index[column] = numGroups+i;
+                       
+                       //zero out highest value that caused the merge.
+                       simMatrix[row][column] = 0.0;
+                       simMatrix[column][row] = 0.0;
+                       
+                       //merge values in simsMatrix
+                       for (int n = 0; n < simMatrix.size(); n++)      {
+                               //row becomes merge of 2 groups
+                               simMatrix[row][n] = (simMatrix[row][n] + simMatrix[column][n]) / 2;
+                               simMatrix[n][row] = simMatrix[row][n];
+                               //delete column
+                               simMatrix[column][n] = 0.0;
+                               simMatrix[n][column] = 0.0;
+                       }
+               }
+       
+               //assemble tree
+               t->assembleTree();
+               
+               //print newick file
+               t->print(*out);
+               
+               //delete tree
+               delete t;
+       
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the BootSharedCommand class Function createTree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the BootSharedCommand class function createTree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+}
+/***********************************************************/
+void BootSharedCommand::printSims() {
+       try {
+               cout << "simsMatrix" << endl;
+               for (int m = 0; m < simMatrix.size(); m++)      {
+                       for (int n = 0; n < simMatrix.size(); n++)      {
+                               cout << simMatrix[m][n] << '\t'; 
+                       }
+                       cout << endl;
+               }
+
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the BootSharedCommand class Function printSims. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the BootSharedCommand class function printSims. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }               
+}
+/***********************************************************/
+
+
diff --git a/bootstrapsharedcommand.h b/bootstrapsharedcommand.h
new file mode 100644 (file)
index 0000000..194aa33
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef BOOTSTRAPSHAREDCOMMAND_H
+#define BOOTSTRAPSHAREDCOMMAND_H
+
+/*
+ *  bootstrapsharedcommand.h
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 4/16/09.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+#include "command.hpp"
+#include "sharedordervector.h"
+#include "sharedlistvector.h"
+#include "inputdata.h"
+#include "groupmap.h"
+#include "readmatrix.hpp"
+#include "validcalculator.h"
+#include "tree.h"
+#include "treemap.h"
+#include "sharedutilities.h"
+       
+class GlobalData;
+
+class BootSharedCommand : public Command {
+       
+public:
+       BootSharedCommand();    
+       ~BootSharedCommand();
+       int execute();  
+       
+private:
+       void createTree(ostream*);
+       void printSims();
+       
+       GlobalData* globaldata;
+       SharedUtil* util;
+       ReadMatrix* read;
+       TreeMap* tmap;
+       Tree* t;
+       vector<Calculator*> treeCalculators;
+       vector<ofstream*> out;
+       vector< vector<float> > simMatrix;
+       map<int, int> index;  //maps row in simMatrix to vector index in the tree       
+       InputData* input;
+       ValidCalculators* validCalculator;
+       SharedListVector* SharedList;
+       SharedOrderVector* order;
+       vector<SharedRAbundVector*> lookup;
+       string format, outputFile;
+       int numGroups, iters;
+
+};
+       
+       
+#endif
+
+
index 0dc67b9b07e3a8bde26300ba1b8b5233e0af099e..7f12d1d826fa0baf28b4726c3dbd0abf0c9b660c 100644 (file)
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/6/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index f2107b18f9d3484884133b180e41ee3cfe5b0077..f4693b7974ea60dace28bcb088b64d9c09d6629d 100644 (file)
--- a/bstick.h
+++ b/bstick.h
@@ -5,7 +5,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/6/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 #include "calculator.h"
index b4e68e4cd67de88de0198251f2d595c9e000a498..ff156139ea3f3c1d67791d440113177fc261a700 100644 (file)
@@ -36,6 +36,7 @@
 #include "binsequencecommand.h"
 #include "getoturepcommand.h"
 #include "treegroupscommand.h"
+#include "bootstrapsharedcommand.h"
 
 
 /***********************************************************/
@@ -83,7 +84,8 @@ Command* CommandFactory::getCommand(string commandName){
                else if(commandName == "venn")                                  {   command = new VennCommand();                                }
                else if(commandName == "bin.seqs")                              {   command = new BinSeqCommand();                              }
                else if(commandName == "get.oturep")                    {   command = new GetOTURepCommand();                   }
-               else if(commandName == "tree.groups")                   {   command = new TreeGroupCommand();                   }
+               else if(commandName == "tree.shared")                   {   command = new TreeGroupCommand();                   }
+               else if(commandName == "bootstrap.shared")              {   command = new BootSharedCommand();                  }
                else                                                                                    {       command = new NoCommand();                                      }
 
                return command;
index 841cad2ddddea905faaf91dca54f193b0221a6ea..4eef3b041aaf724e87efb980c6115c9cc78036ce 100644 (file)
@@ -111,7 +111,7 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "abund" )          { abund = value; }
                                if (parameter == "random" )                     { randomtree = value;   }
                                if (parameter == "sorted" )                     { sorted = value;       }
-                               if (parameter == "scaler" )                     { scaler = value;       }
+                               if (parameter == "scale" )                      { scale = value;        }
                                
                        }
                        
@@ -146,7 +146,7 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "random" )                     { randomtree = value;   }
                                if (parameter == "abund" )          { abund = value; }
                                if (parameter == "sorted" )                     { sorted = value;       }
-                               if (parameter == "scaler" )                     { scaler = value;       }
+                               if (parameter == "scale" )                      { scale = value;        }
                        }
                }
                
@@ -219,10 +219,10 @@ bool ErrorCheck::checkInput(string input) {
                        if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { cout << "You must read a list, sabund or rabund before you can use the collect.single, rarefaction.single or summary.single commands." << endl; return false; }
                }
                
-               if ((commandName == "collect.shared") || (commandName == "rarefaction.shared") || (commandName == "summary.shared") || (commandName == "tree.groups") ){ 
+               if ((commandName == "collect.shared") || (commandName == "rarefaction.shared") || (commandName == "summary.shared") || (commandName == "tree.shared") || (commandName == "bootstrap.shared")){ 
                        if (globaldata->getSharedFile() == "") {
-                               if (globaldata->getListFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared or tree.groups commands." << endl; return false; }
-                               else if (globaldata->getGroupFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared or tree.groups commands." << endl; return false; }
+                               if (globaldata->getListFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared, tree.shared or bootstrap.shared commands." << endl; return false; }
+                               else if (globaldata->getGroupFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared, summary.shared, tree.shared or bootstrap.shared commands." << endl; return false; }
                        }
                }
                
index 3ddc65c962cbe35ec8e0d7acb0389e113efdc12f..05ce5cf12a071c2e50409dd29c648447465f5bfe 100644 (file)
@@ -34,7 +34,7 @@ class ErrorCheck {
                void clear();
                void refresh();
                string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, sharedfile, cutoff, format; 
-               string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary, randomtree, abund, sorted, scaler;
+               string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary, randomtree, abund, sorted, scale;
                string commandName, optionText;
                bool errorFree;
 
index e6f069dd894e7fe5702b63e5fe6e4c3ce85bc25e..9c1f9c0f0c61fe3b27d84f699482d8708ad1e660 100644 (file)
@@ -90,7 +90,7 @@ void ThreeColumnFile::resetFile(){
                renameOk = rename(outName.c_str(), inName.c_str());
                
                //checks to make sure user was able to rename and remove successfully
-               if ((renameOk != 0)) { cout << "Unable to rename necessary files." << endl; }
+               if ((renameOk != 0)) {  cout << "Unable to rename necessary files." << endl;  cout << outName << "  g   " << inName << endl;}
 
        }
        catch(exception& e) {
@@ -106,7 +106,7 @@ void ThreeColumnFile::resetFile(){
 /***********************************************************************/
 /***********************************************************************/
 
-ThreeColumnFile2::~ThreeColumnFile2(){
+ColumnFile::~ColumnFile(){
        
        inFile.close();
        outFile.close();
@@ -115,7 +115,7 @@ ThreeColumnFile2::~ThreeColumnFile2(){
 
 /***********************************************************************/
 
-void ThreeColumnFile2::initFile(string label, vector<string> tags){
+void ColumnFile::initFile(string label, vector<string> tags){
        try {
                if(counter != 0){
                        openOutputFile(outName, outFile);
@@ -125,7 +125,7 @@ void ThreeColumnFile2::initFile(string label, vector<string> tags){
                        getline(inFile, inputBuffer);
                
                        outFile <<  inputBuffer << '\t'; 
-                       for(int i = 1; i < tags.size(); i++) {
+                       for(int i = 0; i < tags.size(); i++) {
                                outFile << label + tags[i] << '\t';
                        }
                        outFile << endl;
@@ -136,52 +136,58 @@ void ThreeColumnFile2::initFile(string label, vector<string> tags){
                                outFile << label + tags[i] << '\t';
                        }
                        outFile << endl;
-
                }
 
                outFile.setf(ios::fixed, ios::floatfield);
                outFile.setf(ios::showpoint);
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ThreeColumnFile class Function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "Standard Error: " << e.what() << " has occurred in the ColumnFile class Function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
        catch(...) {
-               cout << "An unknown error has occurred in the ThreeColumnFile class function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "An unknown error has occurred in the ColumnFile class function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
 }
 
 /***********************************************************************/
 
-void ThreeColumnFile2::output(vector<double> data){
+void ColumnFile::output(vector<double> data){
        try {
        
                if(counter != 0){               
                        string inputBuffer;
                        getline(inFile, inputBuffer);
 
-                       outFile << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
+                       outFile << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length());
+                       for (int i = 1; i< data.size(); i++) {
+                               outFile << '\t' << data[i]; 
+                       }
+                       outFile << endl;
                }
                else{
-                       outFile << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
-
+                       outFile << setprecision(6) << data[0] << setprecision(globaldata->getIters().length());
+                       for (int i = 1; i< data.size(); i++) {
+                               outFile << '\t' << data[i]; 
+                       }
+                       outFile << endl;
                }
 
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ThreeColumnFile2 class Function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "Standard Error: " << e.what() << " has occurred in the ColumnFile class Function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
        catch(...) {
-               cout << "An unknown error has occurred in the ThreeColumnFile2 class function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "An unknown error has occurred in the ColumnFile class function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
 };
 
 /***********************************************************************/
 
-void ThreeColumnFile2::resetFile(){
+void ColumnFile::resetFile(){
        try {
                if(counter != 0){
                        outFile.close();
@@ -200,11 +206,11 @@ void ThreeColumnFile2::resetFile(){
 
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ThreeColumnFile2 class Function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "Standard Error: " << e.what() << " has occurred in the ColumnFile class Function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
        catch(...) {
-               cout << "An unknown error has occurred in the ThreeColumnFile2 class function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               cout << "An unknown error has occurred in the ColumnFile class function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }       
 }
index 7e9d8d26144be2150d75358e67da2a72a6dafb32..3b73b148d88c7052421d48358c8ccdf0b39035ed 100644 (file)
@@ -13,12 +13,13 @@ class FileOutput {
 public:
        FileOutput(){};
        ~FileOutput(){};
-       virtual void output(int, vector<double>) = 0;
+       
        virtual void initFile(string) = 0;
-       virtual void resetFile() = 0;
-       virtual string getFileName() = 0;
        virtual void initFile(string, vector<string>) = 0;
+       virtual void output(int, vector<double>) = 0;
        virtual void output(vector<double>) = 0;
+       virtual void resetFile() = 0;
+       virtual string getFileName() = 0;
 
 protected:
        GlobalData* globaldata;
@@ -38,7 +39,7 @@ public:
        void resetFile();
        string getFileName()    { return inName;        };
        
-       void initFile(string, vector<string>) {};
+       void initFile(string, vector<string>){};
        void output(vector<double>) {};
 
 private:
@@ -125,11 +126,11 @@ private:
 
 /***********************************************************************/
 
-class ThreeColumnFile2 : public FileOutput {
+class ColumnFile : public FileOutput {
        
 public:
-       ThreeColumnFile2(string n) : FileOutput(), inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) { globaldata = GlobalData::getInstance(); };
-       ~ThreeColumnFile2();
+       ColumnFile(string n) : FileOutput(), inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) { globaldata = GlobalData::getInstance(); };
+       ~ColumnFile();
        
        //to make compatible with parent class
        void output(int, vector<double>){};
index 1a7c2bfd601340c85cf5b73b06b280550b8f1f60..1b8c4ec4c8ad69fa4112daf8a05c192b5a3044f1 100644 (file)
--- a/geom.cpp
+++ b/geom.cpp
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 2/23/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
diff --git a/geom.h b/geom.h
index 56bc112d938faadc7efb2fe3e9faca12ca15ac79..b9da73f06594fd6fd41e62328698081d6213a278 100644 (file)
--- a/geom.h
+++ b/geom.h
@@ -6,7 +6,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 2/23/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 #include "calculator.h"
index 59987a33e6f169c589f608168a12d9e11747c2b7..b4d2d74d0cc72d6c7f4db7acbd4202e3ea5b9972 100644 (file)
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 2/2/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index b29673529cca9387ed4a5916166180e0a9966ead..6750373102c4621d6ed4abf5062f537d55849449 100644 (file)
@@ -6,7 +6,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 2/2/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index c5a59acae780cc5b404fd7236712de164b3adc88..1e272673a502df4e39de245c32700eb8bdb25a93 100644 (file)
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 1/30/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index d3797acc32e2accb8a3cda94660a40019c970bf4..ec0692cac91902901630388ddcd908a22121beb8 100644 (file)
@@ -6,7 +6,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 1/30/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index a7ca17fc34297c58869f0d578f52ec70e1fc3367..09b16541930d34f795bba4ca182ed74b9054d8fc 100644 (file)
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 1/30/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index 7953f9f945b61efb8bc23154ce84130f536d3bb1..2eda1cc08efa47ea6a2f2b07d5777d554b676a8b 100644 (file)
@@ -6,7 +6,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 1/30/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index 5bc7f5857b686742d42afff89025f5f0096796df..714b5ad2e447a579872f9f5b8d8c7886303a8391 100644 (file)
@@ -73,7 +73,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                                if (key == "step")                      { step = value;                 }
                                if (key == "form")                      { form = value;                 }
                                if (key == "sorted")            { sorted = value;               }
-                               if (key == "scaler")            { scaler = value;               }
+                               if (key == "scale")                     { scale = value;                }
                                
 
                                
@@ -129,7 +129,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        if (key == "step")                      { step = value;                 }
                        if (key == "form")                      { form = value;                 }
                        if (key == "sorted")            { sorted = value;               }
-                       if (key == "scaler")            { scaler = value;               }
+                       if (key == "scale")                     { scale = value;                }
                        
 
                        if (key == "line") {//stores lines to be used in a vector
@@ -200,7 +200,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        Estimators.clear();
                        splitAtDash(calc, Estimators); 
                }
-               if (commandName == "tree.groups") {
+               if ((commandName == "tree.shared") || (commandName == "bootstrap.shared")) {
                        if (calc != "") { 
                                Estimators.clear();
                                splitAtDash(calc, Estimators);                  
@@ -253,7 +253,7 @@ string GlobalData::getGroups()                      {       return groups;          }
 string GlobalData::getStep()                   {       return step;            }
 string GlobalData::getForm()                   {       return form;            }
 string GlobalData::getSorted()                 {       return sorted;          }
-string GlobalData::getScaler()                 {       return scaler;          }
+string GlobalData::getScale()                  {       return scale;           }
 void GlobalData::setListFile(string file)      {       listfile = file;        inputFileName = file;}
 void GlobalData::setRabundFile(string file)    {       rabundfile = file;      inputFileName = file;}
 void GlobalData::setSabundFile(string file)    {       sabundfile = file;      inputFileName = file;}
@@ -304,8 +304,8 @@ void GlobalData::clear() {
        abund           =   "10";
        step                    =       "0.01";
        form                    =       "integral";
-       sorted                  =       "1";  //0 means don't sort, 1 means sort.
-       scaler                  =       "log10";
+       sorted                  =       "T";  //F means don't sort, T means sort.
+       scale                   =       "log10";
 }
 
 //*******************************************************/
@@ -317,7 +317,7 @@ void GlobalData::reset() {
        iters                   =       "1000"; 
        groups                  =       "";
        jumble                  =       "1";    //0 means don't jumble, 1 means jumble.
-       sorted                  =       "1";  //0 means don't sort, 1 means sort.
+       sorted                  =       "T";  //F means don't sort, T means sort.
        randomtree              =       "";  //"" means user will enter some user trees, "outputfile" means they just want the random tree distribution to be outputted to outputfile.
        freq                    =       "100";
        method                  =       "furthest";
@@ -392,7 +392,7 @@ void GlobalData::parseTreeFile() {
                        
                        //use nexus translation rather than parsing tree to save time
                        if ((holder == "translate") || (holder == "Translate")) {
-cout << "there is a translate " << endl;
+
                                string number, name, h;
                                h = ""; // so it enters the loop the first time
                                while((h != ";") && (number != ";")) { 
index 3b688b43457d318c8f73471bb088d7ad5de1affb..be5b0087abdb7ee546e3d9f081a9091c95ee2b8c 100644 (file)
@@ -70,7 +70,7 @@ public:
        string getStep();
        string getForm();
        string getSorted();
-       string getScaler();
+       string getScale();
 
        void setListFile(string);
        void setPhylipFile(string);
@@ -97,7 +97,7 @@ public:
                
 private:
        string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, fastafile, treefile, sharedfile, line, label, randomtree, groups;
-       string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, scaler;
+       string cutoff, format, precision, method, fileroot, iters, jumble, freq, calc, abund, step, form, sorted, scale;
 
        static GlobalData* _uniqueInstance;
        GlobalData( const GlobalData& ); // Disable copy constructor
index 523662ece3dae73f4ff48461621ba6b92ae9d8cc..08eb732b22818efee710f647c70646cd1cc7ade2 100644 (file)
@@ -35,24 +35,24 @@ void HeatMap::getPic(OrderVector* order) {
                rabund = order->getRAbundVector();
                
                //get users scaling method
-               scaler = globaldata->getScaler();
+               scaler = globaldata->getScale();
                
                float maxbin = 0.0;
                for (int i = 0; i < rabund.size(); i++) {
                        if (rabund.get(i) != 0) { //don't want log value of 0.
                                        if (scaler == "log10") {
-                                               colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))] = "";  
-                                               if (maxbin < (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))) { maxbin = (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 100)); }
+                                               colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))] = "";  
+                                               if (maxbin < (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))) { maxbin = (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000)); }
                                        }else if (scaler == "log2") {
-                                               colorScale[(log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))] = "";  
-                                               if (maxbin < (log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))) { maxbin = (log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 100)); }
+                                               colorScale[(log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))] = "";  
+                                               if (maxbin < (log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))) { maxbin = (log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000)); }
                                        }else if (scaler == "linear") {
                                                colorScale[rabund.get(i)] = "";
                                                if (maxbin < rabund.get(i)) { maxbin = rabund.get(i); }
                                        }else {  //if user enters invalid scaler option.
                                                cout << scaler << " is not a valid scaler option. I will use log10." << endl;
-                                               colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))] = ""; 
-                                               if (maxbin < (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))) { maxbin = (log10((rabund.get(i)) / (float)rabund.getNumSeqs()) * 100); }  
+                                               colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))] = ""; 
+                                               if (maxbin < (log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))) { maxbin = (log10((rabund.get(i)) / (float)rabund.getNumSeqs()) * 1000); }  
                                        } 
                        }else { colorScale[0] = "00";  }
                }
@@ -77,46 +77,21 @@ void HeatMap::getPic(OrderVector* order) {
                outsvg << "<text fill=\"black\" class=\"seri\" x=\"100\" y=\"25\">Heatmap at distance " + order->getLabel() + "</text>\n";
                
                //output legend and color labels
-               //go through map and give each score a color value
                string color;
                int x = 0;
                int y = 103 + (rabund.getNumBins()*5);
-               if (maxbin != 0) {
-                       //convert maxbin to relative abundance again
-                       if (scaler == "log10") {
-                               maxbin = pow(10, maxbin) / 100;
-                       }else if (scaler == "log2") {
-                               maxbin = pow(2, maxbin) / 100;
-                       }else {  maxbin = pow(10, maxbin) / 100;        } 
-               }else { maxbin = 0.00; }
+               printLegend(y, maxbin);
                
-               //5 is the number of boxes in the legend
-               float maxbinScaler = maxbin / 10;
-               float colorScaler = 255 / 10;
-                                       
-               for (int i = 0; i < 10; i++) {
-                       string label = toString(((i+1) * maxbinScaler));
-                       //set precision of relative abundance to 3
-                       int pos = label.find_first_of('.');
-                       label = label.substr(0,pos+4);
-                       color = toHex(int((float)(i+1) * colorScaler));
-
-                       outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"30\" height=\"10\"/>\n";
-                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\">" + label + "</text>\n";
-                       x += 30;
-               }
-       
-               x = 0;
                y = 70;
                for (int i = 0; i <= rabund.getNumBins(); i++) {
                        if (rabund.get(i) != 0) { //don't want log value of 0.
                                if (scaler == "log10") {
-                                       color = colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))];  
+                                       color = colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))];  
                                }else if (scaler == "log2") {
-                                       color = colorScale[(log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))];  
+                                       color = colorScale[(log2((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))];  
                                }else if (scaler == "linear") {
                                        color = colorScale[rabund.get(i)]; 
-                               }else {  color = colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 100))];       } 
+                               }else {  color = colorScale[(log10((rabund.get(i) / (float)rabund.getNumSeqs()) * 1000))];      } 
                        }else { color = "OO";  }
                        
                        outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"300\" height=\"5\"/>\n";
@@ -143,30 +118,30 @@ void HeatMap::getPic(SharedOrderVector* sharedorder) {
                
                //fills vector of sharedsabunds - lookup
                util->getSharedVectors(globaldata->Groups, lookup, sharedorder);  //fills group vectors from order vector.
-               
+
                //sort lookup so shared bins are on top
-               if (sorted == "1") {  sortSharedVectors();  }
-               
+               if (sorted == "T") {  sortSharedVectors();  }
+       
                //get users scaling method
-               scaler = globaldata->getScaler();
+               scaler = globaldata->getScale();
                
                float maxbin = 0.0;
                for (int i = 0; i < lookup.size(); i++) {
                        for (int j = 0; j < lookup[i]->size(); j++) {
                                if (lookup[i]->getAbundance(j) != 0) { //don't want log value of 0.
                                        if (scaler == "log10") {
-                                               colorScale[(log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100))] = "";  
-                                               if (maxbin < (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100))) { maxbin = (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100)); }
+                                               colorScale[(log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))] = "";  
+                                               if (maxbin < (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))) { maxbin = (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000)); }
                                        }else if (scaler == "log2") {
-                                               colorScale[(log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100))] = "";  
-                                               if (maxbin < (log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100))) { maxbin = (log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100)); }
+                                               colorScale[(log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))] = "";  
+                                               if (maxbin < (log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))) { maxbin = (log2((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000)); }
                                        }else if (scaler == "linear") {
                                                colorScale[lookup[i]->getAbundance(j)] = "";
                                                if (maxbin < lookup[i]->getAbundance(j)) { maxbin = lookup[i]->getAbundance(j); }
                                        }else {  //if user enters invalid scaler option.
                                                cout << scaler << " is not a valid scaler option. I will use log10." << endl;
-                                               colorScale[(log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100))] = ""; 
-                                               if (maxbin < (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 100))) { maxbin = (log10((lookup[i]->getAbundance(j)) / (float)lookup[i]->getNumSeqs()) * 100); }  
+                                               colorScale[(log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))] = ""; 
+                                               if (maxbin < (log10((lookup[i]->getAbundance(j) / (float)lookup[i]->getNumSeqs()) * 1000))) { maxbin = (log10((lookup[i]->getAbundance(j)) / (float)lookup[i]->getNumSeqs()) * 1000); }  
                                        } 
                                }else { colorScale[0] = "00";  }
                        }
@@ -199,49 +174,23 @@ void HeatMap::getPic(SharedOrderVector* sharedorder) {
                }
                
                //output legend and color labels
-               //go through map and give each score a color value
                string color;
                int x = 0;
                int y = 103 + (lookup[0]->getNumBins()*5);
-               if (maxbin != 0) {
-                       //convert maxbin to relative abundance again
-                       if (scaler == "log10") {
-                               maxbin = pow(10, maxbin) / 100;
-                       }else if (scaler == "log2") {
-                               maxbin = pow(2, maxbin) / 100;
-                       }else {  maxbin = pow(10, maxbin) / 100;        } 
-               }else { maxbin = 0.00; }
-               
-               //((lookup.size() * 300) / 60) is the number of boxes in the legend
-               float maxbinScaler = maxbin / ((lookup.size() * 300) / 60);
-               float colorScaler = 255 / ((lookup.size() * 300) / 60);
-                                       
-               for (int i = 0; i < ((lookup.size() * 300) / 60); i++) {
-                       string label = toString(((i+1) * maxbinScaler));
-                       //set precision of relative abundance to 3
-                       int pos = label.find_first_of('.');
-                       label = label.substr(0,pos+4);
+               printLegend(y, maxbin);
 
-                       color = toHex(int(((i+1) * colorScaler) + 15));
-                       outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"30\" height=\"10\"/>\n";
-                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\">" + label + "</text>\n";
-                       x += 30;
-               }
-               
-               x = 0;
                y = 70;
-               
-               for (int i = 0; i <= lookup[0]->getNumBins(); i++) {
+               for (int i = 0; i < lookup[0]->size(); i++) {
                        for (int j = 0; j < lookup.size(); j++) {
                                
                                if (lookup[j]->getAbundance(i) != 0) { //don't want log value of 0.
                                        if (scaler == "log10") {
-                                               color = colorScale[(log10((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 100))];  
+                                               color = colorScale[(log10((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 1000))];  
                                        }else if (scaler == "log2") {
-                                               color = colorScale[(log2((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 100))];  
+                                               color = colorScale[(log2((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 1000))];  
                                        }else if (scaler == "linear") {
                                                color = colorScale[lookup[j]->getAbundance(i)]; 
-                                       }else {  color = colorScale[(log10((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 100))];      } 
+                                       }else {  color = colorScale[(log10((lookup[j]->getAbundance(i) / (float)lookup[j]->getNumSeqs()) * 1000))];     } 
                                }else { color = "OO";  }
 
                                
@@ -350,7 +299,55 @@ void HeatMap::sortSharedVectors(){
 }
 
 //**********************************************************************************************************************
+void HeatMap::printLegend(int y, float maxbin) {
+       try {
+       
+               //output legend and color labels
+               //go through map and give each score a color value
+               string color;
+               int x = 0;
+               if (maxbin != 0) {
+                       //convert maxbin to relative abundance again
+                       if (scaler == "log10") {
+                               maxbin = pow(10, maxbin) / 1000;
+                       }else if (scaler == "log2") {
+                               maxbin = pow(2, maxbin) / 1000;
+                       }else {  maxbin = pow(10, maxbin) / 1000;       } 
+               }else { maxbin = 0.00; }
+               
+               //5 is the number of boxes in the legend
+               float maxbinScaler = maxbin / 10;
+               float colorScaler = 255 / 10;
+               
+               //prints legend
+               for (int i = 0; i < 10; i++) {
+                       color = toHex(int((float)(i+1) * colorScaler));
+                       outsvg << "<rect fill=\"#" + color + "0000\" stroke=\"#" + color + "0000\" x=\"" + toString(x) + "\" y=\"" + toString(y) + "\" width=\"30\" height=\"10\"/>\n";
+                       x += 30;
+               }
+               
+               //prints legend labels
+               x -= 30;
+               for (int i = 10; i > 0; i = i-2) {
+                       string label = toString((i * maxbinScaler));
+                       //set precision of relative abundance to 3
+                       int pos = label.find_first_of('.');
+                       label = label.substr(0,pos+4);
+                       
+                       outsvg << "<text fill=\"black\" class=\"seri\" x=\"" + toString(x) + "\" y=\"" + toString(y-3) + "\">" + label + "</text>\n";
+                       x -= 60;
+               }
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the HeatMap class Function printLegend. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the HeatMap class function printLegend. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
 
+}
 
 
 
index a89500c004c9b61e2a73a37407c26b98979e5da0..54035f0cb4aba4e595183d3f8b6ae9e0ce256bc9 100644 (file)
--- a/heatmap.h
+++ b/heatmap.h
@@ -32,6 +32,7 @@ class HeatMap {
 
        private:
                void sortSharedVectors();
+               void printLegend(int, float);
                
                GlobalData* globaldata;
                SharedUtil* util;
index 16938077c7cd43999ceba642753085b972172ded..6cf2134451e97369bab550382845a056387491d3 100644 (file)
@@ -14,6 +14,7 @@
 HelpCommand::HelpCommand(){
        globaldata = GlobalData::getInstance();
        validCommands = new ValidCommands();
+       validCalcs = new ValidCalculators();
 }
 
 //**********************************************************************************************************************
@@ -77,6 +78,7 @@ int HelpCommand::execute(){
                cout << "collect.single(label=yourLabel, line=yourLines, iters=yourIters, freq=yourFreq, calc=yourEstimators)." << "\n";
                cout << "Example collect(label=unique-.01-.03, line=0-5-10, iters=10000, freq=10, calc=sobs-chao-ace-jack)." << "\n";
                cout << "The default values for freq is 100, and calc are sobs-chao-ace-jack-shannon-npshannon-simpson." << "\n";
+               validCalcs->printCalc("single", cout);
                cout << "The label and line parameters are used to analyze specific lines in your input." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "collect.shared") {
@@ -84,9 +86,10 @@ int HelpCommand::execute(){
                cout << "The collect.shared command parameters are label, line, freq, jumble, calc and groups.  No parameters are required, but you may not use " << "\n";
                cout << "both the line and label parameters at the same time. The collect.shared command should be in the following format: " << "\n";
                cout << "collect.shared(label=yourLabel, line=yourLines, freq=yourFreq, jumble=yourJumble, calc=yourEstimators, groups=yourGroups)." << "\n";
-               cout << "Example collect.shared(label=unique-.01-.03, line=0-5-10, freq=10, jumble=1, groups=B-C, calc=sharedChao-sharedAce-Jabund-SorensonAbund-Jclass-SorClass-Jest-SorEst-ThetaYC-ThetaN)." << "\n";
-               cout << "The default values for jumble is 1 (meaning jumble, if it’s set to 0 then it will not jumble), freq is 100 and calc are sharedsobs-sharedChao-sharedAce-Jabund-SorensonAbund-Jclass-SorClass-Jest-SorEst-ThetaYC-ThetaN." << "\n";
+               cout << "Example collect.shared(label=unique-.01-.03, line=0-5-10, freq=10, jumble=1, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan)." << "\n";
+               cout << "The default values for jumble is 1 (meaning jumble, if it’s set to 0 then it will not jumble), freq is 100 and calc are sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan." << "\n";
                cout << "The default value for groups is all the groups in your groupfile." << "\n";
+               validCalcs->printCalc("shared", cout);
                cout << "The label and line parameters are used to analyze specific lines in your input." << "\n";
                cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile)." << "\n" << "\n";
@@ -116,6 +119,7 @@ int HelpCommand::execute(){
                cout << "rarefaction.single(label=yourLabel, line=yourLines, iters=yourIters, freq=yourFreq, calc=yourEstimators)." << "\n";
                cout << "Example rarefaction.single(label=unique-.01-.03, line=0-5-10, iters=10000, freq=10, calc=sobs-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson)." << "\n";
                cout << "The default values for iters is 1000, freq is 100, and calc is rarefaction which calculates the rarefaction curve for the observed richness." << "\n";
+               validCalcs->printCalc("rarefaction", cout);
                cout << "The label and line parameters are used to analyze specific lines in your input." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "rarefaction.shared") {
@@ -126,6 +130,7 @@ int HelpCommand::execute(){
                cout << "Example rarefaction.shared(label=unique-.01-.03, line=0-5-10, iters=10000, jumble=1, groups=B-C, calc=sharedobserved)." << "\n";
                cout << "The default values for iters is 1000, jumble is 1 (meaning jumble, if it’s set to 0 then it will not jumble), freq is 100, and calc is sharedobserved which calculates the shared rarefaction curve for the observed richness." << "\n";
                cout << "The default value for groups is all the groups in your groupfile." << "\n";
+               validCalcs->printCalc("sharedrarefaction", cout);
                cout << "The label and line parameters are used to analyze specific lines in your input." << "\n";
                cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq)." << "\n" << "\n";
@@ -136,6 +141,7 @@ int HelpCommand::execute(){
                cout << "both the line and label parameters at the same time. The summary.single command should be in the following format: " << "\n";
                cout << "summary.single(label=yourLabel, line=yourLines, calc=yourEstimators)." << "\n";
                cout << "Example summary.single(label=unique-.01-.03, line=0,5,10, calc=sobs-chao-ace-jack-bootstrap-shannon-npshannon-simpson)." << "\n";
+               validCalcs->printCalc("summary", cout);
                cout << "The default value calc is sobs-chao-ace-jack-shannon-npshannon-simpson" << "\n";
                cout << "The label and line parameters are used to analyze specific lines in your input." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. line), '=' and parameters (i.e.yourLines)." << "\n" << "\n";
@@ -144,8 +150,9 @@ int HelpCommand::execute(){
                cout << "The summary.shared command parameters are label, line, jumble and calc.  No parameters are required, but you may not use " << "\n";
                cout << "both the line and label parameters at the same time. The summary.shared command should be in the following format: " << "\n";
                cout << "summary.shared(label=yourLabel, line=yourLines, jumble=yourJumble, calc=yourEstimators, groups=yourGroups)." << "\n";
-               cout << "Example summary.shared(label=unique-.01-.03, line=0,5,10, jumble=1, groups=B-C, calc=sharedChao-sharedAce-Jabund-SorensonAbund-Jclass-SorClass-Jest-SorEst-ThetaYC-ThetaN)." << "\n";
-               cout << "The default value for jumble is 1 (meaning jumble, if it’s set to 0 then it will not jumble) and calc is sharedsobs-sharedChao-sharedAce-Jabund-SorensonAbund-Jclass-SorClass-Jest-SorEst-ThetaYC-ThetaN" << "\n";
+               cout << "Example summary.shared(label=unique-.01-.03, line=0,5,10, jumble=1, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan)." << "\n";
+               validCalcs->printCalc("sharedsummary", cout);
+               cout << "The default value for jumble is 1 (meaning jumble, if it’s set to 0 then it will not jumble) and calc is sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan" << "\n";
                cout << "The default value for groups is all the groups in your groupfile." << "\n";
                cout << "The label and line parameters are used to analyze specific lines in your input." << "\n";
                cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups." << "\n";
@@ -194,16 +201,16 @@ int HelpCommand::execute(){
                cout << "Note: No spaces between parameter labels (i.e. iters), '=' and parameters (i.e.yourIters)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "heatmap") { 
                cout << "The heatmap command can only be executed after a successful read.otu command." << "\n";
-               cout << "The heatmap command parameters are groups, sorted, scaler, line and label.  No parameters are required, but you may not use line and label at the same time." << "\n";
+               cout << "The heatmap command parameters are groups, sorted, scale, line and label.  No parameters are required, but you may not use line and label at the same time." << "\n";
                cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap." << "\n";
                cout << "The sorted parameter allows you to choose to see the file with the shared otus at the top or the otus in the order they appear in your input file. " << "\n";
-               cout << "The scaler parameter allows you to choose the range of color your bin information will be displayed with." << "\n";
+               cout << "The scale parameter allows you to choose the range of color your bin information will be displayed with." << "\n";
                cout << "The group names are separated by dashes. The line and label allow you to select what distance levels you would like a heatmap created for, and are also separated by dashes." << "\n";
                cout << "The heatmap command should be in the following format: heatmap(groups=yourGroups, sorted=yourSorted, line=yourLines, label=yourLabels)." << "\n";
-               cout << "Example heatmap(groups=A-B-C, line=1-3-5, sorted=0, scaler=log10)." << "\n";
+               cout << "Example heatmap(groups=A-B-C, line=1-3-5, sorted=F, scale=log10)." << "\n";
                cout << "The default value for groups is all the groups in your groupfile, and all lines in your inputfile will be used." << "\n";
-               cout << "The default value for sorted is 1 meaning you want the shared otus on top, you may change it to 0 meaning the exact representation of your input file." << "\n";
-               cout << "The default value for scaler is log10; your other options are log2 and linear." << "\n";
+               cout << "The default value for sorted is T meaning you want the shared otus on top, you may change it to F meaning the exact representation of your input file." << "\n";
+               cout << "The default value for scale is log10; your other options are log2 and linear." << "\n";
                cout << "The heatmap command outputs a .svg file for each line or label you specify." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "venn") { 
@@ -211,7 +218,7 @@ int HelpCommand::execute(){
                cout << "The venn command parameters are groups, calc, line and label.  No parameters are required, but you may not use line and label at the same time." << "\n";
                cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like included in your venn diagram, you may only use a maximum of 4 groups." << "\n";
                cout << "The group names are separated by dashes. The line and label allow you to select what distance levels you would like a venn diagram created for, and are also separated by dashes." << "\n";
-               cout << "The venn command should be in the following format: venn(groups=yourGroups, calc=yourSorted, line=yourLines, label=yourLabels)." << "\n";
+               cout << "The venn command should be in the following format: venn(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels)." << "\n";
                cout << "Example venn(groups=A-B-C, line=1-3-5, calc=sharedsobs-sharedchao)." << "\n";
                cout << "The default value for groups is all the groups in your groupfile up to 4, and all lines in your inputfile will be used." << "\n";
                cout << "The default value for calc is sobs if you have only read a list file or if you have selected only one group, and sharedsobs if you have multiple groups." << "\n";
@@ -219,6 +226,30 @@ int HelpCommand::execute(){
                cout << "The only estmiator available four 4 groups is sharedsobs." << "\n";
                cout << "The venn command outputs a .svg file for each calculator you specify at each distance you choose." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups)." << "\n" << "\n";
+       }else if (globaldata->helpRequest == "tree.shared") { 
+               cout << "The tree.shared command can only be executed after a successful read.otu command." << "\n";
+               cout << "The tree.shared command parameters are groups, calc, line and label.  The calc parameter is required, and you may not use line and label at the same time." << "\n";
+               cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like included used." << "\n";
+               cout << "The group names are separated by dashes. The line and label allow you to select what distance levels you would like trees created for, and are also separated by dashes." << "\n";
+               cout << "The tree.shared command should be in the following format: tree.shared(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels)." << "\n";
+               cout << "Example tree.shared(groups=A-B-C, line=1-3-5, calc=jabund-sorensonabund)." << "\n";
+               cout << "The default value for groups is all the groups in your groupfile." << "\n";
+               cout << "There is no default value for calc." << "\n";
+               validCalcs->printCalc("treegroup", cout);
+               cout << "The tree.shared command outputs a .tre file for each calculator you specify at each distance you choose." << "\n";
+               cout << "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups)." << "\n" << "\n";
+       }else if (globaldata->helpRequest == "bootstrap.shared") { 
+               cout << "The bootstrap.shared command can only be executed after a successful read.otu command." << "\n";
+               cout << "The bootstrap.shared command parameters are groups, calc, iters, line and label.  The calc parameter is required, and you may not use line and label at the same time." << "\n";
+               cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like included used." << "\n";
+               cout << "The group names are separated by dashes. The line and label allow you to select what distance levels you would like trees created for, and are also separated by dashes." << "\n";
+               cout << "The bootstrap.shared command should be in the following format: bootstrap.shared(groups=yourGroups, calc=yourCalcs, line=yourLines, label=yourLabels, iters=yourIters)." << "\n";
+               cout << "Example bootstrap.shared(groups=A-B-C, line=1-3-5, calc=jabund-sorensonabund, iters=100)." << "\n";
+               cout << "The default value for groups is all the groups in your groupfile." << "\n";
+               cout << "There is no default value for calc. The default for iters is 1000." << "\n";
+               validCalcs->printCalc("boot", cout);
+               cout << "The bootstrap.shared command outputs a .tre file for each calculator you specify at each distance you choose containing iters number of trees." << "\n";
+               cout << "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "bin.seqs") { 
                cout << "The bin.seqs command can only be executed after a successful read.otu command of a list file." << "\n";
                cout << "The bin.seqs command parameters are fasta, name, line and label.  The fasta parameter is required, and you may not use line and label at the same time." << "\n";
index d8f9b14d884e48d931f013f42badf8be4f38e42b..58356d13fa21b6f0c81377915618fff9c277473b 100644 (file)
@@ -14,6 +14,7 @@
 #include "command.hpp"
 #include "globaldata.hpp"
 #include "validcommands.h"
+#include "validcalculator.h"
 
 
 class HelpCommand : public Command {
@@ -25,6 +26,7 @@ public:
 private:
        GlobalData* globaldata;
        ValidCommands* validCommands;
+       ValidCalculators* validCalcs;
        
 private:
                
index 7b63e5bf8c7fdd84b253e68e1b11aebbcd019527..fddee4f5e94e977bd417e0d32a82f6f37894d232 100644 (file)
--- a/logsd.cpp
+++ b/logsd.cpp
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 2/23/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
diff --git a/logsd.h b/logsd.h
index b96115b7edf20cee6c6d3fd52c6c62c9a07c3bb2..02c2ca5c95b7839372036dcaee044c40361e2e5d 100644 (file)
--- a/logsd.h
+++ b/logsd.h
@@ -6,7 +6,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 2/23/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 #include "calculator.h"
index 4fa4ec5ed0943614bf4da9d5a1f03b5d8f706a42..b5c59e87104cb7d413ca4984fee751fbe8707ba4 100644 (file)
@@ -21,15 +21,13 @@ ParsimonyCommand::ParsimonyCommand() {
                if (randomtree == "") { 
                        T = globaldata->gTree;
                        tmap = globaldata->gTreemap;
-                       parsFile = globaldata->getTreeFile() + ".parsimony";
-                       parsFileout = globaldata->getTreeFile() + "temp" + ".parsimony";
+                       output = new ColumnFile(globaldata->getTreeFile()  +  ".parsimony");
                        sumFile = globaldata->getTreeFile() + ".psummary";
                        openOutputFile(sumFile, outSum);
                }else { //user wants random distribution
                        savetmap = globaldata->gTreemap;
                        getUserInput();
-                       parsFile = randomtree;
-                       parsFileout = globaldata->getTreeFile() + "temp";
+                       output = new ColumnFile(randomtree);
                }
                
                //set users groups to analyze
@@ -223,12 +221,16 @@ int ParsimonyCommand::execute() {
 void ParsimonyCommand::printParsimonyFile() {
        try {
                vector<double> data;
+               vector<string> tags;
                
-               //format output
-               out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint);
+               if (randomtree == "") {
+                       tags.push_back("Score"); tags.push_back("UserFreq"); tags.push_back("UserCumul"); tags.push_back("RandFreq"); tags.push_back("RandCumul");
+               }else {
+                       tags.push_back("Score"); tags.push_back("RandFreq"); tags.push_back("RandCumul");
+               }
 
                for(int a = 0; a < numComp; a++) {
-                       initFile(groupComb[a]);
+                       output->initFile(groupComb[a], tags);
                        //print each line
                        for (it = validScores.begin(); it != validScores.end(); it++) { 
                                if (randomtree == "") {
@@ -236,15 +238,11 @@ void ParsimonyCommand::printParsimonyFile() {
                                }else{
                                        data.push_back(it->first);  data.push_back(rscoreFreq[a][it->first]); data.push_back(rCumul[a][it->first]); 
                                }
-                               output(data);
+                               output->output(data);
                                data.clear();
                        } 
-                       resetFile();
+                       output->resetFile();
                }
-               
-               out.close();
-               inFile.close();
-               remove(parsFileout.c_str());
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the ParsimonyCommand class Function printParsimonyFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -340,102 +338,7 @@ void ParsimonyCommand::getUserInput() {
                exit(1);
        }
 }
-/*****************************************************************/
-
-void ParsimonyCommand::initFile(string label){
-       try {
-               if(counter != 0){
-                       openOutputFile(parsFileout, out);
-                       openInputFile(parsFile, inFile);
-
-                       string inputBuffer;
-                       getline(inFile, inputBuffer);
-                       
-                       if (randomtree == "") {
-                               out <<  inputBuffer << '\t' << label + "Score" << '\t' << label + "UserFreq" << '\t' << label + "UserCumul" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
-                       }else {
-                               out <<  inputBuffer << '\t' << "Score" << '\t' << "RandFreq" << '\t' << "RandCumul" << endl;
-                       }
-               }else{
-                       openOutputFile(parsFileout, out);
-                       //column headers
-                       if (randomtree == "") {
-                               out << label + "Score" << '\t' << label + "UserFreq" << '\t' << label + "UserCumul" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
-                       }else {
-                               out << "Score" << '\t' << "RandFreq" << '\t' << "RandCumul" << endl;
-                       }
-               }
-
-               out.setf(ios::fixed, ios::floatfield);
-               out.setf(ios::showpoint);
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ParsimonyCommand class Function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ParsimonyCommand class function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-/***********************************************************************/
 
-void ParsimonyCommand::output(vector<double> data){
-       try {
-               if(counter != 0){               
-                       string inputBuffer;
-                       getline(inFile, inputBuffer);
-               
-                       if (randomtree == "") {
-                               out << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << '\t' << data[3] << '\t' << data[4] << endl;
-                       }else{
-                               out << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
-                       }
-               }
-               else{
-                       if (randomtree == "") {
-                               out << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << '\t' << data[3] << '\t' << data[4] << endl;
-                       }else{
-                               out << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
-                       }
-               }
-
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ParsimonyCommand class Function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ParsimonyCommand class function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-/***********************************************************************/
-
-void ParsimonyCommand::resetFile(){
-       try {
-               if(counter != 0){
-                       out.close();
-                       inFile.close();
-               }
-               else{
-                       out.close();
-               }
-               counter = 1;
-               
-               remove(parsFile.c_str());
-               rename(parsFileout.c_str(), parsFile.c_str());
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ParsimonyCommand class Function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ParsimonyCommand class function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
+/***********************************************************/
 
 
index dd4e2377e93a0708d7722d13c19068e3db578bf8..26d392e86acd94654ec3a5ec6351770e4efb995f 100644 (file)
@@ -14,6 +14,7 @@
 #include "treemap.h"
 #include "progress.hpp"
 #include "sharedutilities.h"
+#include "fileoutput.h"
 
 using namespace std;
 
@@ -23,12 +24,13 @@ class ParsimonyCommand : public Command {
        
        public:
                ParsimonyCommand();     
-               ~ParsimonyCommand() { delete pars; delete util; }
+               ~ParsimonyCommand() { delete pars; delete util; delete output; }
                int execute();  
        
        private:
                GlobalData* globaldata;
                SharedUtil* util;
+               FileOutput* output;
                vector<Tree*> T;           //user trees
                Tree* randT;  //random tree
                Tree* copyUserTree; 
@@ -36,7 +38,7 @@ class ParsimonyCommand : public Command {
                TreeMap* savetmap;
                Parsimony* pars;
                vector<string> groupComb; // AB. AC, BC...
-               string parsFile, parsFileout, sumFile, randomtree, allGroups;
+               string sumFile, randomtree, allGroups;
                int iters, numGroups, numComp, counter;
                vector<int> numEachGroup; //vector containing the number of sequences in each group the users wants for random distrib.
                vector< vector<float> > userTreeScores; //scores for users trees for each comb.
@@ -57,10 +59,6 @@ class ParsimonyCommand : public Command {
                void printParsimonyFile();  
                void printUSummaryFile();
                void getUserInput();
-               void initFile(string);
-               void output(vector<double>);
-               void resetFile();
-
                
 };
 
index cac06be7289d3a96913bd65abbc2b94e0c798f41..a2f821eaa630de32713f6b97ecdedb3f15d9136a 100644 (file)
--- a/qstat.cpp
+++ b/qstat.cpp
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/4/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
diff --git a/qstat.h b/qstat.h
index 3911dc14f1905ad106e1c426f28c017de6406040..16b8b4d2f23d3dbe053c68ec1e9abf2214c9610d 100644 (file)
--- a/qstat.h
+++ b/qstat.h
@@ -5,7 +5,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/4/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 #include "calculator.h"
index 983ed102adc08f5629e061013b9d19c1fa49a28a..812626604483ca0ab0d5978e2ea8c9542d394fc6 100644 (file)
@@ -134,6 +134,7 @@ void RareDisplay::reset(){
 
 void RareDisplay::close(){
        try {
+               
                output->initFile(label);
        
                openInputFile(tempInName, tempInFile);
index d00385d79f4597ea691650933ad996f844f6e0d5..ae2753d99c1e810d3d3b8b1994687af144d87d50 100644 (file)
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/13/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index 1a8eb87046099ca23ab13ec01b135a4d7afaf509..07b4fe07c76a8245987516b53581b88c7173d455 100644 (file)
@@ -5,7 +5,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/13/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 #include "calculator.h"
index 604f1f67ff1b42e09dc14a0c46ed8e30793799cf..1da7c90c1e3b4bcda6ae0a0aee70e60995c9c8e8 100644 (file)
@@ -3,7 +3,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/6/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
index 89440256f36fea1aa99b615705ea3f247a9a336c..67c85257b026a9bd9852cf76867a0afb1a0c0f1f 100644 (file)
@@ -5,7 +5,7 @@
  *  Mothur
  *
  *  Created by Thomas Ryabin on 3/6/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 #include "calculator.h"
index 4cc1d18fd80179af4ce8c5069a4e8144ca95dd81..41daa8024713190e997fcb845c144731252386ed 100644 (file)
@@ -29,7 +29,7 @@ SharedOrderVector::SharedOrderVector(string id, vector<individual>  ov) :
 //This function is used to read a .shared file for the collect.shared, rarefaction.shared and summary.shared commands
 //if you don't use a list and groupfile.  
 
-SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {
+SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {  //reads in a shared file
        try {
                globaldata = GlobalData::getInstance();
                maxRank = 0; numBins = 0; numSeqs = 0;
@@ -55,7 +55,7 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {
                        f >> inputData;
                        
                        for (int j = 0; j < inputData; j++) {
-                               push_back(i+1, i+1, groupN);
+                               push_back(i, i, groupN);
                                numSeqs++;
                        }
                }
@@ -80,7 +80,7 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {
                                f >> inputData;
                                
                                for (int j = 0; j < inputData; j++) {
-                                       push_back(i+1, i+1, groupN);
+                                       push_back(i, i, groupN);
                                        numSeqs++;
                                }
                        }
@@ -96,8 +96,9 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {
                f.seekg(pos, ios::beg);
        
                if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; }
-       
+               
                updateStats();
+               
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the SharedOrderVector class Function SharedOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -111,21 +112,18 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {
 /***********************************************************************/
 
 int SharedOrderVector::getNumBins(){
-       if(needToUpdate == 1){  updateStats();  }
        return numBins;
 }
 
 /***********************************************************************/
 
 int SharedOrderVector::getNumSeqs(){
-       if(needToUpdate == 1){  updateStats();  }
        return numSeqs;
 }
 
 /***********************************************************************/
 
 int SharedOrderVector::getMaxRank(){
-       if(needToUpdate == 1){  updateStats();  }
        return maxRank;
 }
 
@@ -139,8 +137,8 @@ void SharedOrderVector::set(int index, int binNumber, int abund, string groupNam
        data[index].group = groupName;
        data[index].bin = binNumber;
        data[index].abundance = abund;
-       needToUpdate = 1;
-       
+       //if (abund > maxRank) { maxRank = abund; }
+       updateStats();
 }
 
 /***********************************************************************/
@@ -158,8 +156,10 @@ void SharedOrderVector::push_back(int binNumber, int abund, string groupName){
        newGuy.abundance = abund;
        newGuy.bin = binNumber;
        data.push_back(newGuy);
-       needToUpdate = 1;
-       
+       //numSeqs++;
+       //numBins++;
+       //if (abund > maxRank) { maxRank = abund; }
+       updateStats();
 }
 
 /***********************************************************************/
index 4683c59b63050de20e6bb79e2103563478066a71..9634613ded396633062188934cab9f1f4a40e9dc 100644 (file)
@@ -242,7 +242,8 @@ void SharedRAbundVector::push_front(int binSize, int otu, string groupName){
 
 /***********************************************************************/
 void SharedRAbundVector::pop_back(){
-
+       numSeqs -= data[data.size()-1].abundance;
+       numBins--;
        return data.pop_back();
 }
 
@@ -276,7 +277,7 @@ void SharedRAbundVector::print(ostream& output){
        try {
                output << numBins << '\t';
        
-               for(int i=0;i<numBins;i++){             output << data[i].abundance << '\t';            }
+               for(int i=0;i<data.size();i++){         output << data[i].abundance << '\t';            }
                output << endl;
        }
        catch(exception& e) {
index 4e35ff3df44fcf24df6accc2c0b920ecac60bcd9..edd16c7cdee387c1c83f50471d6caf025c8352ec 100644 (file)
@@ -30,7 +30,7 @@ void SharedUtil::getSharedVectors(vector<string> Groups, vector<SharedRAbundVect
                        temp->setGroup(Groups[i]);
                        lookup.push_back(temp);
                }
-               
+       
                int numSeqs = order->size();
                //sample all the members
                for(int i=0;i<numSeqs;i++){
@@ -57,6 +57,55 @@ void SharedUtil::getSharedVectors(vector<string> Groups, vector<SharedRAbundVect
                exit(1);
        }
 }
+/**************************************************************************************************/
+
+void SharedUtil::getSharedVectorswithReplacement(vector<string> Groups, vector<SharedRAbundVector*>& lookup, SharedOrderVector* order) {
+       try {
+       
+               //delete each sharedrabundvector in lookup
+               for (int j = 0; j < lookup.size(); j++) {
+                       delete lookup[j];
+               }
+               
+               lookup.clear();
+               
+               //create and initialize vector of sharedvectors, one for each group
+               for (int i = 0; i < Groups.size(); i++) { 
+                       SharedRAbundVector* temp = new SharedRAbundVector(order->getNumBins());
+                       temp->setLabel(order->getLabel());
+                       temp->setGroup(Groups[i]);
+                       lookup.push_back(temp);
+               }
+       
+               int numSeqs = order->size();
+               
+               //sample all the members
+               for(int i=0;i<numSeqs;i++){
+                       //get random number
+                       int random = int((float)(i+1) * (float)(rand()) / ((float)RAND_MAX+1.0));
+                       individual chosen = order->get(random);
+
+                       int abundance; 
+                       //set info for sharedvector in chosens group
+                       for (int j = 0; j < lookup.size(); j++) { 
+                               if (chosen.group == lookup[j]->getGroup()) {
+                                        abundance = lookup[j]->getAbundance(chosen.bin);
+                                        lookup[j]->set(chosen.bin, (abundance + 1), chosen.group);
+                                        break;
+                               }
+                       }
+               }
+               
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the SharedUtil class Function getSharedVectorswithReplacement. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the SharedUtil class function getSharedVectorswithReplacement. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+}
 
 /**************************************************************************************************/
 //need to have mode because different commands require different number of valid groups
index f4e46311a973ae8ab10a23b7f49481f72deb8cc3..d43d2b6982d95ef36e5c5814b6d3f4767f3a717e 100644 (file)
@@ -22,6 +22,7 @@ class SharedUtil {
                ~SharedUtil() {};
                
                void getSharedVectors(vector<string>, vector<SharedRAbundVector*>&, SharedOrderVector*);
+               void getSharedVectorswithReplacement(vector<string>, vector<SharedRAbundVector*>&, SharedOrderVector*);
                void setGroups(vector<string>&, vector<string>&, string);  //globaldata->Groups, your tree or group map, mode
                void setGroups(vector<string>&, vector<string>&, string&, int&, string);  //globaldata->Groups, your tree or group map, allgroups, numGroups, mode
                void getCombos(vector<string>&, vector<string>, int&); //groupcomb, globaldata->Groups, numcomb
index f93b9335749b4e79bb8c3e3c1be58684efc1cf65..e138121661f19f77d1c8603036793f86a95dfe67 100644 (file)
--- a/tree.cpp
+++ b/tree.cpp
@@ -453,7 +453,22 @@ void Tree::randomTopology() {
                exit(1);
        }               
 }
-
+/*****************************************************************/
+void Tree::print(ostream& out) {
+       try {
+               int root = findRoot();
+               printBranch(root, out);
+               out << ";" << endl;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the Tree class Function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the Tree class function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }               
+}
 /*****************************************************************/
 // This prints out the tree in Newick form.
 void Tree::createNewickFile(string f) {
@@ -463,7 +478,7 @@ void Tree::createNewickFile(string f) {
                filename = f;
                openOutputFile(filename, out);
                
-               printBranch(root);
+               printBranch(root, out);
                
                // you are at the end of the tree
                out << ";" << endl;
@@ -501,15 +516,15 @@ int Tree::findRoot() {
 }
 
 /*****************************************************************/
-void Tree::printBranch(int node) {
+void Tree::printBranch(int node, ostream& out) {
        try {
                
                // you are not a leaf
                if (tree[node].getLChild() != -1) {
                        out << "(";
-                       printBranch(tree[node].getLChild());
+                       printBranch(tree[node].getLChild(), out);
                        out << ",";
-                       printBranch(tree[node].getRChild());
+                       printBranch(tree[node].getRChild(), out);
                        out << ")";
                        //if there is a branch length then print it
                        if (tree[node].getBranchLength() != -1) {
diff --git a/tree.h b/tree.h
index ac57a4a8168701e5d9f285537a8550de3f946bfa..58f3a792e9fbb22547765d9d238ffcabc1a77a01 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -34,6 +34,7 @@ public:
        int getNumLeaves(){     return numLeaves; }
        map<string, int> mergeUserGroups(int, vector<string>);  //returns a map with a groupname and the number of times that group was seen in the children
        void printTree();
+       void print(ostream&);
        
        //this function takes the leaf info and populates the non leaf nodes
        void assembleTree();            
@@ -54,7 +55,7 @@ private:
        void randomLabels(vector<string>);
        void randomLabels(string, string);
        int findRoot();  //return index of root node
-       void printBranch(int);  //recursively print out tree
+       void printBranch(int, ostream&);  //recursively print out tree
 };
 
 #endif
index a6e1918ffdefcf34d6052730f5161d011d644567..6cc64feed9cb3b031b87ed9ea92bad616a362621 100644 (file)
@@ -141,9 +141,9 @@ int TreeGroupCommand::execute(){
                                        for (int g = 0; g < numGroups; g++) {   index[g] = g;   }
                
                                        //create a new filename
-                                       outputFile = getRootName(globaldata->inputFileName) + treeCalculators[i]->getName() + "." + order->getLabel() + groupNames + ".tre";
+                                       outputFile = getRootName(globaldata->inputFileName) + treeCalculators[i]->getName() + "." + order->getLabel() + ".tre";
                                                        
-                                       for (int k = 0; k < lookup.size(); k++) { // pass cdd each set of groups to commpare
+                                       for (int k = 0; k < lookup.size(); k++) { 
                                                for (int l = k; l < lookup.size(); l++) {
                                                        if (k != l) { //we dont need to similiarity of a groups to itself
                                                                //get estimated similarity between 2 groups
index 5880b0c593fdd0dc96808e485921d96871e865d6..00ae0e664ff5fb7d289893b445be08b5fd20c89a 100644 (file)
@@ -152,7 +152,7 @@ void TreeMap::makeSim(GroupMap* groupmap) {
                //set names of seqs to names of groups
                namesOfSeqs = groupmap->namesOfGroups;
                
-               // make map where key and value are both the group name since that what the tree.groups command wants
+               // make map where key and value are both the group name since that what the tree.shared command wants
                for (int i = 0; i < namesOfGroups.size(); i++) {
                        treemap[namesOfGroups[i]].groupname = namesOfGroups[i];
                        seqsPerGroup[namesOfGroups[i]] = 1;
index 12299731f89e10741926cd797fad2a02ed267c2d..73d02fcc4b0c58f29de00c130e3fa8a197dd3d53 100644 (file)
--- a/treemap.h
+++ b/treemap.h
@@ -38,7 +38,7 @@ public:
     map<string,int> seqsPerGroup;      //groupname, number of seqs in that group.
        map<string, GroupIndex> treemap; //sequence name and <groupname, vector index>
        void print(ostream&);
-       void makeSim(GroupMap*);  //takes groupmap info and fills treemap for use by tree.groups command.
+       void makeSim(GroupMap*);  //takes groupmap info and fills treemap for use by tree.shared command.
        
        
 private:
index 9d170631592cc9faf9c54fbd5bde5c710efe05f6..a9b46bfc90154f48106a76bea85acd4729080070 100644 (file)
@@ -58,8 +58,8 @@ int UnifracUnweightedCommand::execute() {
                //get pscores for users trees
                for (int i = 0; i < T.size(); i++) {
                        counter = 0;
-                       unweightedFile = globaldata->getTreeFile()  + toString(i+1) + ".unweighted";
-                       unweightedFileout = globaldata->getTreeFile() + "temp." + toString(i+1) + ".unweighted";
+                       
+                       output = new ColumnFile(globaldata->getTreeFile()  + toString(i+1) + ".unweighted");
                        
                        outSum << i+1 << '\t';
                        cout << i+1 << '\t';
@@ -99,31 +99,33 @@ int UnifracUnweightedCommand::execute() {
                                
                        }
                
-               for(int a = 0; a < numComp; a++) {
-                       float rcumul = 1.0000;
-                       //this loop fills the cumulative maps and put 0.0000 in the score freq map to make it easier to print.
-                       for (it = validScores.begin(); it != validScores.end(); it++) { 
-                               //make rscoreFreq map and rCumul
-                               it2 = rscoreFreq[a].find(it->first);
-                               rCumul[a][it->first] = rcumul;
-                               //get percentage of random trees with that info
-                               if (it2 != rscoreFreq[a].end()) {  rscoreFreq[a][it->first] /= iters; rcumul-= it2->second;  }
-                               else { rscoreFreq[a][it->first] = 0.0000; } //no random trees with that score
+                       for(int a = 0; a < numComp; a++) {
+                               float rcumul = 1.0000;
+                               //this loop fills the cumulative maps and put 0.0000 in the score freq map to make it easier to print.
+                               for (it = validScores.begin(); it != validScores.end(); it++) { 
+                                       //make rscoreFreq map and rCumul
+                                       it2 = rscoreFreq[a].find(it->first);
+                                       rCumul[a][it->first] = rcumul;
+                                       //get percentage of random trees with that info
+                                       if (it2 != rscoreFreq[a].end()) {  rscoreFreq[a][it->first] /= iters; rcumul-= it2->second;  }
+                                       else { rscoreFreq[a][it->first] = 0.0000; } //no random trees with that score
+                               }
+                               UWScoreSig[a].push_back(rCumul[a][userData[a]]);
                        }
-                       UWScoreSig[a].push_back(rCumul[a][userData[a]]);
-               }
                
                
                
-               printUnweightedFile();
-               printUWSummaryFile();
+                       printUnweightedFile();
+                       printUWSummaryFile();
+                       
+                       delete output;
+                       rscoreFreq.clear(); 
+                       rCumul.clear();  
+                       validScores.clear(); 
+                       utreeScores.clear();  
+                       UWScoreSig.clear(); 
+               }
                
-               rscoreFreq.clear(); 
-               rCumul.clear();  
-               validScores.clear(); 
-               utreeScores.clear();  
-               UWScoreSig.clear(); 
-       }
                //reset groups parameter
                globaldata->Groups.clear(); 
                outSum.close();
@@ -144,22 +146,19 @@ int UnifracUnweightedCommand::execute() {
 void UnifracUnweightedCommand::printUnweightedFile() {
        try {
                vector<double> data;
+               vector<string> tags;
+               tags.push_back("Score"); tags.push_back("RandFreq"); tags.push_back("RandCumul");
                
                for(int a = 0; a < numComp; a++) {
-                       initFile(groupComb[a]);
+                       output->initFile(groupComb[a], tags);
                        //print each line
                        for (it = validScores.begin(); it != validScores.end(); it++) { 
                                data.push_back(it->first);  data.push_back(rscoreFreq[a][it->first]); data.push_back(rCumul[a][it->first]); 
-                               output(data);
+                               output->output(data);
                                data.clear();
                        } 
-                       resetFile();
+                       output->resetFile();
                }
-               
-               out.close();
-               inFile.close();
-               remove(unweightedFileout.c_str());
-               
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the UnifracUnweightedCommand class Function printUnweightedFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -200,85 +199,7 @@ void UnifracUnweightedCommand::printUWSummaryFile() {
                exit(1);
        }
 }
-/*****************************************************************/
-
-void UnifracUnweightedCommand::initFile(string label){
-       try {
-               if(counter != 0){
-                       openOutputFile(unweightedFileout, out);
-                       openInputFile(unweightedFile, inFile);
-
-                       string inputBuffer;
-                       getline(inFile, inputBuffer);
-               
-                       out     <<  inputBuffer << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;           
-               }else{
-                       openOutputFile(unweightedFileout, out);
-                       out     << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
-               }
-
-               out.setf(ios::fixed, ios::floatfield);
-               out.setf(ios::showpoint);
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the UnifracUnweightedCommand class Function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the UnifracUnweightedCommand class function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-/***********************************************************************/
 
-void UnifracUnweightedCommand::output(vector<double> data){
-       try {
-               if(counter != 0){               
-                       string inputBuffer;
-                       getline(inFile, inputBuffer);
-//                     out     <<  inputBuffer << setprecision(6) << '\t' << data[0] << setprecision(globaldata->getIters().length()) << '\t' << data[1] << '\t' << data[2] << endl;
-               
-                       out << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
-               }
-               else{
-                       out << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
-               }
-
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the UnifracUnweightedCommand class Function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the UnifracUnweightedCommand class function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-};
-
-/***********************************************************************/
+/***********************************************************/
 
-void UnifracUnweightedCommand::resetFile(){
-       try {
-               if(counter != 0){
-                       out.close();
-                       inFile.close();
-               }
-               else{
-                       out.close();
-               }
-               counter = 1;
-               
-               remove(unweightedFile.c_str());
-               rename(unweightedFileout.c_str(), unweightedFile.c_str());
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the UnifracUnweightedCommand class Function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the UnifracUnweightedCommand class function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-}
 
index 3bd9a0db8915eb36c2e66174e8750c0fb1fab52a..d9991e81ce3ddee08a4afc8fae19d78ce89f794e 100644 (file)
@@ -14,6 +14,7 @@
 #include "unweighted.h"
 #include "treemap.h"
 #include "sharedutilities.h"
+#include "fileoutput.h"
 
 
 using namespace std;
@@ -30,10 +31,11 @@ class UnifracUnweightedCommand : public Command {
        private:
                GlobalData* globaldata;
                SharedUtil* util;
+               FileOutput* output;
                vector<Tree*> T;           //user trees
                TreeMap* tmap;
                Unweighted* unweighted;
-               string sumFile, unweightedFile, unweightedFileout, allGroups;
+               string sumFile, allGroups;
                vector<string> groupComb; // AB. AC, BC...
                int iters, numGroups, numComp, counter;
                EstOutput userData;                     //unweighted score info for user tree
@@ -51,10 +53,7 @@ class UnifracUnweightedCommand : public Command {
                
                void printUWSummaryFile();
                void printUnweightedFile();
-               void initFile(string);
-               void output(vector<double>);
-               void resetFile();
+                
                
 };
 
index 5f7b4ad5363a2660aa2df7ac9ecb8f3fa998a13d..6dfbd710765478d3e7b5c8dc21ab844fa4a6b231 100644 (file)
@@ -56,9 +56,8 @@ int UnifracWeightedCommand::execute() {
                        counter = 0;
                        rScores.resize(numComp);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
                        uScores.resize(numComp);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
-                       //weightedFile = globaldata->getTreeFile()  + toString(i+1) + ".weighted";
-                       //weightedFileout = globaldata->getTreeFile() + "temp." + toString(i+1) + ".weighted";
-                       output = new ThreeColumnFile2(globaldata->getTreeFile()  + toString(i+1) + ".weighted");
+                       
+                       output = new ColumnFile(globaldata->getTreeFile()  + toString(i+1) + ".weighted");
 
                        userData = weighted->getValues(T[i]);  //userData[0] = weightedscore
                        
@@ -163,11 +162,6 @@ void UnifracWeightedCommand::printWeightedFile() {
                        } 
                        output->resetFile();
                }
-               
-               //out.close();
-               //inFile.close();
-               //remove(weightedFileout.c_str());
-               
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the UnifracWeightedCommand class Function printWeightedFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -284,92 +278,8 @@ void UnifracWeightedCommand::calculateFreqsCumuls() {
 
 }
 
-/*****************************************************************
-
-void UnifracWeightedCommand::initFile(string label){
-       try {
-               if(counter != 0){
-                       openOutputFile(weightedFileout, out);
-                       openInputFile(weightedFile, inFile);
-
-                       string inputBuffer;
-                       getline(inFile, inputBuffer);
-               
-                       out     <<  inputBuffer << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;           
-               }else{
-                       openOutputFile(weightedFileout, out);
-                       out     << label + "Score" << '\t' << label + "RandFreq" << '\t' << label + "RandCumul" << endl;
-               }
-
-               out.setf(ios::fixed, ios::floatfield);
-               out.setf(ios::showpoint);
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the UnifracWeightedCommand class Function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the UnifracWeightedCommand class function initFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-/***********************************************************************
-
-void UnifracWeightedCommand::output(vector<double> data){
-       try {
-               if(counter != 0){               
-                       string inputBuffer;
-                       getline(inFile, inputBuffer);
-
-                       out << inputBuffer << '\t' << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
-               }
-               else{
-                       out << setprecision(6) << data[0] << setprecision(globaldata->getIters().length())  << '\t' << data[1] << '\t' << data[2] << endl;
-
-               }
-               
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the UnifracWeightedCommand class Function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the UnifracWeightedCommand class function output. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-};
-
-/***********************************************************************
-
-void UnifracWeightedCommand::resetFile(){
-       try {
-               if(counter != 0){
-                       out.close();
-                       inFile.close();
-               }
-               else{
-                       out.close();
-               }
-               counter = 1;
-               
-               remove(weightedFile.c_str());
-               rename(weightedFileout.c_str(), weightedFile.c_str());
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the UnifracWeightedCommand class Function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the UnifracWeightedCommand class function resetFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       
-       
-                       
-}
+/***********************************************************/
 
-*/
 
 
 
index 751343b3f641d29799c8704d71f6684c04d504ac..5cd93a94c0dcf96547ee409d4ca641092309d2bc 100644 (file)
@@ -39,7 +39,7 @@ class UnifracWeightedCommand : public Command {
                Tree* randT;  //random tree
                TreeMap* tmap;
                Weighted* weighted;
-               string weightedFile, weightedFileout, sumFile;
+               string sumFile;
                int iters, numGroups, numComp, counter;
                EstOutput userData;                     //weighted score info for user tree
                EstOutput randomData;           //weighted score info for random trees
@@ -59,10 +59,7 @@ class UnifracWeightedCommand : public Command {
                //void removeValidScoresDuplicates();
                int findIndex(float, int);
                void calculateFreqsCumuls();
-               //void initFile(string);
-               //void output(vector<double>);
-               //void resetFile();
-
+               
 };
 
 
index 4c05e4a8e466e2a99a2628e0ca7e1cf31c5e4bfe..7d3477f68c2c8eb71c5c42ab27b1aceb7eb81472 100644 (file)
@@ -21,6 +21,7 @@ ValidCalculators::ValidCalculators() {
                 initialVennSingle();
                 initialVennShared();
                 initialTreeGroups();
+                initialBoot();
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -138,13 +139,23 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        if ((treegroup.find(calculator)) != (treegroup.end())) {
                                return true;
                        }else { 
-                               cout << calculator << " is not a valid estimator for the tree.groups command in shared mode and will be disregarded. Valid estimators are ";
+                               cout << calculator << " is not a valid estimator for the tree.shared command in shared mode and will be disregarded. Valid estimators are ";
                                for (it = treegroup.begin(); it != treegroup.end(); it++) {
                                        cout << it->first << ", ";
                                }
                                cout << endl;
                                return false; }
-
+               }else if (parameter == "boot") {
+                       //is it valid
+                       if ((boot.find(calculator)) != (boot.end())) {
+                               return true;
+                       }else { 
+                               cout << calculator << " is not a valid estimator for the bootstrap.shared command in shared mode and will be disregarded. Valid estimators are ";
+                               for (it = boot.begin(); it != boot.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                //not a valid parameter
                }else { return false; }
                
@@ -393,10 +404,90 @@ void ValidCalculators::initialTreeGroups() {
                exit(1);
        }       
 }
-
-
 /********************************************************************/
+void ValidCalculators::initialBoot() {
+       try {   
+               boot["jabund"]                          = "jabund";
+               boot["sorensonabund"]           = "sorensonabund";
+               boot["jclass"]                          = "jclass";
+               boot["sorclass"]                        = "orclass";
+               boot["jest"]                            = "jest";
+               boot["sorest"]                          = "sorest";
+               boot["thetayc"]                         = "thetayc";
+               boot["thetan"]                          = "thetan";
+               boot["morisitahorn"]            = "morisitahorn";
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialBoot. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ValidCalculator class function initialBoot. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
 
+/********************************************************************/
+void ValidCalculators::printCalc(string parameter, ostream& out) {
+       try{
+               out << "The available estimators for calc are ";
+               //are you looking for a calculator for a single parameter
+               if (parameter == "single") {
+                       for (it = single.begin(); it != single.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a shared parameter
+               }else if (parameter == "shared") {
+                       for (it = shared.begin(); it != shared.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a rarefaction parameter
+               }else if (parameter == "rarefaction") {
+                       for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a summary parameter
+               }else if (parameter == "summary") {
+                       for (it = summary.begin(); it != summary.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a sharedsummary parameter
+               }else if (parameter == "sharedsummary") {
+                       for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "sharedrarefaction") {
+                       for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "vennsingle") {
+                       for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "vennshared") {
+                       for (it = vennshared.begin(); it != vennshared.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "treegroup") {
+                       for (it = treegroup.begin(); it != treegroup.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "boot") {
+                       for (it = boot.begin(); it != boot.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }
+               out << endl;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function printCalc. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ValidCalculator class function printCalc. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
 
-
+}
+/********************************************************************/
 
index 6cf37924144906276a9aa39c491ffed301c35510..9f0d9b47430fbef80d66d5883c8231daded87c7d 100644 (file)
@@ -23,6 +23,7 @@ class ValidCalculators {
                ValidCalculators();
                ~ValidCalculators();
                bool isValidCalculator(string, string);
+               void printCalc(string, ostream&);
                
        private:
                map<string, string> single;
@@ -34,6 +35,7 @@ class ValidCalculators {
                map<string, string> vennsingle;
                map<string, string> vennshared;
                map<string, string> treegroup;
+               map<string, string> boot;
                map<string, string>::iterator it;
                
                void initialSingle();
@@ -45,6 +47,7 @@ class ValidCalculators {
                void initialVennSingle();
                void initialVennShared();
                void initialTreeGroups();
+               void initialBoot();
 };
 
 #endif
index bc9f62c089bdfdded2181dcb53be18e7d37e71c4..696214e236be1b44cfc63335ee9caecc96249ea8 100644 (file)
@@ -31,12 +31,13 @@ ValidCommands::ValidCommands() {
                commands["unifrac.weighted"]    = "unifrac.weighted"; 
                commands["unifrac.unweighted"]  = "unifrac.unweighted"; 
                commands["libshuff"]                    = "libshuff";
-               commands["tree.groups"]                 = "tree.groups";
+               commands["tree.shared"]                 = "tree.shared";
                commands["heatmap"]                             = "heatmap";
                commands["venn"]                                = "venn";
                commands["get.group"]           = "get.group";
                commands["get.label"]           = "get.label";
                commands["get.line"]            = "get.line";
+               commands["bootstrap.shared"]    = "bootstrap.shared";
                commands["help"]                                = "help"; 
                commands["quit"]                                = "quit"; 
 
index 98dbde868627018c08221875a65c10426a9f0947..3fbf307b69918626e097e2e61a11cfcf54244bb4 100644 (file)
@@ -283,7 +283,7 @@ void ValidParameters::initCommandParameters() {
                string unifracUnweightedArray[] =  {"groups","iters"};
                commandParameters["unifrac.unweighted"] = addParameters(unifracUnweightedArray, sizeof(unifracUnweightedArray)/sizeof(string));
 
-               string heatmapArray[] =  {"groups","line","label","sorted","scaler"};
+               string heatmapArray[] =  {"groups","line","label","sorted","scale"};
                commandParameters["heatmap"] = addParameters(heatmapArray, sizeof(heatmapArray)/sizeof(string));
 
                string vennArray[] =  {"groups","line","label","calc"};
@@ -296,7 +296,10 @@ void ValidParameters::initCommandParameters() {
                commandParameters["get.oturep"] = addParameters(getOTURepArray, sizeof(getOTURepArray)/sizeof(string));
                
                string treeGroupsArray[] =  {"line","label","calc","groups"};
-               commandParameters["tree.groups"] = addParameters(treeGroupsArray, sizeof(treeGroupsArray)/sizeof(string));
+               commandParameters["tree.shared"] = addParameters(treeGroupsArray, sizeof(treeGroupsArray)/sizeof(string));
+               
+               string bootstrapArray[] =  {"line","label","calc","groups","iters"};
+               commandParameters["bootstrap.shared"] = addParameters(bootstrapArray, sizeof(bootstrapArray)/sizeof(string));
                
                string quitArray[] = {};
                commandParameters["quit"] = addParameters(quitArray, sizeof(quitArray)/sizeof(string));
@@ -376,4 +379,3 @@ vector<string> ValidParameters::addParameters(string parameters[], int size) {
        }
 }
 
-