#!/usr/bin/env python # Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 import arvados import os import re import sys import pyrtg this_job = arvados.current_job() this_task = arvados.current_task() fasta_path = arvados.util.collection_extract( collection = this_job['script_parameters']['input'], path = 'fasta', decompress = False) fasta_files = filter(lambda f: f != '.locator', os.listdir(fasta_path)) out_dir = os.path.join(arvados.current_task().tmpdir, 'ref-sdf') arvados.util.run_command(['rm', '-rf', out_dir], stderr=sys.stderr) pyrtg.run_rtg('format', out_dir, map(lambda f: os.path.join(fasta_path, f), fasta_files)) out = arvados.CollectionWriter() out.write_directory_tree(out_dir, max_manifest_depth=0) this_task.set_output(out.finish())