StochHMM
v0.34
Flexible Hidden Markov Model C++ Library and Application
|
#include <state.h>
Public Member Functions | |
state () | |
Create a state object. | |
state (std::string &, stringList &, tracks &, weights *, StateFuncs *) | |
~state () | |
Create state from string. | |
size_t | getIterator () |
std::string & | getName () |
std::string & | getGFF () |
std::string & | getLabel () |
std::vector< transition * > * | getTransitions () |
std::bitset< STATE_MAX > * | getTo () |
std::bitset< STATE_MAX > * | getFrom () |
transition * | getTrans (size_t iter) |
transition * | getEnding () |
emm * | getEmission (size_t iter) |
double | get_emission_prob (sequences &seqs, size_t iter) |
double | get_transition_prob (sequences &seqs, size_t to, size_t iter) |
double | getEndTrans () |
Get the log probability transitioning to end from the state. | |
void | print () |
std::string | stringify () |
bool | parse (std::string &, stringList &, tracks &, weights *, StateFuncs *) |
void | addTransition (transition *trans) |
void | setEndingTransition (transition *trans) |
void | addEmission (emm *em) |
void | setName (std::string &txt) |
void | setGFF (std::string &txt) |
Set the GFF Tag for the state. | |
void | setLabel (std::string &txt) |
Set the Label for the state. | |
void | addToState (state *st) |
Add state that this state transitions to. | |
void | addFromState (state *st) |
Add state that transitions to this state. | |
void | setIter (size_t val) |
Set the index value to be used for the state. | |
bool | hasComplexEmission () |
bool | hasComplexTransition () |
bool | hasSimpleEmission () |
bool | hasSimpleTransition () |
bool | isSimple () |
void | checkLabels (std::set< std::string > &, std::set< std::string > &, std::set< std::string > &) |
Checks the label tags for traceback and combine identifiers. | |
void | _finalizeTransitions (std::map< std::string, state * > &state_index) |
Private Member Functions | |
bool | _parseHeader (std::string &) |
bool | _parseTransition (std::string &, stringList &, tracks &, weights *, StateFuncs *) |
bool | _parseEmission (std::string &, stringList &, tracks &, weights *, StateFuncs *) |
Private Attributes | |
std::string | name |
std::string | gff |
std::string | label |
std::vector< transition * > * | transi |
transition * | endi |
std::vector< emm * > | emission |
size_t | stateIterator |
std::bitset< STATE_MAX > | to |
std::bitset< STATE_MAX > | from |
Friends | |
class | model |
StochHMM::state::state | ( | ) |
StochHMM::state::state | ( | std::string & | txt, |
stringList & | names, | ||
tracks & | trcks, | ||
weights * | wts, | ||
StateFuncs * | funcs | ||
) |
Create a state from string Parses the string to create a state
txt | String representation of a state |
names | Names of all the states |
trcks | Tracks defined for model |
wts | Pointer to all weight defined for the model |
funcs | State functions defined for the model |
Definition at line 42 of file state.cpp.
StochHMM::state::~state | ( | ) |
void StochHMM::state::_finalizeTransitions | ( | std::map< std::string, state * > & | state_index | ) |
Definition at line 514 of file state.cpp.
References getIterator(), StochHMM::transition::getName(), name, and transi.
Referenced by StochHMM::model::finalize().
|
private |
Parses the emission for a state from a string
txt | String representation of emissions |
names | stringList of all state names defined in the model |
trks | Tracks defined in the model |
wts | Weight defined of the model |
funcs | StateFunction defined for the model |
Definition at line 296 of file state.cpp.
References emission, StochHMM::emm::parse(), StochHMM::stringList::size(), and StochHMM::stringList::splitND().
Referenced by parse().
|
private |
Parse the state header information and assign to class variables *Required header information includes then NAME and PATH_LABEL *Optonal header information includes GFF_DESC
txt | String representation of state header |
Definition at line 127 of file state.cpp.
References StochHMM::clear_whitespace(), StochHMM::stringList::contains(), gff, StochHMM::stringList::indexOf(), label, name, StochHMM::stringList::size(), and StochHMM::splitString().
Referenced by parse().
|
private |
Parses the transitions of the state from a text string
txt | Text representation of the transitions |
name | StringList of all state names defined in the model |
trks | Reference to tracks for the model |
wts | Weight defined in the model |
funcs | State functions defined for the model |
Definition at line 197 of file state.cpp.
References addTransition(), StochHMM::clear_whitespace(), StochHMM::stringList::contains(), StochHMM::COUNTS, StochHMM::DURATION, endi, StochHMM::transition::getName(), StochHMM::LEXICAL, StochHMM::LOG_PROB, StochHMM::transition::parse(), StochHMM::PROBABILITY, StochHMM::stringList::removeComments(), StochHMM::stringList::removeLWS(), StochHMM::stringList::size(), StochHMM::stringList::splitND(), StochHMM::splitString(), and StochHMM::STANDARD.
Referenced by parse().
|
inline |
|
inline |
Add state that transitions to this state.
Definition at line 147 of file state.h.
References from, and getIterator().
Referenced by StochHMM::model::_addStateToFromTransition().
|
inline |
Add state that this state transitions to.
Definition at line 144 of file state.h.
References getIterator(), and to.
Referenced by StochHMM::model::_addStateToFromTransition().
|
inline |
Add the transition to the state
trans | Pointer to transition to add to the state |
Definition at line 123 of file state.h.
References transi.
Referenced by _parseTransition().
void StochHMM::state::checkLabels | ( | std::set< std::string > & | labels, |
std::set< std::string > & | gff, | ||
std::set< std::string > & | name | ||
) |
Checks the label tags for traceback and combine identifiers.
Definition at line 451 of file state.cpp.
References StochHMM::DIFF_STATE, StochHMM::FULL, StochHMM::transitionFuncParam::getCombineName(), StochHMM::transitionFuncParam::getCombineType(), StochHMM::transitionFuncParam::getTracebackName(), StochHMM::transitionFuncParam::getTracebackType(), StochHMM::START_INIT, StochHMM::STATE_GFF, StochHMM::STATE_LABEL, StochHMM::STATE_NAME, StochHMM::STATEGFF, StochHMM::STATELABEL, and StochHMM::STATENAME.
double StochHMM::state::get_emission_prob | ( | sequences & | seqs, |
size_t | iter | ||
) |
Get the emission value from a state at a particular position in the sequence
seqs | Sequences the model is analyzing |
iter | Position in the sequence |
Definition at line 411 of file state.cpp.
References emission.
Referenced by StochHMM::trellis::naive_forward(), StochHMM::trellis::naive_nth_viterbi(), StochHMM::trellis::naive_stochastic_forward(), StochHMM::trellis::naive_stochastic_viterbi(), StochHMM::trellis::naive_viterbi(), StochHMM::trellis::simple_backward(), and StochHMM::trellis::simple_posterior().
double StochHMM::state::get_transition_prob | ( | sequences & | seqs, |
size_t | to, | ||
size_t | iter | ||
) |
Get the transition value from a state at a particular position in the sequence
seqs | Sequences the model is analyzing |
to | State that transition is being calculated to |
iter | Position in the sequence |
Definition at line 424 of file state.cpp.
References StochHMM::STANDARD, to, and transi.
|
inline |
|
inline |
double StochHMM::state::getEndTrans | ( | ) |
|
inline |
|
inline |
Get the GFF tag to use for the state std::string GFF tag
Definition at line 74 of file state.h.
References gff.
Referenced by StochHMM::trellis::get_explicit_duration_length(), StochHMM::traceback_path::gff(), StochHMM::traceback_path::print_gff(), and StochHMM::trellis::transitionFuncTraceback().
|
inline |
Get the states integer index value
Definition at line 66 of file state.h.
References stateIterator.
Referenced by _finalizeTransitions(), addFromState(), addToState(), StochHMM::trellis::get_explicit_duration_length(), StochHMM::trellis::getTransition(), and StochHMM::trellis::transitionFuncTraceback().
|
inline |
Get the Label used for the state
Definition at line 78 of file state.h.
References label.
Referenced by StochHMM::trellis::get_explicit_duration_length(), StochHMM::traceback_path::label(), StochHMM::traceback_path::print_label(), and StochHMM::trellis::transitionFuncTraceback().
|
inline |
Get the name of the state
Definition at line 70 of file state.h.
References name.
Referenced by StochHMM::model::_parseStates(), StochHMM::model::addState(), StochHMM::trellis::get_explicit_duration_length(), StochHMM::traceback_path::name(), and StochHMM::trellis::transitionFuncTraceback().
|
inline |
|
inline |
|
inline |
Get all transition defined for the state
Definition at line 82 of file state.h.
References transi.
Referenced by StochHMM::model::_addStateToFromTransition().
bool StochHMM::state::hasComplexEmission | ( | ) |
bool StochHMM::state::hasComplexTransition | ( | ) |
bool StochHMM::state::hasSimpleEmission | ( | ) |
bool StochHMM::state::hasSimpleTransition | ( | ) |
bool StochHMM::state::isSimple | ( | ) |
Definition at line 566 of file state.cpp.
References hasComplexEmission(), and hasComplexTransition().
bool StochHMM::state::parse | ( | std::string & | txt, |
stringList & | names, | ||
tracks & | trks, | ||
weights * | wts, | ||
StateFuncs * | funcs | ||
) |
Parses state from string
txt | String of state definition |
names | StringList with names of other states. Used to identify position of transitions in transition In future, may want to organize transitions in non-linear fashion |
Definition at line 73 of file state.cpp.
References _parseEmission(), _parseHeader(), _parseTransition(), and name.
Referenced by StochHMM::model::_parseStates(), and state().
void StochHMM::state::print | ( | ) |
Definition at line 319 of file state.cpp.
References stringify().
|
inline |
|
inline |
|
inline |
Set the index value to be used for the state.
Definition at line 150 of file state.h.
References stateIterator.
|
inline |
|
inline |
std::string StochHMM::state::stringify | ( | ) |
Definition at line 326 of file state.cpp.
References StochHMM::DURATION, emission, endi, gff, label, StochHMM::LEXICAL, name, StochHMM::STANDARD, StochHMM::transition::stringify(), and transi.
Referenced by StochHMM::model::_stringifyStates(), and print().
|
private |
Definition at line 173 of file state.h.
Referenced by _parseEmission(), addEmission(), get_emission_prob(), getEmission(), hasComplexEmission(), and stringify().
|
private |
Definition at line 170 of file state.h.
Referenced by StochHMM::model::_addStateToFromTransition(), _parseTransition(), getEnding(), getEndTrans(), setEndingTransition(), and stringify().
|
private |
Definition at line 179 of file state.h.
Referenced by addFromState(), StochHMM::model::getEndingFrom(), and getFrom().
|
private |
Definition at line 166 of file state.h.
Referenced by _parseHeader(), getGFF(), setGFF(), and stringify().
|
private |
Definition at line 167 of file state.h.
Referenced by _parseHeader(), getLabel(), setLabel(), and stringify().
|
private |
Definition at line 165 of file state.h.
Referenced by _finalizeTransitions(), _parseHeader(), getName(), parse(), setName(), and stringify().
|
private |
Definition at line 177 of file state.h.
Referenced by getIterator(), and setIter().
|
private |
Definition at line 178 of file state.h.
Referenced by addToState(), get_transition_prob(), StochHMM::model::getInitialTo(), and getTo().
|
private |
Definition at line 169 of file state.h.
Referenced by StochHMM::model::_checkTopology(), _finalizeTransitions(), addTransition(), get_transition_prob(), getTrans(), getTransitions(), hasComplexTransition(), state(), stringify(), and ~state().