]> git.donarmstrong.com Git - mothur.git/commitdiff
added set.current and get.current commands and modified existing commands to update...
authorwestcott <westcott>
Wed, 16 Mar 2011 17:14:04 +0000 (17:14 +0000)
committerwestcott <westcott>
Wed, 16 Mar 2011 17:14:04 +0000 (17:14 +0000)
75 files changed:
Mothur.xcodeproj/project.pbxproj
aligncommand.cpp
aligncommand.h
amovacommand.cpp
anosimcommand.cpp
binsequencecommand.cpp
bootstrapsharedcommand.cpp
chimerabellerophoncommand.cpp
chimeraccodecommand.cpp
chimerapintailcommand.cpp
chimeraslayercommand.cpp
chopseqscommand.cpp
classifyseqscommand.cpp
clearcutcommand.cpp
clustercommand.cpp
clusterdoturcommand.cpp
clusterfragmentscommand.cpp
clustersplitcommand.cpp
command.hpp
commandfactory.cpp
consensuscommand.cpp
currentfile.cpp [deleted file]
currentfile.h
deconvolutecommand.cpp
degapseqscommand.cpp
deuniqueseqscommand.cpp
distancecommand.cpp
filterseqscommand.cpp
getcurrentcommand.cpp [new file with mode: 0644]
getcurrentcommand.h [new file with mode: 0644]
getgroupscommand.cpp
getlineagecommand.cpp
getoturepcommand.cpp
getotuscommand.cpp
getrabundcommand.cpp
getrelabundcommand.cpp
getsabundcommand.cpp
getseqscommand.cpp
getsharedotucommand.cpp
hclustercommand.cpp
indicatorcommand.cpp
listseqscommand.cpp
makegroupcommand.cpp
matrixoutputcommand.cpp
mergegroupscommand.cpp
mgclustercommand.cpp
mothurout.cpp
mothurout.h
normalizesharedcommand.cpp
optionparser.cpp
pairwiseseqscommand.cpp
parsefastaqcommand.cpp
parselistscommand.cpp
phylotypecommand.cpp
preclustercommand.cpp
readotucommand.cpp
removegroupscommand.cpp
removelineagecommand.cpp
removeotuscommand.cpp
removerarecommand.cpp
removeseqscommand.cpp
reversecommand.cpp
screenseqscommand.cpp
setcurrentcommand.cpp [new file with mode: 0644]
setcurrentcommand.h [new file with mode: 0644]
sffinfocommand.cpp
sharedcommand.cpp
splitabundcommand.cpp
splitgroupscommand.cpp
subsamplecommand.cpp
treegroupscommand.cpp
trimflowscommand.cpp
trimseqscommand.cpp
unifracunweightedcommand.cpp
unifracweightedcommand.cpp

index 7d1df469e1864cca4a54ff8091839754cbcf9d0c..4bc5960998187c10304d8ea3d6874250d2120f1e 100644 (file)
@@ -18,7 +18,6 @@
                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;
                };
index 77e99c0b0f4d512ce1c9409207e50fdde18d32c6..a820542e42f4d7a7b9956b194f790555e634536a 100644 (file)
@@ -79,7 +79,6 @@ AlignCommand::AlignCommand(){
 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;}
@@ -139,9 +138,6 @@ AlignCommand::AlignCommand(string option)  {
                        
                        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);
                                
@@ -471,10 +467,9 @@ int AlignCommand::execute(){
                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();    }
index d519e9154fecadd04d3e535c3cfe6916e03cabba..169b43512375aef99a22029b35425d87d6360afb 100644 (file)
@@ -15,7 +15,6 @@
 #include "database.hpp"
 #include "alignment.hpp"
 #include "alignmentdb.h"
-#include "mothurfiles.h"
 
 class AlignCommand : public Command {
        
@@ -60,7 +59,6 @@ private:
        vector<string> outputNames;
        
        bool abort, flip, calledHelp;
-       CurrentFile* currentFiles;
 
 };
 
index 13c8b2636680ee247cf05750cd57b6d5916b7d9c..8ab08553c4969268be12230b68f0f80303da2989 100644 (file)
@@ -117,10 +117,6 @@ AmovaCommand::AmovaCommand(string option) {
                        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
@@ -128,10 +124,6 @@ AmovaCommand::AmovaCommand(string option) {
                        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);
index 443cf8aae28e423b703085c4b2f14ce65ef86cfa..79064a4bf6731cfcd1604f2a2c8d28f42e501b13 100644 (file)
@@ -117,10 +117,6 @@ AnosimCommand::AnosimCommand(string option) {
                        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
@@ -128,11 +124,6 @@ AnosimCommand::AnosimCommand(string option) {
                        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);
index 81c24a33713a6a0a732f3c9e6b7cbe99e10dc02d..8b137c8935e099f6e806f60746244c0d244b9687 100644 (file)
@@ -387,7 +387,7 @@ int BinSeqCommand::process(ListVector* list) {
                                                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
@@ -396,7 +396,7 @@ int BinSeqCommand::process(ListVector* list) {
                                                                        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;
                                                                }
@@ -413,7 +413,7 @@ int BinSeqCommand::process(ListVector* list) {
                                        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
@@ -422,7 +422,7 @@ int BinSeqCommand::process(ListVector* list) {
                                                                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;
                                                        }
index 66a43976c8c5b6ca61090f78a216acfae99d694f..afc3cf1533475b6bf78b8127ba34086193612371 100644 (file)
@@ -340,6 +340,13 @@ int BootSharedCommand::execute(){
                //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();    }
index 22e4fe2956e18100b1e6a4920c25b9237a8d5504..140a94993df3634fec862bd371f7658390b928e6 100644 (file)
@@ -52,7 +52,6 @@ ChimeraBellerophonCommand::ChimeraBellerophonCommand(){
                vector<string> tempOutNames;
                outputTypes["chimera"] = tempOutNames;
                outputTypes["accnos"] = tempOutNames;
-               outputTypes["fasta"] = tempOutNames;
        }
        catch(exception& e) {
                m->errorOut(e, "ChimeraBellerophonCommand", "ChimeraBellerophonCommand");
@@ -87,7 +86,6 @@ ChimeraBellerophonCommand::ChimeraBellerophonCommand(string option)  {
                        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);              
@@ -271,6 +269,13 @@ int ChimeraBellerophonCommand::execute(){
                        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();    }
index 8a4ccdedea59eb676ecf4f2161e9c1719db8f72a..457eaf314bf304fe3d7f9e5eec67509f07236a35 100644 (file)
@@ -435,6 +435,14 @@ int ChimeraCcodeCommand::execute(){
                        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();    }       
index a8d2d65c6c3752fcc7ca9737e505c32850d62f7b..038460fe1485dc531cec04f83b28793f0b55a550 100644 (file)
@@ -517,6 +517,13 @@ int ChimeraPintailCommand::execute(){
                        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();    }       
index a331908c1ddb09609d469ceb186ce659f1e21f08..e7b02b8937d74c8cabd382ea9dcc1c56c11af071 100644 (file)
@@ -569,6 +569,20 @@ int ChimeraSlayerCommand::execute(){
                        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();    }       
index 1ebb1f4b631f21d02596aa3e1e528d27cb3587df..a09ff65856ae39c1e8fbb1a662ed8bacd8860694 100644 (file)
@@ -133,7 +133,7 @@ ChopSeqsCommand::ChopSeqsCommand(string option)  {
 
 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");
@@ -202,6 +202,21 @@ int ChopSeqsCommand::execute(){
                
                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;               
        }
 
index 2dfe05a05f9e267390c7e7656dee12d0ee1ab169..6cfa3321c1cfd9b14cc3bf4b86d400c46feecb3c 100644 (file)
@@ -682,6 +682,13 @@ int ClassifySeqsCommand::execute(){
                        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;
        }
index 767981de36e7c3da3063ea4a9b1df696040c0e4f..7fd8c134a0fdee4c6f93075f1d97e9f5ab98000a 100644 (file)
@@ -310,6 +310,14 @@ int ClearcutCommand::execute() {
                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();    }
index 5d9225b0f9ca4c6f39de259454dfc1fb92e6c919..391b20a9de857755854401f96869c774508bd0af 100644 (file)
@@ -294,6 +294,25 @@ int ClusterCommand::execute(){
                        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();    }
index b2b31edc27b9808ea9556e345d7d817429de1321..5bcfe03416f90700a02a4ff3d58ad312f788bb96 100644 (file)
@@ -271,6 +271,25 @@ int ClusterDoturCommand::execute(){
                //      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();    }
index a8277ffb029fdd6e5f3e110614836e37292ce9a3..be78e76d75e15ace53867afb13bece32969c76ad 100644 (file)
@@ -258,6 +258,18 @@ int ClusterFragmentsCommand::execute(){
                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;
                
index cb3fc40aaa6e42a0e802d0f47ec3f8897cc4fa61..f9d38227f2d59709235bfe69f87385067317b1ab 100644 (file)
@@ -616,6 +616,25 @@ int ClusterSplitCommand::execute(){
                
                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();    }
index f65f6cc0fb14ab1d892dbcc5df567c086ca183c9..93669ba7babe40f9b5889e953bf943d362cd7bbe 100644 (file)
 #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
@@ -31,7 +32,6 @@ class Command {
                virtual ~Command() { }
        protected:
                MothurOut* m;
-               
                bool calledHelp;
        
                map<string, vector<string> >::iterator itTypes;
index a401177f74a97a3c61f9373a6390c249f24403a7..e18e6ac1956e3f21f990d6c5b1c45be42dafebf9 100644 (file)
 #include "mantelcommand.h"
 #include "makefastqcommand.h"
 #include "anosimcommand.h"
+#include "getcurrentcommand.h"
+#include "setcurrentcommand.h"
 
 /*******************************************************/
 
@@ -231,6 +233,8 @@ CommandFactory::CommandFactory(){
        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"; 
@@ -396,6 +400,8 @@ Command* CommandFactory::getCommand(string commandName, string optionString){
                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);                                          }
 
@@ -529,6 +535,8 @@ Command* CommandFactory::getCommand(string commandName, string optionString, str
                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;
@@ -649,6 +657,8 @@ Command* CommandFactory::getCommand(string commandName){
                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;
index 9880b8dbf01f72abe4a2a50d9630a2d09d3fd6d0..d64dc93c6b2c9e5812a24b02d19eaac8cc7ff742 100644 (file)
@@ -211,6 +211,13 @@ int ConcensusCommand::execute(){
                
                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) {
diff --git a/currentfile.cpp b/currentfile.cpp
deleted file mode 100644 (file)
index cf4800a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  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; 
-}
-/*********************************************************************************************/
-
-
index b76397198a4c221e96b3adcb3bf00ad9cecb5f12..8f2ea4822247c09dea03d2a6207f6e51c73ee7af 100644 (file)
 
 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; }
 };
 /***********************************************/
 
index 6c04c1255ab94010da7cacfb409d497b4f0354d4..62daa612d52a04fa72b85c1c621b89b539d14ab0 100644 (file)
@@ -177,7 +177,17 @@ int DeconvoluteCommand::execute() {
                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;
        }
index 5df61889747833ef27f5929d227c849ea7245769..7fd2803a4ec6c5e578d7b180a9e08fda1af33385 100644 (file)
@@ -219,6 +219,13 @@ int DegapSeqsCommand::execute(){
                        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();    }       
index 214359e3353f5521aa337085ce46136187d326c0..1d87204abd165396a20f99cbef0e3440eadbcd95 100644 (file)
@@ -215,6 +215,13 @@ int DeUniqueSeqsCommand::execute() {
                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) {
index 3d667227ae2219347f2523ee1ff8286988299423..5ffe0da63cfbbafd80ab1813a66b3cdb9779725b 100644 (file)
@@ -501,6 +501,19 @@ int DistanceCommand::execute(){
                
                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();
index 6fd4e04a0e562e5ee44fd0a05fc7df9b1bfae3d4..cb0b131f58e039f5eea76b784334715e1e7481e3 100644 (file)
@@ -302,6 +302,12 @@ int FilterSeqsCommand::execute() {
                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();
diff --git a/getcurrentcommand.cpp b/getcurrentcommand.cpp
new file mode 100644 (file)
index 0000000..bd7539a
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ *  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);
+       }
+}
+
+//**********************************************************************************************************************
+
+
+
diff --git a/getcurrentcommand.h b/getcurrentcommand.h
new file mode 100644 (file)
index 0000000..c36b6a5
--- /dev/null
@@ -0,0 +1,40 @@
+#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
+
index 2d7ac5481dedbc90863bc58eb6035176d629d70e..ac76d7397a004634e2b3d9a2c879e20ea7e95f2c 100644 (file)
@@ -258,6 +258,33 @@ int GetGroupsCommand::execute(){
                        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;               
index eee0ccad08a84f448ea47a42213673b0dd05254f..5a30e1e2e3495e6a9e2c69c06c11d45c83baec5f 100644 (file)
@@ -257,6 +257,33 @@ int GetLineageCommand::execute(){
                        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;               
index 84d3871c3d74026c8d92af7e5b66dfa03ebcba21..78c39f7c1c16e5bce1c4d0475ad06839ebe0758b 100644 (file)
@@ -543,6 +543,18 @@ int GetOTURepCommand::execute(){
                
                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();    }
index f10142bb74a67a9fa98bded8b8a2e0d48fa85358..15d2bcb8e46454809cdc4441574a469abfc6d6b2 100644 (file)
@@ -207,6 +207,18 @@ int GetOtusCommand::execute(){
                        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;               
index 0b2d4ee3ed0de4daf04da29b9ad5a3595143c4b1..3b03f3694967d6d480ba0dc00153454c7e8b074f 100644 (file)
@@ -262,6 +262,13 @@ int GetRAbundCommand::execute(){
                
                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;               
        }
 
index 5e48203f87e11fe14f54033b966b0bbd55bdde60..e79ccc9a3b3c9ec4812dc219af6dbe0428d5ece9 100644 (file)
@@ -263,6 +263,13 @@ int GetRelAbundCommand::execute(){
                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) {
index 2ae807c65c7d9f4ec814564fb5823ccd3f925471..0533af3604bd6361dadae6294efeb11f6c6c8fd2 100644 (file)
@@ -248,6 +248,13 @@ int GetSAbundCommand::execute(){
                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;               
        }
 
index 902cc07c2d6e8768e5aa9d1bacd3d9586e9196d9..68d0d2b4e4a8f9addeb39d4ee853d12aef61592f 100644 (file)
@@ -282,6 +282,39 @@ int GetSeqsCommand::execute(){
                        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;               
index 7746ef9873498cf43dfb33c735757908606e673d..4fe711e568728f0fa1af026bec4c21af822732cd 100644 (file)
@@ -334,6 +334,20 @@ int GetSharedOTUCommand::execute(){
                
                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();    }
index 94082dfc74dfe0969e769572fc6df219ecaa69d2..128dee379080ddf32704367789c916d3bce14f41 100644 (file)
@@ -395,7 +395,26 @@ int HClusterCommand::execute(){
                        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();
index 239a4bc65d7d80ddf6322eca0188550068cf758f..654ec066f7610ae4def19f745c28512a71d3b196 100644 (file)
@@ -325,6 +325,13 @@ int IndicatorCommand::execute(){
                        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();    }
index 406085728838262b79100a70133600639e6c47a2..a8a9d2b5a6cff6da2ab8e86e22af19782f5ce0bf 100644 (file)
@@ -226,6 +226,7 @@ int ListSeqsCommand::execute(){
 
                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++) {
@@ -237,12 +238,21 @@ int ListSeqsCommand::execute(){
                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;               
        }
 
index 1c04fecb477d09e0e6de73b1307a3878fcc8e4b3..8adfe09f7db893f6f8366f7cbecd18639b72f42c 100644 (file)
@@ -229,7 +229,14 @@ int MakeGroupCommand::execute(){
                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) {
index baf449e34d8bac9e67ab424ba02539fb053033e6..ef2c23688e09e37167e8bd8421a0a493a4c4f943 100644 (file)
@@ -402,6 +402,13 @@ int MatrixOutputCommand::execute(){
                //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();    }
index c54cd1c7dd8e578126b345c68ac0ac1d8f684e19..60b9c85481a2d455d53ab4b13a3bd46cfaf5a389 100644 (file)
@@ -273,6 +273,14 @@ int MergeGroupsCommand::execute(){
                
                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();    }
index 4809964db6f2e3a65bd30f72d8f157fd7bc1fa44..23f359eae8ab7fe84e9b86faf96d54d33ac8dcd3 100644 (file)
@@ -507,6 +507,26 @@ int MGClusterCommand::execute(){
                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;
index 96e7bb83e168a335472d77e9dae77359d2889951..0c25f2a62ed8961cfc8c29080ae37cd2f2d6b77a 100644 (file)
@@ -18,6 +18,63 @@ MothurOut* MothurOut::getInstance() {
        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;
index 750973fde12ecffe585f354fc413612fc50f21b6..35805320227e168d6b2862fe889374fa939a0ca9 100644 (file)
@@ -91,17 +91,86 @@ class MothurOut {
                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&);
index d9405a5129dd238ee2992a2986289ffffd6ed167..37cfb5daa98b4eeb850b44d60e5e9d80fa268de5 100644 (file)
@@ -381,6 +381,13 @@ int NormalizeSharedCommand::execute(){
                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) {
index 08032b32b83556f7ace0b83e235e51121e80f399..0506da6ff441c5a85e296c1fd6f3033110622335 100644 (file)
@@ -30,13 +30,83 @@ OptionParser::OptionParser(string option) {
                }
        }
        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);
+       }
+}
 
 /***********************************************************************/
index 0a4edea92911866d4768328ed2f2e46cf4a089b3..e3f8852203b21640567a725aa10af3d68eb6fbef 100644 (file)
@@ -494,6 +494,19 @@ int PairwiseSeqsCommand::execute(){
                        
                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();    }
index 7f4fbbab1096101aa8f09931e4c9ac40e04052b1..87ec2d26651749f20153b7854ba7c3930eebd70c 100644 (file)
@@ -28,7 +28,7 @@ ParseFastaQCommand::ParseFastaQCommand(){
                abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["fasta"] = tempOutNames;
-               outputTypes["qual"] = tempOutNames;
+               outputTypes["qfile"] = tempOutNames;
        }
        catch(exception& e) {
                m->errorOut(e, "ParseFastaQCommand", "ParseFastaQCommand");
@@ -84,7 +84,7 @@ ParseFastaQCommand::ParseFastaQCommand(string option){
                        //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);              
@@ -146,7 +146,7 @@ int ParseFastaQCommand::execute(){
                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);
@@ -194,6 +194,18 @@ int ParseFastaQCommand::execute(){
                
                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();    }
index fdacc3a58fb799ba9b1fcff2497d9ba5ab562ccd..2d26ef3672a364cd694e01d48922d9d53e56b0db 100644 (file)
@@ -295,6 +295,13 @@ int ParseListCommand::execute(){
                        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();    }
index 4b524dd09af79b7d9cc2653caec6eb9d4dfb36ad..c3aee4719859a4921ece77b25e7cf5dfe69d9aec 100644 (file)
@@ -305,6 +305,25 @@ int PhylotypeCommand::execute(){
                        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();    }
index 14409f5a0a6aa86a166f42ff6f99423777237759..0fb9370d191440562b9e6f6e7727ed00366b160b 100644 (file)
@@ -245,7 +245,19 @@ int PreClusterCommand::execute(){
                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;
                
        }
index 67575561721451bfe172c7235bb172ed24606155..3d0b94d84fb4ec54fe14e4b07a6adfde21f6f432 100644 (file)
@@ -310,8 +310,22 @@ int ReadOtuCommand::execute(){
                        
                        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) {
index 4462b52863f235cb8436d0db77fe5a3698823534..34a072b30a0b563fd22ddef60099224bdc6bf9f0 100644 (file)
@@ -258,6 +258,33 @@ int RemoveGroupsCommand::execute(){
                        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;               
index 6e43b1025cae8ccc828e7e48c51b63304200dc62..893b2100cc60aeb26806a6b47620d3aca468f72d 100644 (file)
@@ -256,6 +256,33 @@ int RemoveLineageCommand::execute(){
                        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;               
index 347bb0870f3fde2ab71c86c5b67918fad4a4904c..f1ef4ac5a80c7e2782843349d1433680b38bda45 100644 (file)
@@ -207,6 +207,18 @@ int RemoveOtusCommand::execute(){
                        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;               
index 0c656a053a7293f4ef7fa3325edead27339c9196..bcb9af60d096a82b13c13efa35f4b74d54b0897b 100644 (file)
@@ -243,6 +243,33 @@ int RemoveRareCommand::execute(){
                        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;               
index 81c42f6e426a2b59cb074a2d28cbed1c6e529c0b..1990e9c364d6bdedb257f2801abe55f566de8e29 100644 (file)
@@ -273,6 +273,38 @@ int RemoveSeqsCommand::execute(){
                        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;               
index 5eceb3049f0d6cbc41025c875843adce306a745c..fffe8a2b9de510bead87e0c9762cf75f71af8ef3 100644 (file)
@@ -181,7 +181,7 @@ int ReverseSeqsCommand::execute(){
                        }
                        inFASTA.close();
                        outFASTA.close();
-                       outputNames.push_back(fastaReverseFileName);
+                       outputNames.push_back(fastaReverseFileName); outputTypes["fasta"].push_back(fastaReverseFileName);
                }
                
                string qualReverseFileName;
@@ -204,9 +204,24 @@ int ReverseSeqsCommand::execute(){
                        }
                        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++){
@@ -214,6 +229,8 @@ int ReverseSeqsCommand::execute(){
                        m->mothurOutEndLine();
                }
                
+               
+               
                return 0;
        }
        catch(exception& e) {
index e6d29c190433d03ead4562f963c5416e7a1f65b8..8c334cb217b00d709f7bfa35220dce6a8d6c5dad 100644 (file)
@@ -484,6 +484,23 @@ int ScreenSeqsCommand::execute(){
                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();
diff --git a/setcurrentcommand.cpp b/setcurrentcommand.cpp
new file mode 100644 (file)
index 0000000..a4f5c5c
--- /dev/null
@@ -0,0 +1,449 @@
+/*
+ *  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);
+       }
+}
+
+//**********************************************************************************************************************
+
+
+
diff --git a/setcurrentcommand.h b/setcurrentcommand.h
new file mode 100644 (file)
index 0000000..98033b7
--- /dev/null
@@ -0,0 +1,46 @@
+#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
+
+
index 4a9271ce94df57f99e9734ba2b4d9d30d20872e9..973e14f4fd68416bac6949a149a75bb5fbe174c4 100644 (file)
@@ -30,7 +30,7 @@ SffInfoCommand::SffInfoCommand(){
                outputTypes["fasta"] = tempOutNames;
                outputTypes["flow"] = tempOutNames;
                outputTypes["sfftxt"] = tempOutNames;
-               outputTypes["qual"] = tempOutNames;
+               outputTypes["qfile"] = tempOutNames;
        }
        catch(exception& e) {
                m->errorOut(e, "SffInfoCommand", "SffInfoCommand");
@@ -89,7 +89,7 @@ SffInfoCommand::SffInfoCommand(string option)  {
                        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 = "";         }
@@ -300,6 +300,18 @@ int SffInfoCommand::execute(){
                
                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();
@@ -336,7 +348,7 @@ int SffInfoCommand::extractSffInfo(string input, string accnos){
                
                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;
index ec6b1d3828c38019085101abaa4a0599c539f974..731f981f7a7b9c14d7f0f9033671cc274b43595b 100644 (file)
@@ -321,6 +321,18 @@ int SharedCommand::execute(){
                                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();    }
index d0f925eb0ae26d98cd5f8098eca3ade34fc9e5d4..bdfbeae8f845fc235ac3d115367a13ac61ff883e 100644 (file)
@@ -332,6 +332,33 @@ int SplitAbundCommand::execute(){
                        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();    }
index d389d8907bfaffde16b8ca9eac4dad0061341831..16d90a48372f7c97d46f7fd4d0b640fde6b533fb 100644 (file)
@@ -184,6 +184,17 @@ int SplitGroupCommand::execute(){
                
                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();    }
index 223c9f5edf68c6eaa23f668e48ac0917854f6067..d24bcc5ad616b324b444f929ec3be57716dd05de 100644 (file)
@@ -295,7 +295,44 @@ int SubSampleCommand::execute(){
                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();    }
index a31c15192f1f27dcc1b84ddf114d0dcf485d41a3..07999f6a1ff89499fd92b9429191704b51545f61 100644 (file)
@@ -476,7 +476,14 @@ int TreeGroupCommand::execute(){
                }
                                
                //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();
index 6592651d068fc12580043897898479bf858a2047..bf80ee8cb3ea18ed3d363816eda22d0a501e141f 100644 (file)
@@ -330,6 +330,13 @@ int TrimFlowsCommand::execute(){
                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();    }
index 49aca824ea46fb18c5845e4caa5bab0aca5db305..0e0ed587343e1a02288f7a49b9af18c8dcf846c5 100644 (file)
@@ -405,7 +405,7 @@ int TrimSeqsCommand::execute(){
 
                //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(); }
 //             }
@@ -413,6 +413,23 @@ int TrimSeqsCommand::execute(){
                
                        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();    }
index 2e90626585b2c86e31f34770b7f7868eb2926ba7..5c0d5839c355e28c7a51e4a0433a840bd35a545f 100644 (file)
@@ -307,6 +307,19 @@ int UnifracUnweightedCommand::execute() {
                
                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();    }
index 0ccdf2f5b58888741328346b230b47cdf874a7d2..d5212009b46003b4046c5f8e2895321edbcb907d 100644 (file)
@@ -318,6 +318,19 @@ int UnifracWeightedCommand::execute() {
                
                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();    }