Mercurial > repos > dfornika > snippy
comparison snippy_core_wrapper.py @ 5:b9eacd069df6 draft
planemo upload for repository https://github.com/tseemann/snippy commit 73ec6ea773b1b88f7c32a2e8bc57b644b82f7ff9-dirty
| author | dfornika |
|---|---|
| date | Mon, 21 Jan 2019 15:46:37 -0500 |
| parents | 3f5ced130c5c |
| children | ab3026667cdc |
comparison
equal
deleted
inserted
replaced
| 4:3f5ced130c5c | 5:b9eacd069df6 |
|---|---|
| 20 from shutil import copyfile | 20 from shutil import copyfile |
| 21 | 21 |
| 22 def main(): | 22 def main(): |
| 23 parser = argparse.ArgumentParser() | 23 parser = argparse.ArgumentParser() |
| 24 parser.add_argument('-r', '--ref', help='Reference fasta', required=True) | 24 parser.add_argument('-r', '--ref', help='Reference fasta', required=True) |
| 25 parser.add_argument('inputs', nargs='+') | 25 parser.add_argument('-i', '--indirs', nargs='+') |
| 26 args = parser.parse_args() | 26 args = parser.parse_args() |
| 27 | 27 |
| 28 snippy_core_command_line = ['snippy-core', '--ref', args.ref] | 28 snippy_core_command_line = ['snippy-core', '--ref', args.ref] |
| 29 | 29 |
| 30 for input in args.inputs: | 30 for indir in args.indirs: |
| 31 bn = os.path.basename(input) | 31 base_name = os.path.basename(indir) |
| 32 sys.stderr.write(input + '\n') | 32 sys.stderr.write(indir + '\n') |
| 33 copyfile(input, bn) | 33 copyfile(indir, base_name) |
| 34 sys.stderr.write('\n'.join([input, bn]) + '\n') | 34 sys.stderr.write('\n'.join([indir, base_name]) + '\n') |
| 35 subprocess.run(['tar', '-xf', bn]) | 35 subprocess.run(['tar', '-xf', base_name]) |
| 36 | 36 |
| 37 test_list = [f.path for f in os.scandir() if f.is_dir() ] | 37 extracted_dirs = [f.path for f in os.scandir() if f.is_dir() ] |
| 38 | 38 |
| 39 for dir in test_list: | 39 for extracted_dir in extracted_dirs: |
| 40 snippy_core_command_line.append(dir) | 40 snippy_core_command_line.append(extracted_dir) |
| 41 | 41 |
| 42 print(snippy_core_command_line) | 42 print(snippy_core_command_line) |
| 43 subprocess.run(snippy_core_command_line) | 43 subprocess.run(snippy_core_command_line) |
| 44 | |
| 44 if __name__ == '__main__': | 45 if __name__ == '__main__': |
| 45 main() | 46 main() |
