Pair HMMs with discrete emissions over multiple alphabets.
Optional features: continuous values for transition classes
Methods
|
|
__init__
__str__
addEmissionDomains
checkEmissions
checkTransitions
logP
viterbi
viterbiPropagate
|
|
__init__
|
__init__ (
self,
emissionDomains,
distribution,
cmodel,
)
create a new PairHMM object (this should only be done using the
factory: e.g model = PairHMMOpenXML(modelfile) )
@param emissionDomains: list of EmissionDomain objects
@param distribution: (not used) inherited from HMM
@param cmodel: a swig pointer on the underlying C structure
|
|
__str__
|
__str__ ( self )
string representation (more for debuging) shows the contents of the C
structure pmodel
@return: string representation
|
|
addEmissionDomains
|
addEmissionDomains ( self, emissionDomains )
add additional EmissionDomains that are not specified in the XML file.
This is used to add information for the transition classes.
@param emissionDomains: a list of EmissionDomain objects
|
|
checkEmissions
|
checkEmissions ( self, eps=0.0000000000001 )
checks the sum of emission probabilities in all states
@param eps: precision (if the sum is > 1 - eps it passes)
@return: 1 if the emission of all states sum to one, 0 otherwise
|
|
checkTransitions
|
checkTransitions ( self, eps=0.0000000000001 )
checks the sum of outgoing transition probabilities for all states
@param eps: precision (if the sum is > 1 - eps it passes)
@return: 1 if the transitions of all states sum to one, 0 otherwise
|
|
logP
|
logP (
self,
complexEmissionSequenceX,
complexEmissionSequenceY,
path,
)
compute the log probability of two sequences X and Y and a path
@param complexEmissionSequenceX: sequence X encoded as
ComplexEmissionSequence
@param EmissionSequenceEmissionSequenceY: sequence Y encoded as
ComplexEmissionSequence
@param path: the state path
@return: log probability
|
|
viterbi
|
viterbi (
self,
complexEmissionSequenceX,
complexEmissionSequenceY,
)
run the naive implementation of the Viterbi algorithm and
return the viterbi path and the log probability of the path
@param complexEmissionSequenceX: sequence X encoded as ComplexEmissionSequence
@param complexEmissionSequenceY: sequence Y encoded as ComplexEmissionSequence
@return: (path, log_p)
|
|
viterbiPropagate
|
viterbiPropagate (
self,
complexEmissionSequenceX,
complexEmissionSequenceY,
startX=None,
startY=None,
stopX=None,
stopY=None,
startState=None,
startLogp=None,
stopState=None,
stopLogp=None,
)
run the linear space implementation of the Viterbi algorithm and
return the viterbi path and the log probability of the path
@param complexEmissionSequenceX: sequence X encoded as ComplexEmissionSequence
@param complexEmissionSequenceY: sequence Y encoded as ComplexEmissionSequence
Optional parameters to run the algorithm only on a segment:
@param startX: start index in X
@param startY: start index in Y
@param stopX: stop index in X
@param stopY: stop index in Y
@param startState: start the path in this state
@param stopState: path ends in this state
@param startLogp: initialize the start state with this log probability
@param stopLogp: if known this is the logp of the partial path
@return: (path, log_p)
|
|