Skip to content

Instantly share code, notes, and snippets.

@coela
Created December 9, 2016 05:28
Show Gist options
  • Save coela/b9c075e9669e2cc79c5e58c78f4ff5c7 to your computer and use it in GitHub Desktop.
Save coela/b9c075e9669e2cc79c5e58c78f4ff5c7 to your computer and use it in GitHub Desktop.
from Bio import SeqIO
for seq_record in SeqIO.parse("NC_000913.gbk", "genbank"):
for feature in seq_record.features:
if feature.qualifiers.has_key('locus_tag'):
start = feature.location.nofuzzy_start
end = feature.location.nofuzzy_end
print ">" + feature.qualifiers['locus_tag'][0]
print seq_record.seq[start:end]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment