Package csb :: Package bio :: Package hmm :: Class ProfileHMM

[frames] | no frames]

# Class ProfileHMM

source code

    object --+
             |
            ProfileHMM

Known Subclasses:
  - ProfileHMMSegment
  - , ProfileHMMRegion

Describes a protein profile Hidden Markov Model. Optional parameters:

Instance Methods

__init__(self, units=LogScales, scale=-1000.0, logbase=2) x.__init__(...) initializes x; see help(type(x)) for signature | source code

add_emission_pseudocounts(self, *a, **k) See csb.bio.hmm.pseudocounts.PseudocountBuilder | source code

add_transition_pseudocounts(self, *a, **k) See csb.bio.hmm.pseudocounts.PseudocountBuilder | source code

Chain

chain(self, chain_id=None) Extract the structural information from the HMM. | source code

convert_scores(self, units=Probability, method=None) Convert emission and transition scores to the specified units. | source code

list

emission_profile(self) Extract the emission scores of all match states in the profile. | source code

float

emission_similarity(self, other) Compute the Log-sum-of-odds score between the emission tables of self and other (Soeding 2004). | source code

ProfileHMMSegment

segment(self, start, end) Extract a sub-segment of the profile. | source code

serialize(self, file_name) Serialize this HMM to a file. | source code

Structure

structure(self, chain_id=None, accession=None) Extract the structural information from the HMM. | source code

subregion(self, start, end) | source code

to_hmm(self, output_file=None, convert_scores=False) Dump the profile in HHM format. | source code

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

Static Methods

deserialize(file_name) De-serialize an HMM from a file. | source code

Properties
A3MAlignment | alignment Source multiple alignment
list of HMMLayer | all_layers A list of layers including start and start_insertion
AbstractSequence | consensus Consensus sequence
SecondaryStructure | dssp DSSP (calculated) secondary structure
str | dssp_solvent Solvent accessibility values
| effective_matches Number of effective matches (NEFF)
bool | emission_pseudocounts
State | end Final state (at the end layer)
EVDParameters | evd Extreme-value distribution parameters (EVD)
str | family Alternative entry ID (FAM)
bool | has_structure True if this profile contains structural data
str | id Profile entry ID (FILE)
HMMLayersCollection | layers List-like access to the HMM's layers
ProfileLength | length Profile length
float | logbase Base of the logarithm used for score scaling
str | name Profile name (NAME)
bool | pseudocounts
SecondaryStructure | psipred PSIPRED (predicted) secondary structure
collection of Residue | residues List of representative residues, attached to each layer
float | scale Score scaling factor
ScoreUnits member | score_units Current score units
State | start Start state (at the start layer)
State | start_insertion Insertion state at the start layer
bool | transition_pseudocounts
str | version Format version number (HHsearch)
Inherited from `object`: `__class__`

Method Details

### __init__(self, units=LogScales, scale=-1000.0, logbase=2)
(Constructor)

source code

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

Parameters:
  - `units` (ScoreUnits) - defines the units of the transition and emission scores
  - `scale` (float) - the scaling factor used to convert emission/transition probabilities
  - `logbase` (float) - the base of the logarithm used for scaling the emission and transition probabilities
Overrides: object.__init__
  (inherited documentation)

### chain(self, chain_id=None)

source code

Extract the structural information from the HMM.

Parameters:
  - `chain_id` (str) - defines explicitly the chain identifier
Returns: Chain
  a shallow Chain wrapper around the residues in the HMM.

### convert_scores(self, units=Probability, method=None)

source code

Convert emission and transition scores to the specified units.

Parameters:
  - `units` (csb.core.EnumItem) - the target units for the conversion (a member of ScoreUnits).
  - `method` (function, lambda) - if defined, implements the exact mathematical transformation that will be applied. It must be a function or lambda expression with the following signature:

             def (target_units, score, scale, logbase)

    and it has to return the score converted to `target_units`. If method performs a conversion from probabilities to scaled logs, you should also update `hmm.scale` and `hmm.logbase`.

### deserialize(file_name)
Static Method

source code

De-serialize an HMM from a file.

Parameters:
  - `file_name` (str) - source file name (pickle)

### emission_profile(self)

source code

Extract the emission scores of all match states in the profile. The metric of the emission scores returned depends on the current hmm.score_units setting - you may need to call hmm.convert_scores() to adjust the hmm to your particular needs.

Returns: list
  a list of dictionaries; each dict key is a single amino acid

### emission_similarity(self, other)

source code

Compute the Log-sum-of-odds score between the emission tables of self and other (Soeding 2004). If no observable Match state is found at a given layer, the Insertion state is used instead.

Parameters:
  - `other` (ProfileHMM) - the subject HMM
Returns: float
  emission log-sum-of-odds similarity between `self` and `other`
Raises:
  - `ValueError` - when self and other differ in their length, when the score_units are not Probability, or when no observable states are present

Note: This is not a full implementation of the formula since only emission vectors are involved in the computation and any transition probabilities are ignored.

### segment(self, start, end)

source code

Extract a sub-segment of the profile.

Parameters:
  - `start` (int) - start layer of the segment (rank)
  - `end` (int) - end layer of the segment (rank)
Returns: ProfileHMMSegment
  a deepcopy of the extracted HMM segment

### serialize(self, file_name)

source code

Serialize this HMM to a file.

Parameters:
  - `file_name` (str) - target file name

### structure(self, chain_id=None, accession=None)

source code

Extract the structural information from the HMM.

Parameters:
  - `accession` (str) - defines the accession number of the structure
  - `chain_id` (str) - defines explicitly the chain identifier
Returns: Structure
  a shallow Structure wrapper around the residues in the HMM.

### to_hmm(self, output_file=None, convert_scores=False)

source code

Dump the profile in HHM format.

Parameters:
  - `output_file` (str) - the output file name
  - `convert_scores` (bool) - if True, forces automatic convertion to ScoreUnits.LogScales, which is required by the output file format

Property Details

### alignment

Source multiple alignment

Get Method:
  unreachable.alignment(self) - Source multiple alignment
Set Method:
  unreachable.alignment(self, value)
Type:
  A3MAlignment

### all_layers

A list of layers including start and start_insertion

Get Method:
  unreachable.all_layers(self) - A list of layers including start and start_insertion
Type:
  list of HMMLayer

### consensus

Consensus sequence

Get Method:
  unreachable.consensus(self) - Consensus sequence
Set Method:
  unreachable.consensus(self, value)
Type:
  AbstractSequence

### dssp

DSSP (calculated) secondary structure

Get Method:
  unreachable.dssp(self) - DSSP (calculated) secondary structure
Set Method:
  unreachable.dssp(self, value)
Type:
  SecondaryStructure

### dssp_solvent

Solvent accessibility values

Get Method:
  unreachable.dssp_solvent(self) - Solvent accessibility values
Set Method:
  unreachable.dssp_solvent(self, value)
Type:
  str

### effective_matches

Number of effective matches (NEFF)

Get Method:
  unreachable.effective_matches(self) - Number of effective matches (NEFF)
Set Method:
  unreachable.effective_matches(self, value)

### emission_pseudocounts

Get Method:
  unreachable.emission_pseudocounts(self)
Set Method:
  unreachable.emission_pseudocounts(self, value)
Type:
  bool

### end

Final state (at the end layer)

Get Method:
  unreachable.end(self) - Final state (at the end layer)
Set Method:
  unreachable.end(self, value)
Type:
  State

### evd

Extreme-value distribution parameters (EVD)

Get Method:
  unreachable.evd(self) - Extreme-value distribution parameters (EVD)
Set Method:
  unreachable.evd(self, value)
Type:
  EVDParameters

### family

Alternative entry ID (FAM)

Get Method:
  unreachable.family(self) - Alternative entry ID (FAM)
Set Method:
  unreachable.family(self, value)
Type:
  str

### has_structure

True if this profile contains structural data

Get Method:
  unreachable.has_structure(self) - True if this profile contains structural data
Type:
  bool

### id

Profile entry ID (FILE)

Get Method:
  unreachable.id(self) - Profile entry ID (FILE)
Set Method:
  unreachable.id(self, value)
Type:
  str

### layers

List-like access to the HMM's layers

Get Method:
  unreachable.layers(self) - List-like access to the HMM's layers
Type:
  HMMLayersCollection

### length

Profile length

Get Method:
  unreachable.length(self) - Profile length
Set Method:
  unreachable.length(self, value)
Type:
  ProfileLength

### logbase

Base of the logarithm used for score scaling

Get Method:
  unreachable.logbase(self) - Base of the logarithm used for score scaling
Type:
  float

### name

Profile name (NAME)

Get Method:
  unreachable.name(self) - Profile name (NAME)
Set Method:
  unreachable.name(self, value)
Type:
  str

### pseudocounts

Get Method:
  unreachable.pseudocounts(self)
Set Method:
  unreachable.pseudocounts(self, value)
Type:
  bool

### psipred

PSIPRED (predicted) secondary structure

Get Method:
  unreachable.psipred(self) - PSIPRED (predicted) secondary structure
Set Method:
  unreachable.psipred(self, value)
Type:
  SecondaryStructure

### residues

List of representative residues, attached to each layer

Get Method:
  unreachable.residues(self) - List of representative residues, attached to each layer
Type:
  collection of Residue

### scale

Score scaling factor

Get Method:
  unreachable.scale(self) - Score scaling factor
Type:
  float

### score_units

Current score units

Get Method:
  unreachable.score_units(self) - Current score units
Type:
  ScoreUnits member

### start

Start state (at the start layer)

Get Method:
  unreachable.start(self) - Start state (at the start layer)
Set Method:
  unreachable.start(self, value)
Type:
  State

### start_insertion

Insertion state at the start layer

Get Method:
  unreachable.start_insertion(self) - Insertion state at the start layer
Set Method:
  unreachable.start_insertion(self, value)
Type:
  State

### transition_pseudocounts

Get Method:
  unreachable.transition_pseudocounts(self)
Set Method:
  unreachable.transition_pseudocounts(self, value)
Type:
  bool

### version

Format version number (HHsearch)

Get Method:
  unreachable.version(self) - Format version number (HHsearch)
Set Method:
  unreachable.version(self, value)
Type:
  str