Hidden Markov Model API
package defines abstractions for working with HHpred's HMMs and hit lists.
is the most important object of this module. It describes a sequence profile hidden Markov model in the way HHpred sees this concept:
- a profile is composed of a list of HMMLayers, which contain a number of
- these States can be of different types: Match, Insertion, Deletion, etc.
- a profile contains a multiple alignment, from which it is derived
- this multiple alignment is an A3M (condensed) Alignment, where the first sequence is a master sequence
- the match states in all layers correspond to the residues of the master sequence
objects provide list-like access to their layers:
<HMMLayer> # first layer: layer at master residue=1
Every layer provides dictionary-like access to its states:
and every state provides dictionary-like access to its transitions to other states:
>>> state = hmm.layers[States.match]
<Transition> # Match > Insertion
<Match State> # source state
<Insertion State> # target state
Whether this transition points to a state at the same (i) or the next layer (i+1) depends on the semantics of the source and the target states.
Building HMMs from scratch is supported through a number of append methods at various places:
>>> layer = HMMLayer(...)
in our API docs for details.
CSB provides python bindings for working with HHpred's .hhm (HMM) and .hhr (HHsearch result) files. These are part of the
module, which exposes two HHpred format parsers: HHProfileParser
. The first one is used to read HMM (.hhm) files:
>>> HHProfileParser("profile.hhm", "profile.pdb").parse()
<ProfileHMM> # ProfileHMM object
while the latter parses HHsearch results files (.hhr):
<HHpredHitList> # collection of HHpredHit-s
for details. For text serialization of HMM profiles, see
in our API docs.