From: westcott Date: Mon, 9 Mar 2009 15:16:01 +0000 (+0000) Subject: deleted read.shared command and added its functionality to read.otu. X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=39ef0543b73cb12dfc64529522b66ad3df7527d0 deleted read.shared command and added its functionality to read.otu. --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index e79c94c..a403f35 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -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 */; }; @@ -144,8 +143,6 @@ 37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtree.cpp; sourceTree = ""; }; 37AFC71D0F445386005F492D /* sharedsobscollectsummary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedsobscollectsummary.h; sourceTree = ""; }; 37AFC71E0F445386005F492D /* sharedsobscollectsummary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedsobscollectsummary.cpp; sourceTree = ""; }; - 37AFC7A10F44703E005F492D /* readsharedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readsharedcommand.h; sourceTree = ""; }; - 37AFC7A20F44703E005F492D /* readsharedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readsharedcommand.cpp; sourceTree = ""; }; 37B28F660F27590100808A62 /* deconvolutecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deconvolutecommand.h; sourceTree = ""; }; 37B28F670F27590100808A62 /* deconvolutecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = deconvolutecommand.cpp; sourceTree = ""; }; 37D927B80F21331F001D4494 /* ace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ace.cpp; sourceTree = ""; }; @@ -493,8 +490,6 @@ 372E12950F263D5A0095CF7E /* readdistcommand.cpp */, 372E126E0F26365B0095CF7E /* readotucommand.h */, 372E126F0F26365B0095CF7E /* readotucommand.cpp */, - 37AFC7A10F44703E005F492D /* readsharedcommand.h */, - 37AFC7A20F44703E005F492D /* readsharedcommand.cpp */, 37E5F4900F2A3DA800F8D827 /* readtreecommand.h */, 37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */, 37D928270F21331F001D4494 /* sharedcommand.h */, @@ -700,7 +695,6 @@ 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 */, diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index c473c2d..e61fb9b 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -31,9 +31,6 @@ CollectSharedCommand::CollectSharedCommand(){ format = globaldata->getFormat(); validCalculator = new ValidCalculators(); - //set users groups - setGroups(); - int i; for (i=0; iEstimators.size(); i++) { if (validCalculator->isValidCalculator("shared", globaldata->Estimators[i]) == true) { @@ -112,6 +109,9 @@ int CollectSharedCommand::execute(){ order = SharedList->getSharedOrderVector(); } set orderList; + + //set users groups + setGroups(); while(order != NULL){ orderList.insert(order->getLabel()); diff --git a/commandfactory.cpp b/commandfactory.cpp index e05f8df..a5ec5f1 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -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(); } diff --git a/errorchecking.cpp b/errorchecking.cpp index d827929..430729d 100644 --- a/errorchecking.cpp +++ b/errorchecking.cpp @@ -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") { diff --git a/globaldata.cpp b/globaldata.cpp index 60a106a..3ddd02e 100644 --- a/globaldata.cpp +++ b/globaldata.cpp @@ -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(); diff --git a/helpcommand.cpp b/helpcommand.cpp index 9fb5ad7..05592fc 100644 --- a/helpcommand.cpp +++ b/helpcommand.cpp @@ -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"; diff --git a/rarefactsharedcommand.cpp b/rarefactsharedcommand.cpp index 9bd8805..58f73f3 100644 --- a/rarefactsharedcommand.cpp +++ b/rarefactsharedcommand.cpp @@ -19,8 +19,6 @@ RareFactSharedCommand::RareFactSharedCommand(){ fileNameRoot = getRootName(globaldata->inputFileName); format = globaldata->getFormat(); validCalculator = new ValidCalculators(); - - setGroups(); int i; for (i=0; iEstimators.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 index 0035156..0000000 --- a/readsharedcommand.cpp +++ /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 index 6cb16b3..0000000 --- a/readsharedcommand.h +++ /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 - - - - diff --git a/summarysharedcommand.cpp b/summarysharedcommand.cpp index fcd2b00..040de20 100644 --- a/summarysharedcommand.cpp +++ b/summarysharedcommand.cpp @@ -31,9 +31,6 @@ SummarySharedCommand::SummarySharedCommand(){ format = globaldata->getFormat(); validCalculator = new ValidCalculators(); - //set users groups - setGroups(); - int i; for (i=0; iEstimators.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){ diff --git a/validcommands.cpp b/validcommands.cpp index e0d6045..1ccb8fc 100644 --- a/validcommands.cpp +++ b/validcommands.cpp @@ -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";