A75790591301749D00A30DAB /* homovacommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75790581301749D00A30DAB /* homovacommand.cpp */; };
A799F5B91309A3E000AEEFA0 /* makefastqcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A799F5B81309A3E000AEEFA0 /* makefastqcommand.cpp */; };
A7A61F2D130062E000E05B6B /* amovacommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A61F2C130062E000E05B6B /* amovacommand.cpp */; };
- A7AACFBC132FE008003D6C4D /* currentfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AACFBB132FE008003D6C4D /* currentfile.cpp */; };
A7E9B88112D37EC400DA6239 /* ace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B64F12D37EC300DA6239 /* ace.cpp */; };
A7E9B88212D37EC400DA6239 /* aligncommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B65112D37EC300DA6239 /* aligncommand.cpp */; };
A7E9B88312D37EC400DA6239 /* alignment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B65312D37EC300DA6239 /* alignment.cpp */; };
A7FA10021302E097003860FE /* mantelcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FA10011302E096003860FE /* mantelcommand.cpp */; };
A7FC480E12D788F20055BC5C /* linearalgebra.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FC480D12D788F20055BC5C /* linearalgebra.cpp */; };
A7FC486712D795D60055BC5C /* pcacommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FC486612D795D60055BC5C /* pcacommand.cpp */; };
+ A7FE7C401330EA1000F7B327 /* getcurrentcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FE7C3F1330EA1000F7B327 /* getcurrentcommand.cpp */; };
+ A7FE7E6D13311EA400F7B327 /* setcurrentcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7FE7E6C13311EA400F7B327 /* setcurrentcommand.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
A7A61F2B130062E000E05B6B /* amovacommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = amovacommand.h; sourceTree = "<group>"; };
A7A61F2C130062E000E05B6B /* amovacommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = amovacommand.cpp; sourceTree = "<group>"; };
A7AACFBA132FE008003D6C4D /* currentfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = currentfile.h; sourceTree = "<group>"; };
- A7AACFBB132FE008003D6C4D /* currentfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = currentfile.cpp; sourceTree = "<group>"; };
A7E9B64F12D37EC300DA6239 /* ace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ace.cpp; sourceTree = "<group>"; };
A7E9B65012D37EC300DA6239 /* ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ace.h; sourceTree = "<group>"; };
A7E9B65112D37EC300DA6239 /* aligncommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = aligncommand.cpp; sourceTree = "<group>"; };
A7FC480D12D788F20055BC5C /* linearalgebra.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = linearalgebra.cpp; sourceTree = "<group>"; };
A7FC486512D795D60055BC5C /* pcacommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pcacommand.h; sourceTree = "<group>"; };
A7FC486612D795D60055BC5C /* pcacommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pcacommand.cpp; sourceTree = "<group>"; };
+ A7FE7C3E1330EA1000F7B327 /* getcurrentcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getcurrentcommand.h; sourceTree = "<group>"; };
+ A7FE7C3F1330EA1000F7B327 /* getcurrentcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getcurrentcommand.cpp; sourceTree = "<group>"; };
+ A7FE7E6B13311EA400F7B327 /* setcurrentcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setcurrentcommand.h; sourceTree = "<group>"; };
+ A7FE7E6C13311EA400F7B327 /* setcurrentcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = setcurrentcommand.cpp; sourceTree = "<group>"; };
C6A0FF2C0290799A04C91782 /* mothur.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = mothur.1; sourceTree = "<group>"; };
/* End PBXFileReference section */
A7E9B6B412D37EC400DA6239 /* completelinkage.cpp */,
A7E9BA4212D3960D00DA6239 /* containers */,
A7AACFBA132FE008003D6C4D /* currentfile.h */,
- A7AACFBB132FE008003D6C4D /* currentfile.cpp */,
A7E9B6C912D37EC400DA6239 /* display.h */,
A7E9B6D112D37EC400DA6239 /* dlibshuff.cpp */,
A7E9B6D212D37EC400DA6239 /* dlibshuff.h */,
A7E9B6CC12D37EC400DA6239 /* distancecommand.h */,
A7E9B6E312D37EC400DA6239 /* filterseqscommand.cpp */,
A7E9B6E412D37EC400DA6239 /* filterseqscommand.h */,
+ A7FE7C3E1330EA1000F7B327 /* getcurrentcommand.h */,
+ A7FE7C3F1330EA1000F7B327 /* getcurrentcommand.cpp */,
A7E9B6F212D37EC400DA6239 /* getgroupcommand.cpp */,
A7E9B6F312D37EC400DA6239 /* getgroupcommand.h */,
A7E9B6F412D37EC400DA6239 /* getgroupscommand.cpp */,
A7E9B7D812D37EC400DA6239 /* seqerrorcommand.h */,
A7E9B7D912D37EC400DA6239 /* seqsummarycommand.cpp */,
A7E9B7DA12D37EC400DA6239 /* seqsummarycommand.h */,
+ A7FE7E6B13311EA400F7B327 /* setcurrentcommand.h */,
+ A7FE7E6C13311EA400F7B327 /* setcurrentcommand.cpp */,
A7E9B7DF12D37EC400DA6239 /* setdircommand.cpp */,
A7E9B7E012D37EC400DA6239 /* setdircommand.h */,
A7E9B7E112D37EC400DA6239 /* setlogfilecommand.cpp */,
A7FA10021302E097003860FE /* mantelcommand.cpp in Sources */,
A799F5B91309A3E000AEEFA0 /* makefastqcommand.cpp in Sources */,
A71CB160130B04A2001E7287 /* anosimcommand.cpp in Sources */,
- A7AACFBC132FE008003D6C4D /* currentfile.cpp in Sources */,
+ A7FE7C401330EA1000F7B327 /* getcurrentcommand.cpp in Sources */,
+ A7FE7E6D13311EA400F7B327 /* setcurrentcommand.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AlignCommand::AlignCommand(string option) {
try {
abort = false; calledHelp = false;
- currentFiles = CurrentFile::getInstance();
//allow user to run help
if(option == "help") { help(); abort = true; calledHelp = true;}
candidateFileName = validParameter.validFile(parameters, "candidate", false);
if (candidateFileName == "not found") {
- //check currentFiles for a fasta file
- if (currentFiles->getFastaFile() != "") { candidateFileName = currentFiles->getFastaFile(); m->mothurOut("Using " + candidateFileName + " as candidate file."); m->mothurOutEndLine();
- }else { m->mothurOut("candidate is a required parameter for the align.seqs command."); m->mothurOutEndLine(); abort = true; }
}else {
m->splitAtDash(candidateFileName, candidateFileNames);
string currentFasta = "";
itTypes = outputTypes.find("fasta");
if (itTypes != outputTypes.end()) {
- if ((itTypes->second).size() != 0) { currentFasta = (itTypes->second)[0]; }
+ if ((itTypes->second).size() != 0) { currentFasta = (itTypes->second)[0]; m->setFastaFile(currentFasta); }
}
- currentFiles->setFastaFile(currentFasta);
- cout << "current fasta = " << currentFiles->getFastaFile() << endl;
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
#include "database.hpp"
#include "alignment.hpp"
#include "alignmentdb.h"
-#include "mothurfiles.h"
class AlignCommand : public Command {
vector<string> outputNames;
bool abort, flip, calledHelp;
- CurrentFile* currentFiles;
};
if (phylipFileName == "not open") { phylipFileName = ""; abort = true; }
else if (phylipFileName == "not found") {
phylipFileName = "";
-
- //check currentFiles for a phylip file
- //if (currentFiles->getPhylipFile() != "") { phylipFileName = currentFiles->getPhylipFile(); m->mothurOut("Using " + phylipFileName + " as phylip file."); m->mothurOutEndLine();
- //}else { m->mothurOut("You must provide an phylip file."); m->mothurOutEndLine(); abort = true; }
}
//check for required parameters
if (designFileName == "not open") { abort = true; }
else if (designFileName == "not found") {
designFileName = "";
-
- //check currentFiles for a design file
- //if (currentFiles->getDesignFile() != "") { designFileName = currentFiles->getDesignFile(); m->mothurOut("Using " + designFileName + " as design file."); m->mothurOutEndLine();
- //}else { m->mothurOut("You must provide an design file."); m->mothurOutEndLine(); abort = true; }
}
string temp = validParameter.validFile(parameters, "iters", false);
if (phylipFileName == "not open") { phylipFileName = ""; abort = true; }
else if (phylipFileName == "not found") {
phylipFileName = "";
-
- //check currentFiles for a phylip file
- //if (currentFiles->getPhylipFile() != "") { phylipFileName = currentFiles->getPhylipFile(); m->mothurOut("Using " + phylipFileName + " as phylip file."); m->mothurOutEndLine();
- //}else { m->mothurOut("You must provide an phylip file."); m->mothurOutEndLine(); abort = true; }
}
//check for required parameters
if (designFileName == "not open") { abort = true; }
else if (designFileName == "not found") {
designFileName = "";
-
- //check currentFiles for a design file
- //if (currentFiles->getDesignFile() != "") { designFileName = currentFiles->getDesignFile(); m->mothurOut("Using " + designFileName + " as design file."); m->mothurOutEndLine();
- //}else { m->mothurOut("You must provide an design file."); m->mothurOutEndLine(); abort = true; }
-
}
string temp = validParameter.validFile(parameters, "iters", false);
if (sequence != "not found") {
//if you don't have groups
if (groupfile == "") {
- name = name + "|" + toString(i+1);
+ name = name + "\t" + toString(i+1);
out << ">" << name << endl;
out << sequence << endl;
}else {//if you do have groups
m->mothurOut(name + " is missing from your group file. Please correct. "); m->mothurOutEndLine();
return 1;
}else{
- name = name + "|" + group + "|" + toString(i+1);
+ name = name + "\t" + group + "\t" + toString(i+1);
out << ">" << name << endl;
out << sequence << endl;
}
if (sequence != "not found") {
//if you don't have groups
if (groupfile == "") {
- binnames = binnames + "|" + toString(i+1);
+ binnames = binnames + "\t" + toString(i+1);
out << ">" << binnames << endl;
out << sequence << endl;
}else {//if you do have groups
m->mothurOut(binnames + " is missing from your group file. Please correct. "); m->mothurOutEndLine();
return 1;
}else{
- binnames = binnames + "|" + group + "|" + toString(i+1);
+ binnames = binnames + "\t" + group + "\t" + toString(i+1);
out << ">" << binnames << endl;
out << sequence << endl;
}
//reset groups parameter
globaldata->Groups.clear();
+ //set first tree file as new current treefile
+ string currentTree = "";
+ itTypes = outputTypes.find("tree");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { currentTree = (itTypes->second)[0]; m->setTreeFile(currentTree); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
vector<string> tempOutNames;
outputTypes["chimera"] = tempOutNames;
outputTypes["accnos"] = tempOutNames;
- outputTypes["fasta"] = tempOutNames;
}
catch(exception& e) {
m->errorOut(e, "ChimeraBellerophonCommand", "ChimeraBellerophonCommand");
vector<string> tempOutNames;
outputTypes["chimera"] = tempOutNames;
outputTypes["accnos"] = tempOutNames;
- outputTypes["fasta"] = tempOutNames;
//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);
delete chimera;
}
+ //set accnos file as new current accnosfile
+ string current = "";
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+
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(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
}
+
+ //set accnos file as new current accnosfile
+ string current = "";
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+
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(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
}
+ //set accnos file as new current accnosfile
+ string current = "";
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+
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(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
}
+ //set accnos file as new current accnosfile
+ string current = "";
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+
+ if (trim) {
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
void ChopSeqsCommand::help(){
try {
- m->mothurOut("The chop.seqs command reads a fasta file and outputs a .chop.fasta containing the trimmed sequences.\n");
+ m->mothurOut("The chop.seqs command reads a fasta file and outputs a .chop.fasta containing the trimmed sequences. Note: If a sequence is completely 'chopped', an accnos file will be created with the names of the sequences removed. \n");
m->mothurOut("The chop.seqs command parameters are fasta, numbases, countgaps and keep. fasta and numbases are required required.\n");
m->mothurOut("The chop.seqs command should be in the following format: chop.seqs(fasta=yourFasta, numbases=yourNum, keep=yourKeep).\n");
m->mothurOut("The numbases parameter allows you to specify the number of bases you want to keep.\n");
m->mothurOutEndLine();
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ if (wroteAccnos) { //set accnos file as new current accnosfile
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+ }
+
+
return 0;
}
m->mothurOutEndLine();
}
+ //set taxonomy file as new current taxonomyfile
+ string current = "";
+ itTypes = outputTypes.find("taxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+ }
+
delete classify;
return 0;
}
delete[] clearcutParameters;
if (!stdoutWanted) {
+
+ //set first tree file as new current treefile
+ string currentTree = "";
+ itTypes = outputTypes.find("tree");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { currentTree = (itTypes->second)[0]; m->setTreeFile(currentTree); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine();
}
+ //set list file as new current listfile
+ string current = "";
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ //set rabund file as new current rabundfile
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ //set sabund file as new current sabundfile
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
// m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine();
//}
+ //set list file as new current listfile
+ string current = "";
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ //set rabund file as new current rabundfile
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ //set sabund file as new current sabundfile
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOut(newNamesFile); m->mothurOutEndLine();
outputNames.push_back(newFastaFile); outputNames.push_back(newNamesFile); outputTypes["fasta"].push_back(newFastaFile); outputTypes["name"].push_back(newNamesFile);
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
return 0;
m->mothurOut("It took " + toString(time(NULL) - estart) + " seconds to merge."); m->mothurOutEndLine();
+ //set list file as new current listfile
+ string current = "";
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ //set rabund file as new current rabundfile
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ //set sabund file as new current sabundfile
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
#include "validparameter.h"
#include "mothurout.h"
+
class Command {
public:
- Command() { m = MothurOut::getInstance(); }
+ Command() { m = MothurOut::getInstance(); }
virtual vector<string> getValidParameters() = 0;
virtual vector<string> getRequiredParameters() = 0; //adding "or" as the last element indicates one of the previous is needed
virtual vector<string> getRequiredFiles() = 0; //adding "or" as the last element indicates one of the previous is needed
virtual ~Command() { }
protected:
MothurOut* m;
-
bool calledHelp;
map<string, vector<string> >::iterator itTypes;
#include "mantelcommand.h"
#include "makefastqcommand.h"
#include "anosimcommand.h"
+#include "getcurrentcommand.h"
+#include "setcurrentcommand.h"
/*******************************************************/
commands["anosim"] = "anosim";
commands["make.fastq"] = "make.fastq";
commands["merge.groups"] = "merge.groups";
+ commands["get.current"] = "get.current";
+ commands["set.current"] = "set.current";
commands["pairwise.seqs"] = "MPIEnabled";
commands["pipeline.pds"] = "MPIEnabled";
commands["classify.seqs"] = "MPIEnabled";
else if(commandName == "homova") { command = new HomovaCommand(optionString); }
else if(commandName == "mantel") { command = new MantelCommand(optionString); }
else if(commandName == "make.fastq") { command = new MakeFastQCommand(optionString); }
+ else if(commandName == "get.current") { command = new GetCurrentCommand(optionString); }
+ else if(commandName == "set.current") { command = new SetCurrentCommand(optionString); }
else if(commandName == "anosim") { command = new AnosimCommand(optionString); }
else { command = new NoCommand(optionString); }
else if(commandName == "mantel") { pipecommand = new MantelCommand(optionString); }
else if(commandName == "anosim") { pipecommand = new AnosimCommand(optionString); }
else if(commandName == "make.fastq") { pipecommand = new MakeFastQCommand(optionString); }
+ else if(commandName == "get.current") { pipecommand = new GetCurrentCommand(optionString); }
+ else if(commandName == "set.current") { pipecommand = new SetCurrentCommand(optionString); }
else { pipecommand = new NoCommand(optionString); }
return pipecommand;
else if(commandName == "mantel") { shellcommand = new MantelCommand(); }
else if(commandName == "anosim") { shellcommand = new AnosimCommand(); }
else if(commandName == "make.fastq") { shellcommand = new MakeFastQCommand(); }
+ else if(commandName == "get.current") { shellcommand = new GetCurrentCommand(); }
+ else if(commandName == "set.current") { shellcommand = new SetCurrentCommand(); }
else { shellcommand = new NoCommand(); }
return shellcommand;
delete consensusTree;
+ //set first tree file as new current treefile
+ string currentTree = "";
+ itTypes = outputTypes.find("tree");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { currentTree = (itTypes->second)[0]; m->setTreeFile(currentTree); }
+ }
+
return 0;
}
catch(exception& e) {
+++ /dev/null
-/*
- * currentfile.cpp
- * Mothur
- *
- * Created by westcott on 3/15/11.
- * Copyright 2011 Schloss Lab. All rights reserved.
- *
- */
-
-#include "currentfile.h"
-
-/******************************************************/
-CurrentFile* CurrentFile::getInstance() {
- if(_uniqueInstance == 0) {
- _uniqueInstance = new CurrentFile();
- }
- return _uniqueInstance;
-}
-/*********************************************************************************************/
-CurrentFile::CurrentFile() {
- m = MothurOut::getInstance();
-
- phylipfile = "";
- columnfile = "";
- listfile = "";
- rabundfile = "";
- sabundfile = "";
- namefile = "";
- groupfile = "";
- designfile = "";
- orderfile = "";
- treefile = "";
- sharedfile = "";
- ordergroupfile = "";
- relabundfile = "";
- fastafile = "";
- qualfile = "";
- sfffile = "";
- oligosfile = "";
-}
-/*********************************************************************************************/
-CurrentFile::~CurrentFile() {
- _uniqueInstance = 0;
-}
-/*********************************************************************************************/
-
-
class CurrentFile {
-public:
-
- static CurrentFile* getInstance();
-
- string getPhylipFile() { return phylipfile; }
- string getColumnFile() { return columnfile; }
- string getListFile() { return listfile; }
- string getRabundFile() { return rabundfile; }
- string getSabundFile() { return sabundfile; }
- string getNameFile() { return namefile; }
- string getGroupFile() { return groupfile; }
- string getOrderFile() { return orderfile; }
- string getOrderGroupFile() { return ordergroupfile; }
- string getTreeFile() { return treefile; }
- string getSharedFile() { return sharedfile; }
- string getRelAbundFile() { return relabundfile; }
- string getDesignFile() { return designfile; }
- string getFastaFile() { return fastafile; }
- string getSFFFile() { return sfffile; }
- string getQualFile() { return qualfile; }
- string getOligosFile() { return oligosfile; }
-
-
- void setListFile(string f) { listfile = m->getFullPathName(f); }
- void setTreeFile(string f) { treefile = m->getFullPathName(f); }
- void setGroupFile(string f) { groupfile = m->getFullPathName(f); }
- void setPhylipFile(string f) { phylipfile = m->getFullPathName(f); }
- void setColumnFile(string f) { columnfile = m->getFullPathName(f); }
- void setNameFile(string f) { namefile = m->getFullPathName(f); }
- void setRabundFile(string f) { rabundfile = m->getFullPathName(f); }
- void setSabundFile(string f) { sabundfile = m->getFullPathName(f); }
- void setSharedFile(string f) { sharedfile = m->getFullPathName(f); }
- void setRelAbundFile(string f) { relabundfile = m->getFullPathName(f); }
- void setOrderFile(string f) { orderfile = m->getFullPathName(f); }
- void setOrderGroupFile(string f) { ordergroupfile = m->getFullPathName(f); }
- void setDesignFile(string f) { designfile = m->getFullPathName(f); }
- void setFastaFile(string f) { fastafile = m->getFullPathName(f); }
- void setSFFFile(string f) { sfffile = m->getFullPathName(f); }
- void setQualFile(string f) { qualfile = m->getFullPathName(f); }
- void setOligosFile(string f) { oligosfile = m->getFullPathName(f); }
-
-private:
-
- static CurrentFile* _uniqueInstance;
- CurrentFile( const CurrentFile& ); // Disable copy constructor
- void operator=( const CurrentFile& ); // Disable assignment operator
- CurrentFile();
- ~CurrentFile();
-
- MothurOut* m;
- string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile;
- string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile;
+ public:
+ static CurrentFile* getInstance() {
+ if(instance == 0) { instance = new CurrentFile(); }
+ return instance;
+ }
+
+ string getPhylipFile() { return phylipfile; }
+ string getColumnFile() { return columnfile; }
+ string getListFile() { return listfile; }
+ string getRabundFile() { return rabundfile; }
+ string getSabundFile() { return sabundfile; }
+ string getNameFile() { return namefile; }
+ string getGroupFile() { return groupfile; }
+ string getOrderFile() { return orderfile; }
+ string getOrderGroupFile() { return ordergroupfile; }
+ string getTreeFile() { return treefile; }
+ string getSharedFile() { return sharedfile; }
+ string getRelAbundFile() { return relabundfile; }
+ string getDesignFile() { return designfile; }
+ string getFastaFile() { return fastafile; }
+ string getSFFFile() { return sfffile; }
+ string getQualFile() { return qualfile; }
+ string getOligosFile() { return oligosfile; }
+
+
+ void setListFile(string f) { listfile = m->getFullPathName(f); }
+ void setTreeFile(string f) { treefile = m->getFullPathName(f); }
+ void setGroupFile(string f) { groupfile = m->getFullPathName(f); }
+ void setPhylipFile(string f) { phylipfile = m->getFullPathName(f); }
+ void setColumnFile(string f) { columnfile = m->getFullPathName(f); }
+ void setNameFile(string f) { namefile = m->getFullPathName(f); }
+ void setRabundFile(string f) { rabundfile = m->getFullPathName(f); }
+ void setSabundFile(string f) { sabundfile = m->getFullPathName(f); }
+ void setSharedFile(string f) { sharedfile = m->getFullPathName(f); }
+ void setRelAbundFile(string f) { relabundfile = m->getFullPathName(f); }
+ void setOrderFile(string f) { orderfile = m->getFullPathName(f); }
+ void setOrderGroupFile(string f) { ordergroupfile = m->getFullPathName(f); }
+ void setDesignFile(string f) { designfile = m->getFullPathName(f); }
+ void setFastaFile(string f) { fastafile = m->getFullPathName(f); }
+ void setSFFFile(string f) { sfffile = m->getFullPathName(f); }
+ void setQualFile(string f) { qualfile = m->getFullPathName(f); }
+ void setOligosFile(string f) { oligosfile = m->getFullPathName(f); }
+ private:
+ MothurOut* m;
+ string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile;
+ string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile;
+
+ static CurrentFile* instance;
+ CurrentFile( const CurrentFile& ); // Disable copy constructor
+ void operator=( const CurrentFile& ); // Disable assignment operator
+ CurrentFile() {
+ phylipfile = "";
+ columnfile = "";
+ listfile = "";
+ rabundfile = "";
+ sabundfile = "";
+ namefile = "";
+ groupfile = "";
+ designfile = "";
+ orderfile = "";
+ treefile = "";
+ sharedfile = "";
+ ordergroupfile = "";
+ relabundfile = "";
+ fastafile = "";
+ qualfile = "";
+ sfffile = "";
+ oligosfile = "";
+ }
+ ~CurrentFile() { instance = 0; }
};
/***********************************************/
outputNames.push_back(outFastaFile); outputNames.push_back(outNameFile); outputTypes["fasta"].push_back(outFastaFile); outputTypes["name"].push_back(outNameFile);
m->mothurOutEndLine();
-
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
return 0;
}
if (m->control_pressed) { outputTypes.clear(); remove(degapFile.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
}
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
outputNames.push_back(outFastaFile); outputTypes["fasta"].push_back(outFastaFile);
m->mothurOutEndLine();
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
return 0;
}
catch(exception& e) {
delete distCalculator;
+ //set phylip file as new current phylipfile
+ string current = "";
+ itTypes = outputTypes.find("phylip");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setPhylipFile(current); }
+ }
+
+ //set column file as new current columnfile
+ itTypes = outputTypes.find("column");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setColumnFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
m->mothurOut(outputFile); m->mothurOutEndLine();
m->mothurOut("Length of the original alignment: " + toString(alignmentLength)); m->mothurOutEndLine();
m->mothurOut("Number of sequences used to construct filter: " + toString(numSeqs)); m->mothurOutEndLine();
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
--- /dev/null
+/*
+ * getcurrentcommand.cpp
+ * Mothur
+ *
+ * Created by westcott on 3/16/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "getcurrentcommand.h"
+
+
+//**********************************************************************************************************************
+vector<string> GetCurrentCommand::getValidParameters(){
+ try {
+ string Array[] = {"outputdir","inputdir","clear"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetCurrentCommand", "getValidParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+GetCurrentCommand::GetCurrentCommand(){
+ try {
+ abort = true; calledHelp = true;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetCurrentCommand", "GetCurrentCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> GetCurrentCommand::getRequiredParameters(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetCurrentCommand", "getRequiredParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> GetCurrentCommand::getRequiredFiles(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetCurrentCommand", "getRequiredFiles");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+GetCurrentCommand::GetCurrentCommand(string option) {
+ try {
+ abort = false; calledHelp = false;
+
+ //allow user to run help
+ if(option == "help") { help(); abort = true; calledHelp = true; }
+
+ else {
+ //valid paramters for this command
+ string Array[] = {"outputdir","inputdir","clear"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+
+ OptionParser parser(option);
+ map<string,string> parameters = parser.getParameters();
+
+ ValidParameters validParameter;
+ //check to make sure all parameters are valid for command
+ for (map<string,string>::iterator it = parameters.begin(); it != parameters.end(); it++) {
+ if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
+ }
+
+ clearTypes = validParameter.validFile(parameters, "clear", false);
+ if (clearTypes == "not found") { clearTypes = ""; }
+ else { m->splitAtDash(clearTypes, types); }
+ }
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetCurrentCommand", "GetCurrentCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+
+void GetCurrentCommand::help(){
+ try {
+ m->mothurOut("The get.current command outputs the current files saved by mothur.\n");
+ m->mothurOut("The get.current command has one parameter: clear.\n");
+ m->mothurOut("The clear paramter is used to indicate which file types you would like to clear values for, multiple types can be separated by dashes.\n");
+ m->mothurOut("The get.current command should be in the following format: \n");
+ m->mothurOut("get.current() or get.current(clear=fasta-name-accnos)\n");
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetCurrentCommand", "help");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+GetCurrentCommand::~GetCurrentCommand(){}
+//**********************************************************************************************************************
+
+int GetCurrentCommand::execute(){
+ try {
+
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
+
+ //user wants to clear a type
+ if (types.size() != 0) {
+ for (int i = 0; i < types.size(); i++) {
+
+ if (m->control_pressed) { break; }
+
+ //look for file types
+ if (types[i] == "fasta") {
+ m->setFastaFile("");
+ }else if (types[i] == "qfile") {
+ m->setQualFile("");
+ }else if (types[i] == "phylip") {
+ m->setPhylipFile("");
+ }else if (types[i] == "column") {
+ m->setColumnFile("");
+ }else if (types[i] == "list") {
+ m->setListFile("");
+ }else if (types[i] == "rabund") {
+ m->setRabundFile("");
+ }else if (types[i] == "sabund") {
+ m->setSabundFile("");
+ }else if (types[i] == "name") {
+ m->setNameFile("");
+ }else if (types[i] == "group") {
+ m->setGroupFile("");
+ }else if (types[i] == "order") {
+ m->setOrderFile("");
+ }else if (types[i] == "ordergroup") {
+ m->setOrderGroupFile("");
+ }else if (types[i] == "tree") {
+ m->setTreeFile("");
+ }else if (types[i] == "shared") {
+ m->setSharedFile("");
+ }else if (types[i] == "relabund") {
+ m->setRelAbundFile("");
+ }else if (types[i] == "design") {
+ m->setDesignFile("");
+ }else if (types[i] == "sff") {
+ m->setSFFFile("");
+ }else if (types[i] == "oligos") {
+ m->setOligosFile("");
+ }else if (types[i] == "accnos") {
+ m->setAccnosFile("");
+ }else if (types[i] == "taxonomy") {
+ m->setTaxonomyFile("");
+ }else if (types[i] == "all") {
+ m->clearCurrentFiles();
+ }else {
+ m->mothurOut("[ERROR]: mothur does not save a current file for " + types[i]); m->mothurOutEndLine();
+ }
+ }
+ }
+
+ m->mothurOutEndLine(); m->mothurOut("Current files saved by mothur:"); m->mothurOutEndLine();
+ m->printCurrentFiles();
+
+ return 0;
+ }
+
+ catch(exception& e) {
+ m->errorOut(e, "GetCurrentCommand", "execute");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+
+
--- /dev/null
+#ifndef GETCURRENTCOMMAND_H
+#define GETCURRENTCOMMAND_H
+
+/*
+ * getcurrentcommand.h
+ * Mothur
+ *
+ * Created by westcott on 3/16/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "command.hpp"
+
+class GetCurrentCommand : public Command {
+
+ public:
+ GetCurrentCommand(string);
+ GetCurrentCommand();
+ ~GetCurrentCommand();
+ vector<string> getRequiredParameters();
+ vector<string> getValidParameters();
+ vector<string> getRequiredFiles();
+ map<string, vector<string> > getOutputFiles() { return outputTypes; }
+ int execute();
+ void help();
+
+ private:
+
+ vector<string> outputNames;
+ map<string, vector<string> > outputTypes;
+ bool abort;
+
+ string clearTypes;
+ vector<string> types;
+
+};
+
+#endif
+
m->mothurOut("Output File names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("taxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+ }
}
return 0;
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("taxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+ }
}
return 0;
if (m->control_pressed) { return 0; }
+ //set fasta file as new current fastafile - use first one??
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); 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();
+
+ //set list file as new current listfile
+ string current = "";
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
}
return 0;
globaldata->gListVector = NULL;
+ //set rabund file as new current rabundfile
+ string current = "";
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
return 0;
}
m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["relabund"].push_back(outputFileName);
m->mothurOutEndLine();
+ //set relabund file as new current relabundfile
+ string current = "";
+ itTypes = outputTypes.find("relabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRelAbundFile(current); }
+ }
+
return 0;
}
catch(exception& e) {
m->mothurOut(filename); m->mothurOutEndLine(); outputNames.push_back(filename); outputTypes["sabund"].push_back(filename);
m->mothurOutEndLine();
+ //set sabund file as new current sabundfile
+ string current = "";
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
return 0;
}
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("taxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+ }
+
+ itTypes = outputTypes.find("qfile");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+ }
+
}
return 0;
if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete groupMap; return 0; }
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ if (output == "accnos") {
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
return 0;
}
-
+
+ //set list file as new current listfile
+ string current = "";
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ //set rabund file as new current rabundfile
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ //set sabund file as new current sabundfile
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
delete outputTree; delete globaldata->gTreemap; return 0;
}
+ //set tree file as new current treefile
+ string current = "";
+ itTypes = outputTypes.find("tree");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTreeFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
ofstream out;
m->openOutputFile(outputFileName, out);
+ outputNames.push_back(outputFileName); outputTypes["accnos"].push_back(outputFileName);
//output to .accnos file
for (int i = 0; i < names.size(); i++) {
out.close();
if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; }
-
+
+ m->setAccnosFile(outputFileName);
+
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
- m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["accnos"].push_back(outputFileName);
+ m->mothurOut(outputFileName); m->mothurOutEndLine();
m->mothurOutEndLine();
+ //set accnos file as new current accnosfile
+ string current = "";
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+
return 0;
}
m->mothurOutEndLine();
m->mothurOut("Output File Name: " + filename); m->mothurOutEndLine(); outputNames.push_back(filename); outputTypes["group"].push_back(filename);
m->mothurOutEndLine();
-
+
+ //set group file as new current groupfile
+ string current = "";
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
return 0;
}
catch(exception& e) {
//reset groups parameter
globaldata->Groups.clear();
+ //set phylip file as new current phylipfile
+ string current = "";
+ itTypes = outputTypes.find("phylip");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setPhylipFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0;}
+
+ //set shared file as new current sharedfile
+ string current = "";
+ itTypes = outputTypes.find("shared");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOut(fileroot+ tag + ".sabund"); m->mothurOutEndLine(); outputNames.push_back(fileroot+ tag + ".sabund"); outputTypes["sabund"].push_back(fileroot+ tag + ".sabund");
m->mothurOutEndLine();
+ //set list file as new current listfile
+ string current = "";
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ //set rabund file as new current rabundfile
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ //set sabund file as new current sabundfile
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
+
m->mothurOut("It took " + toString(time(NULL) - start) + " seconds to cluster."); m->mothurOutEndLine();
return 0;
return _uniqueInstance;
}
/*********************************************************************************************/
+void MothurOut::printCurrentFiles() {
+ try {
+ if (accnosfile != "") { mothurOut("accnos=" + accnosfile); mothurOutEndLine(); }
+ if (columnfile != "") { mothurOut("column=" + columnfile); mothurOutEndLine(); }
+ if (designfile != "") { mothurOut("design=" + designfile); mothurOutEndLine(); }
+ if (fastafile != "") { mothurOut("fasta=" + fastafile); mothurOutEndLine(); }
+ if (groupfile != "") { mothurOut("group=" + groupfile); mothurOutEndLine(); }
+ if (listfile != "") { mothurOut("list=" + listfile); mothurOutEndLine(); }
+ if (namefile != "") { mothurOut("name=" + namefile); mothurOutEndLine(); }
+ if (oligosfile != "") { mothurOut("oligos=" + oligosfile); mothurOutEndLine(); }
+ if (orderfile != "") { mothurOut("order=" + orderfile); mothurOutEndLine(); }
+ if (ordergroupfile != "") { mothurOut("ordergroup=" + ordergroupfile); mothurOutEndLine(); }
+ if (phylipfile != "") { mothurOut("phylip=" + phylipfile); mothurOutEndLine(); }
+ if (qualfile != "") { mothurOut("qfile=" + qualfile); mothurOutEndLine(); }
+ if (rabundfile != "") { mothurOut("rabund=" + rabundfile); mothurOutEndLine(); }
+ if (relabundfile != "") { mothurOut("relabund=" + relabundfile); mothurOutEndLine(); }
+ if (sabundfile != "") { mothurOut("sabund=" + sabundfile); mothurOutEndLine(); }
+ if (sfffile != "") { mothurOut("sff=" + sfffile); mothurOutEndLine(); }
+ if (sharedfile != "") { mothurOut("shared=" + sharedfile); mothurOutEndLine(); }
+ if (taxonomyfile != "") { mothurOut("taxonomy=" + taxonomyfile); mothurOutEndLine(); }
+ if (treefile != "") { mothurOut("tree=" + treefile); mothurOutEndLine(); }
+
+ }
+ catch(exception& e) {
+ errorOut(e, "MothurOut", "printCurrentFiles");
+ exit(1);
+ }
+}
+/*********************************************************************************************/
+void MothurOut::clearCurrentFiles() {
+ try {
+ phylipfile = "";
+ columnfile = "";
+ listfile = "";
+ rabundfile = "";
+ sabundfile = "";
+ namefile = "";
+ groupfile = "";
+ designfile = "";
+ orderfile = "";
+ treefile = "";
+ sharedfile = "";
+ ordergroupfile = "";
+ relabundfile = "";
+ fastafile = "";
+ qualfile = "";
+ sfffile = "";
+ oligosfile = "";
+ accnosfile = "";
+ taxonomyfile = "";
+ }
+ catch(exception& e) {
+ errorOut(e, "MothurOut", "clearCurrentFiles");
+ exit(1);
+ }
+}
+/*********************************************************************************************/
void MothurOut::setFileName(string filename) {
try {
logFileName = filename;
int control_pressed;
bool executing;
+ //current files - if you add a new type you must edit optionParser->getParameters, get.current command and mothurOut->printCurrentFiles/clearCurrentFiles.
+ string getPhylipFile() { return phylipfile; }
+ string getColumnFile() { return columnfile; }
+ string getListFile() { return listfile; }
+ string getRabundFile() { return rabundfile; }
+ string getSabundFile() { return sabundfile; }
+ string getNameFile() { return namefile; }
+ string getGroupFile() { return groupfile; }
+ string getOrderFile() { return orderfile; }
+ string getOrderGroupFile() { return ordergroupfile; }
+ string getTreeFile() { return treefile; }
+ string getSharedFile() { return sharedfile; }
+ string getRelAbundFile() { return relabundfile; }
+ string getDesignFile() { return designfile; }
+ string getFastaFile() { return fastafile; }
+ string getSFFFile() { return sfffile; }
+ string getQualFile() { return qualfile; }
+ string getOligosFile() { return oligosfile; }
+ string getAccnosFile() { return accnosfile; }
+ string getTaxonomyFile() { return taxonomyfile; }
+
+ void setListFile(string f) { listfile = getFullPathName(f); }
+ void setTreeFile(string f) { treefile = getFullPathName(f); }
+ void setGroupFile(string f) { groupfile = getFullPathName(f); }
+ void setPhylipFile(string f) { phylipfile = getFullPathName(f); }
+ void setColumnFile(string f) { columnfile = getFullPathName(f); }
+ void setNameFile(string f) { namefile = getFullPathName(f); }
+ void setRabundFile(string f) { rabundfile = getFullPathName(f); }
+ void setSabundFile(string f) { sabundfile = getFullPathName(f); }
+ void setSharedFile(string f) { sharedfile = getFullPathName(f); }
+ void setRelAbundFile(string f) { relabundfile = getFullPathName(f); }
+ void setOrderFile(string f) { orderfile = getFullPathName(f); }
+ void setOrderGroupFile(string f) { ordergroupfile = getFullPathName(f); }
+ void setDesignFile(string f) { designfile = getFullPathName(f); }
+ void setFastaFile(string f) { fastafile = getFullPathName(f); }
+ void setSFFFile(string f) { sfffile = getFullPathName(f); }
+ void setQualFile(string f) { qualfile = getFullPathName(f); }
+ void setOligosFile(string f) { oligosfile = getFullPathName(f); }
+ void setAccnosFile(string f) { accnosfile = getFullPathName(f); }
+ void setTaxonomyFile(string f) { taxonomyfile = getFullPathName(f); }
+
+ void printCurrentFiles();
+ void clearCurrentFiles();
+
private:
static MothurOut* _uniqueInstance;
MothurOut( const MothurOut& ); // Disable copy constructor
void operator=( const MothurOut& ); // Disable assignment operator
- MothurOut() { control_pressed = false; defaultPath=""; };
+ MothurOut() {
+ control_pressed = false; defaultPath="";
+ phylipfile = "";
+ columnfile = "";
+ listfile = "";
+ rabundfile = "";
+ sabundfile = "";
+ namefile = "";
+ groupfile = "";
+ designfile = "";
+ orderfile = "";
+ treefile = "";
+ sharedfile = "";
+ ordergroupfile = "";
+ relabundfile = "";
+ fastafile = "";
+ qualfile = "";
+ sfffile = "";
+ oligosfile = "";
+ accnosfile = "";
+ taxonomyfile = "";
+ };
~MothurOut();
string logFileName;
string defaultPath, outputDir;
string releaseDate, version;
-
+
+ string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
+ string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile;
+
+
ofstream out;
int mem_usage(double&, double&);
m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["shared"].push_back(outputFileName);
m->mothurOutEndLine();
+ //set shared file as new current sharedfile
+ string current = "";
+ itTypes = outputTypes.find("shared");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
+ }
+
return 0;
}
catch(exception& e) {
}
}
catch(exception& e) {
- m->errorOut(e, "OptionParser", "parse");
+ m->errorOut(e, "OptionParser", "OptionParser");
exit(1);
}
}
/***********************************************************************/
-map<string, string> OptionParser::getParameters() { return parameters; }
+map<string, string> OptionParser::getParameters() {
+ try {
+
+ //loop through parameters and look for "current" so you can return the appropriate file
+ //doing it here to avoid code duplication in each of the commands
+
+ map<string, string>::iterator it;
+ for (it = parameters.begin(); it != parameters.end();) {
+
+ if (it->second == "current") {
+
+ //look for file types
+ if ((it->first == "fasta") || (it->first == "candidate")) {
+ it->second = m->getFastaFile();
+ }else if (it->first == "qfile") {
+ it->second = m->getQualFile();
+ }else if (it->first == "phylip") {
+ it->second = m->getPhylipFile();
+ }else if (it->first == "column") {
+ it->second = m->getColumnFile();
+ }else if (it->first == "list") {
+ it->second = m->getListFile();
+ }else if (it->first == "rabund") {
+ it->second = m->getRabundFile();
+ }else if (it->first == "sabund") {
+ it->second = m->getSabundFile();
+ }else if (it->first == "name") {
+ it->second = m->getNameFile();
+ }else if (it->first == "group") {
+ it->second = m->getGroupFile();
+ }else if (it->first == "order") {
+ it->second = m->getOrderFile();
+ }else if (it->first == "ordergroup") {
+ it->second = m->getOrderGroupFile();
+ }else if (it->first == "tree") {
+ it->second = m->getTreeFile();
+ }else if (it->first == "shared") {
+ it->second = m->getSharedFile();
+ }else if (it->first == "relabund") {
+ it->second = m->getRelAbundFile();
+ }else if (it->first == "design") {
+ it->second = m->getDesignFile();
+ }else if (it->first == "sff") {
+ it->second = m->getSFFFile();
+ }else if (it->first == "oligos") {
+ it->second = m->getOligosFile();
+ }else if (it->first == "accnos") {
+ it->second = m->getAccnosFile();
+ }else if (it->first == "taxonomy") {
+ it->second = m->getTaxonomyFile();
+ }else {
+ m->mothurOut("[ERROR]: mothur does not save a current file for " + it->first); m->mothurOutEndLine();
+ }
+
+ if (it->second == "") { //no file was saved for that type, warn and remove from parameters
+ m->mothurOut("[WARNING]: no file was saved for " + it->first + " parameter."); m->mothurOutEndLine();
+ parameters.erase(it++);
+ }else {
+ m->mothurOut("Using " + it->second + " as input file for the " + it->first + " parameter."); m->mothurOutEndLine();
+ it++;
+ }
+ }else{ it++; }
+ }
+
+ return parameters;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "OptionParser", "getParameters");
+ exit(1);
+ }
+}
/***********************************************************************/
delete distCalculator;
+ //set phylip file as new current phylipfile
+ string current = "";
+ itTypes = outputTypes.find("phylip");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setPhylipFile(current); }
+ }
+
+ //set column file as new current columnfile
+ itTypes = outputTypes.find("column");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setColumnFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["fasta"] = tempOutNames;
- outputTypes["qual"] = tempOutNames;
+ outputTypes["qfile"] = tempOutNames;
}
catch(exception& e) {
m->errorOut(e, "ParseFastaQCommand", "ParseFastaQCommand");
//initialize outputTypes
vector<string> tempOutNames;
outputTypes["fasta"] = tempOutNames;
- outputTypes["qual"] = tempOutNames;
+ outputTypes["qfile"] = tempOutNames;
//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);
string qualFile = outputDir + m->getRootName(m->getSimpleName(fastaQFile)) + "qual";
ofstream outFasta, outQual;
m->openOutputFile(fastaFile, outFasta); outputNames.push_back(fastaFile); outputTypes["fasta"].push_back(fastaFile);
- m->openOutputFile(qualFile, outQual); outputNames.push_back(qualFile); outputTypes["qual"].push_back(qualFile);
+ m->openOutputFile(qualFile, outQual); outputNames.push_back(qualFile); outputTypes["qfile"].push_back(qualFile);
ifstream in;
m->openInputFile(fastaQFile, in);
if (m->control_pressed) { outputTypes.clear(); remove(fastaFile.c_str()); remove(qualFile.c_str()); return 0; }
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("qfile");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
return 0;
}
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
return 0;
}
+ //set list file as new current listfile
+ string current = "";
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ //set rabund file as new current rabundfile
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ //set sabund file as new current sabundfile
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOut(newFastaFile); m->mothurOutEndLine(); outputNames.push_back(newFastaFile); outputTypes["fasta"].push_back(newFastaFile);
m->mothurOut(newNamesFile); m->mothurOutEndLine(); outputNames.push_back(newNamesFile); outputTypes["name"].push_back(newNamesFile);
m->mothurOutEndLine();
-
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
return 0;
}
outputTypes = shared->getOutputFiles();
+ //set rabund file as new current rabundfile
+ string current = "";
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ itTypes = outputTypes.find("shared");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
+ }
+
delete shared;
}
+
+
return 0;
}
catch(exception& e) {
m->mothurOut("Output File names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("taxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+ }
}
return 0;
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("taxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+ }
}
return 0;
m->mothurOut("Output File names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
}
return 0;
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set rabund file as new current rabundfile
+ string current = "";
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("shared");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
+ }
}
return 0;
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("taxonomy");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+ }
+
+ itTypes = outputTypes.find("qfile");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+ }
}
return 0;
}
inFASTA.close();
outFASTA.close();
- outputNames.push_back(fastaReverseFileName);
+ outputNames.push_back(fastaReverseFileName); outputTypes["fasta"].push_back(fastaReverseFileName);
}
string qualReverseFileName;
}
inQual.close();
outQual.close();
- outputNames.push_back(qualReverseFileName);
+ outputNames.push_back(qualReverseFileName); outputTypes["qfile"].push_back(qualReverseFileName);
}
+ if (m->control_pressed) { remove(qualReverseFileName.c_str()); remove(fastaReverseFileName.c_str()); return 0; }
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("qfile");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+ }
+
+
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
for(int i=0;i<outputNames.size();i++){
m->mothurOutEndLine();
}
+
+
return 0;
}
catch(exception& e) {
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOutEndLine();
m->mothurOutEndLine();
+
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
m->mothurOut("It took " + toString(time(NULL) - start) + " secs to screen " + toString(numFastaSeqs) + " sequences.");
m->mothurOutEndLine();
--- /dev/null
+/*
+ * setcurrentcommand.cpp
+ * Mothur
+ *
+ * Created by westcott on 3/16/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "setcurrentcommand.h"
+
+//**********************************************************************************************************************
+vector<string> SetCurrentCommand::getValidParameters(){
+ try {
+ string Array[] = {"outputdir","inputdir","clear", "phylip", "column", "list","rabund","sabund","name","group",
+ "design","order","tree","shared","ordergroup","relabund","fasta","qfile","sff","oligos","accnos","taxonomy"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SetCurrentCommand", "getValidParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+SetCurrentCommand::SetCurrentCommand(){
+ try {
+ abort = true; calledHelp = true;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SetCurrentCommand", "SetCurrentCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> SetCurrentCommand::getRequiredParameters(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SetCurrentCommand", "getRequiredParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> SetCurrentCommand::getRequiredFiles(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SetCurrentCommand", "getRequiredFiles");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+SetCurrentCommand::SetCurrentCommand(string option) {
+ try {
+ abort = false; calledHelp = false;
+
+ //allow user to run help
+ if(option == "help") { help(); abort = true; calledHelp = true; }
+
+ else {
+ //valid paramters for this command
+ string Array[] = {"outputdir","inputdir","clear", "phylip", "column", "list","rabund","sabund","name","group",
+ "design","order","tree","shared","ordergroup","relabund","fasta","qfile","sff","oligos","accnos","taxonomy"};
+ 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("phylip");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["phylip"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("column");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["column"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("fasta");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["fasta"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("list");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["list"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("rabund");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["rabund"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("sabund");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->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; }
+ }
+
+ it = parameters.find("name");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["name"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("group");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["group"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("design");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["design"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("order");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["order"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("tree");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["tree"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("shared");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["shared"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("ordergroup");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["ordergroup"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("relabund");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["relabund"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("fasta");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["fasta"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("qfile");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["qfile"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("sff");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["sff"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("oligos");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["oligos"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("accnos");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["accnos"] = inputDir + it->second; }
+ }
+
+ it = parameters.find("taxonomy");
+ //user has given a template file
+ if(it != parameters.end()){
+ path = m->hasPath(it->second);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { parameters["taxonomy"] = inputDir + it->second; }
+ }
+ }
+
+ //check for parameters
+ phylipfile = validParameter.validFile(parameters, "phylip", true);
+ if (phylipfile == "not open") { m->mothurOut("Ignoring: " + parameters["phylip"]); m->mothurOutEndLine(); phylipfile = ""; }
+ else if (phylipfile == "not found") { phylipfile = ""; }
+ if (phylipfile != "") { m->setPhylipFile(phylipfile); }
+
+ columnfile = validParameter.validFile(parameters, "column", true);
+ if (columnfile == "not open") { m->mothurOut("Ignoring: " + parameters["column"]); m->mothurOutEndLine(); columnfile = ""; }
+ else if (columnfile == "not found") { columnfile = ""; }
+ if (columnfile != "") { m->setColumnFile(columnfile); }
+
+ listfile = validParameter.validFile(parameters, "list", true);
+ if (listfile == "not open") { m->mothurOut("Ignoring: " + parameters["list"]); m->mothurOutEndLine(); listfile = ""; }
+ else if (listfile == "not found") { listfile = ""; }
+ if (listfile != "") { m->setListFile(listfile); }
+
+ rabundfile = validParameter.validFile(parameters, "rabund", true);
+ if (rabundfile == "not open") { m->mothurOut("Ignoring: " + parameters["rabund"]); m->mothurOutEndLine(); rabundfile = ""; }
+ else if (rabundfile == "not found") { rabundfile = ""; }
+ if (rabundfile != "") { m->setRabundFile(rabundfile); }
+
+ sabundfile = validParameter.validFile(parameters, "sabund", true);
+ if (sabundfile == "not open") { m->mothurOut("Ignoring: " + parameters["sabund"]); m->mothurOutEndLine(); sabundfile = ""; }
+ else if (sabundfile == "not found") { sabundfile = ""; }
+ if (sabundfile != "") { m->setSabundFile(sabundfile); }
+
+ namefile = validParameter.validFile(parameters, "name", true);
+ if (namefile == "not open") { m->mothurOut("Ignoring: " + parameters["name"]); m->mothurOutEndLine(); namefile = ""; }
+ else if (namefile == "not found") { namefile = ""; }
+ if (namefile != "") { m->setNameFile(namefile); }
+
+ groupfile = validParameter.validFile(parameters, "group", true);
+ if (groupfile == "not open") { m->mothurOut("Ignoring: " + parameters["group"]); m->mothurOutEndLine(); groupfile = ""; }
+ else if (groupfile == "not found") { groupfile = ""; }
+ if (groupfile != "") { m->setGroupFile(groupfile); }
+
+ designfile = validParameter.validFile(parameters, "design", true);
+ if (designfile == "not open") { m->mothurOut("Ignoring: " + parameters["design"]); m->mothurOutEndLine(); designfile = ""; }
+ else if (designfile == "not found") { designfile = ""; }
+ if (designfile != "") { m->setDesignFile(designfile); }
+
+ orderfile = validParameter.validFile(parameters, "order", true);
+ if (orderfile == "not open") { m->mothurOut("Ignoring: " + parameters["order"]); m->mothurOutEndLine(); orderfile = ""; }
+ else if (orderfile == "not found") { orderfile = ""; }
+ if (orderfile != "") { m->setOrderFile(orderfile); }
+
+ treefile = validParameter.validFile(parameters, "tree", true);
+ if (treefile == "not open") { m->mothurOut("Ignoring: " + parameters["tree"]); m->mothurOutEndLine(); treefile = ""; }
+ else if (treefile == "not found") { treefile = ""; }
+ if (treefile != "") { m->setTreeFile(treefile); }
+
+ sharedfile = validParameter.validFile(parameters, "shared", true);
+ if (sharedfile == "not open") { m->mothurOut("Ignoring: " + parameters["shared"]); m->mothurOutEndLine(); sharedfile = ""; }
+ else if (sharedfile == "not found") { sharedfile = ""; }
+ if (sharedfile != "") { m->setSharedFile(sharedfile); }
+
+ ordergroupfile = validParameter.validFile(parameters, "ordergroup", true);
+ if (ordergroupfile == "not open") { m->mothurOut("Ignoring: " + parameters["ordergroup"]); m->mothurOutEndLine(); ordergroupfile = ""; }
+ else if (ordergroupfile == "not found") { ordergroupfile = ""; }
+ if (ordergroupfile != "") { m->setOrderGroupFile(ordergroupfile); }
+
+ relabundfile = validParameter.validFile(parameters, "relabund", true);
+ if (relabundfile == "not open") { m->mothurOut("Ignoring: " + parameters["relabund"]); m->mothurOutEndLine(); relabundfile = ""; }
+ else if (relabundfile == "not found") { relabundfile = ""; }
+ if (relabundfile != "") { m->setRelAbundFile(relabundfile); }
+
+ fastafile = validParameter.validFile(parameters, "fasta", true);
+ if (fastafile == "not open") { m->mothurOut("Ignoring: " + parameters["fasta"]); m->mothurOutEndLine(); fastafile = ""; }
+ else if (fastafile == "not found") { fastafile = ""; }
+ if (fastafile != "") { m->setFastaFile(fastafile); }
+
+ qualfile = validParameter.validFile(parameters, "qfile", true);
+ if (qualfile == "not open") { m->mothurOut("Ignoring: " + parameters["qfile"]); m->mothurOutEndLine(); qualfile = ""; }
+ else if (qualfile == "not found") { qualfile = ""; }
+ if (qualfile != "") { m->setQualFile(qualfile); }
+
+ sfffile = validParameter.validFile(parameters, "sff", true);
+ if (sfffile == "not open") { m->mothurOut("Ignoring: " + parameters["sff"]); m->mothurOutEndLine(); sfffile = ""; }
+ else if (sfffile == "not found") { sfffile = ""; }
+ if (sfffile != "") { m->setSFFFile(sfffile); }
+
+ oligosfile = validParameter.validFile(parameters, "oligos", true);
+ if (oligosfile == "not open") { m->mothurOut("Ignoring: " + parameters["oligos"]); m->mothurOutEndLine(); oligosfile = ""; }
+ else if (oligosfile == "not found") { oligosfile = ""; }
+ if (oligosfile != "") { m->setOligosFile(oligosfile); }
+
+ accnosfile = validParameter.validFile(parameters, "accnos", true);
+ if (accnosfile == "not open") { m->mothurOut("Ignoring: " + parameters["accnos"]); m->mothurOutEndLine(); accnosfile = ""; }
+ else if (accnosfile == "not found") { accnosfile = ""; }
+ if (accnosfile != "") { m->setAccnosFile(accnosfile); }
+
+ taxonomyfile = validParameter.validFile(parameters, "taxonomy", true);
+ if (taxonomyfile == "not open") { m->mothurOut("Ignoring: " + parameters["taxonomy"]); m->mothurOutEndLine(); taxonomyfile = ""; }
+ else if (taxonomyfile == "not found") { taxonomyfile = ""; }
+ if (taxonomyfile != "") { m->setTaxonomyFile(taxonomyfile); }
+
+ clearTypes = validParameter.validFile(parameters, "clear", false);
+ if (clearTypes == "not found") { clearTypes = ""; }
+ else { m->splitAtDash(clearTypes, types); }
+ }
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SetCurrentCommand", "SetCurrentCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+
+void SetCurrentCommand::help(){
+ try {
+ m->mothurOut("The set.current command allows you to set the current files saved by mothur.\n");
+ m->mothurOut("The set.current command parameters are: clear, phylip, column, list, rabund, sabund, name, group, design, order, tree, shared, ordergroup, relabund, fasta, qfile, sff, oligos, accnos, taxonomy.\n");
+ m->mothurOut("The clear paramter is used to indicate which file types you would like to clear values for, multiple types can be separated by dashes.\n");
+ m->mothurOut("The set.current command should be in the following format: \n");
+ m->mothurOut("set.current(fasta=yourFastaFile) or set.current(fasta=amazon.fasta, clear=name-accnos)\n");
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SetCurrentCommand", "help");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+SetCurrentCommand::~SetCurrentCommand(){}
+//**********************************************************************************************************************
+
+int SetCurrentCommand::execute(){
+ try {
+
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
+
+ //user wants to clear a type
+ if (types.size() != 0) {
+ for (int i = 0; i < types.size(); i++) {
+
+ if (m->control_pressed) { break; }
+
+ //look for file types
+ if (types[i] == "fasta") {
+ m->setFastaFile("");
+ }else if (types[i] == "qfile") {
+ m->setQualFile("");
+ }else if (types[i] == "phylip") {
+ m->setPhylipFile("");
+ }else if (types[i] == "column") {
+ m->setColumnFile("");
+ }else if (types[i] == "list") {
+ m->setListFile("");
+ }else if (types[i] == "rabund") {
+ m->setRabundFile("");
+ }else if (types[i] == "sabund") {
+ m->setSabundFile("");
+ }else if (types[i] == "name") {
+ m->setNameFile("");
+ }else if (types[i] == "group") {
+ m->setGroupFile("");
+ }else if (types[i] == "order") {
+ m->setOrderFile("");
+ }else if (types[i] == "ordergroup") {
+ m->setOrderGroupFile("");
+ }else if (types[i] == "tree") {
+ m->setTreeFile("");
+ }else if (types[i] == "shared") {
+ m->setSharedFile("");
+ }else if (types[i] == "relabund") {
+ m->setRelAbundFile("");
+ }else if (types[i] == "design") {
+ m->setDesignFile("");
+ }else if (types[i] == "sff") {
+ m->setSFFFile("");
+ }else if (types[i] == "oligos") {
+ m->setOligosFile("");
+ }else if (types[i] == "accnos") {
+ m->setAccnosFile("");
+ }else if (types[i] == "taxonomy") {
+ m->setTaxonomyFile("");
+ }else if (types[i] == "all") {
+ m->clearCurrentFiles();
+ }else {
+ m->mothurOut("[ERROR]: mothur does not save a current file for " + types[i]); m->mothurOutEndLine();
+ }
+ }
+ }
+
+ m->mothurOutEndLine(); m->mothurOut("Current files saved by mothur:"); m->mothurOutEndLine();
+ m->printCurrentFiles();
+
+ return 0;
+ }
+
+ catch(exception& e) {
+ m->errorOut(e, "SetCurrentCommand", "execute");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+
+
--- /dev/null
+#ifndef SETCURRENTCOMMAND_H
+#define SETCURRENTCOMMAND_H
+
+/*
+ * setcurrentcommand.h
+ * Mothur
+ *
+ * Created by westcott on 3/16/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+
+#include "command.hpp"
+
+class SetCurrentCommand : public Command {
+
+public:
+ SetCurrentCommand(string);
+ SetCurrentCommand();
+ ~SetCurrentCommand();
+ vector<string> getRequiredParameters();
+ vector<string> getValidParameters();
+ vector<string> getRequiredFiles();
+ map<string, vector<string> > getOutputFiles() { return outputTypes; }
+ int execute();
+ void help();
+
+private:
+
+ vector<string> outputNames;
+ map<string, vector<string> > outputTypes;
+ bool abort;
+
+ string clearTypes;
+ vector<string> types;
+
+ string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
+ string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile;
+
+
+};
+
+#endif
+
+
outputTypes["fasta"] = tempOutNames;
outputTypes["flow"] = tempOutNames;
outputTypes["sfftxt"] = tempOutNames;
- outputTypes["qual"] = tempOutNames;
+ outputTypes["qfile"] = tempOutNames;
}
catch(exception& e) {
m->errorOut(e, "SffInfoCommand", "SffInfoCommand");
outputTypes["fasta"] = tempOutNames;
outputTypes["flow"] = tempOutNames;
outputTypes["sfftxt"] = tempOutNames;
- outputTypes["qual"] = tempOutNames;
+ outputTypes["qfile"] = tempOutNames;
//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 = ""; }
if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("qfile");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+ }
+
//report output filenames
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
if (sfftxt) { m->openOutputFile(sfftxtFileName, outSfftxt); outSfftxt.setf(ios::fixed, ios::floatfield); outSfftxt.setf(ios::showpoint); outputNames.push_back(sfftxtFileName); outputTypes["sfftxt"].push_back(sfftxtFileName); }
if (fasta) { m->openOutputFile(outFastaFileName, outFasta); outputNames.push_back(outFastaFileName); outputTypes["fasta"].push_back(outFastaFileName); }
- if (qual) { m->openOutputFile(outQualFileName, outQual); outputNames.push_back(outQualFileName); outputTypes["qual"].push_back(outQualFileName); }
+ if (qual) { m->openOutputFile(outQualFileName, outQual); outputNames.push_back(outQualFileName); outputTypes["qfile"].push_back(outQualFileName); }
if (flow) { m->openOutputFile(outFlowFileName, outFlow); outputNames.push_back(outFlowFileName); outFlow.setf(ios::fixed, ios::floatfield); outFlow.setf(ios::showpoint); outputTypes["flow"].push_back(outFlowFileName); }
ifstream in;
return 1;
}
+ //set rabund file as new current rabundfile
+ string current = "";
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ itTypes = outputTypes.find("shared");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
if (fastafile != "") { parseFasta(tag); }
}
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("accnos");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
if (fastafile != "") { getSubSampleFasta(); }
if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); return 0; } }
-
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("name");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
+ itTypes = outputTypes.find("list");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+ }
+
+ itTypes = outputTypes.find("shared");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); }
+ }
+
+ itTypes = outputTypes.find("rabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+ }
+
+ itTypes = outputTypes.find("sabund");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+ }
+
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
}
//reset groups parameter
- globaldata->Groups.clear();
+ globaldata->Groups.clear();
+
+ //set tree file as new current treefile
+ string current = "";
+ itTypes = outputTypes.find("tree");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTreeFile(current); }
+ }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
outputTypes["flow.files"].push_back(flowFilesFileName);
outputNames.push_back(flowFileName);
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
//output group counts
m->mothurOutEndLine();
- int total = 0;
+ //int total = 0;
// for (int i = 0; i < barcodeNameVector.size(); i++) {
// if ((barcodeNameVector[i] != "") && (groupCounts[i] != 0)) { total += groupCounts[i]; m->mothurOut("Group " + barcodeNameVector[i] + " contains " + toString(groupCounts[i]) + " sequences."); m->mothurOutEndLine(); }
// }
if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ //set fasta file as new current fastafile
+ string current = "";
+ itTypes = outputTypes.find("fasta");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+ }
+
+ itTypes = outputTypes.find("qfile");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+ }
+
+ itTypes = outputTypes.find("group");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOut("It took " + toString(time(NULL) - start) + " secs to run unifrac.unweighted."); m->mothurOutEndLine();
+ //set phylip file as new current phylipfile
+ string current = "";
+ itTypes = outputTypes.find("phylip");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setPhylipFile(current); }
+ }
+
+ //set column file as new current columnfile
+ itTypes = outputTypes.find("column");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setColumnFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
m->mothurOut("It took " + toString(time(NULL) - start) + " secs to run unifrac.weighted."); m->mothurOutEndLine();
+ //set phylip file as new current phylipfile
+ string current = "";
+ itTypes = outputTypes.find("phylip");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setPhylipFile(current); }
+ }
+
+ //set column file as new current columnfile
+ itTypes = outputTypes.find("column");
+ if (itTypes != outputTypes.end()) {
+ if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setColumnFile(current); }
+ }
+
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }