]> git.donarmstrong.com Git - mothur.git/commitdiff
adding current file class
authorwestcott <westcott>
Tue, 15 Mar 2011 19:40:48 +0000 (19:40 +0000)
committerwestcott <westcott>
Tue, 15 Mar 2011 19:40:48 +0000 (19:40 +0000)
aligncommand.cpp
aligncommand.h
amovacommand.cpp
anosimcommand.cpp
command.hpp
currentfile.cpp
currentfile.h

index cfedd3b3ca44effd5d1029936c8636db63d568bd..77e99c0b0f4d512ce1c9409207e50fdde18d32c6 100644 (file)
@@ -79,6 +79,7 @@ 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;}
index 169b43512375aef99a22029b35425d87d6360afb..d519e9154fecadd04d3e535c3cfe6916e03cabba 100644 (file)
@@ -15,6 +15,7 @@
 #include "database.hpp"
 #include "alignment.hpp"
 #include "alignmentdb.h"
+#include "mothurfiles.h"
 
 class AlignCommand : public Command {
        
@@ -59,6 +60,7 @@ private:
        vector<string> outputNames;
        
        bool abort, flip, calledHelp;
+       CurrentFile* currentFiles;
 
 };
 
index 74fbda7ff6164128551bead9cfb4c8bfabb7ba0e..13c8b2636680ee247cf05750cd57b6d5916b7d9c 100644 (file)
@@ -119,8 +119,8 @@ AmovaCommand::AmovaCommand(string option) {
                                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;  }
+                               //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
@@ -130,8 +130,8 @@ AmovaCommand::AmovaCommand(string option) {
                                designFileName = "";
                                
                                //check currentFiles for a design file
-                               if (currentFiles->getDesignFile() != "") {  designFileName = currentFiles->getPhylipFile(); m->mothurOut("Using " + designFileName + " as phylip file."); m->mothurOutEndLine();
-                               }else { m->mothurOut("You must provide an design file."); m->mothurOutEndLine(); abort = true;  }
+                               //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 bb0f495a0ac81d6ce72c358b0c02d13592f8dbb2..443cf8aae28e423b703085c4b2f14ce65ef86cfa 100644 (file)
@@ -115,12 +115,12 @@ AnosimCommand::AnosimCommand(string option) {
                        
                        phylipFileName = validParameter.validFile(parameters, "phylip", true);
                        if (phylipFileName == "not open") { phylipFileName = ""; abort = true; }
-                       else if (phylipFileName == "not found") { phylipFileName = ""; }        
-                       else if (designFileName == "not found") {
-                               designFileName = "";
-                               m->mothurOut("You must provide an phylip file.");
-                               m->mothurOutEndLine();
-                               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,9 +128,11 @@ AnosimCommand::AnosimCommand(string option) {
                        if (designFileName == "not open") { abort = true; }
                        else if (designFileName == "not found") {
                                designFileName = "";
-                               m->mothurOut("You must provide an design file.");
-                               m->mothurOutEndLine();
-                               abort = true;
+                               
+                               //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 2d1981aa4cca8d7e608e3708750fc079600d1265..f65f6cc0fb14ab1d892dbcc5df567c086ca183c9 100644 (file)
 #include "optionparser.h"
 #include "validparameter.h"
 #include "mothurout.h"
-#include "currentfile.h"
 
 class Command {
        
        public:
-               Command() {  m = MothurOut::getInstance(); currentFiles = CurrentFile::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
@@ -32,7 +31,7 @@ class Command {
                virtual ~Command() { }
        protected:
                MothurOut* m;
-               CurrentFile* currentFiles;
+               
                bool calledHelp;
        
                map<string, vector<string> >::iterator itTypes;
index 6990a2a529d5b695cbf997b94d7d521c290ab332..cf4800a39f546032c47e341ed8a99f34b86837a5 100644 (file)
@@ -18,6 +18,8 @@ CurrentFile* CurrentFile::getInstance() {
 }
 /*********************************************************************************************/
 CurrentFile::CurrentFile() { 
+       m = MothurOut::getInstance();
+       
        phylipfile = "";
        columnfile = "";
        listfile = "";
index 8acf2a932e4ca13f3b880add560a72172786db4c..b76397198a4c221e96b3adcb3bf00ad9cecb5f12 100644 (file)
@@ -10,6 +10,7 @@
  *
  */
 
+#include "mothurout.h"
 #include "mothur.h"
 
 /***********************************************/
@@ -39,31 +40,33 @@ public:
        string getOligosFile()          { return oligosfile;            }
        
        
-       void setListFile(string f)                      { listfile = f;                         }
-       void setTreeFile(string f)                      { treefile = f;                         }
-       void setGroupFile(string f)                     { groupfile = f;                        }               
-       void setPhylipFile(string f)            { phylipfile = f;                       }
-       void setColumnFile(string f)            { columnfile = f;                       }
-       void setNameFile(string f)                      { namefile = f;                         }       
-       void setRabundFile(string f)            { rabundfile = f;                       }
-       void setSabundFile(string f)            { sabundfile = f;                       }
-       void setSharedFile(string f)            { sharedfile = f;                       }
-       void setRelAbundFile(string f)          { relabundfile = f;                     }
-       void setOrderFile(string f)                     { orderfile = f;                        }
-       void setOrderGroupFile(string f)        { ordergroupfile = f;           }
-       void setDesignFile(string f)            { designfile = f;                       }
-       void setFastaFile(string f)                     { fastafile = f;                        }
-       void setSFFFile(string f)                       { sfffile = f;                          }
-       void setQualFile(string f)                      { qualfile = f;                         }
-       void setOligosFile(string f)            { oligosfile = f;                       }
+       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;