Package csb :: Package bio :: Package sequence :: Class AlignedSequenceAdapter

[frames] | no frames]

# Class AlignedSequenceAdapter

source code

         object --+
                  |
    SequenceAdapter --+
                      |
                     AlignedSequenceAdapter

Adapter, which wraps a gapped AbstractSequence object and makes it compatible with the MSA row/entry interface, expected by AbstractAlignment.

The `adapter.residues` property operates with an UngappedSequenceIndexer, which provides a gap-free view of the underlying sequence.

The `adapter.columns` property operates with a standard ColumnIndexer, the same indexer which is used to provide the column view in multiple alignments. Adapted sequences therefore act as alignment rows and allow for MSA-column-oriented indexing.

Instance Methods

__getitem__(self, index) | source code

__init__(self, sequence) x.__init__(...) initializes x; see help(type(x)) for signature | source code

__iter__(self) | source code

int

map_column(self, column) Return the ungapped sequence rank corresponding to the specified MSA `column` number. | source code

int

map_residue(self, rank) Return the MSA column number corresponding to the specified ungapped sequence `rank`. | source code

Inherited from `SequenceAdapter`: `__repr__`, `__str__`, `extract`, `strip`, `subregion` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
ColumnIndexer | columns Provides 1-based access to the respective columns in the MSA.
UngappedSequenceIndexer | residues Provides 1-based access to the residues of the unaligned (ungapped) sequence.
Inherited from `SequenceAdapter`: `alphabet`, `header`, `id`, `length`, `sequence`, `type` Inherited from `object`: `__class__`

Method Details

### __getitem__(self, index)
(Indexing operator)

source code

Overrides: SequenceAdapter.__getitem__

### __init__(self, sequence)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  - `sequence` (AbstractSequence) - adaptee
Overrides: object.__init__
  (inherited documentation)

### __iter__(self)

source code

Overrides: SequenceAdapter.__iter__

### map_column(self, column)

source code

Return the ungapped sequence rank corresponding to the specified MSA `column` number.

Parameters:
  - `column` (int) - 1-based alignment column number
Returns: int

### map_residue(self, rank)

source code

Return the MSA column number corresponding to the specified ungapped sequence `rank`.

Parameters:
  - `rank` (int) - 1-based residue rank
Returns: int

Property Details

### columns

Provides 1-based access to the respective columns in the MSA.

Get Method:
  unreachable.columns(self) - Provides 1-based access to the respective columns in the MSA.
Type:
  ColumnIndexer

### residues

Provides 1-based access to the residues of the unaligned (ungapped) sequence.

Get Method:
  unreachable.residues(self) - Provides 1-based access to the residues of the unaligned (ungapped) sequence.
Type:
  UngappedSequenceIndexer