X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothur.cpp;h=2d8f2f4bb0b234076d94c1e5845823b6d75fdc2f;hb=f81efc0c56f3be9ff2ee32a9a9469e07b4cb3bee;hp=c60644d027d7fee1f1e18ce90b5a4458c411ef3b;hpb=c5c7502f435e1413c19e373dab1dfebcaa67588d;p=mothur.git diff --git a/mothur.cpp b/mothur.cpp index c60644d..2d8f2f4 100644 --- a/mothur.cpp +++ b/mothur.cpp @@ -11,25 +11,84 @@ #include "engine.hpp" #include "globaldata.hpp" -using namespace std; - /**************************************************************************************************/ GlobalData* GlobalData::_uniqueInstance = 0; int main(int argc, char *argv[]){ try { + + //remove old logfile + string logFileName = "mothur.logFile"; + remove(logFileName.c_str()); + + //version + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + system("clear"); + #if defined (__APPLE__) || (__MACH__) + mothurOutJustToLog("Mac version"); + mothurOutEndLine(); mothurOutEndLine(); + #else + mothurOutJustToLog("Linux version"); + mothurOutEndLine(); mothurOutEndLine(); + #endif + + #else + system("CLS"); + mothurOutJustToLog("Windows version"); + mothurOutEndLine(); mothurOutEndLine(); + #endif + + + //header + mothurOut("mothur v.1.7.0"); + mothurOutEndLine(); + mothurOut("Last updated: 11/23/2009"); + mothurOutEndLine(); + mothurOutEndLine(); + mothurOut("by"); + mothurOutEndLine(); + mothurOut("Patrick D. Schloss"); + mothurOutEndLine(); + mothurOutEndLine(); + mothurOut("Department of Microbiology & Immunology"); + mothurOutEndLine(); + mothurOut("University of Michigan"); + mothurOutEndLine(); + mothurOut("pschloss@umich.edu"); + mothurOutEndLine(); + mothurOut("http://www.mothur.org"); + mothurOutEndLine(); + mothurOutEndLine(); + mothurOutEndLine(); + mothurOut("Distributed under the GNU General Public License"); + mothurOutEndLine(); + mothurOutEndLine(); + mothurOut("Type 'help()' for information on the commands that are available"); + mothurOutEndLine(); + mothurOutEndLine(); + mothurOut("Type 'quit()' to exit program"); + mothurOutEndLine(); + + //srand(54321); srand( (unsigned)time( NULL ) ); Engine* mothur; bool bail = 0; + string input; if(argc>1){ - mothur = new BatchEngine(argv[1]); + input = argv[1]; + + if (input[0] == '#') { + mothur = new ScriptEngine(argv[0], argv[1]); + }else{ + mothur = new BatchEngine(argv[0], argv[1]); + } } else{ - mothur = new InteractEngine(); + mothur = new InteractEngine(argv[0]); } while(bail == 0) { bail = mothur->getInput(); } @@ -39,11 +98,7 @@ int main(int argc, char *argv[]){ return 0; } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the dotur class Function main. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - catch(...) { - cout << "An unknown error has occurred in the dotur class function main. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + errorOut(e, "mothur", "main"); exit(1); } }