2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: Apache-2.0
12 this_job = arvados.current_job()
13 this_task = arvados.current_task()
14 fasta_path = arvados.util.collection_extract(
15 collection = this_job['script_parameters']['input'],
18 fasta_files = filter(lambda f: f != '.locator', os.listdir(fasta_path))
19 out_dir = os.path.join(arvados.current_task().tmpdir, 'ref-sdf')
20 arvados.util.run_command(['rm', '-rf', out_dir], stderr=sys.stderr)
22 pyrtg.run_rtg('format', out_dir,
23 map(lambda f: os.path.join(fasta_path, f), fasta_files))
25 out = arvados.CollectionWriter()
26 out.write_directory_tree(out_dir, max_manifest_depth=0)
27 this_task.set_output(out.finish())