| 1 |
import argparse |
| 2 |
from pyfastaq import tasks |
| 3 |
|
| 4 |
def run(description): |
| 5 |
parser = argparse.ArgumentParser( |
| 6 |
description = 'Trims sequences off the start of all sequences in a pair of sequence files, whenever there is a perfect match. Only keeps a read pair if both reads of the pair are at least a minimum length after any trimming', |
| 7 |
usage = 'fastaq sequence_trim [options] <infile_1> <infile_2> <outfile_1> <outfile_2> <trim_seqs>') |
| 8 |
parser.add_argument('--min_length', type=int, help='Minimum length of output sequences [%(default)s]', default=50, metavar='INT') |
| 9 |
parser.add_argument('--revcomp', action='store_true', help='Trim the end of each sequence if it matches the reverse complement. This option is intended for PCR primer trimming') |
| 10 |
parser.add_argument('infile_1', help='Name of forward fasta/q file to be trimmed') |
| 11 |
parser.add_argument('infile_2', help='Name of reverse fasta/q file to be trimmed') |
| 12 |
parser.add_argument('outfile_1', help='Name of output forward fasta/q file') |
| 13 |
parser.add_argument('outfile_2', help='Name of output reverse fasta/q file') |
| 14 |
parser.add_argument('trim_seqs', help='Name of file of sequences to search for at the start of each input sequence') |
| 15 |
options = parser.parse_args() |
| 16 |
tasks.sequence_trim( |
| 17 |
options.infile_1, |
| 18 |
options.infile_2, |
| 19 |
options.outfile_1, |
| 20 |
options.outfile_2, |
| 21 |
options.trim_seqs, |
| 22 |
min_length=options.min_length, |
| 23 |
check_revcomp=options.revcomp |
| 24 |
) |