diff --git a/scripts/snpEffBuildAndRun b/scripts/snpEffBuildAndRun index 152dc79..178dab7 100755 --- a/scripts/snpEffBuildAndRun +++ b/scripts/snpEffBuildAndRun @@ -30,8 +30,6 @@ def parse_arguments(): parser.add_argument('--keep', action='store_true', default=False, help="Keep temporary files and databases (useful for debugging)") args = parser.parse_args() - args = check_and_amend_executables(args) - return args if __name__ == '__main__': @@ -43,4 +41,5 @@ if __name__ == '__main__': logging.basicConfig(format="[%(asctime)s] %(levelname)s: %(message)s", level=logging.INFO) logger = logging.getLogger('snpEffWrapper') + args = check_and_amend_executables(args) annotate_vcf(args) diff --git a/setup.py b/setup.py index a95b966..469f453 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import multiprocessing setup(name='snpEffWrapper', - version='0.2.1', + version='0.2.2', scripts=[ 'scripts/snpEffBuildAndRun' ], diff --git a/snpEffWrapper/wrapper.py b/snpEffWrapper/wrapper.py index 6dd1d2f..c60d59a 100755 --- a/snpEffWrapper/wrapper.py +++ b/snpEffWrapper/wrapper.py @@ -37,6 +37,8 @@ class AnnotationError(ValueError): pass def _java_version_ok(java): + if java is None: + return False try: output = subprocess.check_output([java, '-version'], stderr=subprocess.STDOUT) first_line = output.decode("utf-8").splitlines()[0] @@ -48,14 +50,15 @@ def _java_version_ok(java): return False def _choose_java(): - path_java = shutil.which('java') - if not path_java is None and _java_version_ok(path_java): - logger.debug("Using '%s'", path_java) - return path_java - sanger_pathogens_java='/software/pathogen/external/apps/usr/local/jdk1.7.0_21/bin/java' - if not path_java is None and _java_version_ok(sanger_pathogens_java): - logger.debug("Using '%s'", sanger_pathogens_java) - return sanger_pathogens_java + possible_javas = [ + shutil.which('java'), + '/software/bin/java', + '/software/pathogen/external/apps/usr/local/jdk1.7.0_21/bin/java' + ] + for java in possible_javas: + if _java_version_ok(java): + logger.debug("Using '%s'", java) + return java raise WrongJavaError("Could not find a suitable version of Java (1.7)") def check_and_amend_executables(args):