Package Bio :: Module SeqRecord :: Class SeqRecord
[hide private]
[frames] | no frames]

Class SeqRecord

source code

Known Subclasses:

A SeqRecord object holds a sequence and information about it.

Main attributes:
id          - Identifier such as a locus tag (string)
seq         - The sequence itself (Seq object)

Additional attributes:
name        - Sequence name, e.g. gene name (string)
description - Additional text (string)
dbxrefs     - List of database cross references (list of strings)
features    - Any (sub)features defined (list of SeqFeature objects)
annotations - Further information about the whole sequence (dictionary)
              Most entries are lists of strings.

Instance Methods [hide private]
 
__init__(self, seq, id='<unknown id>', name='<unknown name>', description='<unknown description>', dbxrefs=None, features=None)
Create a SeqRecord.
source code
 
__len__(self)
Returns the length of the sequence.
source code
 
__nonzero__(self)
Returns True regardless of the length of the sequence.
source code
 
__repr__(self)
A concise summary of the record for debugging.
source code
 
__str__(self)
A human readable summary of the record and its annotation.
source code
Method Details [hide private]

__init__(self, seq, id='<unknown id>', name='<unknown name>', description='<unknown description>', dbxrefs=None, features=None)
(Constructor)

source code 

Create a SeqRecord.

Arguments: seq - Sequence, required (Seq object) id - Sequence identifier, recommended (string) name - Sequence name, optional (string) description - Sequence description, optional (string) dbxrefs - Database cross references, optional (list of strings) features - Any (sub)features, optional (list of SeqFeature objects)

Note that while an id is optional, we strongly recommend you supply a unique id string for each record. This is especially important if you wish to write your sequences to a file.

You can create a 'blank' SeqRecord object, and then populated the attributes later. Note that currently the annotations dictionary cannot be specified when creating the SeqRecord.

__nonzero__(self)
(Boolean test operator)

source code 

Returns True regardless of the length of the sequence.

This behaviour is for backwards compatibility, since until the __len__ method was added, a SeqRecord always evaluated as True.

Note that in comparison, a Seq object will evaluate to False if it has a zero length sequence.

WARNING: The SeqRecord may in future evaluate to False when its sequence is of zero length (in order to better match the Seq object behaviour)!