Debian Codegraph @

pyfastaq/runners/enumerate_names.py

raw
1 import argparse
2 from pyfastaq import tasks
3
4 def run(description):
5 parser = argparse.ArgumentParser(
6 description = 'Renames sequences in a file, calling them 1,2,3... etc',
7 usage = 'fastaq enumerate_names [options] <infile> <outfile>')
8 parser.add_argument('--start_index', type=int, help='Starting number [%(default)s]', default=1)
9 parser.add_argument('--rename_file', help='If used, will write a file of old name to new name')
10 parser.add_argument('--keep_suffix', action='store_true', help='Use this to keep a /1 or /2 suffix at the end of each name')
11 parser.add_argument('--suffix', help='Add the given string to the end of every name', default=None)
12 parser.add_argument('infile', help='Name of fasta/q file to be read')
13 parser.add_argument('outfile', help='Name of output fasta/q file')
14 options = parser.parse_args()
15 tasks.enumerate_names(options.infile,
16 options.outfile,
17 start_index=options.start_index,
18 keep_illumina_suffix=options.keep_suffix,
19 rename_file=options.rename_file,
20 suffix=options.suffix)