This page will describe the SeqRecord object used in BioPython to hold a sequence (as a Seq object) with identifiers (ID and name), description and optionally annotation and sub-features.

+

This page will describe the SeqRecord object used in BioPython to hold a sequence (as a [[Seq]] object) with identifiers (ID and name), description and optionally annotation and sub-features.

Most of the sequence file format parsers in BioPython can return SeqRecord objects (and may offer a format specific record object too). The new [[SeqIO]] system will only return SeqRecord objects.

Most of the sequence file format parsers in BioPython can return SeqRecord objects (and may offer a format specific record object too). The new [[SeqIO]] system will only return SeqRecord objects.

+

+

Lets look in closer detail at the well annotated SeqRecord objects Biopython creates from a GenBank file, such as [[http://biopython.org/DIST/docs/tutorial/examples/ls_orchid.gbk ls_orchid.gbk]]. This file contains 94 records:

+

+

<python>

+

from Bio import SeqIO

+

for index, record in enumerate(SeqIO.parse(open("ls_orchid.gbk"), "genbank")) :

+

print "index %i, ID = %s, length %i, with %i features" \

+

% (index, record.id, len(record.seq), len(record.features))

+

</python>

+

+

And this is some of the output. Remember python likes to count from zero, so for the 94 records in this file they have been labelled 0 to 93:

+

+

index 0, ID = Z78533.1, length 740, with 5 features

+

index 1, ID = Z78532.1, length 753, with 5 features

+

index 2, ID = Z78531.1, length 748, with 5 features

+

...

+

index 92, ID = Z78440.1, length 744, with 5 features

+

index 93, ID = Z78439.1, length 592, with 5 features

+

+

Lets look in a little more detail at the final record:

+

+

<python>

+

print record

+

</python>

+

+

That should give you a hint of the sort of information held in this object: