5365: Additional test verifications for Log tab display.
[arvados.git] / crunch_scripts / rtg-fasta2sdf
1 #!/usr/bin/env python
2
3 import arvados
4 import os
5 import re
6 import sys
7 import pyrtg
8
9 this_job = arvados.current_job()
10 this_task = arvados.current_task()
11 fasta_path = arvados.util.collection_extract(
12     collection = this_job['script_parameters']['input'],
13     path = 'fasta',
14     decompress = False)
15 fasta_files = filter(lambda f: f != '.locator', os.listdir(fasta_path))
16 out_dir = os.path.join(arvados.current_task().tmpdir, 'ref-sdf')
17 arvados.util.run_command(['rm', '-rf', out_dir], stderr=sys.stderr)
18
19 pyrtg.run_rtg('format', out_dir,
20               map(lambda f: os.path.join(fasta_path, f), fasta_files))
21
22 out = arvados.CollectionWriter()
23 out.write_directory_tree(out_dir, max_manifest_depth=0)
24 this_task.set_output(out.finish())