Mercurial > repos > dfornika > snippy
comparison snippy_core_wrapper.py @ 4:3f5ced130c5c draft
planemo upload for repository https://github.com/tseemann/snippy commit 73ec6ea773b1b88f7c32a2e8bc57b644b82f7ff9-dirty
author | dfornika |
---|---|
date | Mon, 21 Jan 2019 15:18:21 -0500 |
parents | |
children | b9eacd069df6 |
comparison
equal
deleted
inserted
replaced
3:eb46a277d64b | 4:3f5ced130c5c |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 #-------------------------------------- | |
4 # | |
5 # snippy_core_wrapper.py | |
6 # | |
7 # This is an intermediary script between snippy-core.xml and snippy-core | |
8 # It: | |
9 # - Copys the supplied zipped snippy output files to the working dir | |
10 # - Untars them to their datafile name | |
11 # - Builds the snippy-core command | |
12 # - Runs the snippy-core command | |
13 # | |
14 #-------------------------------------- | |
15 | |
16 import os | |
17 import sys | |
18 import argparse | |
19 import subprocess | |
20 from shutil import copyfile | |
21 | |
22 def main(): | |
23 parser = argparse.ArgumentParser() | |
24 parser.add_argument('-r', '--ref', help='Reference fasta', required=True) | |
25 parser.add_argument('inputs', nargs='+') | |
26 args = parser.parse_args() | |
27 | |
28 snippy_core_command_line = ['snippy-core', '--ref', args.ref] | |
29 | |
30 for input in args.inputs: | |
31 bn = os.path.basename(input) | |
32 sys.stderr.write(input + '\n') | |
33 copyfile(input, bn) | |
34 sys.stderr.write('\n'.join([input, bn]) + '\n') | |
35 subprocess.run(['tar', '-xf', bn]) | |
36 | |
37 test_list = [f.path for f in os.scandir() if f.is_dir() ] | |
38 | |
39 for dir in test_list: | |
40 snippy_core_command_line.append(dir) | |
41 | |
42 print(snippy_core_command_line) | |
43 subprocess.run(snippy_core_command_line) | |
44 if __name__ == '__main__': | |
45 main() |