Package csb :: Package bio :: Package sequence :: Class AbstractSequence |
[frames] | no frames]

# Class AbstractSequence

source code

    object --+
             |
            AbstractSequence

Known Subclasses:
  - Sequence
  - , ChainSequence
  - , RichSequence

Base abstract class for all Sequence objects.

Provides 1-based access to the residues in the sequence via the sequence.residues property. The sequence object itself also behaves like a collection and provides 0-based access to its elements (residues).

Nested Classes
| __metaclass__ Metaclass for defining Abstract Base Classes (ABCs).

Instance Methods
__getitem__(self, spec) | source code
__init__(self, id, header, residues, type=Unknown) x.__init__(...) initializes x; see help(type(x)) for signature | source code
__iter__(self) | source code
__len__(self) | source code
__repr__(self) repr(x) | source code
__str__(self) str(x) | source code
dump(self, output_file) Dump the sequence in FASTA format. | source code
AbstractSequence |
extract(self, positions) Extract a subsequence, defined by a list of 1-based positions. | source code
AbstractSequence |
strip(self) Remove all gaps and insertions from the sequence. | source code
AbstractSequence |
subregion(self, start, end) Extract a subsequence, defined by [start, end]. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Class Variables
| DELIMITER = ``'``>``'``
| __abstractmethods__ = ``frozenset([``'``_add``'``,` `'``_get``'``])``

Properties
csb.core.enum | alphabet The sequence alphabet corresponding to the current sequence type
str | header Sequence description
str | id Sequence identifier
int | length Number of residues
SequenceIndexer | residues Rank-based access to the underlying residues
str | sequence The actual sequence
enum item | type Sequence type - a member of SequenceTypes
Inherited from `object`: `__class__`

Method Details

### __init__(self, id, header, residues, type=Unknown) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Parameters: `id` (str) - FASTA ID of this sequence (e.g. accession number) `header` (str) - FASTA sequence header `residues` (str or collection of ResidueInfo) - sequence residues `type` (EnumItem) - a SequenceTypes member (defaults to protein) Overrides: object.__init__ (inherited documentation)

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

### dump(self, output_file) | source code
Dump the sequence in FASTA format. Parameters: `output_file` (str or stream) - write the output to this file or stream

### extract(self, positions) | source code
Extract a subsequence, defined by a list of 1-based positions. Parameters: `positions` (tuple of int) - positions to extract Returns: AbstractSequence a new sequence Raises: `SequencePositionError` - if any position is out of range

### strip(self) | source code
Remove all gaps and insertions from the sequence. Returns: AbstractSequence a new sequence instance, containing no gaps

### subregion(self, start, end) | source code
Extract a subsequence, defined by [start, end]. The start and end positions are 1-based, inclusive. Parameters: `start` (int) - start position `end` (int) - end position Returns: AbstractSequence a new sequence Raises: `SequencePositionError` - if start/end positions are out of range

Property Details

### alphabet The sequence alphabet corresponding to the current sequence type Get Method: unreachable.alphabet(self) - The sequence alphabet corresponding to the current sequence type Type: csb.core.enum

### header Sequence description Get Method: unreachable.header(self) - Sequence description Set Method: unreachable.header(self, value) Type: str

### id Sequence identifier Get Method: unreachable.id(self) - Sequence identifier Set Method: unreachable.id(self, value) Type: str

### length Number of residues Get Method: unreachable.length(self) - Number of residues Type: int

### residues Rank-based access to the underlying residues Get Method: unreachable.residues(self) - Rank-based access to the underlying residues Type: SequenceIndexer

### sequence The actual sequence Get Method: unreachable.sequence(self) - The actual sequence Type: str

### type Sequence type - a member of SequenceTypes Get Method: unreachable.type(self) - Sequence type - a member of SequenceTypes Set Method: unreachable.type(self, value) Type: enum item