Logo Search packages:      
Sourcecode: python-biopython version File versions  Download package

Public Member Functions | Public Attributes | Properties | Private Member Functions | Private Attributes

Bio::SeqRecord::SeqRecord Class Reference

Inheritance diagram for Bio::SeqRecord::SeqRecord:
Inheritance graph

List of all members.

Public Member Functions

def __add__
def __contains__
def __format__
def __getitem__
def __init__
def __iter__
def __len__
def __nonzero__
def __radd__
def __repr__
def __str__
def format

Public Attributes




Private Member Functions

def _set_per_letter_annotations
def _set_seq

Private Attributes


Detailed Description

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 or similar)

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 strings, or lists of strings.
 - letter_annotations - Per letter/symbol annotation (restricted
                 dictionary). This holds Python sequences (lists, strings
                 or tuples) whose length matches that of the sequence.
                 A typical use would be to hold a list of integers
                 representing sequencing quality scores, or a string
                 representing the secondary structure.

You will typically use Bio.SeqIO to read in sequences from files as
SeqRecord objects.  However, you may want to create your own SeqRecord
objects directly (see the __init__ method for further details):

>>> from Bio.Seq import Seq
>>> from Bio.SeqRecord import SeqRecord
>>> from Bio.Alphabet import IUPAC
...                         IUPAC.protein),
...                    id="YP_025292.1", name="HokC",
...                    description="toxic membrane protein")
>>> print record
ID: YP_025292.1
Name: HokC
Description: toxic membrane protein
Number of features: 0

If you want to save SeqRecord objects to a sequence file, use Bio.SeqIO
for this.  For the special case where you want the SeqRecord turned into
a string in a particular file format there is a format method which uses
Bio.SeqIO internally:

>>> print record.format("fasta")
>YP_025292.1 toxic membrane protein

You can also do things like slicing a SeqRecord, checking its length, etc

>>> len(record)
>>> edited = record[:10] + record[11:]
>>> print edited.seq
>>> print record.seq

Definition at line 42 of file SeqRecord.py.

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index