Skip to content

Instantly share code, notes, and snippets.

@coela
Created April 15, 2017 08:48
Show Gist options
  • Save coela/5fccaa19c891e24e9b58877751a164eb to your computer and use it in GitHub Desktop.
Save coela/5fccaa19c891e24e9b58877751a164eb to your computer and use it in GitHub Desktop.
import sys
from Bio import SeqIO
fh = open(sys.argv[1],"r")
for gb_record in SeqIO.parse(fh, "genbank") :
for (index, feature) in enumerate(gb_record.features) :
if feature.type == 'source':
print "\t".join([gb_record.name,feature.qualifiers['db_xref'][0].split(":")[1]])
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment