[BioPython] I don't understand why SeqRecord.feature is a list

Giovanni Marco Dall'Olio dalloliogm at gmail.com
Tue Jun 12 11:07:20 UTC 2007


Hi,
I'm a newbie to biopython and I'm trying to use it to represent a gene
structure parsed from a gff file.

In principle, I would create a SeqRecord to represent an mRNA; then, I
would like to annotate its exons and introns in the .feature field.
But I don't understand why SeqRecord.feature is a list, I think it
could be easier to use as a dictionary.

For example, this is what I've created until now:

mRNA1 = SeqRecord()
mRNA1.seq = 'cacacacacgtatgcta..'
mRNA1.id = '...'
mRNA1.feature = [exon1_SeqFeatureObj, exon2_SeqFeatureObj,....]

here the exons are annotated in a list; the problem is that in this
way it's difficult to retrieve them, since if let's say I want to
retrieve the informations from the exon3 object, I have to cycle in
all the mRNA1.feature objects to look for it.

Wouldn't it be better to use a dictionary for SeqRecord.feature?

mRNA1 = SeqRecord()
mRNA1.seq = 'cacacacacgtatgcta..'
mRNA1.id = '...'
mRNA1.feature = {'exon1' : exon1_SeqFeatureObj, 'exon2' :
exon2_SeqFeatureObj,....}


Alternatively, I've got the idea of using SeqRecord.annotations to
keep track of the indexes in SeqRecord.feature:

mRNA1 = SeqRecord()
mRNA1.seq = 'cacacacacgtatgcta..'
mRNA1.id = '...'
mRNA.annotations = {'exon1' : mRNA.feature[0], 'exon2' : mRNA.feature[1], ....}
mRNA1.feature = [exon1_SeqFeatureObj, exon2_SeqFeatureObj,....]

-- 
-----------------------------------------------------------

My Blog on Bioinformatics (italian): http://dalloliogm.wordpress.com



More information about the Biopython mailing list