[Biopython] SeqIO Note Field

David Winter djwinter at asu.edu
Tue Sep 9 19:04:10 UTC 2014


Hi Trevor,

The "source" information is stored in the "Features" of a genbank
file, and its corresponsing SeqRecord. Takng an  example genbank file

from Bio import Entrez

#remember to set up your entez.email
handle = Entrez.efetch(db="nuccore", id="AB786880", rettype="gb")
rec = SeqIO.read(handle, "genbank")

The features are represented as a list of SeqFeature objects, 'source'
is usually the first one, but I don't know if that's a requirement. In
case it's not you can use the 'type' field to find the source feature:

for f in rec.features:
    if f.type == 'source':
        src = f
        #or do stuff to f
        break

Each SeqFeature then has a dictionary called "qualifiers"  that you
can use to extract any key's value:

 src.qualifiers["note"]
 src.qualifiers.get("note", None)

Hope that helps,
David


On Tue, Sep 9, 2014 at 5:20 AM, Trevor Bell <trevorgrahambell at gmail.com> wrote:
> Using the SeqIO example in Chapter 5 of the cookbook, I am able to read
> entries from a .gb file of full GenBank records. Where can I find the "note"
> field for the "source" entry?
>
>
> _______________________________________________
> Biopython mailing list  -  Biopython at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython



-- 
David Winter
Postdoctoral Research Associate
Center for Evolutionary Medicine and Informatics
The Biodesign Institute
Arizona State University

ph: +1 480 519 5113
w: www.david-winter.info
lab: http://cartwrig.ht/lab/
blog: sciblogs.co.nz/the-atavism


More information about the Biopython mailing list