StochHMM  v0.34
Flexible Hidden Markov Model C++ Library and Application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends
StochHMM::transition Class Reference

Transition information for each state. More...

#include <transitions.h>

List of all members.

Public Member Functions

 transition ()
 transition (transType)
 transition (transType, valueType, bool)
bool parse (std::string &, stringList &, valueType valtyp, tracks &, weights *, StateFuncs *)
bool parse (stringList &, stringList &, valueType valtyp, tracks &, weights *, StateFuncs *)
void setName (std::string &txt)
void setState (state *st)
void setTransType (transType type)
void setTB_Identifier (tracebackIdentifier tbIdt)
void setTB_String (std::string &txt)
void setDistribution (std::vector< double > *dst)
void setTransProb (double value)
std::string & getName ()
stategetState ()
transType getTransitionType ()
tracebackIdentifier getTracebackIdentifier ()
std::string & getTracebackString ()
double getTransition (size_t, sequences *)
double get_reduced_order (int, sequences *)
double getTransition ()
transitionFuncParamgetExtFunction ()
bool FunctionDefined ()
bool LexFunctionDefined ()
std::string getLexicalFunctionName ()
bool isSimple ()
bool isComplex ()
void print ()
 Print the transition to stdout.
std::string stringify ()

Private Member Functions

bool _parseStandard (std::string &, stringList &, valueType)
bool _parseDuration (stringList &, stringList &, valueType)
bool _parseLexical (stringList &, stringList &, valueType, tracks &, StateFuncs *)
bool _processTags (std::string &, tracks &, weights *, StateFuncs *)

Private Attributes

transType transition_type
std::string stateName
statetoState
double log_trans
std::vector< double > * distribution
double extendedValue
 Transition Length Distribution.
tracebackIdentifier traceback_identifier
std::string traceback_string
bool function
emissionFuncParamlexFunc
lexicalTable scoreTable
transitionFuncParamfunc

Friends

class model
class state

Detailed Description

Transition information for each state.

  

Definition at line 54 of file transitions.h.


Constructor & Destructor Documentation

StochHMM::transition::transition ( )
StochHMM::transition::transition ( transType  type)

Create a transition of a certain type

Parameters:
typeenum transType (STANDARD, DURATION, LEXICAL)

Definition at line 32 of file transitions.cpp.

References StochHMM::DIFF_STATE, extendedValue, func, lexFunc, log_trans, toState, traceback_identifier, and transition_type.

{
log_trans=-INFINITY;
extendedValue=-INFINITY;
function=false;
func = NULL;
lexFunc = NULL;
toState = NULL;
func = NULL;
}
StochHMM::transition::transition ( transType  type,
valueType  valtyp,
bool  survival 
)

Create a transition of a certain type

Parameters:
typeType of transType
valTypeType of Value Transition uses
Isdistributions defined as survival

Definition at line 48 of file transitions.cpp.

References StochHMM::DIFF_STATE, func, lexFunc, log_trans, toState, traceback_identifier, and transition_type.

{
log_trans = -INFINITY;
func=NULL;
lexFunc=NULL;
function=false;
toState=NULL;
func = NULL;
}

Member Function Documentation

bool StochHMM::transition::_parseDuration ( stringList txt,
stringList names,
valueType  valtyp 
)
private

Definition at line 198 of file transitions.cpp.

References StochHMM::stringList::contains(), StochHMM::DIFF_STATE, distribution, extendedValue, StochHMM::stringList::indexOf(), StochHMM::PROBABILITY, StochHMM::stringList::size(), StochHMM::stringList::splitString(), StochHMM::START_INIT, StochHMM::STATE_GFF, StochHMM::STATE_LABEL, StochHMM::STATE_NAME, stateName, StochHMM::stringList::stringify(), StochHMM::stringToDouble(), StochHMM::stringToInt(), traceback_identifier, and traceback_string.

Referenced by parse().

{
stringList line;
line.splitString(txt[1],"\t:,");
if (line.size()<1){
std::cerr << "Couldn't parse the transition STATE information: "<< txt[1] << std::endl;
}
stateName = line[0];
//Determine Traceback options
if (line.contains("TO_LABEL") || line.contains("TB->LABEL")){
size_t idx= (line.contains("TO_LABEL")) ? line.indexOf("TO_LABEL") : line.indexOf("TB->LABEL");
idx++;
traceback_string = line[idx];
}
else if (line.contains("TO_GFF") || line.contains("TB->GFF")){
size_t idx= (line.contains("TO_GFF")) ? line.indexOf("TO_GFF") : line.indexOf("TB->GFF");
idx++;
traceback_string = line[idx];
}
else if (line.contains("TO_STATE") || line.contains("TB->STATE")){
size_t idx= (line.contains("TO_STATE")) ? line.indexOf("TO_STATE") : line.indexOf("TB->STATE");
idx++;
traceback_string = line[idx];
}
else if (line.contains("TO_START") || line.contains("TB->START")){
}
else{
}
//Process Distribution
//from line 2 to end is distribution
distribution = new(std::nothrow) std::vector<double>;
if (distribution==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
for(size_t j=2;j<txt.size();j++){
stringList ln;
ln.splitString(txt[j],"\t");
if (ln.size()!=2){
std::cerr << "More than 2 values on the line: " << ln.stringify() << std::endl;
return false;
}
size_t index(0);
if (!stringToInt(ln[0], index)){
std::cerr << "Distribution position value not numeric:\t" << ln[0] << std::endl;
return false;
}
double value;
if (!stringToDouble(ln[1], value)){
std::cerr << "Distribution position value not numeric:\t" << ln[0] << std::endl;
return false;
}
if (valtyp==PROBABILITY){
value=log(value);
}
//Fill the lower range up to index with the first value
//Extend values to lower
while (distribution->size()< index-1){
distribution->push_back(value);
}
#ifdef DEBUG_MODEL
//cout << value <<endl;
#endif
distribution->push_back(value);
}
return true;
}
bool StochHMM::transition::_parseLexical ( stringList txt,
stringList names,
valueType  valtyp,
tracks trks,
StateFuncs funcs 
)
private

Definition at line 286 of file transitions.cpp.

References StochHMM::lexicalTable::addTrack(), StochHMM::AVERAGE_SCORE, StochHMM::stringList::contains(), StochHMM::COUNTS, StochHMM::DEFINED_SCORE, StochHMM::expVector(), StochHMM::lexicalTable::getAlphaSize(), StochHMM::lexicalTable::getCountsTable(), StochHMM::lexicalTable::getLogProbabilityTable(), StochHMM::lexicalTable::getNumberOfAlphabets(), StochHMM::lexicalTable::getOrder(), StochHMM::lexicalTable::getProbabilityTable(), StochHMM::tracks::getTrack(), StochHMM::HIGHEST_SCORE, StochHMM::stringList::indexOf(), lexFunc, StochHMM::LOG_PROB, StochHMM::logVector(), StochHMM::LOWEST_SCORE, StochHMM::stringList::pop_ith(), StochHMM::POWER, StochHMM::PROBABILITY, StochHMM::probVector(), StochHMM::stringList::push_back(), scoreTable, StochHMM::lexicalTable::setUnkScore(), StochHMM::lexicalTable::setUnkScoreType(), StochHMM::stringList::size(), StochHMM::stringList::splitString(), stateName, StochHMM::stringList::stringify(), StochHMM::stringToDouble(), StochHMM::stringToInt(), and StochHMM::stringList::toVecDouble().

Referenced by parse().

{
//Process Transition
stringList line;
size_t idx(0);
std::string functionName("");
if (txt.contains("FUNCTION")){
idx=txt.indexOf("FUNCTION");
function=true;
if (idx+1 < txt.size()){
functionName=txt[idx+1];
}
else{
std::cerr << "Couldn't parse the function name from the Lexical Transition:\n" << txt.stringify() << std::endl;
}
}
idx=txt.indexOf("TRANSITION");
if (idx+1 < txt.size()){
idx++;
line.splitString(txt[idx],"\t:,");
if (line.size()>0){
stateName = line[0];
}
else{
std::cerr << "Couldn't parse the STATE for the Lexical transition:\n" << txt.stringify() << std::endl;
}
}
else{
std::cerr << "Couldn't parse the Lexical Transition:\n" << txt.stringify() << std::endl;
return false;
}
if (!names.contains(stateName)){
std::cerr << "Lexical transition defined transition to state named : " << stateName << " However, there doesn't appear to be any state with that name\n";
return false;
}
//remaining tracks and Orders then set Track
std::vector<track*> tempTracks;
for(size_t i=1;i<line.size();i++){
track* tk = trks.getTrack(line[i]);
if (tk==NULL){
std::cerr << "Lexical Transition tried to add a track named: " << line[i] << " . However, there isn't a matching track in the model. Please check to model formatting.\n";
return false;
}
else{
tempTracks.push_back(tk);
}
}
if (function){ //Lexical Function
lexFunc=new(std::nothrow) emissionFuncParam(functionName,funcs,tempTracks[0]);
if (lexFunc==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
}
else{ //Lexical Tables
//Get Order Information
std::vector<int> tempOrder;
if (txt.contains("ORDER")){
idx=txt.indexOf("ORDER");
}
else{
std::cerr << "Unable to locate ORDER: for lexical transition to State Name: " << stateName << std::endl;
return false;
}
line.splitString(txt[idx],"\t:,");
size_t ambIdx(0);
bool containsAmbig=line.contains("AMBIGUOUS");
if (containsAmbig){
ambIdx=line.indexOf("AMBIGUOUS");
for(size_t i=1;i<ambIdx;i++){
int tempInt;
if (!stringToInt(line[i], tempInt)){
std::cerr << "Lexical Transition Order is not numeric" << line[i] << std::endl;
return false;
}
tempOrder.push_back(tempInt);
}
}
else{
for(size_t i=1;i<line.size();i++){
int tempInt;
if (!stringToInt(line[i], tempInt)){
std::cerr << "Lexical Transition Order is not numeric" << line[i] << std::endl;
return false;
}
tempOrder.push_back(tempInt);
}
}
if (tempOrder.size() == tempTracks.size()){
for(size_t i=0;i<tempOrder.size();i++){
scoreTable.addTrack(tempTracks[i], tempOrder[i]);
}
}
else{
std::cerr << "Different number of tracks and orders parsed in LEXICAL TRANSITION to state: " << stateName << " Check the formatting of the Lexical Transition" << std::endl;
return false;
}
//Parse Ambiguous Tag Info
if (containsAmbig){
ambIdx++;
if (line.size()<=ambIdx){
std::cerr << "No scoring type after AMBIGUOUS label\nAssuming AVG\n";
}
else if (line[ambIdx].compare("AVG")==0){scoreTable.setUnkScoreType(AVERAGE_SCORE);}
else if (line[ambIdx].compare("MAX")==0){scoreTable.setUnkScoreType(HIGHEST_SCORE);}
else if (line[ambIdx].compare("MIN")==0){scoreTable.setUnkScoreType(LOWEST_SCORE);}
else if (line[ambIdx].compare("P(X)")==0)
{
ambIdx++;
double tempValue;
if (!stringToDouble(line[ambIdx], tempValue)){
std::cerr << "Ambiguous Value couldn't be parsed: "<< line[ambIdx] << std::endl;
return false;
}
scoreTable.setUnkScore(log(tempValue));
}
else if (line[ambIdx].compare("LOG")==0){
ambIdx++;
double tempValue;
if (!stringToDouble(line[ambIdx], tempValue)){
std::cerr << "Ambiguous Value couldn't be parsed: "<< line[ambIdx] << std::endl;
return false;
}
scoreTable.setUnkScore(tempValue);
}
}
//Get Tables
size_t expectedColumns(1);
size_t expectedRows(1);
for(size_t i = 0; i<scoreTable.getNumberOfAlphabets(); i++){
expectedColumns*=scoreTable.getAlphaSize(i);
expectedRows*=POWER[scoreTable.getOrder(i)][scoreTable.getAlphaSize(i)-1];
}
std::vector<std::vector<double> >* log_prob = scoreTable.getLogProbabilityTable();
std::vector<std::vector<double> >* prob = scoreTable.getProbabilityTable();
std::vector<std::vector<double> >* counts = scoreTable.getCountsTable();
idx++;
for (size_t iter = idx; iter< txt.size();iter++){
//If it's the first line check for a '#' indicating that the column header is present
if (iter==idx && txt[idx][0]=='@'){
continue;
}
line.splitString(txt[iter],"\t ");
//Check for Row header
if (line[0][0]=='@'){
line.pop_ith(0);
}
//line.splitString(txt[iter],"\t ");
std::vector<double> temp = line.toVecDouble();
if (temp.size() != expectedColumns){
std::cerr << "The following line couldn't be parsed into the required number of columns. Expected Columns: " << expectedColumns << "\n The line appears as: " << txt[iter] << std::endl;
return false;
}
else{
if (valtyp == PROBABILITY){
prob->push_back(temp);
logVector(temp);
log_prob->push_back(temp);
}
else if (valtyp == LOG_PROB){
log_prob->push_back(temp);
expVector(temp);
prob->push_back(temp);
}
else if (valtyp == COUNTS){
counts->push_back(temp);
probVector(temp);
prob->push_back(temp);
logVector(temp);
log_prob->push_back(temp);
}
}
}
if (log_prob->size() != expectedRows){
std::cerr << " The Lexical table doesn't contain enough rows. Expected Rows: " << expectedRows << " \n Please check the Lexical Table and formatting\n";
return false;
}
}
return true;
}
bool StochHMM::transition::_parseStandard ( std::string &  txt,
stringList names,
valueType  valtyp 
)
private

Definition at line 149 of file transitions.cpp.

References StochHMM::stringList::contains(), StochHMM::LOG_PROB, log_trans, StochHMM::PROBABILITY, StochHMM::stringList::size(), StochHMM::stringList::splitString(), stateName, and StochHMM::stringToDouble().

Referenced by parse().

{
//Process Transition
stringList line;
line.splitString(txt,"\t:");
if (line.size()<2){
std::cerr << "Line should contain 2 values (STATE VALUE). Couldn't parse:\n" << txt << std::endl;
return false;
}
stateName= line[0];
if (!names.contains(stateName) && stateName!="END"){
std::cerr << "Tried to create a transition in the model to state named : " << stateName << " but there is no state with that name. Please check the formatting. \n";
return false;
}
if(valtyp==PROBABILITY){
double tempValue;
if (!stringToDouble(line[1], tempValue)){
std::cerr << "Probability value not numeric: " << line[1] << std::endl;
return false;
}
log_trans = log(tempValue);
}
else if (valtyp == LOG_PROB){
double tempValue;
if (!stringToDouble(line[1], tempValue)){
std::cerr << "Log Probability value not numeric: " << line[1] << std::endl;
return false;
}
log_trans = tempValue;
}
return true;
}
bool StochHMM::transition::_processTags ( std::string &  txt,
tracks trks,
weights wts,
StateFuncs funcs 
)
private

Definition at line 121 of file transitions.cpp.

References StochHMM::extractTag(), func, StochHMM::transitionFuncParam::getTrackName(), StochHMM::transitionFuncParam::parse(), and StochHMM::stringList::size().

Referenced by parse().

{
stringList lst = extractTag(txt);
if (lst.size() == 0){
return true;
}
func=new(std::nothrow) transitionFuncParam();
if (func==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
if (!func->parse(lst,trks, wts,funcs)){
std::cerr << "Couldn't parse Transition Tag information" << std::endl;
return false;
}
std::string trackName = func->getTrackName();
//Does it contain the name
return true;
}
bool StochHMM::transition::FunctionDefined ( )
inline

Definition at line 158 of file transitions.h.

References func.

Referenced by StochHMM::trellis::getTransition().

{if(func!=NULL){return true;} else {return false;}};
double StochHMM::transition::get_reduced_order ( int  ,
sequences  
)
transitionFuncParam* StochHMM::transition::getExtFunction ( )
inline

Get pointer to externalFuncs

Returns:
externalFuncs* Pointer to external function definition in transition

Definition at line 157 of file transitions.h.

References func.

Referenced by StochHMM::trellis::getTransition().

{return func;};
std::string StochHMM::transition::getLexicalFunctionName ( )
inline

Definition at line 161 of file transitions.h.

References StochHMM::emissionFuncParam::getName(), and lexFunc.

{return lexFunc->getName();}
std::string& StochHMM::transition::getName ( )
inline

Get the name of state that transition is to

Returns:
std::string Name of the state that transition is to

Definition at line 129 of file transitions.h.

References stateName.

Referenced by StochHMM::state::_finalizeTransitions(), and StochHMM::state::_parseTransition().

{return stateName;};
state* StochHMM::transition::getState ( )
inline

Get pointer to stte that transition is to

Returns:
state* Pointer to state that transitioning to

Definition at line 133 of file transitions.h.

References toState.

{return toState;};
tracebackIdentifier StochHMM::transition::getTracebackIdentifier ( )
inline

Get the tracebackIdentifier defined in the transitioin

Returns:
tracebackIdentifier
See also:
tracebackIdentifier

Definition at line 145 of file transitions.h.

References traceback_identifier.

Referenced by StochHMM::trellis::get_explicit_duration_length().

std::string& StochHMM::transition::getTracebackString ( )
inline

Get the string (GFF/Label/State Name) Traceback is to

Returns:
std::string name that traceback is to

Definition at line 149 of file transitions.h.

References traceback_string.

Referenced by StochHMM::trellis::get_explicit_duration_length().

{return traceback_string;};
double StochHMM::transition::getTransition ( size_t  pos,
sequences seqs 
)

Calculate the transition probability for a transition at a particular position in the sequence

Parameters:
posPosition in sequences that we are determining the transition
seqsPointer to sequences, used in determining transition
Returns:
double Score of the transition

Definition at line 601 of file transitions.cpp.

References distribution, StochHMM::DURATION, StochHMM::emissionFuncParam::evaluate(), extendedValue, StochHMM::lexicalTable::getValue(), lexFunc, StochHMM::LEXICAL, log_trans, scoreTable, StochHMM::STANDARD, and transition_type.

Referenced by StochHMM::trellis::getTransition().

{
return log_trans;
}
if (pos >= distribution->size()){ // Check that size corresponds to zero index or one index.....
return extendedValue;
}
else{
return (*distribution)[pos-1];
}
}
double value;
if (function){
value = lexFunc->evaluate(*seqs, pos);
}
else{
value = scoreTable.getValue(*seqs,pos);
}
return value;
}
else{
return -INFINITY;
}
}
double StochHMM::transition::getTransition ( )
transType StochHMM::transition::getTransitionType ( )
inline

Get the transition type

Returns:
transType
See also:
transType

Definition at line 140 of file transitions.h.

References transition_type.

Referenced by StochHMM::trellis::getTransition().

{return transition_type;};
bool StochHMM::transition::isComplex ( )
inline

Definition at line 170 of file transitions.h.

References isSimple().

{
return !isSimple();
}
bool StochHMM::transition::isSimple ( )
inline

Definition at line 163 of file transitions.h.

References StochHMM::DURATION, func, and transition_type.

Referenced by isComplex().

{
if (transition_type != DURATION && func == NULL && !function){
return true;
}
return false;
}
bool StochHMM::transition::LexFunctionDefined ( )
inline

Definition at line 160 of file transitions.h.

{return function;}
bool StochHMM::transition::parse ( std::string &  txt,
stringList names,
valueType  valtyp,
tracks trks,
weights wts,
StateFuncs funcs 
)

Parse the transition User and Standard Transition from String to create a transition for the state

Parameters:
txtString representation of the transition
namesStringList of all the states
valtypValue type used (log, p(x)...)
trksTracks of the model
wtsWeight defined in the model
funcsState Functions created by the user

Definition at line 67 of file transitions.cpp.

References _parseStandard(), _processTags(), StochHMM::STANDARD, and transition_type.

Referenced by StochHMM::state::_parseTransition().

{
if (!_processTags(txt,trks, wts, funcs)){
std::cerr << "Couldn't properly process tag from: "<< txt << std::endl;
return false;
}
if (!_parseStandard(txt,names, valtyp)){
std::cerr << "Couldn't parse the Standard Transition" << std::endl;
}
}
return true;
}
bool StochHMM::transition::parse ( stringList txt,
stringList names,
valueType  valtyp,
tracks trks,
weights wts,
StateFuncs funcs 
)

Parse the Transition Lexical and User from String List

Parameters:
txtString representation of the transition used to create the transition from model file
namesStringList of all the states
valtypValue type used (log, p(x)...)
trksTracks of the model
wtsWeight defined in the model
funcsState Functions created by the user

Definition at line 90 of file transitions.cpp.

References _parseDuration(), _parseLexical(), _processTags(), StochHMM::DURATION, StochHMM::LEXICAL, and transition_type.

{
//txt.print();
if (!_processTags(txt[1],trks, wts, funcs)){
std::cerr << "Couldn't properly process tag from: "<< txt[1] << std::endl;
return false;
}
if (!_parseDuration(txt, names, valtyp)){
std::cerr << "Couldn't parse Duration Transition" <<std::endl;
return false;
}
}
else if (transition_type == LEXICAL){
if (!_parseLexical(txt, names, valtyp, trks, funcs)){
std::cerr << "Couldn't parse Lexical Transition" << std::endl;
return false;
}
}
return true;
}
void StochHMM::transition::print ( )

Print the transition to stdout.

Definition at line 515 of file transitions.cpp.

References stringify().

{
std::cout << stringify() << std::endl;
}
void StochHMM::transition::setDistribution ( std::vector< double > *  dst)
inline

Set the length distribution of the transition Each position in the vector is a length 0=1, 99=100 length Distribution should be a survival function but could be user defined

Parameters:
dststd::vector of double

Definition at line 98 of file transitions.h.

References distribution.

{distribution=dst;}; //Check that distribution is survival function
void StochHMM::transition::setName ( std::string &  txt)
inline

Set the name of the state we are transitioning to

Parameters:
txtName of the next state

Definition at line 72 of file transitions.h.

References stateName.

{stateName=txt;};
void StochHMM::transition::setState ( state st)
inline

Set the pointer to the state we are transitioning to

Parameters:
stPointer to state

Definition at line 76 of file transitions.h.

References toState.

{toState=st;};
void StochHMM::transition::setTB_Identifier ( tracebackIdentifier  tbIdt)
inline

Sets teh Traceback Identifier used when doing a traceback during calculation of transition

Parameters:
tbIdtenum tracebackIdentifier
See also:
enum tracebackIdentifier

Definition at line 87 of file transitions.h.

References traceback_identifier.

void StochHMM::transition::setTB_String ( std::string &  txt)
inline

Set the traceback Label/GFF/StateName to use during traceback

Parameters:
txtString to use for traceback

Definition at line 91 of file transitions.h.

References traceback_string.

void StochHMM::transition::setTransProb ( double  value)
inline

Set the standard transition probability of the transition

Parameters:
valuelog based 2 value of transitioin probabability

Definition at line 103 of file transitions.h.

References log_trans.

{log_trans=value;};
void StochHMM::transition::setTransType ( transType  type)
inline

Set the type of the transition (enum transType)

Parameters:
typeenum Transtype
See also:
enum transType

Definition at line 81 of file transitions.h.

References transition_type.

std::string StochHMM::transition::stringify ( )

Convert the transition to a string representation as shown in the model file

Returns:
std::string Representation of the transition

Definition at line 521 of file transitions.cpp.

References StochHMM::AVERAGE_SCORE, distribution, StochHMM::double_to_string(), StochHMM::DURATION, func, StochHMM::lexicalTable::getAmbDefinedScore(), StochHMM::lexicalTable::getAmbScoringType(), StochHMM::track::getName(), StochHMM::lexicalTable::getOrder(), StochHMM::lexicalTable::getTrack(), StochHMM::emissionFuncParam::getTrackName(), StochHMM::HIGHEST_SCORE, StochHMM::int_to_string(), lexFunc, StochHMM::LEXICAL, log_trans, StochHMM::LOWEST_SCORE, StochHMM::NO_SCORE, scoreTable, StochHMM::STANDARD, StochHMM::STATE_GFF, StochHMM::STATE_LABEL, StochHMM::STATE_NAME, stateName, StochHMM::lexicalTable::stringify(), StochHMM::transitionFuncParam::stringify(), traceback_identifier, traceback_string, StochHMM::lexicalTable::trackSize(), and transition_type.

Referenced by print(), and StochHMM::state::stringify().

{
std::string transString;
transString+="\t" + stateName + ":\t" + double_to_string(log_trans);
if (func!=NULL){
transString+="\t" + func->stringify();
}
}
else if (transition_type == DURATION){
transString+="\t" + stateName + ":\t" ;
transString+= (traceback_identifier==STATE_NAME) ? "TO_STATE:\t" + traceback_string :
(traceback_identifier==STATE_GFF) ? "TO_GFF:\t" + traceback_string : "DIFF_STATE" ;
if (func!=NULL){
transString+="\t" + func->stringify();
}
transString+="\n";
for(size_t i=0;i<distribution->size();i++){
transString+= "\t\t" + int_to_string((int) i+1) + "\t" + double_to_string((*distribution)[i]) + "\n";
}
}
else if (transition_type == LEXICAL){
transString+="\t" + stateName + ":\t";
if (function){
transString+=lexFunc->getTrackName();
if (func!=NULL){
transString+="\t" + func->stringify();
}
}
else{
for(size_t i=0;i<scoreTable.trackSize();i++){
if (i>0){
transString+=",";
}
transString+=scoreTable.getTrack(i)->getName();
}
if (func!=NULL){
transString+="\t" + func->stringify();
}
transString+="\n\t\tORDER:\t";
for(size_t i=0;i<scoreTable.trackSize();i++){
if (i>0){
transString+=",";
}
transString+=int_to_string(scoreTable.getOrder(i));
}
if (ambtemp!=NO_SCORE){
transString+="\tAMBIGUOUS:\t";
transString+=(ambtemp==HIGHEST_SCORE)? "MAX":
(ambtemp==LOWEST_SCORE)? "MIN":
}
transString+="\n";
//Print the probability table
//Output Column Headers
transString+=scoreTable.stringify();
}
}
return transString;
}

Friends And Related Function Documentation

friend class model
friend

Definition at line 61 of file transitions.h.

friend class state
friend

Definition at line 62 of file transitions.h.


Member Data Documentation

std::vector<double>* StochHMM::transition::distribution
private

Definition at line 188 of file transitions.h.

Referenced by _parseDuration(), getTransition(), setDistribution(), and stringify().

double StochHMM::transition::extendedValue
private

Transition Length Distribution.

Definition at line 189 of file transitions.h.

Referenced by _parseDuration(), getTransition(), and transition().

transitionFuncParam* StochHMM::transition::func
private
bool StochHMM::transition::function
private

Definition at line 198 of file transitions.h.

emissionFuncParam* StochHMM::transition::lexFunc
private
double StochHMM::transition::log_trans
private
lexicalTable StochHMM::transition::scoreTable
private

Definition at line 201 of file transitions.h.

Referenced by _parseLexical(), getTransition(), and stringify().

std::string StochHMM::transition::stateName
private
state* StochHMM::transition::toState
private

Definition at line 182 of file transitions.h.

Referenced by getState(), setState(), and transition().

tracebackIdentifier StochHMM::transition::traceback_identifier
private
std::string StochHMM::transition::traceback_string
private

Definition at line 194 of file transitions.h.

Referenced by _parseDuration(), getTracebackString(), setTB_String(), and stringify().

transType StochHMM::transition::transition_type
private

The documentation for this class was generated from the following files: