]> git.donarmstrong.com Git - mothur.git/commitdiff
deleted read.shared command and added its functionality to read.otu.
authorwestcott <westcott>
Mon, 9 Mar 2009 15:16:01 +0000 (15:16 +0000)
committerwestcott <westcott>
Mon, 9 Mar 2009 15:16:01 +0000 (15:16 +0000)
Mothur.xcodeproj/project.pbxproj
collectsharedcommand.cpp
commandfactory.cpp
errorchecking.cpp
globaldata.cpp
helpcommand.cpp
rarefactsharedcommand.cpp
readsharedcommand.cpp [deleted file]
readsharedcommand.h [deleted file]
summarysharedcommand.cpp
validcommands.cpp

index e79c94c3662ad0241e2024272853a579d5ea497c..a403f35250d8e910f63798ac2ae26e46798b810c 100644 (file)
@@ -22,7 +22,6 @@
                37AD4DBB0F28E2FE00AA2D49 /* tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */; };
                37AD4DCA0F28F3DD00AA2D49 /* readtree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */; };
                37AFC71F0F445386005F492D /* sharedsobscollectsummary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AFC71E0F445386005F492D /* sharedsobscollectsummary.cpp */; };
-               37AFC7A30F44703E005F492D /* readsharedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AFC7A20F44703E005F492D /* readsharedcommand.cpp */; };
                37B28F680F27590100808A62 /* deconvolutecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37B28F670F27590100808A62 /* deconvolutecommand.cpp */; };
                37D928550F21331F001D4494 /* ace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927B80F21331F001D4494 /* ace.cpp */; };
                37D928560F21331F001D4494 /* averagelinkage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927BA0F21331F001D4494 /* averagelinkage.cpp */; };
                37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtree.cpp; sourceTree = "<group>"; };
                37AFC71D0F445386005F492D /* sharedsobscollectsummary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedsobscollectsummary.h; sourceTree = "<group>"; };
                37AFC71E0F445386005F492D /* sharedsobscollectsummary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedsobscollectsummary.cpp; sourceTree = "<group>"; };
-               37AFC7A10F44703E005F492D /* readsharedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readsharedcommand.h; sourceTree = "<group>"; };
-               37AFC7A20F44703E005F492D /* readsharedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readsharedcommand.cpp; sourceTree = "<group>"; };
                37B28F660F27590100808A62 /* deconvolutecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deconvolutecommand.h; sourceTree = "<group>"; };
                37B28F670F27590100808A62 /* deconvolutecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = deconvolutecommand.cpp; sourceTree = "<group>"; };
                37D927B80F21331F001D4494 /* ace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ace.cpp; sourceTree = "<group>"; };
                                372E12950F263D5A0095CF7E /* readdistcommand.cpp */,
                                372E126E0F26365B0095CF7E /* readotucommand.h */,
                                372E126F0F26365B0095CF7E /* readotucommand.cpp */,
-                               37AFC7A10F44703E005F492D /* readsharedcommand.h */,
-                               37AFC7A20F44703E005F492D /* readsharedcommand.cpp */,
                                37E5F4900F2A3DA800F8D827 /* readtreecommand.h */,
                                37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */,
                                37D928270F21331F001D4494 /* sharedcommand.h */,
                                374610830F40652400460C57 /* unweighted.cpp in Sources */,
                                3746109D0F40657600460C57 /* unifracunweightedcommand.cpp in Sources */,
                                37AFC71F0F445386005F492D /* sharedsobscollectsummary.cpp in Sources */,
-                               37AFC7A30F44703E005F492D /* readsharedcommand.cpp in Sources */,
                                A70B53AA0F4CD7AD0064797E /* getgroupcommand.cpp in Sources */,
                                A70B53AB0F4CD7AD0064797E /* getlabelcommand.cpp in Sources */,
                                A70B53AC0F4CD7AD0064797E /* getlinecommand.cpp in Sources */,
index c473c2d77e819164d62799095ea6bf849d27c42a..e61fb9bd02bad10c693bab5ce8a54ffa2b66f03f 100644 (file)
@@ -31,9 +31,6 @@ CollectSharedCommand::CollectSharedCommand(){
                format = globaldata->getFormat();
                validCalculator = new ValidCalculators();
                
-               //set users groups
-               setGroups();
-               
                int i;
                for (i=0; i<globaldata->Estimators.size(); i++) {
                        if (validCalculator->isValidCalculator("shared", globaldata->Estimators[i]) == true) { 
@@ -112,6 +109,9 @@ int CollectSharedCommand::execute(){
                        order = SharedList->getSharedOrderVector();
                }
                set<string> orderList;
+               
+               //set users groups
+               setGroups();
 
                while(order != NULL){
                        orderList.insert(order->getLabel());
index e05f8dffa1cb5d1c13716152773793fc509ad96c..a5ec5f12c48059089496af3a39d26b0fedb12f52 100644 (file)
@@ -10,7 +10,6 @@
 #include "command.hpp"
 #include "readdistcommand.h"
 #include "readtreecommand.h"
-#include "readsharedcommand.h"
 #include "readotucommand.h"
 #include "clustercommand.h"
 #include "parselistcommand.h"
@@ -59,7 +58,6 @@ Command* CommandFactory::getCommand(string commandName){
                         if(commandName == "read.dist")                         {       command = new ReadDistCommand();                        }
                else if(commandName == "read.otu")                              {       command = new ReadOtuCommand();                         }
                else if(commandName == "read.tree")                             {       command = new ReadTreeCommand();                        }
-               else if(commandName == "read.shared")                   {       command = new ReadSharedCommand();                      }
                else if(commandName == "cluster")                               {       command = new ClusterCommand();                         }
                else if(commandName == "deconvolute")                   {       command = new DeconvoluteCommand();                     }
                else if(commandName == "parsimony")                             {       command = new ParsimonyCommand();                       }
index d827929fd94290dbfb302d0fe36e76f4982874a0..430729d026ec5082416d2cdc118413dee290e48d 100644 (file)
@@ -352,13 +352,12 @@ bool ErrorCheck::checkInput(string input) {
                        //you want to do shared commands
                        if ((listfile != "") && (groupfile != ""))      {
                                validateParseFiles(); //checks the listfile and groupfile parameters
-                       }else { //you want to do single commands
+                       }else if (listfile != "") { //you want to do single commands
                                validateReadFiles();
                                validateReadPhil();
+                       }else {//you are reading a shared file
+                               validateReadFiles();
                        }
-               }else if (commandName == "read.shared") { 
-                       //you want to do shared commands with just the shared file
-                       validateReadFiles();
                }else if (commandName == "read.tree") { 
                        validateTreeFiles(); //checks the treefile and groupfile parameters
                }else if (commandName == "deconvolute") {
index 60a106a17eb6ce31e75b51a088bb2261e1815361..3ddd02e5c24dc03cd8ff7549b6b03a32982562e9 100644 (file)
@@ -27,7 +27,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                reset();
                
                //clears out data from previous read
-               if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree") || (commandName == "read.shared")) { 
+               if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree")) { 
                        clear();
                        gGroupmap = NULL;
                        gTree.clear();
index 9fb5ad7ce66af542c02b7b302eda606f67f53396..05592fc91577a171a83f1697224907bc3878566d 100644 (file)
@@ -40,9 +40,9 @@ int HelpCommand::execute(){
                cout << "The list, rabund or sabund parameter is required, but you may only use one of them." << "\n";
                cout << "The line and label parameters are optional but you may not use both the line and label parameters at the same time." << "\n";
                cout << "The label and line parameters are used to read specific lines in your input." << "\n";
-               cout << "The second way to use the read.otu command is to read a list and a group so you can use the collect.shared, rarefaction.shared or summary.shared commands." << "\n";
-               cout << "In this case the read.otu command should be in the following format: read.otu(list=yourListFile, group=yourGroupFile, line=yourLines).  " << "\n";
-               cout << "The list parameter and group paramaters are required. When using the command the second way read.otu command parses the .list file" << "\n";
+               cout << "The second way to use the read.otu command is to read a list and a group, or a shared so you can use the collect.shared, rarefaction.shared or summary.shared commands." << "\n";
+               cout << "In this case the read.otu command should be in the following format: read.otu(list=yourListFile, group=yourGroupFile, line=yourLines) or read.otu(shared=yourSharedFile).  " << "\n";
+               cout << "The list parameter and group paramaters or the shared paremeter is required. When using the command the second way with a list and group file read.otu command parses the .list file" << "\n";
                cout << "and separates it into groups.  It outputs a .shared file containing the OTU information for each group. The read.otu command also outputs a .list file for each group. " << "\n";
                cout << "Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "read.tree") {
@@ -51,11 +51,6 @@ int HelpCommand::execute(){
                cout << "The read.tree command should be in the following format: read.tree(tree=yourTreeFile, group=yourGroupFile)." << "\n";
                cout << "The tree and group parameters are both required." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. tree), '=' and parameters (i.e.yourTreefile)." << "\n" << "\n";
-       }else if (globaldata->helpRequest == "read.shared") {
-               cout << "The read.shared must be run before you execute a collect.shared, rarefaction.shared or summary.shared command." << "\n";
-               cout << "The read.shared command is used to read a shared file. The read.shared should be entered in the following format:" << "\n";
-               cout << "read.shared(shared=yourSharedFile). The shared parameter is required." << "\n";
-               cout << "Note: No spaces between parameter labels (i.e. shared), '=' and parameters (i.e.yourSharedfile)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "cluster") {
                cout << "The cluster command can only be executed after a successful read.dist command." << "\n";
                cout << "The cluster command parameter options are method, cuttoff and precision. No parameters are required." << "\n";
index 9bd8805f4867a6e445b42324d8b13d406471eace..58f73f34e45b61b30e5355ebd38cfa63f988448d 100644 (file)
@@ -19,8 +19,6 @@ RareFactSharedCommand::RareFactSharedCommand(){
                fileNameRoot = getRootName(globaldata->inputFileName);
                format = globaldata->getFormat();
                validCalculator = new ValidCalculators();
-               
-               setGroups();
                                
                int i;
                for (i=0; i<globaldata->Estimators.size(); i++) {
@@ -80,6 +78,9 @@ int RareFactSharedCommand::execute(){
                        order = SharedList->getSharedOrderVector();
                }
                
+               //set users groups
+               setGroups();
+               
                while(order != NULL){
                
                        if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
diff --git a/readsharedcommand.cpp b/readsharedcommand.cpp
deleted file mode 100644 (file)
index 0035156..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  readsharedcommand.cpp
- *  Mothur
- *
- *  Created by Sarah Westcott on 2/12/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include "readsharedcommand.h"
-
-//**********************************************************************************************************************
-ReadSharedCommand::ReadSharedCommand(){
-       try {
-               globaldata = GlobalData::getInstance();
-               filename = globaldata->inputFileName;
-               read = new ReadPhilFile(filename);
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadSharedCommand class Function ReadSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadSharedCommand class function ReadSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-//**********************************************************************************************************************
-
-ReadSharedCommand::~ReadSharedCommand(){
-       delete read;
-}
-
-//**********************************************************************************************************************
-
-int ReadSharedCommand::execute(){
-       try {
-               read->read(&*globaldata); 
-       
-               return 0;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadSharedCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadSharedCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-//**********************************************************************************************************************
\ No newline at end of file
diff --git a/readsharedcommand.h b/readsharedcommand.h
deleted file mode 100644 (file)
index 6cb16b3..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef READSHAREDCOMMAND_H
-#define READSHAREDCOMMAND_H
-/*
- *  readsharedcommand.h
- *  Mothur
- *
- *  Created by Sarah Westcott on 2/12/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include "command.hpp"
-#include "readmatrix.hpp"
-#include "inputdata.h"
-
-/* The read.shared must be run before you execute a collect.shared, rarefaction.shared or summary.shared command.
-The read.shared command is used to read a shared file. The read.shared should be entered in the following format:
-read.shared(shared=yourSharedFile). The shared parameter is required.  */
-
-class GlobalData;
-
-class ReadSharedCommand : public Command {
-public:
-       ReadSharedCommand();
-       ~ReadSharedCommand();
-       int execute();
-       
-private:
-       GlobalData* globaldata;
-       ReadMatrix* read;
-       InputData* input;
-       string filename;
-};
-
-#endif
-
-
-
-
index fcd2b00ea28805a54646524d831dd90d9784100e..040de2067faf9d0dd9d1de74b2b4f6fe2f6a0086 100644 (file)
@@ -31,9 +31,6 @@ SummarySharedCommand::SummarySharedCommand(){
                format = globaldata->getFormat();
                validCalculator = new ValidCalculators();
                
-               //set users groups
-               setGroups();
-               
                int i;
                for (i=0; i<globaldata->Estimators.size(); i++) {
                        if (validCalculator->isValidCalculator("sharedsummary", globaldata->Estimators[i]) == true) { 
@@ -114,6 +111,9 @@ int SummarySharedCommand::execute(){
                        outputFileHandle << '\t' << sumCalculators[i]->getName();
                }
                outputFileHandle << endl;
+               
+               //set users groups
+               setGroups();
 
                while(order != NULL){
                
index e0d604543ec564f1e364426a9f61c613e97ffea0..1ccb8fca51577674af1ecb2fa5fe895655330654 100644 (file)
@@ -17,7 +17,6 @@ ValidCommands::ValidCommands() {
                commands["read.dist"]                   = "read.dist"; 
                commands["read.otu"]                    = "read.otu";
                commands["read.tree"]                   = "read.tree"; 
-               commands["read.shared"]                 = "read.shared";
                commands["cluster"]                             = "cluster"; 
                commands["deconvolute"]                 = "deconvolute"; 
                commands["parsimony"]                   = "parsimony";