9 this_job = arvados.current_job()
10 this_task = arvados.current_task()
11 ref_dir = arvados.util.collection_extract(
12 collection = this_job['script_parameters']['reference'],
15 input_dir = arvados.util.collection_extract(
16 collection = this_job['script_parameters']['input'],
18 bam_files = map(lambda f: os.path.join(input_dir, f),
19 filter(lambda f: re.search(r'^(.*/)?alignments.bam$', f),
20 arvados.util.listdir_recursive(input_dir)))
21 out_dir = os.path.join(arvados.current_task().tmpdir, 'out')
22 arvados.util.run_command(['rm', '-rf', out_dir], stderr=sys.stderr)
24 # call sequence variants
25 pyrtg.run_rtg('snp', out_dir,
26 ['-t', ref_dir] + bam_files)
29 out = arvados.CollectionWriter()
30 out.write_directory_tree(out_dir, max_manifest_depth=0)
31 this_task.set_output(out.finish())