Mercurial > repos > peterjc > seq_select_by_id
comparison tools/seq_select_by_id/seq_select_by_id.py @ 9:3b0a14722175 draft default tip
v0.0.14 - Script works on Python 2 and 3 (fixed output file mode)
author | peterjc |
---|---|
date | Wed, 23 May 2018 09:15:13 -0400 |
parents | 8e1a90917fa7 |
children |
comparison
equal
deleted
inserted
replaced
8:8e1a90917fa7 | 9:3b0a14722175 |
---|---|
24 from __future__ import print_function | 24 from __future__ import print_function |
25 | 25 |
26 import sys | 26 import sys |
27 | 27 |
28 if "-v" in sys.argv or "--version" in sys.argv: | 28 if "-v" in sys.argv or "--version" in sys.argv: |
29 print("v0.0.13") | 29 print("v0.0.14") |
30 sys.exit(0) | 30 sys.exit(0) |
31 | 31 |
32 # Parse Command Line | 32 # Parse Command Line |
33 try: | 33 try: |
34 tabular_file, col_arg, in_file, seq_format, out_file = sys.argv[1:] | 34 tabular_file, col_arg, in_file, seq_format, out_file = sys.argv[1:] |
126 raise | 126 raise |
127 out_handle.close() | 127 out_handle.close() |
128 else: | 128 else: |
129 # Avoid overhead of parsing into SeqRecord objects, | 129 # Avoid overhead of parsing into SeqRecord objects, |
130 # just re-use the original formatting from the input file. | 130 # just re-use the original formatting from the input file. |
131 out_handle = open(out_file, "w") | 131 out_handle = open(out_file, "wb") |
132 count = 0 | 132 count = 0 |
133 for name in parse_ids(tabular_file, column): | 133 for name in parse_ids(tabular_file, column): |
134 try: | 134 try: |
135 out_handle.write(records.get_raw(name)) | 135 out_handle.write(records.get_raw(name)) |
136 except KeyError: | 136 except KeyError: |