Created
September 7, 2011 16:27
-
-
Save peterjc/1201025 to your computer and use it in GitHub Desktop.
Selecting FASTQ sequences by ID (Biopython with SeqRecord object)
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
from Bio import SeqIO | |
import sys | |
ids = set(x[:-1] for x in open(sys.argv[1])) | |
wanted = (rec for rec in SeqIO.parse(sys.stdin, "fastq") if rec.id in ids) | |
SeqIO.write(wanted, sys.stdout, "fastq") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment