]> git.donarmstrong.com Git - mothur.git/blob - mothur.cpp
added sorted parameter to get.oturep, added error checking to chimera classes in...
[mothur.git] / mothur.cpp
1 /*
2  *  interface.cpp
3  *  
4  *
5  *  Created by Pat Schloss on 8/14/08.
6  *  Copyright 2008 Patrick D. Schloss. All rights reserved.
7  *
8  */
9  
10 #include "mothur.h"
11 #include "engine.hpp"
12 #include "globaldata.hpp"
13
14 /**************************************************************************************************/
15
16 GlobalData* GlobalData::_uniqueInstance = 0;
17 CommandFactory* CommandFactory::_uniqueInstance = 0;
18
19 int main(int argc, char *argv[]){
20         try {
21                 
22                 //remove old logfile
23                 string logFileName = "mothur.logFile";
24                 remove(logFileName.c_str());
25                 
26                 //version
27                 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
28                         system("clear");
29                         #if defined (__APPLE__) || (__MACH__)
30                                 mothurOutJustToLog("Mac version");
31                                 mothurOutEndLine(); mothurOutEndLine();
32                         #else
33                                 mothurOutJustToLog("Linux version");
34                                 mothurOutEndLine(); mothurOutEndLine();
35                         #endif
36
37                 #else
38                         system("CLS");
39                         mothurOutJustToLog("Windows version");
40                         mothurOutEndLine(); mothurOutEndLine();
41                 #endif          
42
43                 
44                 //header
45                 mothurOut("mothur v.1.7.2");
46                 mothurOutEndLine();             
47                 mothurOut("Last updated: 12/04/2009");
48                 mothurOutEndLine();     
49                 mothurOutEndLine();             
50                 mothurOut("by");
51                 mothurOutEndLine();             
52                 mothurOut("Patrick D. Schloss");
53                 mothurOutEndLine();
54                 mothurOutEndLine();                     
55                 mothurOut("Department of Microbiology & Immunology");
56                 mothurOutEndLine();     
57                 mothurOut("University of Michigan");
58                 mothurOutEndLine();                     
59                 mothurOut("pschloss@umich.edu");
60                 mothurOutEndLine();             
61                 mothurOut("http://www.mothur.org");
62                 mothurOutEndLine();
63                 mothurOutEndLine();
64                 mothurOut("When using, please cite:");
65                 mothurOutEndLine();
66                 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.");
67                 mothurOutEndLine();     
68                 mothurOutEndLine();             
69                 mothurOut("Distributed under the GNU General Public License");
70                 mothurOutEndLine();
71                 mothurOutEndLine();                     
72                 mothurOut("Type 'help()' for information on the commands that are available");
73                 mothurOutEndLine();
74                 mothurOutEndLine();                     
75                 mothurOut("Type 'quit()' to exit program");
76                 mothurOutEndLine();     
77
78                                 
79                 //srand(54321);
80                 srand( (unsigned)time( NULL ) );
81                 
82                 Engine* mothur;
83                 bool bail = 0;
84                 string input;
85
86                 if(argc>1){
87                         input = argv[1];
88
89                         if (input[0] == '#') {
90                                 mothur = new ScriptEngine(argv[0], argv[1]);
91                         }else{
92                                 mothur = new BatchEngine(argv[0], argv[1]);
93                         }
94                 }
95                 else{
96                         mothur = new InteractEngine(argv[0]);   
97                 }
98                 
99                 //used to intercept the terminate signal, so instead of terminating mothur it will end a command
100                 //void (*prev_fn)(int);
101                 //prev_fn = signal(SIGTERM, mothur->terminateCommand(0));
102                 
103                 //if (prev_fn==SIG_IGN) signal (SIGTERM,SIG_IGN);
104
105                 
106                 while(bail == 0)                {       bail = mothur->getInput();                      }
107         
108                 delete mothur;
109         
110                 return 0;
111         }
112         catch(exception& e) {
113                 errorOut(e, "mothur", "main");
114                 exit(1);
115         }
116 }
117
118 /**************************************************************************************************/
119