StochHMM
v0.34
Flexible Hidden Markov Model C++ Library and Application
|
Lexical table stores the log2 probabilities for both emissions and lexical transitions. More...
#include <lexicalTable.h>
Public Member Functions | |
lexicalTable () | |
~lexicalTable () | |
double | getValue (sequences &, size_t) |
double | getValue (sequence &, size_t) |
void | initialize_emission_table () |
Initialize the final emission table with ambiguous characters. | |
double | getReducedOrder (sequences &seqs, size_t position) |
double | getReducedOrder (sequence &seq, size_t position) |
std::vector< std::vector < double > > * | getCountsTable () |
std::vector< std::vector < double > > * | getProbabilityTable () |
std::vector< std::vector < double > > * | getLogProbabilityTable () |
void | createTable (int rows, int columns, int pseudocount, valueType typ) |
void | addTrack (track *, int) |
void | assignTable (std::vector< std::vector< double > > *, valueType) |
void | setUnkScoreType (unknownCharScoringType type) |
void | setUnkScore (double val) |
Set a given score to be returned for unknownCharScoringType. | |
track * | getTrack (size_t iter) |
size_t | trackSize () |
std::vector< uint8_t > & | getOrder () |
uint8_t | getOrder (size_t i) |
std::vector< std::vector < double > > & | getLogEmm () |
std::vector< uint8_t > & | getAlphaSize () |
uint8_t | getAlphaSize (size_t i) |
size_t | getNumberOfAlphabets () |
unknownCharScoringType | getAmbScoringType () |
double | getAmbDefinedScore () |
void | incrementCounts (size_t word_index, size_t char_index) |
Increment counts. | |
void | incrementCountsDouble (size_t word_index, size_t char_index, double val) |
Increment counts by double. | |
std::string | stringify () |
std::string | stringifyAmbig () |
void | print () |
Private Member Functions | |
void | init_table_dimension_values () |
void | init_array_dimension_values () |
size_t | convertIndex (size_t, size_t) |
void | decompose (size_t row, size_t column, std::vector< uint8_t > &letters) |
void | decompose (size_t index, std::vector< uint8_t > &letters) |
void | transferValues (std::vector< bool > &transferred) |
size_t | calculateArrayIndex (std::vector< uint8_t > &kmer) |
void | expand_ambiguous (std::vector< uint8_t > &letters, std::vector< double > &expanded) |
std::vector< std::vector < uint8_t > > * | expand_ambiguous (std::vector< std::vector< uint8_t > > *words, size_t letter) |
size_t | calculateIndexFromDecomposed (std::vector< uint8_t > &word) |
double | getAmbiguousScore (std::vector< uint8_t > &letters) |
Private Attributes | |
unknownCharScoringType | unknownScoreType |
double | unknownDefinedScore |
What type of score to use with unknown. | |
size_t | number_of_tracks |
Undefined character score. | |
std::vector< track * > | trcks |
std::vector< uint8_t > | alphabets |
std::vector< uint8_t > | max_unambiguous |
std::vector< uint8_t > | order |
uint8_t | max_order |
size_t | y_dim |
size_t * | x_subarray |
size_t * | y_subarray |
std::vector< std::vector < double > > * | prob |
std::vector< std::vector < double > > * | counts |
std::vector< std::vector < double > > * | logProb |
size_t | array_size |
size_t | dimensions |
std::vector< size_t > | subarray_value |
std::vector< size_t > | subarray_sequence |
std::vector< size_t > | subarray_position |
std::vector< size_t > | decompose_values |
std::vector< size_t > | decompose_sequence |
std::vector< double > * | log_emission |
std::vector< std::vector < double > * > | low_order_emissions |
std::vector< std::vector < std::pair< size_t, size_t > * > > | low_order_info |
Lexical table stores the log2 probabilities for both emissions and lexical transitions.
Definition at line 31 of file lexicalTable.h.
StochHMM::lexicalTable::lexicalTable | ( | ) |
Definition at line 15 of file lexicalTable.cpp.
References counts, log_emission, logProb, max_order, StochHMM::NO_SCORE, prob, unknownDefinedScore, unknownScoreType, x_subarray, and y_subarray.
StochHMM::lexicalTable::~lexicalTable | ( | ) |
Definition at line 32 of file lexicalTable.cpp.
References counts, log_emission, logProb, prob, x_subarray, and y_subarray.
void StochHMM::lexicalTable::addTrack | ( | track * | trk, |
int | orderValue | ||
) |
Add a track to an emission
trk | Pointer to track |
orderValue | order of emission from track |
Definition at line 158 of file lexicalTable.cpp.
References alphabets, StochHMM::track::getAlphaSize(), max_order, order, and trcks.
Referenced by StochHMM::transition::_parseLexical(), StochHMM::Counter::initializeTable(), and StochHMM::emm::parse().
void StochHMM::lexicalTable::assignTable | ( | std::vector< std::vector< double > > * | temp, |
valueType | emmType | ||
) |
Set the type of counts in the emission 2D table provided by the user
temp | vector of vectors of doubles |
emmType | Type of value (COUNTS, PROBABILITY, LOG_PROB) |
Definition at line 171 of file lexicalTable.cpp.
References StochHMM::COUNTS, counts, initialize_emission_table(), StochHMM::LOG_PROB, logProb, prob, and StochHMM::PROBABILITY.
|
private |
Definition at line 814 of file lexicalTable.cpp.
References dimensions, and subarray_value.
Referenced by transferValues().
|
private |
Definition at line 806 of file lexicalTable.cpp.
References decompose_values, and dimensions.
|
private |
void StochHMM::lexicalTable::createTable | ( | int | rows, |
int | columns, | ||
int | pseudocount, | ||
valueType | typ | ||
) |
Definition at line 48 of file lexicalTable.cpp.
References StochHMM::COUNTS, and counts.
Referenced by StochHMM::Counter::initializeTable().
|
private |
Definition at line 822 of file lexicalTable.cpp.
References number_of_tracks, x_subarray, y_dim, and y_subarray.
Referenced by transferValues().
|
private |
Definition at line 841 of file lexicalTable.cpp.
References dimensions, and subarray_value.
|
private |
|
private |
|
inline |
Get the alphabet sizes for all tracks used in emission
Definition at line 87 of file lexicalTable.h.
References alphabets.
Referenced by StochHMM::transition::_parseLexical(), and StochHMM::emm::parse().
|
inline |
|
inline |
Definition at line 92 of file lexicalTable.h.
References unknownDefinedScore.
Referenced by StochHMM::emm::stringify(), and StochHMM::transition::stringify().
|
private |
Definition at line 718 of file lexicalTable.cpp.
References StochHMM::AVERAGE_SCORE, decompose_sequence, decompose_values, dimensions, StochHMM::HIGHEST_SCORE, log_emission, StochHMM::LOWEST_SCORE, max_unambiguous, StochHMM::Index::setAmbiguous(), StochHMM::Index::size(), trcks, and unknownScoreType.
Referenced by transferValues().
|
inline |
Definition at line 91 of file lexicalTable.h.
References unknownScoreType.
Referenced by StochHMM::emm::stringify(), and StochHMM::transition::stringify().
std::vector< std::vector< double > > * StochHMM::lexicalTable::getCountsTable | ( | ) |
Definition at line 69 of file lexicalTable.cpp.
References counts.
Referenced by StochHMM::transition::_parseLexical(), and StochHMM::emm::parse().
|
inline |
Get Log(prob) emission table
Definition at line 83 of file lexicalTable.h.
References logProb.
std::vector< std::vector< double > > * StochHMM::lexicalTable::getLogProbabilityTable | ( | ) |
Definition at line 99 of file lexicalTable.cpp.
References logProb.
Referenced by StochHMM::transition::_parseLexical(), and StochHMM::emm::parse().
|
inline |
Definition at line 89 of file lexicalTable.h.
References alphabets.
Referenced by StochHMM::transition::_parseLexical(), and StochHMM::emm::parse().
|
inline |
Get Orders of lexical emission will use for all tracks
Definition at line 78 of file lexicalTable.h.
References order.
Referenced by StochHMM::transition::_parseLexical(), StochHMM::emm::parse(), StochHMM::emm::stringify(), and StochHMM::transition::stringify().
|
inline |
std::vector< std::vector< double > > * StochHMM::lexicalTable::getProbabilityTable | ( | ) |
Definition at line 84 of file lexicalTable.cpp.
References prob.
Referenced by StochHMM::transition::_parseLexical(), and StochHMM::emm::parse().
double StochHMM::lexicalTable::getReducedOrder | ( | sequences & | seqs, |
size_t | position | ||
) |
Definition at line 607 of file lexicalTable.cpp.
References StochHMM::AVERAGE_SCORE, dimensions, StochHMM::HIGHEST_SCORE, log_emission, StochHMM::LOWEST_SCORE, max_unambiguous, StochHMM::NO_SCORE, StochHMM::Index::setAmbiguous(), StochHMM::Index::size(), subarray_position, subarray_sequence, subarray_value, trcks, and unknownScoreType.
Referenced by getValue().
double StochHMM::lexicalTable::getReducedOrder | ( | sequence & | seq, |
size_t | position | ||
) |
Definition at line 664 of file lexicalTable.cpp.
References StochHMM::AVERAGE_SCORE, dimensions, StochHMM::HIGHEST_SCORE, log_emission, StochHMM::LOWEST_SCORE, max_unambiguous, StochHMM::NO_SCORE, StochHMM::Index::setAmbiguous(), StochHMM::Index::size(), subarray_position, subarray_sequence, subarray_value, trcks, and unknownScoreType.
|
inline |
Get pointer to track at index position of emission
iter | Index iterator of position |
Definition at line 70 of file lexicalTable.h.
References trcks.
Referenced by StochHMM::emm::stringify(), and StochHMM::transition::stringify().
double StochHMM::lexicalTable::getValue | ( | sequences & | seqs, |
size_t | pos | ||
) |
Definition at line 113 of file lexicalTable.cpp.
References array_size, dimensions, getReducedOrder(), log_emission, max_order, subarray_position, subarray_sequence, and subarray_value.
Referenced by StochHMM::emm::get_emission(), and StochHMM::transition::getTransition().
double StochHMM::lexicalTable::getValue | ( | sequence & | seq, |
size_t | pos | ||
) |
Definition at line 134 of file lexicalTable.cpp.
References array_size, dimensions, getReducedOrder(), log_emission, max_order, subarray_position, and subarray_value.
|
inline |
Increment counts.
Definition at line 95 of file lexicalTable.h.
References counts.
|
inline |
Increment counts by double.
Definition at line 98 of file lexicalTable.h.
References counts.
|
private |
Definition at line 452 of file lexicalTable.cpp.
References array_size, decompose_sequence, decompose_values, dimensions, StochHMM::integerPower(), number_of_tracks, order, subarray_position, subarray_sequence, subarray_value, trcks, and y_dim.
Referenced by initialize_emission_table().
|
private |
Definition at line 408 of file lexicalTable.cpp.
References alphabets, number_of_tracks, order, StochHMM::sumVector(), trcks, x_subarray, y_dim, and y_subarray.
Referenced by initialize_emission_table().
void StochHMM::lexicalTable::initialize_emission_table | ( | ) |
Initialize the final emission table with ambiguous characters.
Definition at line 856 of file lexicalTable.cpp.
References array_size, StochHMM::DEFINED_SCORE, init_array_dimension_values(), init_table_dimension_values(), log_emission, logProb, max_unambiguous, number_of_tracks, transferValues(), trcks, and unknownDefinedScore.
Referenced by assignTable(), and StochHMM::emm::parse().
void StochHMM::lexicalTable::print | ( | ) |
Definition at line 64 of file lexicalTable.cpp.
References stringify().
|
inline |
Set a given score to be returned for unknownCharScoringType.
Definition at line 65 of file lexicalTable.h.
References unknownDefinedScore.
Referenced by StochHMM::transition::_parseLexical(), and StochHMM::emm::parse().
|
inline |
Set how the emission will deal with unknown alphabet
type | enum UnknownCharScoringType |
Definition at line 62 of file lexicalTable.h.
References unknownScoreType.
Referenced by StochHMM::transition::_parseLexical(), and StochHMM::emm::parse().
std::string StochHMM::lexicalTable::stringify | ( | ) |
Definition at line 297 of file lexicalTable.cpp.
References counts, StochHMM::double_to_string(), logProb, order, StochHMM::POWER, prob, and trcks.
Referenced by print(), StochHMM::emm::stringify(), and StochHMM::transition::stringify().
std::string StochHMM::lexicalTable::stringifyAmbig | ( | ) |
Definition at line 185 of file lexicalTable.cpp.
References trcks.
|
inline |
Get the number of tracks defined in emission
Definition at line 74 of file lexicalTable.h.
References trcks.
Referenced by StochHMM::emm::stringify(), and StochHMM::transition::stringify().
|
private |
Definition at line 543 of file lexicalTable.cpp.
References calculateArrayIndex(), decompose(), StochHMM::DEFINED_SCORE, getAmbiguousScore(), logProb, StochHMM::NO_SCORE, unknownDefinedScore, and unknownScoreType.
Referenced by initialize_emission_table().
|
private |
Definition at line 112 of file lexicalTable.h.
Referenced by addTrack(), getAlphaSize(), getNumberOfAlphabets(), and init_table_dimension_values().
|
private |
Definition at line 125 of file lexicalTable.h.
Referenced by getValue(), init_array_dimension_values(), and initialize_emission_table().
|
private |
Definition at line 121 of file lexicalTable.h.
Referenced by assignTable(), createTable(), getCountsTable(), incrementCounts(), incrementCountsDouble(), lexicalTable(), stringify(), and ~lexicalTable().
|
private |
Definition at line 132 of file lexicalTable.h.
Referenced by getAmbiguousScore(), and init_array_dimension_values().
|
private |
Definition at line 131 of file lexicalTable.h.
Referenced by calculateIndexFromDecomposed(), getAmbiguousScore(), and init_array_dimension_values().
|
private |
Definition at line 126 of file lexicalTable.h.
Referenced by calculateArrayIndex(), calculateIndexFromDecomposed(), decompose(), getAmbiguousScore(), getReducedOrder(), getValue(), and init_array_dimension_values().
|
private |
Definition at line 134 of file lexicalTable.h.
Referenced by getAmbiguousScore(), getReducedOrder(), getValue(), initialize_emission_table(), lexicalTable(), and ~lexicalTable().
|
private |
Definition at line 122 of file lexicalTable.h.
Referenced by assignTable(), getLogEmm(), getLogProbabilityTable(), initialize_emission_table(), lexicalTable(), stringify(), transferValues(), and ~lexicalTable().
|
private |
Definition at line 135 of file lexicalTable.h.
|
private |
Definition at line 136 of file lexicalTable.h.
|
private |
Definition at line 115 of file lexicalTable.h.
Referenced by addTrack(), getValue(), and lexicalTable().
|
private |
Definition at line 113 of file lexicalTable.h.
Referenced by getAmbiguousScore(), getReducedOrder(), and initialize_emission_table().
|
private |
Undefined character score.
Definition at line 110 of file lexicalTable.h.
Referenced by decompose(), init_array_dimension_values(), init_table_dimension_values(), and initialize_emission_table().
|
private |
Definition at line 114 of file lexicalTable.h.
Referenced by addTrack(), getOrder(), init_array_dimension_values(), init_table_dimension_values(), and stringify().
|
private |
Definition at line 120 of file lexicalTable.h.
Referenced by assignTable(), getProbabilityTable(), lexicalTable(), stringify(), and ~lexicalTable().
|
private |
Definition at line 129 of file lexicalTable.h.
Referenced by getReducedOrder(), getValue(), and init_array_dimension_values().
|
private |
Definition at line 128 of file lexicalTable.h.
Referenced by getReducedOrder(), getValue(), and init_array_dimension_values().
|
private |
Definition at line 127 of file lexicalTable.h.
Referenced by calculateArrayIndex(), decompose(), getReducedOrder(), getValue(), and init_array_dimension_values().
|
private |
Definition at line 111 of file lexicalTable.h.
Referenced by addTrack(), getAmbiguousScore(), getReducedOrder(), getTrack(), init_array_dimension_values(), init_table_dimension_values(), initialize_emission_table(), stringify(), stringifyAmbig(), and trackSize().
|
private |
What type of score to use with unknown.
Definition at line 108 of file lexicalTable.h.
Referenced by getAmbDefinedScore(), initialize_emission_table(), lexicalTable(), setUnkScore(), and transferValues().
|
private |
Definition at line 107 of file lexicalTable.h.
Referenced by getAmbiguousScore(), getAmbScoringType(), getReducedOrder(), lexicalTable(), setUnkScoreType(), and transferValues().
|
private |
Definition at line 118 of file lexicalTable.h.
Referenced by decompose(), init_table_dimension_values(), lexicalTable(), and ~lexicalTable().
|
private |
Definition at line 117 of file lexicalTable.h.
Referenced by decompose(), init_array_dimension_values(), and init_table_dimension_values().
|
private |
Definition at line 119 of file lexicalTable.h.
Referenced by decompose(), init_table_dimension_values(), lexicalTable(), and ~lexicalTable().