]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.cpp
changing command name classify.shared to classifyrf.shared
[mothur.git] / mothur.cpp
index 67ede87039d783c71a40a0317d3a1ccbffdc7b97..accdb2962c198988c457dc8f837b8817dc2799f0 100644 (file)
 #include "mothur.h"
 #include "engine.hpp"
 #include "mothurout.h"
+#include "referencedb.h"
 
 /**************************************************************************************************/
 
 CommandFactory* CommandFactory::_uniqueInstance = 0;
 MothurOut* MothurOut::_uniqueInstance = 0;
-
+ReferenceDB* ReferenceDB::myInstance = 0;
 /***********************************************************************/
 volatile int ctrlc_pressed = 0;
 void ctrlc_handler ( int sig ) {
@@ -45,7 +46,7 @@ int main(int argc, char *argv[]){
 
                m->setFileName(logFileName);
                
-               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        system("clear");
                #else
                        system("CLS");
@@ -56,7 +57,7 @@ int main(int argc, char *argv[]){
                
                        //add / to name if needed
                        string lastChar = temp.substr(temp.length()-1);
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                if (lastChar != "/") { temp += "/"; }
                        #else
                                if (lastChar != "\\") { temp += "\\"; } 
@@ -78,15 +79,16 @@ int main(int argc, char *argv[]){
                m->setVersion(mothurVersion);
                
                //will make the gui output "pretty"
-               bool guiMode = false;
+               bool outputHeader = true;
                if (argc>1) {
                        string guiInput = argv[1];
-                       if (guiInput[0] == '+') { guiMode = true; }
+                       if (guiInput[0] == '+') { outputHeader = false; }
+                       if (guiInput[0] == '-') { outputHeader = false; }
                }
                
-               if (!guiMode) {
+               if (outputHeader)  {
                        //version
-                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+                       #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                                #if defined (__APPLE__) || (__MACH__)
                                        m->mothurOutJustToLog("Mac version");
                                        m->mothurOutEndLine(); m->mothurOutEndLine();
@@ -161,7 +163,7 @@ int main(int argc, char *argv[]){
                //srand(54321);
                srand( (unsigned)time( NULL ) );
                
-               Engine* mothur;
+               Engine* mothur = NULL;
                bool bail = 0;
                string input;
  
@@ -177,6 +179,12 @@ int main(int argc, char *argv[]){
                        }else if (input[0] == '+') {
                                        mothur = new ScriptEngine(argv[0], argv[1]);
                                        m->gui = true;
+                       }else if (input == "-version") {
+                               m->mothurOut("Mothur version=" + mothurVersion + "\nRelease Date=" + releaseDate); m->mothurOutEndLine(); m->mothurOutEndLine(); m->closeLog();
+                               #ifdef USE_MPI
+                                       MPI_Finalize();
+                               #endif
+                               return 0;
                        }else{
                                m->mothurOutJustToLog("Batch Mode");
                                m->mothurOutEndLine(); m->mothurOutEndLine();
@@ -220,7 +228,7 @@ int main(int argc, char *argv[]){
                                outNewLog.close();
                                
                                m->appendFiles(logFileName, newlogFileName);
-                               remove(logFileName.c_str());
+                               m->mothurRemove(logFileName);
                        }
                }else{  
                        newlogFileName = outputDir + logFileName;
@@ -229,7 +237,7 @@ int main(int argc, char *argv[]){
                }
                
                                
-               delete mothur;
+               if (mothur != NULL) { delete mothur; }
                
                #ifdef USE_MPI
                        MPI_Finalize();