From 69255e061e6783e729d90026c2f65e458758a326 Mon Sep 17 00:00:00 2001
From: Luis Pedro Coelho <luis@luispedro.org>
Date: Wed, 26 Apr 2017 10:38:10 +0200
Subject: [PATCH] MIN numpy and pandas are necessary too

Mention in README
Check before import
---
 README.md       |  4 ++--
 metaSNV_post.py | 20 ++++++++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 0b0905a..dc76f79 100644
--- a/README.md
+++ b/README.md
@@ -40,14 +40,14 @@ universe repository before):
 If you use [anaconda](https://www.continuum.io/downloads), you can create an
 environment with all necessary dependencies using the following commands:
 
-    conda create --name metaSNV boost htslib pkg-config
+    conda create --name metaSNV boost htslib pkg-config numpy pandas
     source activate metaSNV
     export CFLAGS=-I$CONDA_ENV_PATH/include
     export LD_LIBRARY_PATH=$CONDA_ENV_PATH/lib:$LD_LIBRARY_PATH
 
 If you do not have a C++ compiler, anaconda can also install G++:
 
-    conda create --name metaSNV boost htslib pkg-config
+    conda create --name metaSNV boost htslib pkg-config numpy pandas
     source activate metaSNV
     # Add this command:
     conda install gcc
diff --git a/metaSNV_post.py b/metaSNV_post.py
index 5317283..ccd1afc 100755
--- a/metaSNV_post.py
+++ b/metaSNV_post.py
@@ -1,12 +1,20 @@
 #!/usr/bin/env python
-import os               # interacting with operating system
-import sys		# interact with system commandline 
-import time		# print current date/time
-import argparse		# manage command line options and arguments
+import os
+import sys
+import time
+import argparse
 import glob
 
-import numpy as np
-import pandas as pd
+try:
+	import numpy as np
+except ImportError:
+	sys.stderr.write("Numpy is necessary to run postfiltering.\n")
+	sys.exit(1)
+try:
+	import pandas as pd
+except ImportError:
+	sys.stderr.write("Pandas is necessary to run postfiltering.\n")
+	sys.exit(1)
 
 
 basedir = os.path.dirname(os.path.abspath(__file__))
-- 
GitLab