Skip to content

Commit

Permalink
Merge pull request #5 from bewt85/bt5_more_javas
Browse files Browse the repository at this point in the history
More javas
  • Loading branch information
John Tate committed Nov 3, 2015
2 parents 1e4eb33 + b5db48c commit 6ffe7e9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions scripts/snpEffBuildAndRun
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand All @@ -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)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import multiprocessing

setup(name='snpEffWrapper',
version='0.2.1',
version='0.2.2',
scripts=[
'scripts/snpEffBuildAndRun'
],
Expand Down
19 changes: 11 additions & 8 deletions snpEffWrapper/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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):
Expand Down

0 comments on commit 6ffe7e9

Please sign in to comment.