Debian Codegraph @

pyfastaq/runners/to_fasta.py

raw
1 import argparse
2 from pyfastaq import tasks
3
4 def run(description):
5 parser = argparse.ArgumentParser(
6 description = description,
7 usage = 'fastaq to_fasta [options] <infile> <outfile>')
8 parser.add_argument('infile', help='Name of input file. Can be any of FASTA, FASTQ, GFF3, EMBL, GBK, Phylip')
9 parser.add_argument('outfile', help='Name of output file')
10 parser.add_argument('-l', '--line_length', type=int, help='Number of bases on each sequence line of output file. Set to zero for no linebreaks in sequences [%(default)s]', default=60)
11 parser.add_argument('-s', '--strip_after_whitespace', action='store_true', help='Remove everything after first whitespace in every sequence name')
12 parser.add_argument('-u', '--check_unique', action='store_true', help='Die if any of the output sequence names are not unique')
13 options = parser.parse_args()
14
15 tasks.to_fasta(
16 options.infile,
17 options.outfile,
18 line_length=options.line_length,
19 strip_after_first_whitespace=options.strip_after_whitespace,
20 check_unique=options.check_unique
21 )
22