1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
12 picard_install_path = None
15 global picard_install_path
16 if picard_install_path:
17 return picard_install_path
18 zipball = arvados.current_job()['script_parameters']['picard_zip']
19 extracted = arvados.util.zipball_extract(
22 for f in os.listdir(extracted):
23 if (re.search(r'^picard-tools-[\d\.]+$', f) and
24 os.path.exists(os.path.join(extracted, f, '.'))):
25 picard_install_path = os.path.join(extracted, f)
27 if not picard_install_path:
28 raise Exception("picard-tools-{version} directory not found in %s" %
30 return picard_install_path
32 def run(module, **kwargs):
33 kwargs.setdefault('cwd', arvados.current_task().tmpdir)
36 '-Djava.io.tmpdir=' + arvados.current_task().tmpdir,
37 '-jar', os.path.join(install_path(), module + '.jar')]
38 execargs += [str(arg) for arg in kwargs.pop('args', [])]
39 for key, value in kwargs.pop('params', {}).items():
40 execargs += [key.upper() + '=' + str(value)]
41 sys.stderr.write("%s.run: exec %s\n" % (__name__, str(execargs)))
42 return arvados.util.run_command(execargs, **kwargs)