5 * Created by Pat Schloss on 8/14/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
12 #include "globaldata.hpp"
13 #include "mothurout.h"
15 /**************************************************************************************************/
17 GlobalData* GlobalData::_uniqueInstance = 0;
18 CommandFactory* CommandFactory::_uniqueInstance = 0;
19 MothurOut* MothurOut::_uniqueInstance = 0;
21 int main(int argc, char *argv[]){
22 MothurOut* m = MothurOut::getInstance();
25 //string log = "mothur.logFile";
26 //remove(log.c_str());
28 time_t ltime = time(NULL); /* calendar time */
29 string logFileName = "mothur." + toString(ltime) + ".logfile";
31 m->setFileName(logFileName);
34 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
36 #if defined (__APPLE__) || (__MACH__)
37 m->mothurOutJustToLog("Mac version");
38 m->mothurOutEndLine(); m->mothurOutEndLine();
40 m->mothurOutJustToLog("Linux version");
41 >m->mothurOutEndLine(); m->mothurOutEndLine();
46 m->mothurOutJustToLog("Windows version");
47 m->mothurOutEndLine(); m->mothurOutEndLine();
51 m->mothurOutJustToLog("Using ReadLine");
52 m->mothurOutEndLine(); m->mothurOutEndLine();
56 m->mothurOut("mothur v.1.8");
57 m->mothurOutEndLine();
58 m->mothurOut("Last updated: 2/02/2010");
59 m->mothurOutEndLine();
60 m->mothurOutEndLine();
62 m->mothurOutEndLine();
63 m->mothurOut("Patrick D. Schloss");
64 m->mothurOutEndLine();
65 m->mothurOutEndLine();
66 m->mothurOut("Department of Microbiology & Immunology");
67 m->mothurOutEndLine();
68 m->mothurOut("University of Michigan");
69 m->mothurOutEndLine();
70 m->mothurOut("pschloss@umich.edu");
71 m->mothurOutEndLine();
72 m->mothurOut("http://www.mothur.org");
73 m->mothurOutEndLine();
74 m->mothurOutEndLine();
75 m->mothurOut("When using, please cite:");
76 m->mothurOutEndLine();
77 m->mothurOut("Schloss, P.D., et al., Introducing mothur: Open-source, platform-independent, community-supported software for describing and comparing microbial communities. Appl Environ Microbiol, 2009. 75(23):7537-41.");
78 m->mothurOutEndLine();
79 m->mothurOutEndLine();
80 m->mothurOut("Distributed under the GNU General Public License");
81 m->mothurOutEndLine();
82 m->mothurOutEndLine();
83 m->mothurOut("Type 'help()' for information on the commands that are available");
84 m->mothurOutEndLine();
85 m->mothurOutEndLine();
86 m->mothurOut("Type 'quit()' to exit program");
87 m->mothurOutEndLine();
91 srand( (unsigned)time( NULL ) );
100 if (input[0] == '#') {
101 m->mothurOutJustToLog("Script Mode");
102 m->mothurOutEndLine(); m->mothurOutEndLine();
104 mothur = new ScriptEngine(argv[0], argv[1]);
106 m->mothurOutJustToLog("Batch Mode");
107 m->mothurOutEndLine(); m->mothurOutEndLine();
109 mothur = new BatchEngine(argv[0], argv[1]);
113 m->mothurOutJustToLog("Interactive Mode");
114 m->mothurOutEndLine(); m->mothurOutEndLine();
116 mothur = new InteractEngine(argv[0]);
119 while(bail == 0) { bail = mothur->getInput(); }
121 string outputDir = mothur->getOutputDir();
122 string newlogFileName = outputDir + logFileName;
124 //need this because m->mothurOut makes the logfile, but doesn't know where to put it
125 rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp
131 catch(exception& e) {
132 m->errorOut(e, "mothur", "main");
137 /**************************************************************************************************/