Skip to content

Instantly share code, notes, and snippets.

@walterst
Created June 10, 2016 17:02
Show Gist options
  • Save walterst/edde79da8912759285567f6f4cb50c8c to your computer and use it in GitHub Desktop.
Save walterst/edde79da8912759285567f6f4cb50c8c to your computer and use it in GitHub Desktop.
Specify an input fasta file and minimum length, e.g. python remove_short_reads.py seqs.fna 1300 > trimmed_reads.fna
#!/usr/bin/env python
from sys import argv
from cogent.parse.fasta import MinimalFastaParser
min_len = int(argv[2])
for label,seq in MinimalFastaParser(open(argv[1], "U")):
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