StochHMM
v0.34
Flexible Hidden Markov Model C++ Library and Application
|
#include <track.h>
Public Member Functions | |
track () | |
Create a track. | |
track (TrackFuncs *) | |
track (std::vector< std::string > &) | |
bool | parse (std::string &) |
bool | parseAmbiguous (std::string &) |
void | setName (std::string &nm) |
void | setDescription (std::string &desc) |
void | setIndex (size_t indx) |
void | setAlphaType (trackType typ) |
bool | addAlphabetChar (std::string &) |
bool | addAlphabetChar (const char *) |
bool | addAlphabetChar (std::vector< std::string > &) |
bool | addAlphabetChar (size_t chSize, const char *characters[]) |
bool | addAlphabetChar (std::string &character, std::string &complement) |
bool | addAlphabetChar (size_t chSize, const char *characters[], const char *complements[]) |
bool | addAlphabetChar (std::vector< std::string > &characters, std::vector< std::string > &complements) |
void | addComplement (std::string &, std::string &) |
void | addComplement (const char *, const char *) |
bool | addComplement (std::vector< std::string > &characters, std::vector< std::string > &complements) |
void | setAmbiguous () |
void | addAmbiguous (std::string &, std::vector< std::string > &) |
std::string | getName () |
std::string | getDescription () |
size_t | getIndex () |
trackType | getAlphaType () |
size_t | getAlphaSize () |
size_t | getTotalAlphabetSize () |
Get alphabet size including ambiguous characters. | |
size_t | getAlphaMax () |
std::string | getAlpha (int) |
std::string | getAlpha (size_t) |
uint8_t | symbolIndex (const std::string &) |
uint8_t | symbolIndex (unsigned char) |
uint8_t | getComplementIndex (uint8_t val) |
uint8_t | getComplementIndex (std::string &) |
std::string | getComplementSymbol (std::string &character) |
std::string | getComplementSymbol (uint8_t value) |
bool | isComplementDefined () |
bool | isAmbiguousSet () |
bool | isAlpha () |
size_t | getAmbiguousSize () |
std::string | getAmbiguousCharacter (size_t) |
std::vector< size_t > & | getAmbiguousSet (uint8_t val) |
std::vector< size_t > & | getUnambiguousSet () |
std::string | stringify () |
std::string | stringifyAmbig () |
void | print () |
Print the string representation of the track to stdout. | |
std::string | convertIndexToWord (size_t, size_t) |
void | convertIndexToDigital (size_t, size_t, uint8_t *) |
bool | isTrackFuncDefined () |
std::string | getTrackFunction () |
std::string | getTrackToUse () |
Get name of Track to use for trackFunc. | |
uint8_t | getMaxUnambiguous () |
uint8_t | getMaxAmbiguous () |
Private Member Functions | |
void | _splitAmbiguousList (std::vector< std::pair< std::string, std::vector< std::string > > > &, const std::string &) |
Private Attributes | |
std::string | name |
std::string | description |
size_t | trackIndex |
trackType | alpha_type |
bool | trackFunctionDefined |
Track Functions for defining Real Number Tracks. | |
bool | complementSet |
std::string | trackToUse |
std::string | trackFunction |
std::vector< std::string > | alphabet |
std::map< uint8_t, uint8_t > | complementAlphabet |
size_t | maxSize |
uint8_t | max_unambiguous |
uint8_t | max_ambiguous |
std::vector< size_t > | unambiguous |
bool | ambiguous |
int | defaultAmbiguous |
std::vector< ambigCharacter > | ambiguousSymbols |
std::map< std::string, uint8_t > | symbolIndices |
std::vector< uint8_t > * | charIndices |
Friends | |
class | state |
class | model |
class | tracks |
Defines types of data (real-value, text-sequence) used in the model and the alphabet that a text-sequence uses. Tracks are used to digitize the sequence before decoding in HMM
StochHMM::track::track | ( | ) |
Create a track.
Definition at line 47 of file track.cpp.
References alpha_type, ambiguous, charIndices, complementSet, defaultAmbiguous, StochHMM::max(), max_ambiguous, max_unambiguous, maxSize, trackFunctionDefined, trackIndex, and StochHMM::UNDEFINED.
StochHMM::track::track | ( | TrackFuncs * | ) |
StochHMM::track::track | ( | std::vector< std::string > & | characters | ) |
Definition at line 60 of file track.cpp.
References addAlphabetChar(), StochHMM::ALPHA_NUM, ambiguous, charIndices, complementSet, defaultAmbiguous, StochHMM::max(), max_ambiguous, max_unambiguous, maxSize, setAlphaType(), trackFunctionDefined, and trackIndex.
|
private |
Definition at line 471 of file track.cpp.
References StochHMM::clear_whitespace(), and StochHMM::split_line().
Referenced by parseAmbiguous().
bool StochHMM::track::addAlphabetChar | ( | std::string & | character | ) |
Add a letter/word symbol to the track
character | Word or symbol used in undigitized sequence |
Definition at line 109 of file track.cpp.
References StochHMM::ALPHA_NUM, alphabet, max_unambiguous, maxSize, setAlphaType(), symbolIndices, and unambiguous.
Referenced by addAlphabetChar(), parse(), and track().
bool StochHMM::track::addAlphabetChar | ( | const char * | character | ) |
Definition at line 132 of file track.cpp.
References addAlphabetChar(), StochHMM::ALPHA_NUM, maxSize, and setAlphaType().
bool StochHMM::track::addAlphabetChar | ( | std::vector< std::string > & | characters | ) |
Definition at line 141 of file track.cpp.
References addAlphabetChar(), StochHMM::ALPHA_NUM, and setAlphaType().
bool StochHMM::track::addAlphabetChar | ( | size_t | chSize, |
const char * | characters[] | ||
) |
Definition at line 152 of file track.cpp.
References addAlphabetChar().
bool StochHMM::track::addAlphabetChar | ( | std::string & | character, |
std::string & | complement | ||
) |
Definition at line 160 of file track.cpp.
References addAlphabetChar(), addComplement(), StochHMM::ALPHA_NUM, complementSet, and setAlphaType().
bool StochHMM::track::addAlphabetChar | ( | size_t | chSize, |
const char * | characters[], | ||
const char * | complements[] | ||
) |
Definition at line 168 of file track.cpp.
References addAlphabetChar(), addComplement(), StochHMM::ALPHA_NUM, complementSet, and setAlphaType().
bool StochHMM::track::addAlphabetChar | ( | std::vector< std::string > & | characters, |
std::vector< std::string > & | complements | ||
) |
Definition at line 183 of file track.cpp.
References addAlphabetChar(), addComplement(), StochHMM::ALPHA_NUM, complementSet, and setAlphaType().
void StochHMM::track::addAmbiguous | ( | std::string & | ambChar, |
std::vector< std::string > & | defs | ||
) |
Add an ambiguous character/word definition to the track
ambChar | word/symbol fore the ambiguous character |
Definition at line 237 of file track.cpp.
References ambiguousSymbols, defaultAmbiguous, max_ambiguous, max_unambiguous, and symbolIndices.
Referenced by parseAmbiguous().
void StochHMM::track::addComplement | ( | std::string & | character, |
std::string & | complement | ||
) |
Definition at line 203 of file track.cpp.
References complementAlphabet, complementSet, and symbolIndex().
Referenced by addAlphabetChar(), and addComplement().
void StochHMM::track::addComplement | ( | const char * | character, |
const char * | complement | ||
) |
Definition at line 212 of file track.cpp.
References addComplement().
bool StochHMM::track::addComplement | ( | std::vector< std::string > & | characters, |
std::vector< std::string > & | complements | ||
) |
Definition at line 220 of file track.cpp.
References addComplement().
void StochHMM::track::convertIndexToDigital | ( | size_t | , |
size_t | , | ||
uint8_t * | |||
) |
Definition at line 429 of file track.cpp.
References alphabet, and StochHMM::POWER.
std::string StochHMM::track::convertIndexToWord | ( | size_t | wordIndex, |
size_t | order | ||
) |
Definition at line 402 of file track.cpp.
References alphabet, maxSize, and StochHMM::POWER.
std::string StochHMM::track::getAlpha | ( | int | iter | ) |
Get the letter/word that has a given digitized value
iter | integer value of digital symbol |
Definition at line 79 of file track.cpp.
References alphabet, getAmbiguousCharacter(), max_ambiguous, and max_unambiguous.
Referenced by getComplementSymbol(), StochHMM::sequence::getSymbol(), StochHMM::random_sequence(), and StochHMM::sequence::undigitize().
std::string StochHMM::track::getAlpha | ( | size_t | iter | ) |
Get the letter/word that has a given digitized value
iter | integer value of digital symbol |
Definition at line 94 of file track.cpp.
References alphabet, getAmbiguousCharacter(), max_ambiguous, and max_unambiguous.
|
inline |
Get the size of the largest alphabet word
Definition at line 180 of file track.h.
References maxSize.
Referenced by StochHMM::sequence::_digitize(), StochHMM::sequence::complement(), StochHMM::sequence::reverse(), StochHMM::trellis::transitionFuncTraceback(), and StochHMM::sequence::undigitize().
|
inline |
Get the number of characters defined in the track
Definition at line 173 of file track.h.
References alphabet.
Referenced by StochHMM::lexicalTable::addTrack(), StochHMM::Counter::initializeTable(), and StochHMM::random_sequence().
|
inline |
Get the alphabet type of the track
Definition at line 169 of file track.h.
References alpha_type.
Referenced by StochHMM::seqTracks::_initImportTrackInfo(), and StochHMM::emm::isReal().
std::string StochHMM::track::getAmbiguousCharacter | ( | size_t | val | ) |
Get the string representation of the ambigous character defined by integer value If ambiguous character isn't defined, return value is "*"
val | Integer value representing the ambiguous character |
Definition at line 500 of file track.cpp.
References ambiguousSymbols, getAmbiguousSize(), and max_unambiguous.
Referenced by getAlpha(), and stringifyAmbig().
|
inline |
Get the indices of characters that an ambiguous character represents
Definition at line 220 of file track.h.
References ambiguousSymbols, and max_unambiguous.
Referenced by stringifyAmbig().
|
inline |
Get the number of ambiguous characters that are defined
Definition at line 213 of file track.h.
References ambiguousSymbols.
Referenced by getAmbiguousCharacter().
uint8_t StochHMM::track::getComplementIndex | ( | uint8_t | val | ) |
Get the complement alphabet character digitized value given a value
val | Value of character to get complement of |
Definition at line 593 of file track.cpp.
References complementAlphabet, and complementSet.
Referenced by StochHMM::sequence::complement().
uint8_t StochHMM::track::getComplementIndex | ( | std::string & | character | ) |
Get the complement alphabet character digitized value given the string
character | String of alphanumerical symbol |
Definition at line 614 of file track.cpp.
References complementAlphabet, complementSet, symbolIndex(), and symbolIndices.
std::string StochHMM::track::getComplementSymbol | ( | std::string & | character | ) |
Get the compelment alphabet character digitized value given the string
character | String of alphanumerical symbol |
Definition at line 657 of file track.cpp.
References complementAlphabet, complementSet, getAlpha(), symbolIndex(), and symbolIndices.
Referenced by StochHMM::sequence::complement().
std::string StochHMM::track::getComplementSymbol | ( | uint8_t | value | ) |
Get the complement alphanumerical string of a given integer value;
value | Integer value of a symbol |
Definition at line 635 of file track.cpp.
References complementAlphabet, complementSet, and getAlpha().
|
inline |
Get the description of the track
Definition at line 154 of file track.h.
References description.
|
inline |
Get the index of the track
Definition at line 158 of file track.h.
References StochHMM::max(), and trackIndex.
Referenced by StochHMM::sequences::addSeq(), StochHMM::emissionFuncParam::emissionFuncParam(), StochHMM::emm::get_emission(), StochHMM::emissionFuncParam::parse(), and StochHMM::trellis::transitionFuncTraceback().
|
inline |
|
inline |
|
inline |
Get the name of the track
Definition at line 150 of file track.h.
References name.
Referenced by StochHMM::emissionFuncParam::emissionFuncParam(), StochHMM::tracks::push_back(), StochHMM::emm::stringify(), StochHMM::sequences::stringify(), StochHMM::transition::stringify(), and StochHMM::sequences::undigitize().
|
inline |
Get alphabet size including ambiguous characters.
Definition at line 176 of file track.h.
References symbolIndices.
|
inline |
Get name of TrackFunc defined for track
Definition at line 241 of file track.h.
References trackFunction.
Referenced by StochHMM::seqTracks::_initImportTrackInfo().
|
inline |
Get name of Track to use for trackFunc.
Definition at line 244 of file track.h.
References trackToUse.
Referenced by StochHMM::seqTracks::_initImportTrackInfo().
|
inline |
|
inline |
Check to see if the track is AlphaNum type and not a REAL Track
Definition at line 209 of file track.h.
References StochHMM::ALPHA_NUM, and alpha_type.
Referenced by StochHMM::trellis::transitionFuncTraceback().
|
inline |
|
inline |
|
inline |
Check if the TrackFunction is defined for this track
Definition at line 237 of file track.h.
References trackFunctionDefined.
Referenced by StochHMM::seqTracks::_initImportTrackInfo().
bool StochHMM::track::parse | ( | std::string & | txt | ) |
Parse a string representation of track to define a tracks parameters
txt | Line from model that describes a track |
Definition at line 310 of file track.cpp.
References addAlphabetChar(), StochHMM::ALPHA_NUM, StochHMM::stringList::contains(), StochHMM::extractTag(), StochHMM::stringList::fromNext(), StochHMM::stringList::getComment(), StochHMM::stringList::indexOf(), StochHMM::REAL, setAlphaType(), setDescription(), setName(), StochHMM::stringList::size(), StochHMM::stringList::stringify(), trackFunction, trackFunctionDefined, and trackToUse.
Referenced by StochHMM::PWM::_parseTrack(), and StochHMM::model::_parseTracks().
bool StochHMM::track::parseAmbiguous | ( | std::string & | txt | ) |
Parse the ambiguous character definitions from model file
txt | String representation of ambiguous character definition as in model file |
Definition at line 456 of file track.cpp.
References _splitAmbiguousList(), addAmbiguous(), and setAmbiguous().
Referenced by StochHMM::PWM::_parseAmbiguous(), and StochHMM::model::_parseAmbiguous().
|
inline |
Print the string representation of the track to stdout.
Definition at line 229 of file track.h.
References stringify().
|
inline |
Set the alphabet type of the track (Real or alphanum)
typ | enum trackType |
Definition at line 124 of file track.h.
References alpha_type.
Referenced by addAlphabetChar(), parse(), and track().
|
inline |
Set ambiguous character flag to true This will allow ambiguous characters to be processed in sequence Without this flag, only strict track characters or values are allowed
Definition at line 142 of file track.h.
References ambiguous.
Referenced by parseAmbiguous().
|
inline |
Set the Description of the track
desc | Description of track |
Definition at line 108 of file track.h.
References description.
Referenced by parse().
|
inline |
Set the integer index value of the track in tracks
indx | User defined index value; |
Definition at line 112 of file track.h.
References StochHMM::max(), and trackIndex.
Referenced by StochHMM::PWM::_parseTrack(), and StochHMM::model::_parseTracks().
|
inline |
std::string StochHMM::track::stringify | ( | ) |
Get the string representation of the track
Definition at line 360 of file track.cpp.
References StochHMM::ALPHA_NUM, alpha_type, alphabet, StochHMM::join(), name, trackFunction, trackFunctionDefined, and trackToUse.
Referenced by print(), and StochHMM::PWM::stringify().
std::string StochHMM::track::stringifyAmbig | ( | ) |
Get the string representation of the ambiguous character definitions as in model file
Definition at line 381 of file track.cpp.
References alphabet, getAmbiguousCharacter(), getAmbiguousSet(), max_ambiguous, max_unambiguous, and name.
uint8_t StochHMM::track::symbolIndex | ( | const std::string & | symbol | ) |
Get symbol assigned integer value
symbol | word/letter/symbol that we want to get it's assigned integer value |
Definition at line 259 of file track.cpp.
References ambiguous, defaultAmbiguous, and symbolIndices.
Referenced by StochHMM::sequence::_digitize(), addComplement(), StochHMM::ambigCharacter::ambigCharacter(), getComplementIndex(), and getComplementSymbol().
uint8_t StochHMM::track::symbolIndex | ( | unsigned char | symbol | ) |
Get symbol assigned integer value
symbol | word/letter/symbol that we want to get it's assigned integer value |
Definition at line 277 of file track.cpp.
References ambiguous, charIndices, defaultAmbiguous, maxSize, and symbolIndices.
|
private |
Definition at line 254 of file track.h.
Referenced by getAlphaType(), isAlpha(), setAlphaType(), stringify(), and track().
|
private |
Definition at line 263 of file track.h.
Referenced by addAlphabetChar(), convertIndexToDigital(), convertIndexToWord(), getAlpha(), getAlphaSize(), stringify(), and stringifyAmbig().
|
private |
Definition at line 272 of file track.h.
Referenced by isAmbiguousSet(), setAmbiguous(), symbolIndex(), and track().
|
private |
Definition at line 277 of file track.h.
Referenced by addAmbiguous(), getAmbiguousCharacter(), getAmbiguousSet(), and getAmbiguousSize().
|
private |
Definition at line 281 of file track.h.
Referenced by symbolIndex(), and track().
|
private |
Definition at line 264 of file track.h.
Referenced by addComplement(), getComplementIndex(), and getComplementSymbol().
|
private |
Definition at line 258 of file track.h.
Referenced by addAlphabetChar(), addComplement(), getComplementIndex(), getComplementSymbol(), isComplementDefined(), and track().
|
private |
Definition at line 273 of file track.h.
Referenced by addAmbiguous(), symbolIndex(), and track().
|
private |
Definition at line 251 of file track.h.
Referenced by getDescription(), and setDescription().
|
private |
Definition at line 269 of file track.h.
Referenced by addAmbiguous(), getAlpha(), getMaxAmbiguous(), stringifyAmbig(), and track().
|
private |
Definition at line 268 of file track.h.
Referenced by addAlphabetChar(), addAmbiguous(), getAlpha(), getAmbiguousCharacter(), getAmbiguousSet(), getMaxUnambiguous(), stringifyAmbig(), and track().
|
private |
Definition at line 266 of file track.h.
Referenced by addAlphabetChar(), convertIndexToWord(), getAlphaMax(), symbolIndex(), and track().
|
private |
Definition at line 250 of file track.h.
Referenced by getName(), StochHMM::tracks::push_back(), setName(), stringify(), and stringifyAmbig().
|
private |
Definition at line 279 of file track.h.
Referenced by addAlphabetChar(), addAmbiguous(), getComplementIndex(), getComplementSymbol(), getTotalAlphabetSize(), and symbolIndex().
|
private |
Definition at line 261 of file track.h.
Referenced by getTrackFunction(), parse(), and stringify().
|
private |
Track Functions for defining Real Number Tracks.
Definition at line 257 of file track.h.
Referenced by isTrackFuncDefined(), parse(), stringify(), and track().
|
private |
Definition at line 252 of file track.h.
Referenced by getIndex(), setIndex(), and track().
|
private |
Definition at line 260 of file track.h.
Referenced by getTrackToUse(), parse(), and stringify().
|
private |
Definition at line 270 of file track.h.
Referenced by addAlphabetChar(), and getUnambiguousSet().