thanks! I've came across your site before and found it quite helpful... I only wish there were more examples
• 0 views
•
link
I have a list of >100 gene names and want to get the locus_tags. Is there a way I can do this using its genbank file and Biopython?
For example, the genbank file has
/gene="murE"
/locus_tag="BSUW23_07815"
If my list just has murE, I'd like it to print out the corresponding BSUW23_07815
Something like this should work:
from Bio import SeqIO
genbank_file = "example.gbk" # insert your filename here
wanted = ["murE", ...] # or load all your 100 genes from a file
for record in SeqIO.parse(genbank_file, "genbank"):
for f in record.features:
if f.type == "CDS" and "gene" in f.qualifiers:
gene = f.qualifiers["gene"][0]
if gene in wanted:
print f.qualifiers["gene"][0], f.qualifiers["locus_tag"][0]
See also http://www.warwick.ac.uk/go/peter_cock/python/genbank/
Log in to answer this question.
I'm having a similar problem
If i have a list with gene names and i want to get all the information from that gene contained in CDS and GENE in the gbk file? How could i do?