Set a transition as being possible between the two states. probability and pseudocount are optional arguments specifying the probabilities and pseudo counts for the transition. If these are not supplied, then the values are set to the default values. Raises: KeyError  if the two states already have an allowed transition. Definition at line 167 of file MarkovModel.py. : """Set a transition as being possible between the two states. probability and pseudocount are optional arguments specifying the probabilities and pseudo counts for the transition. If these are not supplied, then the values are set to the default values. Raises: KeyError  if the two states already have an allowed transition. """ # check the sanity of adding these states for state in [from_state, to_state]: assert state in self._state_alphabet, \ "State %s was not found in the sequence alphabet" % state # ensure that the states are not already set if ((from_state, to_state) not in self.transition_prob.keys() and (from_state, to_state) not in self.transition_pseudo.keys()): # set the initial probability if probability is None: probability = 0 self.transition_prob[(from_state, to_state)] = probability # set the initial pseudocounts if pseudocount is None: pseudcount = DEFAULT_PSEUDO self.transition_pseudo[(from_state, to_state)] = pseudocount else: raise KeyError("Transtion from %s to %s is already allowed." % (from_state, to_state)) def destroy_transition(self, from_state, to_state):
