3746107E0F4064D100460C57 /* weighted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3746107D0F4064D100460C57 /* weighted.cpp */; };
374610830F40652400460C57 /* unweighted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 374610820F40652400460C57 /* unweighted.cpp */; };
3746109D0F40657600460C57 /* unifracunweightedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3746109C0F40657600460C57 /* unifracunweightedcommand.cpp */; };
+ 3749271D0FD58C840031C06B /* getsabundcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3749271C0FD58C840031C06B /* getsabundcommand.cpp */; };
+ 3749273F0FD5956B0031C06B /* getrabundcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3749273E0FD5956B0031C06B /* getrabundcommand.cpp */; };
37519A6B0F80E6EB00FED5E8 /* sharedanderbergs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37519A6A0F80E6EB00FED5E8 /* sharedanderbergs.cpp */; };
37519AA10F810D0200FED5E8 /* venncommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37519AA00F810D0200FED5E8 /* venncommand.cpp */; };
37519AB50F810FAE00FED5E8 /* venn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37519AB40F810FAE00FED5E8 /* venn.cpp */; };
379294700F2E191800B9034A /* parsimonycommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3792946F0F2E191800B9034A /* parsimonycommand.cpp */; };
3792948A0F2E258500B9034A /* parsimony.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379294890F2E258500B9034A /* parsimony.cpp */; };
379643ED0FB9B5A80081FDB6 /* readseqs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379643EB0FB9B5A80081FDB6 /* readseqs.cpp */; };
+ 3799A9500FD6A58C00E33EDE /* distancedb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3799A94C0FD6A58C00E33EDE /* distancedb.cpp */; };
+ 3799A9510FD6A58C00E33EDE /* seqsummarycommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3799A94E0FD6A58C00E33EDE /* seqsummarycommand.cpp */; };
37AD4CE40F28AEA300AA2D49 /* sharedlistvector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4CE30F28AEA300AA2D49 /* sharedlistvector.cpp */; };
37AD4DBB0F28E2FE00AA2D49 /* tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */; };
37AD4DCA0F28F3DD00AA2D49 /* readtree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */; };
7E412F490F8D21B600381DD0 /* slibshuff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E412F480F8D21B600381DD0 /* slibshuff.cpp */; };
7E412FEA0F8D3E2C00381DD0 /* libshuff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E412FE90F8D3E2C00381DD0 /* libshuff.cpp */; };
7E4130F80F8E58FA00381DD0 /* dlibshuff.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4130F60F8E58FA00381DD0 /* dlibshuff.cpp */; };
- 7E9214820FD2081200699BF3 /* seqsummarycommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E9214810FD2081200699BF3 /* seqsummarycommand.cpp */; };
7EC3D4550FA0FFF900338DA5 /* coverage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EC3D4500FA0FFF900338DA5 /* coverage.cpp */; };
7EC3D4560FA0FFF900338DA5 /* whittaker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EC3D4530FA0FFF900338DA5 /* whittaker.cpp */; };
8DD76F6A0486A84900D96B5E /* Mothur.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Mothur.1 */; };
374610820F40652400460C57 /* unweighted.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unweighted.cpp; sourceTree = SOURCE_ROOT; };
3746109B0F40657600460C57 /* unifracunweightedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unifracunweightedcommand.h; sourceTree = SOURCE_ROOT; };
3746109C0F40657600460C57 /* unifracunweightedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unifracunweightedcommand.cpp; sourceTree = SOURCE_ROOT; };
+ 3749271B0FD58C840031C06B /* getsabundcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getsabundcommand.h; sourceTree = "<group>"; };
+ 3749271C0FD58C840031C06B /* getsabundcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getsabundcommand.cpp; sourceTree = "<group>"; };
+ 3749273D0FD5956B0031C06B /* getrabundcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getrabundcommand.h; sourceTree = "<group>"; };
+ 3749273E0FD5956B0031C06B /* getrabundcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getrabundcommand.cpp; sourceTree = "<group>"; };
37519A690F80E6EB00FED5E8 /* sharedanderbergs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedanderbergs.h; sourceTree = SOURCE_ROOT; };
37519A6A0F80E6EB00FED5E8 /* sharedanderbergs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedanderbergs.cpp; sourceTree = SOURCE_ROOT; };
37519A9F0F810D0200FED5E8 /* venncommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = venncommand.h; sourceTree = SOURCE_ROOT; };
3792948D0F2E271100B9034A /* treecalculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = treecalculator.h; sourceTree = SOURCE_ROOT; };
379643EB0FB9B5A80081FDB6 /* readseqs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readseqs.cpp; sourceTree = SOURCE_ROOT; };
379643EC0FB9B5A80081FDB6 /* readseqs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readseqs.h; sourceTree = SOURCE_ROOT; };
+ 3799A94C0FD6A58C00E33EDE /* distancedb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = distancedb.cpp; sourceTree = "<group>"; };
+ 3799A94D0FD6A58C00E33EDE /* distancedb.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = distancedb.hpp; sourceTree = "<group>"; };
+ 3799A94E0FD6A58C00E33EDE /* seqsummarycommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = seqsummarycommand.cpp; sourceTree = "<group>"; };
+ 3799A94F0FD6A58C00E33EDE /* seqsummarycommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = seqsummarycommand.h; sourceTree = "<group>"; };
37AD4CE20F28AEA300AA2D49 /* sharedlistvector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedlistvector.h; sourceTree = SOURCE_ROOT; };
37AD4CE30F28AEA300AA2D49 /* sharedlistvector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedlistvector.cpp; sourceTree = SOURCE_ROOT; };
37AD4DB90F28E2FE00AA2D49 /* tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = SOURCE_ROOT; };
7E412FE90F8D3E2C00381DD0 /* libshuff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libshuff.cpp; sourceTree = SOURCE_ROOT; };
7E4130F60F8E58FA00381DD0 /* dlibshuff.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dlibshuff.cpp; sourceTree = SOURCE_ROOT; };
7E4130F70F8E58FA00381DD0 /* dlibshuff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dlibshuff.h; sourceTree = SOURCE_ROOT; };
- 7E9214800FD2081200699BF3 /* seqsummarycommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = seqsummarycommand.h; sourceTree = "<group>"; };
- 7E9214810FD2081200699BF3 /* seqsummarycommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = seqsummarycommand.cpp; sourceTree = "<group>"; };
7EC3D4500FA0FFF900338DA5 /* coverage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = coverage.cpp; sourceTree = SOURCE_ROOT; };
7EC3D4510FA0FFF900338DA5 /* coverage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coverage.h; sourceTree = SOURCE_ROOT; };
7EC3D4520FA0FFF900338DA5 /* sharedanderberg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedanderberg.h; sourceTree = SOURCE_ROOT; };
37D928A90F2133E5001D4494 /* commands */ = {
isa = PBXGroup;
children = (
- 7E9214800FD2081200699BF3 /* seqsummarycommand.h */,
- 7E9214810FD2081200699BF3 /* seqsummarycommand.cpp */,
37D927CD0F21331F001D4494 /* command.hpp */,
378DC5CD0FBDE1C8003B8607 /* aligncommand.h */,
378DC5CE0FBDE1C8003B8607 /* aligncommand.cpp */,
A70B53A80F4CD7AD0064797E /* getlinecommand.cpp */,
370B88050F8A4EE4005AB382 /* getoturepcommand.h */,
370B88060F8A4EE4005AB382 /* getoturepcommand.cpp */,
+ 3749273D0FD5956B0031C06B /* getrabundcommand.h */,
+ 3749273E0FD5956B0031C06B /* getrabundcommand.cpp */,
+ 3749271B0FD58C840031C06B /* getsabundcommand.h */,
+ 3749271C0FD58C840031C06B /* getsabundcommand.cpp */,
375873F10F7D64800040F377 /* heatmapcommand.h */,
375873F00F7D64800040F377 /* heatmapcommand.cpp */,
37D927E40F21331F001D4494 /* helpcommand.h */,
372E126F0F26365B0095CF7E /* readotucommand.cpp */,
37E5F4900F2A3DA800F8D827 /* readtreecommand.h */,
37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */,
+ 3799A94E0FD6A58C00E33EDE /* seqsummarycommand.cpp */,
+ 3799A94F0FD6A58C00E33EDE /* seqsummarycommand.h */,
37D928270F21331F001D4494 /* sharedcommand.h */,
37D928260F21331F001D4494 /* sharedcommand.cpp */,
37D928470F21331F001D4494 /* summarycommand.h */,
37D927D40F21331F001D4494 /* database.hpp */,
37D927D30F21331F001D4494 /* database.cpp */,
37D927D50F21331F001D4494 /* datavector.hpp */,
+ 3799A94C0FD6A58C00E33EDE /* distancedb.cpp */,
+ 3799A94D0FD6A58C00E33EDE /* distancedb.hpp */,
37D927DC0F21331F001D4494 /* fastamap.h */,
37D927DB0F21331F001D4494 /* fastamap.cpp */,
375873EA0F7D64520040F377 /* fullmatrix.h */,
373C699C0FC1E63600137ACD /* solow.cpp in Sources */,
EB72FE260FC1F5CA0051AC11 /* shen.cpp in Sources */,
21E859D80FC4632E005E1A48 /* matrixoutputcommand.cpp in Sources */,
- 7E9214820FD2081200699BF3 /* seqsummarycommand.cpp in Sources */,
+ 3749271D0FD58C840031C06B /* getsabundcommand.cpp in Sources */,
+ 3749273F0FD5956B0031C06B /* getrabundcommand.cpp in Sources */,
+ 3799A9500FD6A58C00E33EDE /* distancedb.cpp in Sources */,
+ 3799A9510FD6A58C00E33EDE /* seqsummarycommand.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
- while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(list->getLabel()) == 1){
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
-
+ userLines.erase(count);
}
if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastList->getLabel()) != 1)) {
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
//set users groups
util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "treegroup");
tmap->makeSim(globaldata->gGroupmap);
globaldata->gTreemap = tmap;
- while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
-
- //you have a label the user want that is smaller than this line and the last line has not already been processed
+ userLines.erase(count);
}
+ //you have a label the user want that is smaller than this line and the last line has not already been processed
if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastOrder->getLabel()) != 1)) {
cout << lastOrder->getLabel() << '\t' << count << endl;
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
- while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
cout << order->getLabel() << '\t' << count << endl;
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
+ userLines.erase(count);
//you have a label the user want that is smaller than this line and the last line has not already been processed
}
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
//set users groups
util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "collect");
util->updateGroupIndex(globaldata->Groups, globaldata->gGroupmap->groupIndex);
- while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
cout << order->getLabel() << '\t' << count << endl;
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
+ userLines.erase(count);
//you have a label the user want that is smaller than this line and the last line has not already been processed
}
#include "distancecommand.h"
#include "aligncommand.h"
#include "matrixoutputcommand.h"
+#include "getsabundcommand.h"
+#include "getrabundcommand.h"
#include "seqsummarycommand.h"
+
/***********************************************************/
/***********************************************************/
else if(commandName == "get.group") { command = new GetgroupCommand(); }
else if(commandName == "get.label") { command = new GetlabelCommand(); }
else if(commandName == "get.line") { command = new GetlineCommand(); }
+ else if(commandName == "get.sabund") { command = new GetSAbundCommand(); }
+ else if(commandName == "get.rabund") { command = new GetRAbundCommand(); }
else if(commandName == "libshuff") { command = new LibShuffCommand(); }
else if(commandName == "heatmap") { command = new HeatMapCommand(); }
else if(commandName == "filter.seqs") { command = new FilterSeqsCommand(); }
else {cout << "Not a valid clustering method. Valid clustering algorithms are furthest, nearest or average." << endl; return false; }
}
- if ((commandName == "collect.single") || (commandName == "rarefaction.single") || (commandName == "summary.single") ){
+ if ((commandName == "collect.single") || (commandName == "rarefaction.single") || (commandName == "summary.single")){
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 == "get.rabund") {
+ if (globaldata->getListFile() == "") { cout << "You must read a listfile before you can use the get.rabund command." << endl; return false; }
+ }
+
+ if (commandName == "get.sabund") {
+ if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "")) { cout << "You must read a list or rabund before you can use the get.sabund command." << endl; return false; }
+ }
+
if ((commandName == "collect.shared") || (commandName == "rarefaction.shared") || (commandName == "summary.shared") || (commandName == "bootstrap.shared") || (commandName == "dist.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, tree.shared, bootstrap.shared or dist.shared commands." << endl; return false; }
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
- while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(list->getLabel()) == 1){
cout << list->getLabel() << '\t' << count << endl;
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastList->getLabel()) != 1)) {
--- /dev/null
+/*
+ * getrabundcommand.cpp
+ * Mothur
+ *
+ * Created by Sarah Westcott on 6/2/09.
+ * Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "getrabundcommand.h"
+
+//**********************************************************************************************************************
+
+GetRAbundCommand::GetRAbundCommand(){
+ try {
+ globaldata = GlobalData::getInstance();
+ filename = getRootName(globaldata->inputFileName) + "rabund";
+
+ openOutputFile(filename, out);
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the GetRAbundCommand class Function GetRAbundCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the GetRAbundCommand class function GetRAbundCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+
+}
+
+//**********************************************************************************************************************
+
+GetRAbundCommand::~GetRAbundCommand(){
+}
+
+//**********************************************************************************************************************
+
+int GetRAbundCommand::execute(){
+ try {
+ int count = 1;
+
+ //read first line
+ read = new ReadOTUFile(globaldata->inputFileName);
+ read->read(&*globaldata);
+
+ input = globaldata->ginput;
+ list = globaldata->gListVector;
+ ListVector* lastList = list;
+
+ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
+ set<string> processedLabels;
+ set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
+
+
+ while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
+
+ if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(list->getLabel()) == 1){
+ cout << list->getLabel() << '\t' << count << endl;
+ rabund = new RAbundVector();
+ *rabund = (list->getRAbundVector());
+ rabund->print(out);
+ delete rabund;
+
+ processedLabels.insert(list->getLabel());
+ userLabels.erase(list->getLabel());
+ userLines.erase(count);
+ }
+
+ if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastList->getLabel()) != 1)) {
+ cout << lastList->getLabel() << '\t' << count << endl;
+ rabund = new RAbundVector();
+ *rabund = (lastList->getRAbundVector());
+ rabund->print(out);
+ delete rabund;
+
+ processedLabels.insert(lastList->getLabel());
+ userLabels.erase(lastList->getLabel());
+ }
+
+ if (count != 1) { delete lastList; }
+ lastList = list;
+
+ list = input->getListVector();
+ count++;
+ }
+
+ //output error messages about any remaining user labels
+ set<string>::iterator it;
+ bool needToRun = false;
+ for (it = userLabels.begin(); it != userLabels.end(); it++) {
+ cout << "Your file does not include the label "<< *it;
+ if (processedLabels.count(lastList->getLabel()) != 1) {
+ cout << ". I will use " << lastList->getLabel() << "." << endl;
+ needToRun = true;
+ }else {
+ cout << ". Please refer to " << lastList->getLabel() << "." << endl;
+ }
+ }
+
+ //run last line if you need to
+ if (needToRun == true) {
+ cout << lastList->getLabel() << '\t' << count << endl;
+ rabund = new RAbundVector();
+ *rabund = (lastList->getRAbundVector());
+ rabund->print(out);
+ delete rabund;
+ }
+ delete lastList;
+
+ out.close();
+ return 0;
+ }
+
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the GetRAbundCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the GetRAbundCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+
--- /dev/null
+#ifndef GETRABUNDCOMMAND_H
+#define GETRABUNDCOMMAND_H
+
+/*
+ * getrabundcommand.h
+ * Mothur
+ *
+ * Created by Sarah Westcott on 6/2/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+
+#include "command.hpp"
+#include "inputdata.h"
+#include "readotu.h"
+#include "listvector.hpp"
+
+class GlobalData;
+
+class GetRAbundCommand : public Command {
+public:
+ GetRAbundCommand();
+ ~GetRAbundCommand();
+ int execute();
+
+private:
+ GlobalData* globaldata;
+ string filename;
+ ofstream out;
+ ReadOTUFile* read;
+ InputData* input;
+ ListVector* list;
+ RAbundVector* rabund;
+};
+
+#endif
+
--- /dev/null
+/*
+ * getsabundcommand.cpp
+ * Mothur
+ *
+ * Created by Sarah Westcott on 6/2/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "getsabundcommand.h"
+
+//**********************************************************************************************************************
+
+GetSAbundCommand::GetSAbundCommand(){
+ try {
+ globaldata = GlobalData::getInstance();
+ filename = getRootName(globaldata->inputFileName) + "sabund";
+
+ openOutputFile(filename, out);
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the GetSAbundCommand class Function GetSAbundCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the GetSAbundCommand class function GetSAbundCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+
+}
+
+//**********************************************************************************************************************
+
+GetSAbundCommand::~GetSAbundCommand(){
+}
+
+//**********************************************************************************************************************
+
+int GetSAbundCommand::execute(){
+ try {
+ int count = 1;
+
+ //using order vector so you don't have to distinguish between the list and rabund files
+ read = new ReadOTUFile(globaldata->inputFileName);
+ read->read(&*globaldata);
+
+ order = globaldata->gorder;
+ lastOrder = order;
+ input = globaldata->ginput;
+
+ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
+ set<string> processedLabels;
+ set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
+
+
+ while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
+
+ if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
+ cout << order->getLabel() << '\t' << count << endl;
+ sabund = new SAbundVector();
+ *sabund = (order->getSAbundVector());
+ sabund->print(out);
+ delete sabund;
+
+ processedLabels.insert(order->getLabel());
+ userLabels.erase(order->getLabel());
+ userLines.erase(count);
+ }
+
+ if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastOrder->getLabel()) != 1)) {
+ cout << lastOrder->getLabel() << '\t' << count << endl;
+ sabund = new SAbundVector();
+ *sabund = (lastOrder->getSAbundVector());
+ sabund->print(out);
+ delete sabund;
+
+ processedLabels.insert(lastOrder->getLabel());
+ userLabels.erase(lastOrder->getLabel());
+ }
+
+ if (count != 1) { delete lastOrder; }
+ lastOrder = order;
+
+ order = (input->getOrderVector());
+ count++;
+ }
+
+ //output error messages about any remaining user labels
+ set<string>::iterator it;
+ bool needToRun = false;
+ for (it = userLabels.begin(); it != userLabels.end(); it++) {
+ cout << "Your file does not include the label "<< *it;
+ if (processedLabels.count(lastOrder->getLabel()) != 1) {
+ cout << ". I will use " << lastOrder->getLabel() << "." << endl;
+ needToRun = true;
+ }else {
+ cout << ". Please refer to " << lastOrder->getLabel() << "." << endl;
+ }
+ }
+
+ //run last line if you need to
+ if (needToRun == true) {
+ cout << lastOrder->getLabel() << '\t' << count << endl;
+ sabund = new SAbundVector();
+ *sabund = (lastOrder->getSAbundVector());
+ sabund->print(out);
+ delete sabund;
+ }
+ delete lastOrder;
+
+ out.close();
+ return 0;
+ }
+
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the GetSAbundCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the GetSAbundCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+
--- /dev/null
+#ifndef GETSABUNDCOMMAND_H
+#define GETSABUNDCOMMAND_H
+
+/*
+ * getsabundcommand.h
+ * Mothur
+ *
+ * Created by Sarah Westcott on 6/2/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+
+#include "command.hpp"
+#include "inputdata.h"
+#include "readotu.h"
+#include "sabundvector.hpp"
+
+class GlobalData;
+
+class GetSAbundCommand : public Command {
+public:
+ GetSAbundCommand();
+ ~GetSAbundCommand();
+ int execute();
+
+private:
+ GlobalData* globaldata;
+ string filename, format;
+ ofstream out;
+ ReadOTUFile* read;
+ OrderVector* order;
+ OrderVector* lastOrder;
+ InputData* input;
+ SAbundVector* sabund;
+};
+
+#endif
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
if (format != "list") {
//as long as you are not at the end of the file or done wih the lines you want
- while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){
processedLabels.insert(lookup[0]->getLabel());
userLabels.erase(lookup[0]->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLookup[0]->getLabel()) != 1)) {
}else{
- while((rabund != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((rabund != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(rabund->getLabel()) == 1){
processedLabels.insert(rabund->getLabel());
userLabels.erase(rabund->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(rabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastRAbund->getLabel()) != 1)) {
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
if (lookup.size() < 2) { cout << "You have not provided enough valid groups. I cannot run the command." << endl; return 0;}
numGroups = globaldata->Groups.size();
//as long as you are not at the end of the file or done wih the lines you want
- while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){
cout << lookup[0]->getLabel() << '\t' << count << endl;
processedLabels.insert(lookup[0]->getLabel());
userLabels.erase(lookup[0]->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLookup[0]->getLabel()) != 1)) {
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
//read in group map info.
groupMap = new GroupMap(globaldata->getGroupFile());
//parses and sets each groups listvector
//as long as you are not at the end of the file or done wih the lines you want
- while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(list->getLabel()) == 1){
cout << list->getLabel() << '\t' << count << endl;
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastList->getLabel()) != 1)) {
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
//as long as you are not at the end of the file or done wih the lines you want
- while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((order != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
cout << order->getLabel() << '\t' << count << endl;
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastOrder->getLabel()) != 1)) {
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
//as long as you are not at the end of the file or done wih the lines you want
- while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){
cout << lookup[0]->getLabel() << '\t' << count << endl;
processedLabels.insert(lookup[0]->getLabel());
userLabels.erase(lookup[0]->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLookup[0]->getLabel()) != 1)) {
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
shared = new Shared();
- while((SharedList != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((SharedList != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(SharedList->getLabel()) == 1){
processedLabels.insert(SharedList->getLabel());
userLabels.erase(SharedList->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(SharedList->getLabel(), userLabels, errorOff) == true) && (processedLabels.count(lastList->getLabel()) != 1)) {
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
- while((sabund != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((sabund != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(sabund->getLabel()) == 1){
cout << sabund->getLabel() << '\t' << count << endl;
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
+ userLines.erase(count);
outputFileHandle << sabund->getLabel();
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
//as long as you are not at the end of the file or done wih the lines you want
- while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){
cout << lookup[0]->getLabel() << '\t' << count << endl;
processedLabels.insert(lookup[0]->getLabel());
userLabels.erase(lookup[0]->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLookup[0]->getLabel()) != 1)) {
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
//as long as you are not at the end of the file or done wih the lines you want
- while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){
cout << lookup[0]->getLabel() << '\t' << count << endl;
processedLabels.insert(lookup[0]->getLabel());
userLabels.erase(lookup[0]->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLookup[0]->getLabel()) != 1)) {
commands["get.group"] = "get.group";
commands["get.label"] = "get.label";
commands["get.line"] = "get.line";
+ commands["get.sabund"] = "get.sabund";
+ commands["get.rabund"] = "get.rabund";
commands["bootstrap.shared"] = "bootstrap.shared";
commands["concensus"] = "concensus";
commands["help"] = "help";
string getlineArray[] = {};
commandParameters["get.line"] = addParameters(getlineArray, sizeof(getlineArray)/sizeof(string));
+
+ string getsabundArray[] = {"line", "label"};
+ commandParameters["get.sabund"] = addParameters(getsabundArray, sizeof(getsabundArray)/sizeof(string));
+
+ string getrabundArray[] = {"line", "label"};
+ commandParameters["get.rabund"] = addParameters(getrabundArray, sizeof(getrabundArray)/sizeof(string));
string rarefactionsingleArray[] = {"iters","freq","line","label","calc","abund"};
commandParameters["rarefaction.single"] = addParameters(rarefactionsingleArray, sizeof(rarefactionsingleArray)/sizeof(string));
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
+ set<int> userLines = globaldata->lines;
if (format != "list") {
//as long as you are not at the end of the file or done wih the lines you want
- while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){
cout << lookup[0]->getLabel() << '\t' << count << endl;
processedLabels.insert(lookup[0]->getLabel());
userLabels.erase(lookup[0]->getLabel());
+ userLines.erase(count);
if (lookup.size() > 4) {
cout << "Error: Too many groups chosen. You may use up to 4 groups with the venn command. I will use the first four groups in your groupfile." << endl;
}else{
- while((sabund != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((sabund != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(sabund->getLabel()) == 1){
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(sabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastSAbund->getLabel()) != 1)) {