about summary refs log tree commit diff
path: root/main.cpp
diff options
context:
space:
mode:
authorxiangzhou2014-09-20 10:17:34 -0400
committerxiangzhou2014-09-20 10:17:34 -0400
commit17deca2d54827a00df3ea4d98df700fc2b8ed777 (patch)
tree7e63a05c61c3c33d425b5642aa8f9df38717d1f8 /main.cpp
downloadpangemma-17deca2d54827a00df3ea4d98df700fc2b8ed777.tar.gz
initial upload, version 0.95alpha
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..9ab98ea
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,86 @@
+/*
+	Genome-wide Efficient Mixed Model Association (GEMMA)
+    Copyright (C) 2011  Xiang Zhou
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "param.h"
+
+#ifdef FORCE_FLOAT
+#include "gemma_float.h"
+#else
+#include "gemma.h"
+#endif
+
+using namespace std;
+
+
+
+int main(int argc, char * argv[])
+{ 	
+	GEMMA cGemma;	
+	PARAM cPar;
+
+	if (argc <= 1) {
+		cGemma.PrintHeader(); 
+		return EXIT_SUCCESS;
+	}
+	if (argc==2 && argv[1][0] == '-' && argv[1][1] == 'h') {
+		cGemma.PrintHelp(0);
+		return EXIT_SUCCESS;
+	}
+	if (argc==3 && argv[1][0] == '-' && argv[1][1] == 'h') {
+		string str;
+		str.assign(argv[2]);
+		cGemma.PrintHelp(atoi(str.c_str()));
+		return EXIT_SUCCESS;
+	}
+	if (argc==2 && argv[1][0] == '-' && argv[1][1] == 'l') {
+		cGemma.PrintLicense();
+		return EXIT_SUCCESS;
+	}
+	
+	ifstream check_dir("output/");
+	if (!check_dir) {
+		mkdir("output", S_IRWXU|S_IRGRP|S_IROTH);
+	}	
+	
+	cGemma.Assign(argc, argv, cPar); 
+		
+	if (cPar.error==true) {return EXIT_FAILURE;}
+	     
+	if (cPar.mode_silence) {stringstream ss; cout.rdbuf (ss.rdbuf());}
+	
+	cPar.CheckParam();
+	
+	if (cPar.error==true) {return EXIT_FAILURE;}
+	
+	cGemma.BatchRun(cPar);
+	
+	if (cPar.error==true) {return EXIT_FAILURE;}
+	
+	cGemma.WriteLog(argc, argv, cPar);
+	
+    return EXIT_SUCCESS;                                                          
+}
+
+
+