Package csb :: Package bio :: Package hmm :: Class TransitionTable

[frames] | no frames]

# Class TransitionTable

source code

                  object --+
                           |
        core.AbstractIndexer --+
                               |
    core.BaseDictionaryContainer --+
                                   |
            core.DictionaryContainer --+
                                       |
                                      TransitionTable

Represents a lookup table of transitions that are possible from within a given state.

Provides dictionary-like access, where dictionary keys are target states. These are members of the States enumeration, e.g.:

    >>> state.transitions[States.Match]
    transition info regarding transition from the current state to a Match state
    >>> state.transitions[States.Match].predecessor
    state
    >>> state.transitions[States.Match].successor
    the next match state

Instance Methods

__init__(self, transitions=None, restrict=`frozenset([`Deletion`,` End`,` Insertion`,` Match`,` Start`])`) x.__init__(...) initializes x; see help(type(x)) for signature | source code

append(self, transition) Append a new `transition` to the table. | source code

set(self, table) Set the transition table using the dictionary provided in the argument. | source code

update(self, target_statekind, transition) Update the information of a transition, which points to a target state of the specified States kind. | source code

Inherited from `core.BaseDictionaryContainer`: `__bool__`, `__contains__`, `__getitem__`, `__iter__`, `__len__`, `__nonzero__`, `__repr__`, `keys` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `core.BaseDictionaryContainer`: `length` Inherited from `object`: `__class__`

Method Details

### __init__(self, transitions=None, restrict=`frozenset([`Deletion`,` End`,` Insertion`,` Match`,` Start`])`)
(Constructor)

source code

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

Parameters:
  - `transitions` (dict) - an initialization dictionary of target State:Transition pairs
  - `restrict` (list) - a list of target states allowed for this transition table. Defaults to the States enum members
Overrides: object.__init__
  (inherited documentation)

### append(self, transition)

source code

Append a new `transition` to the table.

Parameters:
  - `transition` (Transition) - transition info
Raises:
  - `TransitionExistsError` - when a transition to the same target state already exists for the current state
Overrides: core.DictionaryContainer.append

### set(self, table)

source code

Set the transition table using the dictionary provided in the argument.

Parameters:
  - `table` (dict) - the new transition table

### update(self, target_statekind, transition)

source code

Update the information of a transition, which points to a target state of the specified States kind.

Parameters:
  - `target_statekind` (csb.core.EnumItem) - the key of the transition to be updated
  - `transition` (Transition) - new transition info object
Raises:
  - `ValueError` - if transition.successor.type differs from `target_statekind`