]> git.donarmstrong.com Git - mothur.git/commitdiff
Added get.line command.
authorryabin <ryabin>
Wed, 18 Feb 2009 19:42:11 +0000 (19:42 +0000)
committerryabin <ryabin>
Wed, 18 Feb 2009 19:42:11 +0000 (19:42 +0000)
Added get.label command.
Added get.group command.
Added parameter and parameter value error checking.
Modified ace to allow changing the abund variable.
Made it so you don't need a space after the comma when entering parameters.
Added error checking for invalid labels.
Added a new convert method that tests if a given string can be converted into an int.

14 files changed:
Mothur.xcodeproj/project.pbxproj
collect.cpp
collect.h
collectcommand.cpp
errorchecking.cpp
getgroupcommand.cpp [new file with mode: 0644]
getgroupcommand.h [new file with mode: 0644]
getlabelcommand.cpp [new file with mode: 0644]
getlabelcommand.h [new file with mode: 0644]
getlinecommand.cpp [new file with mode: 0644]
getlinecommand.h [new file with mode: 0644]
globaldata.hpp
rarefactcommand.cpp
summarycommand.cpp

index d3716c77281a1535db35ac892336f89d66694654..68b44f59dfb9783bfd7109889f90d60f811c4723 100644 (file)
@@ -85,7 +85,6 @@
                37D9289F0F21331F001D4494 /* validparameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928530F21331F001D4494 /* validparameter.cpp */; };
                37E5F3E30F29FD4200F8D827 /* treenode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F3E20F29FD4200F8D827 /* treenode.cpp */; };
                37E5F4920F2A3DA800F8D827 /* readtreecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */; };
-               7E44EBD10F3235D900B0D45D /* makefile in Sources */ = {isa = PBXBuildFile; fileRef = 7E44EBD00F32358B00B0D45D /* makefile */; };
                8DD76F6A0486A84900D96B5E /* Mothur.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Mothur.1 */; };
                EBA52D2C0F378B0F00122C15 /* getgroupcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBA52D2B0F378B0F00122C15 /* getgroupcommand.cpp */; };
                EBFD67840F33876C00883537 /* getlabelcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBFD67830F33876C00883537 /* getlabelcommand.cpp */; };
                37E5F3E20F29FD4200F8D827 /* treenode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = treenode.cpp; sourceTree = SOURCE_ROOT; };
                37E5F4900F2A3DA800F8D827 /* readtreecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readtreecommand.h; sourceTree = SOURCE_ROOT; };
                37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtreecommand.cpp; sourceTree = SOURCE_ROOT; };
-               7E44EBD00F32358B00B0D45D /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = "<group>"; };
                8DD76F6C0486A84900D96B5E /* mothur */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mothur; sourceTree = BUILT_PRODUCTS_DIR; };
                C6859E8B029090EE04C91782 /* Mothur.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Mothur.1; sourceTree = "<group>"; };
                EBA52D2A0F378B0F00122C15 /* getgroupcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getgroupcommand.h; sourceTree = "<group>"; };
                                37D927D60F21331F001D4494 /* display.h */,
                                37D927D80F21331F001D4494 /* engine.hpp */,
                                37D927D70F21331F001D4494 /* engine.cpp */,
-                               7E44EBD00F32358B00B0D45D /* makefile */,
                                37D928B10F213472001D4494 /* errorcheckor */,
                                37D927DE0F21331F001D4494 /* fileoutput.h */,
                                37D927DD0F21331F001D4494 /* fileoutput.cpp */,
                                37E5F3E30F29FD4200F8D827 /* treenode.cpp in Sources */,
                                37E5F4920F2A3DA800F8D827 /* readtreecommand.cpp in Sources */,
                                379293C30F2DE73400B9034A /* treemap.cpp in Sources */,
-                               7E44EBD10F3235D900B0D45D /* makefile in Sources */,
                                EBFD67840F33876C00883537 /* getlabelcommand.cpp in Sources */,
                                EBFD67E80F339AAA00883537 /* getlinecommand.cpp in Sources */,
                                EBA52D2C0F378B0F00122C15 /* getgroupcommand.cpp in Sources */,
index 1c8128aef4ba42ec11fc2a7edbaa8cd42aa97ced..80ad9183337260d83301ced05c99e6934eaf9991 100644 (file)
 /***********************************************************************/
 
 void Collect::getCurve(int increment = 1){
-       try {
-               RAbundVector* lookup = new RAbundVector(order->getNumBins());
-               SAbundVector* rank      = new SAbundVector(order->getMaxRank()+1);
-
-               CollectorsCurveData* ccd = new CollectorsCurveData();
-       
-               for(int i=0;i<displays.size();i++){
-                       ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
-                       displays[i]->init(label);                  //sets displays label
-               }                                                                          
-               for(int i=0;i<numSeqs;i++){
-
-                       int binNumber = order->get(i);
-                       int abundance = lookup->get(binNumber);
-               
-                       rank->set(abundance, rank->get(abundance)-1); 
-               
-                       abundance++;
-               
-                       lookup->set(binNumber, abundance);
-                       rank->set(abundance, rank->get(abundance)+1); //increment rank(abundance)
-
-                       if((i == 0) || (i+1) % increment == 0){
-                               ccd->updateRankData(rank);
-                       }
-               }
-       
-               if(numSeqs % increment != 0){
-                       ccd->updateRankData(rank);
-               }
-       
-               for(int i=0;i<displays.size();i++){
-                       displays[i]->reset();
-               }
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the Collect class function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
+        try {
+                RAbundVector* lookup = new RAbundVector(order->getNumBins());
+                SAbundVector* rank        = new SAbundVector(order->getMaxRank()+1);
+
+                CollectorsCurveData* ccd = new CollectorsCurveData();
+        
+                for(int i=0;i<displays.size();i++){
+                        ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
+                        displays[i]->init(label);                   //sets displays label
+                }                                                                           
+                for(int i=0;i<numSeqs;i++){
+
+                        int binNumber = order->get(i);
+                        int abundance = lookup->get(binNumber);
+                
+                        rank->set(abundance, rank->get(abundance)-1); 
+                
+                        abundance++;
+                
+                        lookup->set(binNumber, abundance);
+                        rank->set(abundance, rank->get(abundance)+1); //increment rank(abundance)
+
+                        if((i == 0) || (i+1) % increment == 0){
+                                ccd->updateRankData(rank);
+                        }
+                }
+        
+                if(numSeqs % increment != 0){
+                        ccd->updateRankData(rank);
+                }
+        
+                for(int i=0;i<displays.size();i++){
+                        displays[i]->reset();
+                }
+        }
+        catch(exception& e) {
+                cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+                exit(1);
+        }
+        catch(...) {
+                cout << "An unknown error has occurred in the Collect class function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+                exit(1);
+        }
 
 }
 
 /***********************************************************************/
 void Collect::getSharedCurve(int increment = 1){
 try {
-               globaldata = GlobalData::getInstance();
-               vector<SharedRAbundVector*> lookup; 
-               vector<string> chosenGroups = globaldata->sharedGroups;
-               
-               //create and initialize vector of sharedvectors, one for each group
-               for (int i = 0; i < globaldata->gGroupmap->getNumGroups(); i++) { 
-                       SharedRAbundVector* temp = new SharedRAbundVector(sharedorder->getNumBins());
-                       temp->setLabel(sharedorder->getLabel());
-                       temp->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
-                       temp->setGroupIndex(globaldata->gGroupmap->groupIndex[globaldata->gGroupmap->namesOfGroups[i]]);
-                       lookup.push_back(temp);
-               }
-
-               SharedCollectorsCurveData* ccd = new SharedCollectorsCurveData();
-       
-               //initialize labels for output
-               //makes  'uniqueAB       uniqueAC  uniqueBC' if your groups are A, B, C
-               getGroupComb(chosenGroups);
-               groupLabel = "";
-               for (int s = 0; s < groupComb.size(); s++) {
-                       groupLabel = groupLabel + label + groupComb[s] + "\t";
-               }
-
-               for(int i=0;i<displays.size();i++){
-                       ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
-                       displays[i]->init(groupLabel);            
-               }
-               
-               //sample all the members
-               for(int i=0;i<numSeqs;i++){
-                       //get first sample
-                       individual chosen = sharedorder->get(i);
-                       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;
-                               }
-                       }
-
-                       //calculate at 0 and the given increment
-                       if((i == 0) || (i+1) % increment == 0){
-                               //randomize group order
-                               if (globaldata->getJumble() == "1") { random_shuffle(lookup.begin(), lookup.end()); }
-                               //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
-                               int n = 1;
-                               for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
-                                       for (int l = n; l < lookup.size(); l++) {
-                                               ccd->updateSharedData(lookup[k], lookup[l], i+1, globaldata->gGroupmap->namesOfGroups.size());
-                                       }
-                                       n++;
-                               }
-                       totalNumSeq = i+1;
-                       }
-               }
-               
-               //calculate last line if you haven't already
-               if(numSeqs % increment != 0){
-                       //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
-                       int n = 1;
-                       for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
-                               for (int l = n; l < lookup.size(); l++) {
-                                       ccd->updateSharedData(lookup[k], lookup[l], totalNumSeq, globaldata->gGroupmap->namesOfGroups.size());
-                               }
-                               n++;
-                       }
-               }
-               
-               //resets output files
-               for(int i=0;i<displays.size();i++){
-                       displays[i]->reset();
-               }
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the Collect class function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
+                globaldata = GlobalData::getInstance();
+                vector<SharedRAbundVector*> lookup; 
+
+                //create and initialize vector of sharedvectors, one for each group
+                for (int i = 0; i < globaldata->gGroupmap->getNumGroups(); i++) { 
+                        SharedRAbundVector* temp = new SharedRAbundVector(sharedorder->getNumBins());
+                        temp->setLabel(sharedorder->getLabel());
+                        temp->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
+                        temp->setGroupIndex(globaldata->gGroupmap->groupIndex[globaldata->gGroupmap->namesOfGroups[i]]);
+                        lookup.push_back(temp);
+                }
+
+                SharedCollectorsCurveData* ccd = new SharedCollectorsCurveData();
+        
+                //initialize labels for output
+                //makes  'uniqueAB         uniqueAC  uniqueBC' if your groups are A, B, C
+                getGroupComb();
+                groupLabel = "";
+                for (int s = 0; s < groupComb.size(); s++) {
+                        groupLabel = groupLabel + label + groupComb[s] + "\t";
+                }
+
+                for(int i=0;i<displays.size();i++){
+                        ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
+                        displays[i]->init(groupLabel);                  
+                }
+                
+                //sample all the members
+                for(int i=0;i<numSeqs;i++){
+                        //get first sample
+                        individual chosen = sharedorder->get(i);
+                        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;
+                                }
+                        }
+                        
+                        //calculate at 0 and the given increment
+                        if((i == 0) || (i+1) % increment == 0){
+                                //randomize group order
+                                if (globaldata->getJumble() == "1") { random_shuffle(lookup.begin(), lookup.end()); }
+                                //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
+                                int n = 1;
+                                for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
+                                        for (int l = n; l < lookup.size(); l++) {
+                                                ccd->updateSharedData(lookup[k], lookup[l], i+1, globaldata->gGroupmap->namesOfGroups.size());
+                                        }
+                                        n++;
+                                }
+                        }
+                        totalNumSeq = i+1;
+                }
+                
+                //calculate last line if you haven't already
+                if(numSeqs % increment != 0){
+                        //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
+                        int n = 1;
+                        for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
+                                for (int l = n; l < lookup.size(); l++) {
+                                        ccd->updateSharedData(lookup[k], lookup[l], totalNumSeq, globaldata->gGroupmap->namesOfGroups.size());
+                                }
+                                n++;
+                        }
+                }
+                
+                //resets output files
+                for(int i=0;i<displays.size();i++){
+                        displays[i]->reset();
+                }
+        }
+        catch(exception& e) {
+                cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+                exit(1);
+        }
+        catch(...) {
+                cout << "An unknown error has occurred in the Collect class function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+                exit(1);
+        }
 
 }
 
 /**************************************************************************************/
 
-void Collect::getGroupComb(vector<string> chosen) {
-               string group;
-               
-               numGroupComb = 0;
-               
-               int n = 1;
-               for (int i = 0; i < (globaldata->gGroupmap->getNumGroups() - 1); i++) {
-                       for (int l = n; l < globaldata->gGroupmap->getNumGroups(); l++) {
-                               string g1 = globaldata->gGroupmap->namesOfGroups[i];
-                               string g2 = globaldata->gGroupmap->namesOfGroups[l];
-                               if(validGroup(chosen, g1) && validGroup(chosen, g2)) { 
-                                       group = g1 + g2;
-                                       groupComb.push_back(group);     
-                                       numGroupComb++;
-                               }
-                       }
-                       n++;
-               }
-}
-
-/**************************************************************************************/
+void Collect::getGroupComb() {
+                string group;
+                
+                numGroupComb = 0;
+                
+                int n = 1;
+                for (int i = 0; i < (globaldata->gGroupmap->getNumGroups() - 1); i++) {
+                        for (int l = n; l < globaldata->gGroupmap->getNumGroups(); l++) {
+                                group = globaldata->gGroupmap->namesOfGroups[i] + globaldata->gGroupmap->namesOfGroups[l];
+                                groupComb.push_back(group);        
+                                numGroupComb++;
+                        }
+                        n++;
+                }
 
-bool Collect::validGroup(vector<string> chosen, string group) {
-       if(chosen.size() == 0)
-               return true;
-       for(int i = 0; i < chosen.size(); i++)
-               if(chosen.at(i).compare(group) == 0)
-                       return true;
-       return false;
 }
-                                       
-
 
+/**************************************************************************************/
\ No newline at end of file
index 3f6a094e0319092f3c8151408813cd2678468d85..aca4ccd40069cf5fdcdb9fed05b17cabe447f567 100644 (file)
--- a/collect.h
+++ b/collect.h
@@ -34,7 +34,7 @@ private:
        vector<Display*> displays;
        int numSeqs, numGroupComb, totalNumSeq;
        string label, groupLabel;
-       void getGroupComb(vector<string>);
+       void getGroupComb();
        vector<string> groupComb;
        bool validGroup(vector<string>, string);
 };
index f012ba151e0813f9b7ab67f5c2961db8eec23b1b..c716732474da857a38bee138931b4a769cca4aa1 100644 (file)
@@ -37,7 +37,7 @@ CollectCommand::CollectCommand(){
                                        cDisplays.push_back(new CollectDisplay(new Chao1(), new ThreeColumnFile(fileNameRoot+"chao")));
                                }else if (globaldata->Estimators[i] == "ace") { 
                                convert(globaldata->getAbund(), abund);
-                                       cDisplays.push_back(new CollectDisplay(new Ace(), new ThreeColumnFile(fileNameRoot+"ace")));
+                                       cDisplays.push_back(new CollectDisplay(new Ace(abund), new ThreeColumnFile(fileNameRoot+"ace")));
                                }else if (globaldata->Estimators[i] == "jack") { 
                                        cDisplays.push_back(new CollectDisplay(new Jackknife(), new ThreeColumnFile(fileNameRoot+"jack")));
                                }else if (globaldata->Estimators[i] == "shannon") { 
index cc6cbf9d8d96ac90a55dc68d16d2ffa157079cb1..ddcfc32b7b2163b5e8477bcc577b0bde52ef013f 100644 (file)
@@ -268,12 +268,6 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "label" )                      { label = value; }
                                if (parameter == "abund" )          { abund = value; }
                                if (parameter == "random" )                     { randomtree = value;   }
-
-                               if (parameter == "comparegroups") { //stores groups to be compared
-                                       sharedGroups.clear(); //clears out old values
-                                       globaldata->splitAtDash(value, sharedGroups);
-                               }
-
                        }
                        
                        //gets the last parameter and value
@@ -345,11 +339,6 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "label" )                      { label = value; }
                                if (parameter == "random" )                     { randomtree = value;   }
                                if (parameter == "abund" )          { abund = value; }
-
-                               if (parameter == "comparegroups") { //stores groups to be compared
-                                       sharedGroups.clear(); //clears out old values
-                                       globaldata->splitAtDash(value, sharedGroups);
-                               }
                        }
                }
                
diff --git a/getgroupcommand.cpp b/getgroupcommand.cpp
new file mode 100644 (file)
index 0000000..393be4e
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *  getgroupcommand.cpp
+ *  Mothur
+ *
+ *  Created by Thomas Ryabin on 2/2/09.
+ *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "getgroupcommand.h"
+
+
+
+
+
+GetgroupCommand::GetgroupCommand(){
+       try {
+               globaldata = GlobalData::getInstance();
+               groupMap = globaldata->gGroupmap;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the GetgroupCommand class Function GetgroupCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the GetgroupCommand class function GetgroupCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+                       
+}
+
+//**********************************************************************************************************************
+
+GetgroupCommand::~GetgroupCommand(){
+}
+
+//**********************************************************************************************************************
+
+int GetgroupCommand::execute(){
+       try {
+               vector<string> groupNames = groupMap->namesOfGroups;    
+               for(int i = 0; i < groupNames.size(); i++)
+                       cout << groupNames[i] << "\n";
+               return 0;       
+       }
+
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the GetgroupCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the GetgroupCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
+
+
diff --git a/getgroupcommand.h b/getgroupcommand.h
new file mode 100644 (file)
index 0000000..00c1b51
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef GETGROUPCOMMAND_H
+#define GETGROUPCOMMAND_H
+
+/*
+ *  getgroupcommand.h
+ *  Mothur
+ *
+ *  Created by Thomas Ryabin on 2/2/09.
+ *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include "command.hpp"
+#include "readmatrix.hpp"
+
+class GlobalData;
+
+class GetgroupCommand : public Command {
+public:
+       GetgroupCommand();
+       ~GetgroupCommand();
+       int execute();
+       
+private:
+       GlobalData* globaldata;
+       GroupMap* groupMap;
+};
+
+#endif
diff --git a/getlabelcommand.cpp b/getlabelcommand.cpp
new file mode 100644 (file)
index 0000000..baabc21
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ *  GetlabelCommand.cpp
+ *  Mothur
+ *
+ *  Created by Thomas Ryabin on 1/30/09.
+ *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "getlabelcommand.h"
+
+
+
+
+
+
+GetlabelCommand::GetlabelCommand(){
+       try {
+               globaldata = GlobalData::getInstance();
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the GetlabelCommand class Function GetlabelCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the GetlabelCommand class function GetlabelCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+                       
+}
+
+//**********************************************************************************************************************
+
+GetlabelCommand::~GetlabelCommand(){
+}
+
+//**********************************************************************************************************************
+
+int GetlabelCommand::execute(){
+       try {
+               filename = globaldata->inputFileName;
+               ifstream in;
+               openInputFile(filename, in);
+               string label;
+               int numBins = 0;
+               int count = -1;
+               while(in.good())
+               {
+                       if(count > numBins)
+                               count = 0;
+                       if(count == 0)
+                       {
+                               cout << label << "\n";
+                               in >> numBins;
+                       }
+                       in >> label;
+                       count++;
+               }       
+               return 0;       
+       }
+
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the GetlabelCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the GetlabelCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
+
diff --git a/getlabelcommand.h b/getlabelcommand.h
new file mode 100644 (file)
index 0000000..ae4c4db
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef GETLABELCOMMAND_H
+#define GETLABELCOMMAND_H
+
+/*
+ *  getlabelcommand.h
+ *  Mothur
+ *
+ *  Created by Thomas Ryabin on 1/30/09.
+ *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include "command.hpp"
+#include "readmatrix.hpp"
+
+class GlobalData;
+
+class GetlabelCommand : public Command {
+public:
+       GetlabelCommand();
+       ~GetlabelCommand();
+       int execute();
+       
+private:
+       GlobalData* globaldata;
+       string filename;
+};
+
+#endif
\ No newline at end of file
diff --git a/getlinecommand.cpp b/getlinecommand.cpp
new file mode 100644 (file)
index 0000000..63dde60
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ *  GetlineCommand.cpp
+ *  Mothur
+ *
+ *  Created by Thomas Ryabin on 1/30/09.
+ *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "getlinecommand.h"
+
+
+
+
+
+
+GetlineCommand::GetlineCommand(){
+       try {
+               globaldata = GlobalData::getInstance();
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the GetlineCommand class Function GetlineCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the GetlineCommand class function GetlineCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+                       
+}
+
+//**********************************************************************************************************************
+
+GetlineCommand::~GetlineCommand(){
+}
+
+//**********************************************************************************************************************
+
+int GetlineCommand::execute(){
+       try {
+               filename = globaldata->inputFileName;
+               ifstream in;
+               openInputFile(filename, in);
+               string label;
+               int numBins = 0;
+               int count = -1;
+               int line = 1;
+               while(in.good())
+               {
+                       if(count > numBins)
+                               count = 0;
+                       if(count == 0)
+                       {
+                               cout << line << "\n";
+                               in >> numBins;
+                               line++;
+                       }
+                       in >> label;
+                       count++;
+               }
+               return 0;               
+       }
+
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the GetlineCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the GetlineCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
+
+
+
diff --git a/getlinecommand.h b/getlinecommand.h
new file mode 100644 (file)
index 0000000..295fe99
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef GETLINECOMMAND_H
+#define GETLINECOMMAND_H
+
+/*
+ *  getlinecommand.h
+ *  Mothur
+ *
+ *  Created by Thomas Ryabin on 1/30/09.
+ *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include "command.hpp"
+#include "readmatrix.hpp"
+
+class GlobalData;
+
+class GetlineCommand : public Command {
+public:
+       GetlineCommand();
+       ~GetlineCommand();
+       int execute();
+       
+private:
+       GlobalData* globaldata;
+       string filename;
+};
+
+#endif
index b36545effa90467bbfeddab77c56351ebeea934a..31a63b67adad73bd7e46487a4849cee6135f6ede 100644 (file)
@@ -97,7 +97,6 @@ private:
        ~GlobalData();
        ListVector* gListVector;
        SparseMatrix* gSparseMatrix;
-       void clear();  //clears all parameters
        void reset();   //clears all non filename parameters
        
        
index df33e5d7a01ed9ca053cee3849bd5bd1448bda23..594b1dde19ee6f48bfbe6641133428513c22c27f 100644 (file)
@@ -38,7 +38,7 @@ RareFactCommand::RareFactCommand(){
                                        convert(globaldata->getAbund(), abund);
                                        if(abund < 5)
                                                abund = 10;
-                                       rDisplays.push_back(new RareDisplay(new Ace(), new ThreeColumnFile(fileNameRoot+"r_ace")));
+                                       rDisplays.push_back(new RareDisplay(new Ace(abund), new ThreeColumnFile(fileNameRoot+"r_ace")));
                                }else if (globaldata->Estimators[i] == "jack") { 
                                        rDisplays.push_back(new RareDisplay(new Jackknife(), new ThreeColumnFile(fileNameRoot+"r_jack")));
                                }else if (globaldata->Estimators[i] == "shannon") { 
index 06cc9b027de971c65204e3254ef07cc1eacae320..36a4e0efb5fc9fdbbe8587eca17886c8b5c55ea4 100644 (file)
@@ -35,7 +35,7 @@ SummaryCommand::SummaryCommand(){
                                        convert(globaldata->getAbund(), abund);
                                        if(abund < 5)
                                                abund = 10;
-                                       sumCalculators.push_back(new Ace());
+                                       sumCalculators.push_back(new Ace(abund));
                                }else if(globaldata->Estimators[i] == "jack"){
                                        sumCalculators.push_back(new Jackknife());
                                }else if(globaldata->Estimators[i] == "shannon"){