[BioPython] SeqFeature

Jan T. Kim jtk at cmp.uea.ac.uk
Tue Aug 29 18:08:06 UTC 2006


On Tue, Aug 29, 2006 at 01:27:49PM -0400, meric ovacik wrote:
> I am having trouble using SeqFeature. please see following
> 
> from Bio import GenBank
> record_parser = GenBank.FeatureParser()
> ncbi_dict = GenBank.NCBIDictionary('nucleotide', 'genbank',
>                                    parser = record_parser)
> 
> gb_seqrecord = ncbi_dict[Geneidesasi]
> print gb_seqrecord.seq
> print gb_seqrecord.name
> print gb_seqrecord.id
> print gb_seqrecord.description
> print gb_seqrecord.annotations
> print gb_seqrecord.features
> 
> until the last line evwrything is fine, however when I wanted to reach the
> features from the data I get the following
> [<Bio.SeqFeature.SeqFeature instance at 0xb7a23f8c>, <
> Bio.SeqFeature.SeqFeature instance at 0xb7a2acac>, <
> Bio.SeqFeature.SeqFeature instance at 0xb7a3456c>, <
> Bio.SeqFeature.SeqFeature instance at 0xb79cf68c>]
> So there should be sometinh related with SeqFeatures, however the cookbook
> and tutorial did not help much.
> How do i use SeqFeatures in such a situation?
> I'll appreciate any help. Thank you in advance.

What you're seeing is a list of Bio.SeqFeature.SeqFeature instances.
To get to the information contained in these SeqFeature instances, you'll
have to (1) select from the list by subscripting and (2) access the
fields containing the info you're after, as in

    >>> print gb_seqrecord.features[0]
    <Bio.SeqFeature.SeqFeature instance at 0xb7a23f8c>
    >>> print gb_seqrecord.features[0].qualifiers
    {'organism': [...], .....}

The fields can be concluded from the API documentation (see
http://biopython.org/DIST/docs/api/private/Bio.SeqFeature.SeqFeature-class.html),
I'm afraid I have to confess that I'm not aware of documentation
beyond that (I've tended to find out the fields I was interested in so
far by checking a sample instance's __dict__, as in

    >>> print gb_seqrecord.features[0].__dict__

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: jtk at cmp.uea.ac.uk                               |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*



More information about the Biopython mailing list