A78434891162224F00100BE0 /* chimeraccodecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeraccodecommand.cpp; sourceTree = "<group>"; };
A7D215C811996C6E00F13F13 /* clearcutcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clearcutcommand.h; sourceTree = "<group>"; };
A7D215C911996C6E00F13F13 /* clearcutcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clearcutcommand.cpp; sourceTree = "<group>"; };
+ A7D216061199C47F00F13F13 /* catchallcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catchallcommand.h; sourceTree = "<group>"; };
+ A7D216071199C47F00F13F13 /* catchallcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catchallcommand.cpp; sourceTree = "<group>"; };
A7DA1FEC113FECD400BF472F /* ace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ace.cpp; sourceTree = "<group>"; };
A7DA1FED113FECD400BF472F /* ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ace.h; sourceTree = "<group>"; };
A7DA1FEE113FECD400BF472F /* aligncommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = aligncommand.cpp; sourceTree = "<group>"; };
A7DA1FFE113FECD400BF472F /* binsequencecommand.h */,
A7DA2007113FECD400BF472F /* bootstrapsharedcommand.cpp */,
A7DA2008113FECD400BF472F /* bootstrapsharedcommand.h */,
+ A7D216061199C47F00F13F13 /* catchallcommand.h */,
+ A7D216071199C47F00F13F13 /* catchallcommand.cpp */,
A7DA2017113FECD400BF472F /* chimeraseqscommand.cpp */,
A78434881162224F00100BE0 /* chimeraccodecommand.h */,
A7DA2018113FECD400BF472F /* chimeraseqscommand.h */,
--- /dev/null
+/*
+ * catchallcommand.cpp
+ * Mothur
+ *
+ * Created by westcott on 5/11/10.
+ * Copyright 2010 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "catchallcommand.h"
+#include "globaldata.hpp"
+
+/**************************************************************************************/
+CatchAllCommand::CatchAllCommand(string option) {
+ try {
+ globaldata = GlobalData::getInstance();
+ abort = false;
+ allLines = 0;
+
+ //allow user to run help
+ if(option == "help") { help(); abort = true; }
+
+ else {
+ //valid paramters for this command
+ string Array[] = {"sabund","label","inputdir","outputdir"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+
+ OptionParser parser(option);
+ map<string,string> parameters = parser.getParameters();
+
+ ValidParameters validParameter;
+ map<string, string>::iterator it;
+
+ //check to make sure all parameters are valid for command
+ for (it = parameters.begin(); it != parameters.end(); it++) {
+ if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
+ }
+
+ //if the user changes the input directory command factory will send this info to us in the output parameter
+ string inputDir = validParameter.validFile(parameters, "inputdir", false);
+ if (inputDir == "not found"){ inputDir = ""; }
+ else {
+ string path;
+ it = parameters.find("sabund");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["sabund"] = inputDir + it->second; }
+ }
+ }
+
+ //check for required parameters
+ sabundfile = validParameter.validFile(parameters, "sabund", true);
+ if (sabundfile == "not open") { sabundfile = ""; abort = true; }
+ else if (sabundfile == "not found") { sabundfile = ""; m->mothurOut("You must provide either a sabund file for the catchall command."); m->mothurOutEndLine(); abort=true; }
+ else { globaldata->setSabundFile(sabundfile); globaldata->setFormat("sabund"); }
+
+ string label = validParameter.validFile(parameters, "label", false);
+ if (label == "not found") { label = ""; }
+ else {
+ if(label != "all") { splitAtDash(label, labels); allLines = 0; }
+ else { allLines = 1; }
+ }
+
+
+ //if the user changes the output directory command factory will send this info to us in the output parameter
+ outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = "./"; }
+ }
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "CatchAllCommand", "CatchAllCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+
+void CatchAllCommand::help(){
+ try {
+ m->mothurOut("The catchall command interfaces mothur with the catchall program written by ...citation goes here...\n");
+ m->mothurOut("For more information about clearcut refer to http://catchall.cac.cornell.edu/ \n");
+ m->mothurOut("The catchall executable must be in a folder called catchall in the same folder as your mothur executable, similar to mothur's requirements for using blast. \n");
+ m->mothurOut("The catchall command parameters are sabund and label, sabund is required. \n");
+ m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+ m->mothurOut("The catchall command should be in the following format: \n");
+ m->mothurOut("catchall(sabund=yourSabundFile) \n");
+ m->mothurOut("Example: catchall(sabund=abrecovery.fn.sabund) \n");
+ }
+ catch(exception& e) {
+ m->errorOut(e, "CatchAllCommand", "help");
+ exit(1);
+ }
+}
+
+/**************************************************************************************/
+int CatchAllCommand::execute() {
+ try {
+
+ if (abort == true) { return 0; }
+
+ vector<string> outputNames;
+
+ //prepare full output directory
+ outputDir = getFullPathName(outputDir);
+
+ //get location of catchall
+ GlobalData* globaldata = GlobalData::getInstance();
+ string path = globaldata->argv;
+ path = path.substr(0, (path.find_last_of('m')));
+ path = getFullPathName(path);
+
+ string catchAllCommandExe = "";
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ catchAllCommandExe += "mono " + path + "catchall/CatchAllcmdL.exe ";
+ #else
+ catchAllCommandExe += path + "catchall/CatchAllcmdW.exe ";
+ #endif
+
+ read = new ReadOTUFile(sabundfile);
+ read->read(&*globaldata);
+
+ SAbundVector* sabund = globaldata->sabund;
+ string lastLabel = sabund->getLabel();
+ input = globaldata->ginput;
+
+ set<string> processedLabels;
+ set<string> userLabels = labels;
+
+ //for each label the user selected
+ while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
+
+
+ if(allLines == 1 || labels.count(sabund->getLabel()) == 1){
+ m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
+
+ //create list of output files catchall will make
+ //datasetname_Analysis.csv
+ //datasetname_BestModelsAnalysis.csv
+ //datasetname_BestModelsFits.csv
+ //datasetname_BubblePlot.csv
+ //datasetname_Poisson_fits.csv
+ //datasetname_SingleExp_fits.csv
+ //datasetname_ThreeMixedExp_fits.csv
+ //datasetname_TwoMixedExp_fits.csv
+
+ //create catchall input file from mothur's inputfile
+ string filename = process(sabund);
+ sabund->print(cout);
+ //create system command
+ string catchAllCommand = catchAllCommandExe + filename + " " + path;
+cout << catchAllCommand << endl;
+ //run catchall
+ system(catchAllCommand.c_str());
+
+ if (m->control_pressed) { delete read; delete input; globaldata->ginput = NULL; delete sabund; return 0; }
+
+ processedLabels.insert(sabund->getLabel());
+ userLabels.erase(sabund->getLabel());
+ }
+
+ if ((anyLabelsToProcess(sabund->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+ string saveLabel = sabund->getLabel();
+
+ delete sabund;
+ sabund = (input->getSAbundVector(lastLabel));
+
+ m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
+
+ //create list of output files catchall will make
+ //datasetname_Analysis.csv
+ //datasetname_BestModelsAnalysis.csv
+ //datasetname_BestModelsFits.csv
+ //datasetname_BubblePlot.csv
+ //datasetname_Poisson_fits.csv
+ //datasetname_SingleExp_fits.csv
+ //datasetname_ThreeMixedExp_fits.csv
+ //datasetname_TwoMixedExp_fits.csv
+
+
+ //create catchall input file from mothur's inputfile
+ string filename = process(sabund);
+
+ //create system command
+ string catchAllCommand = catchAllCommandExe + filename + " " + path;
+cout << catchAllCommand << endl;
+ //run catchall
+ system(catchAllCommand.c_str());
+
+ if (m->control_pressed) { delete read; delete input; globaldata->ginput = NULL; delete sabund; return 0; }
+
+ processedLabels.insert(sabund->getLabel());
+ userLabels.erase(sabund->getLabel());
+
+ //restore real lastlabel to save below
+ sabund->setLabel(saveLabel);
+ }
+
+
+ lastLabel = sabund->getLabel();
+
+ delete sabund;
+ sabund = (input->getSAbundVector());
+ }
+
+ //output error messages about any remaining user labels
+ set<string>::iterator it;
+ bool needToRun = false;
+ for (it = userLabels.begin(); it != userLabels.end(); it++) {
+ m->mothurOut("Your file does not include the label " + *it);
+ if (processedLabels.count(lastLabel) != 1) {
+ m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
+ needToRun = true;
+ }else {
+ m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
+ }
+ }
+
+ //run last label if you need to
+ if (needToRun == true) {
+ if (sabund != NULL) { delete sabund; }
+ sabund = (input->getSAbundVector(lastLabel));
+
+ m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
+ //create list of output files catchall will make
+ //datasetname_Analysis.csv
+ //datasetname_BestModelsAnalysis.csv
+ //datasetname_BestModelsFits.csv
+ //datasetname_BubblePlot.csv
+ //datasetname_Poisson_fits.csv
+ //datasetname_SingleExp_fits.csv
+ //datasetname_ThreeMixedExp_fits.csv
+ //datasetname_TwoMixedExp_fits.csv
+
+ //create catchall input file from mothur's inputfile
+ string filename = process(sabund);
+
+ //create system command
+ string catchAllCommand = catchAllCommandExe + filename + " " + path;
+cout << catchAllCommand << endl;
+ //run catchall
+ system(catchAllCommand.c_str());
+
+
+ delete sabund;
+ }
+
+ delete read;
+ delete input; globaldata->ginput = NULL;
+
+ m->mothurOutEndLine();
+ m->mothurOut("Output File Names: "); m->mothurOutEndLine();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
+ m->mothurOutEndLine();
+
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "CatchAllCommand", "execute");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+string CatchAllCommand::process(SAbundVector* sabund) {
+ try {
+ string filename = outputDir + getRootName(getSimpleName(sabundfile)) + sabund->getLabel() + ".catchall";
+ filename = getFullPathName(filename);
+
+ ofstream out;
+ openOutputFile(filename, out);
+
+ for (int i = 1; i <= sabund->getMaxRank(); i++) {
+ int temp = sabund->get(i);
+
+ if (temp != 0) {
+ out << i << "," << temp << endl;
+ }
+ }
+ out.close();
+
+ return filename;
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "CatchAllCommand", "process");
+ exit(1);
+ }
+}
+/**************************************************************************************/
+
+
+
--- /dev/null
+#ifndef CATCHALLCOMMAND_H
+#define CATCHALLCOMMAND_H
+
+/*
+ * catchallcommand.h
+ * Mothur
+ *
+ * Created by westcott on 5/11/10.
+ * Copyright 2010 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "command.hpp"
+#include "inputdata.h"
+#include "readotu.h"
+#include "sabundvector.hpp"
+
+/*
+ citation goes here
+ */
+
+/****************************************************************************/
+
+class CatchAllCommand : public Command {
+
+public:
+
+ CatchAllCommand(string);
+ ~CatchAllCommand() {};
+ int execute();
+ void help();
+
+private:
+
+ GlobalData* globaldata;
+ ReadOTUFile* read;
+ InputData* input;
+
+ string outputDir, sabundfile, rabundfile, listfile, format;
+ bool abort, allLines;
+ set<string> labels;
+
+ string process(SAbundVector*);
+};
+
+/****************************************************************************/
+
+#endif
+
+
try {
m->mothurOut("The clearcut command interfaces mothur with the clearcut program written by Initiative for Bioinformatics and Evolutionary Studies (IBEST) at the University of Idaho.\n");
m->mothurOut("For more information about clearcut refer to http://bioinformatics.hungry.com/clearcut/ \n");
+ m->mothurOut("The clearcut executable must be in a folder called clearcut in the same folder as your mothur executable, similar to mothur's requirements for using blast. \n");
m->mothurOut("The clearcut command parameters are phylip, fasta, version, verbose, quiet, seed, norandom, shuffle, neighbor, expblen, expdist, ntrees, matrixout, stdout, kimura, jukes, protein, DNA, stdin. \n");
m->mothurOut("The phylip parameter allows you to enter your phylip formatted distance matrix. \n");
m->mothurOut("The fasta parameter allows you to enter your aligned fasta file, if you enter a fastafile you specify if the sequences are DNA or protein using the DNA or protein parameters. \n");
}
}
/**************************************************************************************/
+
+
+
+
/***********************************************************************/
-int Collect::getCurve(int increment = 1){
+int Collect::getCurve(float percentFreq = 0.01){
try {
RAbundVector* lookup = new RAbundVector(order->getNumBins());
SAbundVector* rank = new SAbundVector(order->getMaxRank()+1);
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
- }
+ }
+
+ //convert freq percentage to number
+ int increment = numSeqs * percentFreq;
+
for(int i=0;i<numSeqs;i++){
if (m->control_pressed) { delete lookup; delete rank; delete ccd; return 1; }
}
/***********************************************************************/
-int Collect::getSharedCurve(int increment = 1){
+int Collect::getSharedCurve(float percentFreq = 0.01){
try {
- globaldata = GlobalData::getInstance();
+ globaldata = GlobalData::getInstance();
vector<SharedRAbundVector*> lookup;
vector<SharedRAbundVector*> subset;
else { displays[i]->init(groupLabel); }
}
+ //convert freq percentage to number
+ int increment = numSeqs * percentFreq;
+
//sample all the members
for(int i=0;i<numSeqs;i++){
numSeqs(sharedorder->getNumSeqs()), sharedorder(sharedorder), displays(disp), label(sharedorder->getLabel()) { m = MothurOut::getInstance(); }
~Collect(){ };
- int getCurve(int);
- int getSharedCurve(int);
+ int getCurve(float);
+ int getSharedCurve(float);
private:
SharedOrderVector* sharedorder;
splitAtDash(calc, Estimators);
string temp;
- temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "100"; }
+ temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "0.10"; }
convert(temp, freq);
temp = validParameter.validFile(parameters, "abund", false); if (temp == "not found") { temp = "10"; }
m->mothurOut("The collect.single command can be executed after a successful cluster command. It will use the .list file from the output of the cluster.\n");
m->mothurOut("The collect.single command parameters are label, freq, calc and abund. No parameters are required. \n");
m->mothurOut("The collect.single command should be in the following format: \n");
+ m->mothurOut("The freq parameter is used indicate when to output your data. It is a percentage of the number of sequences. By default it is set to 0.10, meaning 10%. \n");
m->mothurOut("collect.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
m->mothurOut("Example collect(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-chao-ace-jack).\n");
m->mothurOut("The default values for freq is 100, and calc are sobs-chao-ace-jack-shannon-npshannon-simpson.\n");
Collect* cCurve;
ValidCalculators* validCalculator;
vector<Display*> cDisplays;
- int freq, abund, size;
+ int abund, size;
+ float freq;
bool abort, allLines;
set<string> labels; //holds labels to be used
globaldata->Groups = Groups;
string temp;
- temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "100"; }
+ temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "0.10"; }
convert(temp, freq);
temp = validParameter.validFile(parameters, "all", false); if (temp == "not found") { temp = "false"; }
m->mothurOut("Example collect.shared(label=unique-.01-.03, freq=10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n");
m->mothurOut("The default values for freq is 100 and calc are sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan.\n");
m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
+ m->mothurOut("The freq parameter is used indicate when to output your data. It is a percentage of the number of sequences. By default it is set to 0.10, meaning 10%. \n");
validCalculator->printCalc("shared", cout);
m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
m->mothurOut("The all parameter is used to specify if you want the estimate of all your groups together. This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
ValidCalculators* validCalculator;
Collect* cCurve;
vector<Display*> cDisplays;
- int freq;
+ float freq;
string format;
bool abort, allLines, all;
#include "makegroupcommand.h"
#include "chopseqscommand.h"
#include "clearcutcommand.h"
+#include "catchallcommand.h"
/*******************************************************/
commands["make.group"] = "make.group";
commands["chop.seqs"] = "chop.seqs";
commands["clearcut"] = "clearcut";
+ commands["catchall"] = "catchall";
commands["classify.seqs"] = "MPIEnabled";
commands["dist.seqs"] = "MPIEnabled";
commands["filter.seqs"] = "MPIEnabled";
else if(commandName == "make.group") { command = new MakeGroupCommand(optionString); }
else if(commandName == "chop.seqs") { command = new ChopSeqsCommand(optionString); }
else if(commandName == "clearcut") { command = new ClearcutCommand(optionString); }
+ else if(commandName == "catchall") { command = new CatchAllCommand(optionString); }
else { command = new NoCommand(optionString); }
return command;
./helpcommand.o\
./makegroupcommand.o\
./chopseqscommand.o\
- ./clearcutcommand.o\\r
+ ./clearcutcommand.o\
+ ./catchallcommand.o\\r
./inputdata.o\\r
./jackknife.o\\r
./kmer.o\\r
./helpcommand.o\
./makegroupcommand.o\
./chopseqscommand.o\
- ./clearcutcommand.o\\r
+ ./clearcutcommand.o\
+ ./catchallcommand.o\\r
./inputdata.o\\r
./jackknife.o\\r
./kmer.o\\r
./helpcommand.o\
./makegroupcommand.o\
./chopseqscommand.o\
- ./clearcutcommand.o\\r
+ ./clearcutcommand.o\
+ ./catchallcommand.o\\r
./inputdata.o\\r
./jackknife.o\\r
./kmer.o\\r
# Item # 203 -- clearcutcommand --\r
./clearcutcommand.o : clearcutcommand.cpp\r
- $(CC) $(CC_OPTIONS) clearcutcommand.cpp -c $(INCLUDE) -o ./clearcutcommand.o\r
+ $(CC) $(CC_OPTIONS) clearcutcommand.cpp -c $(INCLUDE) -o ./clearcutcommand.o
+
+# Item # 204 -- catchallcommand --\r
+./catchallcommand.o : catchallcommand.cpp\r
+ $(CC) $(CC_OPTIONS) catchallcommand.cpp -c $(INCLUDE) -o ./catchallcommand.o\r
\r
##### END RUN ####\r
m->mothurOut("You must execute the read.tree command, before you may execute the phylo.diversity command."); m->mothurOutEndLine(); abort = true; }
string temp;
- temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "100"; }
+ temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "0.10"; }
convert(temp, freq);
temp = validParameter.validFile(parameters, "iters", false); if (temp == "not found") { temp = "1000"; }
void PhyloDiversityCommand::help(){
try {
-
+ m->mothurOut("The phylo.diversity command can only be executed after a successful read.tree command.\n");
+ m->mothurOut("The phylo.diversity command parameters are groups, iters, freq and rarefy. No parameters are required.\n");
+ m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed. The group names are separated by dashes. By default all groups are used.\n");
+ m->mothurOut("The iters parameter allows you to specify the number of randomizations to preform, by default iters=1000, if you set rarefy to true.\n");
+ m->mothurOut("The freq parameter is used indicate when to output your data. It is a percentage of the number of sequences. By default it is set to 0.10, meaning 10%. \n");
+ m->mothurOut("The rarefy parameter allows you to create a rarefaction curve. The default is false.\n");
+ m->mothurOut("The phylo.diversity command should be in the following format: phylo.diversity(groups=yourGroups, rarefy=yourRarefy, iters=yourIters).\n");
+ m->mothurOut("Example phylo.diversity(groups=A-B-C, rarefy=T, iters=500).\n");
+ m->mothurOut("The phylo.diversity command output two files: .phylo.diversity and if rarefy=T, .rarefaction.\n");
+ m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
}
catch(exception& e) {
numLeafNodes = randomLeaf.size(); //reset the number of leaf nodes you are using
+ //convert freq percentage to number
+ int increment = numLeafNodes * freq;
+
//each group, each sampling, if no rarefy iters = 1;
vector< vector<float> > diversity;
diversity.resize(globaldata->Groups.size());
//initialize sampling spots
vector<int> numSampledList;
- for(int k = 0; k < numLeafNodes; k++){ if((k == 0) || (k+1) % freq == 0){ numSampledList.push_back(k); } }
- if(numLeafNodes % freq != 0){ numSampledList.push_back(numLeafNodes); }
+ for(int k = 0; k < numLeafNodes; k++){ if((k == 0) || (k+1) % increment == 0){ numSampledList.push_back(k); } }
+ if(numLeafNodes % increment != 0){ numSampledList.push_back(numLeafNodes); }
//initialize diversity
for (int j = 0; j < diversity.size(); j++) { diversity[j].resize(numSampledList.size(), 0.0); } // 10sampled 20 sampled ...
leavesSampled.push_back(randomLeaf[k]);
- if((k == 0) || (k+1) % freq == 0){ //ready to calc?
+ if((k == 0) || (k+1) % increment == 0){ //ready to calc?
data = phylo.getValues(trees[i], leavesSampled);
}
}
- if(numLeafNodes % freq != 0){
+ if(numLeafNodes % increment != 0){
data = phylo.getValues(trees[i], leavesSampled);
private:
GlobalData* globaldata;
-
- int iters, freq;
+
+ float freq;
+ int iters;
bool abort, rarefy;
string groups, outputDir;
vector<string> Groups, outputNames; //holds groups to be used, and outputFile names
/***********************************************************************/
-int Rarefact::getCurve(int increment = 1, int nIters = 1000){
+int Rarefact::getCurve(float percentFreq = 0.01, int nIters = 1000){
try {
RarefactionCurveData* rcd = new RarefactionCurveData();
for(int i=0;i<displays.size();i++){
rcd->registerDisplay(displays[i]);
}
-
+
+ //convert freq percentage to number
+ int increment = numSeqs * percentFreq;
+
for(int iter=0;iter<nIters;iter++){
for(int i=0;i<displays.size();i++){
/***********************************************************************/
-int Rarefact::getSharedCurve(int increment = 1, int nIters = 1000){
+int Rarefact::getSharedCurve(float percentFreq = 0.01, int nIters = 1000){
try {
SharedRarefactionCurveData* rcd = new SharedRarefactionCurveData();
//if jumble is false all iters will be the same
if (globaldata->jumble == false) { nIters = 1; }
+ //convert freq percentage to number
+ int increment = numSeqs * percentFreq;
+
for(int iter=0;iter<nIters;iter++){
for(int i=0;i<displays.size();i++){
lookup(shared), displays(disp) { globaldata = GlobalData::getInstance(); m = MothurOut::getInstance(); }
~Rarefact(){};
- int getCurve(int, int);
- int getSharedCurve(int, int);
+ int getCurve(float, int);
+ int getSharedCurve(float, int);
private:
GlobalData* globaldata;
splitAtDash(calc, Estimators);
string temp;
- temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "100"; }
+ temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "0.10"; }
convert(temp, freq);
temp = validParameter.validFile(parameters, "abund", false); if (temp == "not found") { temp = "10"; }
m->mothurOut("The rarefaction.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION.\n");
m->mothurOut("The rarefaction.single command can be executed after a successful cluster command. It will use the .list file from the output of the cluster.\n");
m->mothurOut("The rarefaction.single command parameters are label, iters, freq, calc and abund. No parameters are required. \n");
+ m->mothurOut("The freq parameter is used indicate when to output your data. It is a percentage of the number of sequences. By default it is set to 0.10, meaning 10%. \n");
m->mothurOut("The rarefaction.single command should be in the following format: \n");
m->mothurOut("rarefaction.single(label=yourLabel, iters=yourIters, freq=yourFreq, calc=yourEstimators).\n");
m->mothurOut("Example rarefaction.single(label=unique-.01-.03, iters=10000, freq=10, calc=sobs-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson).\n");
InputData* input;
ValidCalculators* validCalculator;
Rarefact* rCurve;
- int freq, nIters, abund;
-
+ int nIters, abund;
+ float freq;
+
bool abort, allLines;
set<string> labels; //holds labels to be used
string label, calc;
else {
//valid paramters for this command
- string Array[] = {"iters","label","calc","groups", "jumble","outputdir","inputdir"};
+ string Array[] = {"iters","freq","label","calc","groups", "jumble","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
globaldata->Groups = Groups;
string temp;
+ temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "0.10"; }
+ convert(temp, freq);
+
temp = validParameter.validFile(parameters, "iters", false); if (temp == "not found") { temp = "1000"; }
convert(temp, nIters);
m->mothurOut("The rarefaction.shared command parameters are label, iters, groups, jumble and calc. No parameters are required.\n");
m->mothurOut("The rarefaction command should be in the following format: \n");
m->mothurOut("rarefaction.shared(label=yourLabel, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n");
+ m->mothurOut("The freq parameter is used indicate when to output your data. It is a percentage of the number of sequences. By default it is set to 0.10, meaning 10%. \n");
m->mothurOut("Example rarefaction.shared(label=unique-0.01-0.03, iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n");
m->mothurOut("The default values for iters is 1000, freq is 100, and calc is sharedobserved which calculates the shared rarefaction curve for the observed richness.\n");
m->mothurOut("The default value for groups is all the groups in your groupfile, and jumble is true.\n");
ValidCalculators* validCalculator;
Rarefact* rCurve;
vector<Display*> rDisplays;
- int freq, nIters;
+ int nIters;
string format;
-
+ float freq;
+
bool abort, allLines, jumble;
set<string> labels; //holds labels to be used
string label, calc, groups, outputDir;