BioSQL.BioSeq module

Implementations of Biopython-like Seq objects on top of BioSQL.

This allows retrival of items stored in a BioSQL database using a biopython-like SeqRecord and Seq interface.

Note: Currently we do not support recording per-letter-annotations (like quality scores) in BioSQL.

class BioSQL.BioSeq.DBSeq(primary_id, adaptor, alphabet, start, length)

Bases: Bio.Seq.Seq

BioSQL equivalent of the Biopython Seq object.

__init__(self, primary_id, adaptor, alphabet, start, length)

Create a new DBSeq object referring to a BioSQL entry.

You wouldn’t normally create a DBSeq object yourself, this is done for you when retreiving a DBSeqRecord object from the database.

__len__(self)

Return the length of the sequence.

__getitem__(self, index)

Return a subsequence or single letter.

tostring(self)

Return the full sequence as a python string (DEPRECATED).

You are now encouraged to use str(my_seq) instead of my_seq.tostring().

__str__(self)

Return the full sequence as a python string.

property data

Sequence as string (DEPRECATED)

toseq(self)

Return the full sequence as a Seq object.

__add__(self, other)

Add another sequence or string to this sequence.

The sequence is first converted to a Seq object before the addition. The returned object is a Seq object, not a DBSeq object.

__radd__(self, other)

Add another sequence or string to the left.

The sequence is first converted to a Seq object before the addition. The returned object is a Seq object, not a DBSeq object.

__mul__(self, other)

Multiply sequence by an integer.

The sequence is first converted to a Seq object before multiplication. The returned object is a Seq object, not a DBSeq object.

__rmul__(self, other)

Multiply integer by a sequence.

The sequence is first converted to a Seq object before multiplication. The returned object is a Seq object, not a DBSeq object.

__imul__(self, other)

Multiply sequence by integer in-place.

The sequence is first converted to a Seq object before multiplication. The returned object is a Seq object, not a DBSeq object.

class BioSQL.BioSeq.DBSeqRecord(adaptor, primary_id)

Bases: Bio.SeqRecord.SeqRecord

BioSQL equivalent of the Biopython SeqRecord object.

__init__(self, adaptor, primary_id)

Create a DBSeqRecord object.

Arguments:
  • adaptor - A BioSQL.BioSeqDatabase.Adaptor object

  • primary_id - An internal integer ID used by BioSQL

You wouldn’t normally create a DBSeqRecord object yourself, this is done for you when using a BioSeqDatabase object

property seq

Seq object

property dbxrefs

Database cross references

property features

Features

property annotations

Annotations