Created
November 22, 2013 15:49
-
-
Save walterst/7602058 to your computer and use it in GitHub Desktop.
Usage:
python filter_short_reads.py X Y > Z
where
X is the input fasta file
Y is the minimum length
Z is the output fasta file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Usage: | |
python filter_short_reads.py X Y > Z | |
where | |
X is the input fasta file | |
Y is the minimum length | |
Z is the output fasta file | |
""" | |
from sys import argv | |
from cogent.parse.fasta import MinimalFastaParser | |
fasta_f = open(argv[1], "U") | |
min_len = int(argv[2]) | |
for label, seq in MinimalFastaParser(fasta_f): | |
if len(seq) >= min_len: | |
print ">%s\n%s" % (label, seq) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment