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
StochHMM::model Class Reference

#include <hmm.h>

List of all members.

Public Member Functions

 model ()
 Create a model.
std::string & getName ()
 Get the Name of the Model.
std::string & getDescription ()
 Get Description of model.
std::string & getDate ()
 Get Date of model.
std::string & getCommand ()
 Get Creation Command of model.
std::string & getAuthor ()
 Get Author of model.
size_t state_size ()
 Get the number of states that are defined in the model.
std::string & getStateName (size_t iter)
std::string & getStateLabel (size_t iter)
std::string & getStateGFF (size_t iter)
stategetState (size_t iter)
stategetState (const std::string &)
stateoperator[] (size_t iter)
 Get state by using iterator value.
std::bitset< STATE_MAX > * getStateXTo (size_t iter)
 Get vector of states that state at index transitions to.
std::bitset< STATE_MAX > * getInitialTo ()
 Get vector of states that the initial state transitions to.
std::bitset< STATE_MAX > * getStateXFrom (size_t iter)
 Get vector of states that transfer to the state at index.
std::bitset< STATE_MAX > * getEndingFrom ()
 Get list of states that transition to the ending state.
stateInfogetStateInfo ()
stategetInitial ()
 Get pointer to the initial state.
stategetEnding ()
 Get pointer to the ending state.
weightgetScalingFactor (std::string &)
double getDistanceToAttrib (double)
 Get Distance from the model attrib values to user defined value.
size_t track_size ()
 Get the number of tracks defined in the model.
trackgetTrack (size_t iter)
trackgetTrack (const std::string &)
size_t getTrackIter (const std::string &txt)
tracksgetTracks ()
bool isBasic ()
void print ()
 Print model by std::cout.
std::string stringify ()
bool import (std::string &, StateFuncs *)
bool import (std::string &)
bool import (std::string &, StateFuncs *, templates *, weights *)
bool importFromString (std::string &)
bool importFromString (std::string &, StateFuncs *)
 Import and parse the model from std::string.
bool importFromString (std::string &, StateFuncs *, templates *, weights *)
 Import and parse the model from std::string.
bool parse (const std::string &, StateFuncs *, templates *, weights *)
bool parse (std::string &, std::string &)
 Parse the model from std::string.
void setName (std::string &txt)
 Set the name of the model.
void setDesc (std::string &txt)
 Set the model desc.
void setDate (std::string &txt)
 Set the model creation date.
void setCommand (std::string &txt)
 Set the model creation command.
void setAuthor (std::string &txt)
 Set the model author.
void setNumericalAttrib (float value)
void setUpperRange (float &value)
 Set the upper range of the attribute.
void setLowerRange (float &value)
 Set the lower range of the attribute.
void addTrack (track *trk)
 Add track to the model.
void addState (state *)
void setInit (state *st)
void setEnd (state *st)
 Set teh ending state pointer.
void finalize ()
bool checkTopology ()
std::vector< bool > * get_explicit ()
bool hasComplexEmission ()

Private Member Functions

bool _parseHeader (std::string &)
 States that have functions associated with emissions.
bool _parseTracks (std::string &)
 Function to parse header of the model from text file.
bool _parseAmbiguous (std::string &)
 Parse Tracks definitions from text file.
bool _parseScaling (std::string &)
 Parse Ambiguous definitions from text file.
bool _parseTemplates (std::string &)
 Parse Scaling definitions from text file.
bool _parseStates (std::string &, StateFuncs *)
 Parse Templated States definitions from text file.
bool _splitStates (std::string &, stringList &)
 Parse state from text file.
bool _getOrderedStateNames (stringList &, stringList &)
 Split the state definitions into individual states from text file.
bool _processTemplateState (std::string &, stringList &)
 Gets list of states names from model.
std::string _stringifyHeader ()
 Adds templated states to using template.
std::string _stringifyTracks ()
 Converts Header information from model to string representation found in text file.
std::string _stringifyAmbig ()
 Converts Tracks information from model to string representation found in text file.
std::string _stringifyScaling ()
 Converts Ambiguous Character information from model to text string.
std::string _stringifyStates ()
 Converts Scaling definitions from model to text string.
void _addStateToFromTransition (state *)
 Converts States definitions from model to text string.
void checkBasicModel ()
 in banding the trellis decoding functions
void checkExplicitDurationStates ()
 Checks to see if the model has basic transitions and emissions(no addtl functions)
void _checkTopology (state *st, std::vector< uint16_t > &visited)
 Checks to see which states are explicit duration states.

Private Attributes

bool finalized
bool basicModel
std::string name
std::string desc
 Model Name.
std::string date
 Model Description.
std::string command
 Model Creation Date.
std::string author
 Model Creation Command.
float range [2]
 Model Author.
bool attribTwo
 Model Attrib Values.
tracks trcks
 Two attrib Values.
std::vector< state * > states
 Tracks defined by model (Contains alphabet and ambiguous character definitions.
std::map< std::string, state * > stateByName
 All the states contained in the model.
stateInfo info
stateinitial
stateending
 Initial state q0.
weightsscaling
 Ending state.
templatestemplatedStates
 Weights or scaling fractors associated with the model.
std::vector< bool > * explicit_duration_states
 Templated states.
std::vector< bool > * complex_transition_states
 States that are explicit duration states.
std::vector< bool > * complex_emission_states
 States that have functions associated with transitions.

Detailed Description

Hidden Markov Model Class model class combines the States, and model information together in a single unit. This includes the states(emissions, transitions), initial and ending states, track information(alphabet and ambiguous character definitions).

Provides functions to import the model from a text file

Model is used by trellis class to evaluates sequences.

Definition at line 69 of file hmm.h.


Constructor & Destructor Documentation

StochHMM::model::model ( )

Create a model.

Definition at line 156 of file hmm.cpp.

References attribTwo, basicModel, complex_emission_states, complex_transition_states, ending, explicit_duration_states, finalized, initial, range, scaling, and templatedStates.

Referenced by stringify().

{
ending=new(std::nothrow) state();
if (ending==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
finalized=false;
basicModel=true;
attribTwo=false;
initial = NULL;
scaling = NULL;
range[0]=-INFINITY;
range[1]=-INFINITY;
return;
}

Member Function Documentation

void StochHMM::model::_addStateToFromTransition ( state st)
private

Converts States definitions from model to text string.

Definition at line 1021 of file hmm.cpp.

References StochHMM::state::addFromState(), StochHMM::state::addToState(), StochHMM::state::endi, ending, getName(), getState(), StochHMM::state::getTransitions(), and initial.

Referenced by finalize().

{
std::vector<transition*>* trans;
//Process Initial State
trans = st->getTransitions();
for(size_t i=0;i<trans->size();i++){
state* temp;
temp=this->getState((*trans)[i]->getName());
if (temp){
st->addToState(temp); //Also add the ptr to state vector::to
(*trans)[i]->setState(temp);
if (st!=initial){
temp->addFromState(st);
}
}
}
if (st->endi){
}
}
void StochHMM::model::_checkTopology ( state st,
std::vector< uint16_t > &  visited 
)
private

Checks to see which states are explicit duration states.

Definition at line 1283 of file hmm.cpp.

References StochHMM::state::transi.

Referenced by checkTopology().

{
//Follow transitions to see if every state is visited
for(size_t i = 0 ; i < st->transi->size() ; i++){
if (st->transi->at(i) != NULL){
visited.push_back(st->transi->at(i)->getState()->getIterator());
}
}
return;
}
bool StochHMM::model::_getOrderedStateNames ( stringList states,
stringList names 
)
private

Split the state definitions into individual states from text file.

Definition at line 850 of file hmm.cpp.

References StochHMM::clear_whitespace(), StochHMM::stringList::containsExact(), name, StochHMM::stringList::push_back(), and StochHMM::stringList::size().

Referenced by _parseStates().

{
for(size_t i=0;i<states.size();i++){
size_t nameHeader=states[i].find("NAME:");
size_t nameLineEnding=states[i].find_first_of("\n",nameHeader);
std::string name = states[i].substr(nameHeader+5,nameLineEnding-(nameHeader+5));
clear_whitespace(name, " \t\n");
if (names.containsExact(name)){
std::cerr << "State with name of: " << name << " is defined twice in the model\n";
return false;
}
else{
names.push_back(name);
}
}
return true;
}
bool StochHMM::model::_parseAmbiguous ( std::string &  txt)
private

Parse Tracks definitions from text file.

Definition at line 611 of file hmm.cpp.

References getTrack(), info, StochHMM::track::parseAmbiguous(), StochHMM::stringList::size(), and StochHMM::stringList::splitString().

Referenced by parse().

{
stringList lst;
lst.splitString(txt, "\n");
for(size_t i=0;i<lst.size();i++){
stringList ln;
ln.splitString(lst[i],":");
track* trk = getTrack(ln[0]);
if (trk!=NULL){
if (!trk->parseAmbiguous(ln[1])){
std::cerr << "Couldn't parse the Ambiguous section for " << ln[0] << std::endl;
return false;
}
}
else{
std::string info = "Ambiguous Characters Section\nSupplied track name doesn't correspond to any previously parsed tracks.\nPlease check the formatting and names.\n Unfound Name: " + ln[0];
std::cerr << info << std::endl;
return false;
}
}
//lst.print();
return true;
}
bool StochHMM::model::_parseHeader ( std::string &  txt)
private

States that have functions associated with emissions.

Definition at line 441 of file hmm.cpp.

References attribTwo, author, command, StochHMM::stringList::contains(), date, desc, StochHMM::stringList::fromTxt(), StochHMM::stringList::indexOf(), name, range, StochHMM::stringList::size(), and StochHMM::stringToDouble().

Referenced by parse().

{
stringList lst;
size_t index;
bool first(false);
bool second(false);
//std::string headers[] = {"MODEL_NAME", "MODEL_DESCRIPTION", "MODEL_CREATION_DATE","MODEL_CREATION_COMMAND", "MODEL_AUTHOR","MODEL_NUM_ATTRIB","MODEL_NUM_ATTRIB_UPPER","MODEL_NUM_ATTRIB_LOWER"};
std::string headers[] = {"NAME", "DESCRIPTION", "CREATION_DATE","CREATION_COMMAND", "AUTHOR","NUM_ATTRIB","UPPER","LOWER"};
std::string* head[]={&name, &desc, &date, &command,&author};
lst.fromTxt(txt);
for(int i=0;i<5;i++){
if (lst.contains(headers[i])){
index = lst.indexOf(headers[i]);
if (index+1 < lst.size()){
index++;
(*head[i])=lst[index];
}
else{
std::cerr << "Couldn't parse " << headers[i] << " from \"MODEL INFORMATION\" section." << std::endl;
return false;
}
}
}
//Set Numerical Attributes of Model
if (lst.contains(headers[5])){
index = lst.indexOf(headers[5]);
if (index+1 < lst.size()){
index++;
double tempValue;
if (!stringToDouble(lst[index], tempValue)){
std::cerr << "Numerical attribute couldn't be converted to numerical value: " << lst[index] << std::endl;
return false;
}
range[0]=tempValue;
}
else{
std::cerr << "Couldn't parse " << headers[5] << " value from \"MODEL INFORMATION\" section." << std::endl;
return false;
}
}
else if (lst.contains(headers[6]) && lst.contains(headers[7])){
index = lst.indexOf(headers[6]);
if (index+1<lst.size()){
index++;
double tempValue;
if (!stringToDouble(lst[index], tempValue)){
std::cerr << "Numerical attribute couldn't be converted to numerical value: " << lst[index] << std::endl;
return false;
}
range[1]=tempValue;
second=true;
}
else{
std::cerr << "Couldn't parse " << headers[6] << " value from \"MODEL INFORMATION\" section." << std::endl;
return false;
}
index = lst.indexOf(headers[7]);
if (index+1<lst.size()){
index++;
double tempValue;
if (!stringToDouble(lst[index], tempValue)){
std::cerr << "Numerical attribute couldn't be converted to numerical value: " << lst[index] << std::endl;
return false;
}
range[0]=tempValue;
first=true;
}
else{
std::cerr << "Couldn't parse " << headers[6] << " value from \"MODEL INFORMATION\" section." << std::endl;
return false;
}
if (first && second){
attribTwo=true;
}
else{
std::cerr << "Unable to parse both UPPER and LOWER" << std::endl;
return false;
}
}
else if (lst.contains(headers[6])){
index = lst.indexOf(headers[6]);
if (index+1<lst.size()){
index++;
double tempValue;
if (!stringToDouble(lst[index], tempValue)){
std::cerr << "Numerical attribute couldn't be converted to numerical value: " << lst[index] << std::endl;
return false;
}
range[0]=tempValue;
}
else{
std::cerr << "Couldn't parse " << headers[6] << " value from \"MODEL INFORMATION\" section." << std::endl;
return false;
}
}
else if (lst.contains(headers[7])){
index = lst.indexOf(headers[6]);
if (index+1<lst.size()){
index++;
double tempValue;
if (!stringToDouble(lst[index], tempValue)){
std::cerr << "Numerical attribute couldn't be converted to numerical value: " << lst[index] << std::endl;
return false;
}
range[0]=tempValue;
}
else{
std::cerr << "Couldn't parse " << headers[7] << " value from \"MODEL INFORMATION\" section." << std::endl;
return false;
}
}
return true;
}
bool StochHMM::model::_parseScaling ( std::string &  txt)
private

Parse Ambiguous definitions from text file.

Definition at line 636 of file hmm.cpp.

References StochHMM::weights::addWeight(), StochHMM::weight::parse(), scaling, StochHMM::stringList::size(), and StochHMM::stringList::splitND().

Referenced by parse().

{
if (scaling==NULL){
scaling = new(std::nothrow) weights;
if (scaling==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
}
stringList lst;
lst.splitND(txt, "SCALE:");
for(size_t i=0;i<lst.size();i++){
weight* wt = new(std::nothrow) weight;
if (wt==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
if (!wt->parse(lst[i])){
return false;
}
}
//lst.print();
return true;
}
bool StochHMM::model::_parseStates ( std::string &  txt,
StateFuncs funcs 
)
private

Parse Templated States definitions from text file.

Definition at line 688 of file hmm.cpp.

References _getOrderedStateNames(), _splitStates(), finalize(), StochHMM::state::getName(), initial, StochHMM::state::parse(), scaling, StochHMM::stringList::size(), stateByName, states, and trcks.

Referenced by parse().

{
//1. split sections and identify any template sections
//2. get state names list
//3. create and parse states
stringList stats;
_splitStates(txt,stats);
stringList NameList;
_getOrderedStateNames(stats,NameList);
for(size_t iter=0;iter<stats.size();iter++){
state* st = new(std::nothrow) state;
if (st==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
if (!st->parse(stats[iter],NameList,trcks,scaling, funcs)){
delete st;
return false;
}
if (st->getName() == "INIT"){
initial=st;
stateByName[st->getName()]=st;
}
else{
states.push_back(st);
stateByName[st->getName()]=st;
}
}
//Post process states to create final state with only transitions from filled out.
return true;
}
bool StochHMM::model::_parseTemplates ( std::string &  txt)
private

Parse Scaling definitions from text file.

Definition at line 670 of file hmm.cpp.

References StochHMM::templates::parse(), and templatedStates.

Referenced by parse().

{
if (!txt.empty()){
templatedStates = new(std::nothrow) templates();
if (templatedStates==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
if (!templatedStates->parse(txt)){
std::cerr << "Unable to parse Templates for the model" << std::endl;
return false;
}
}
return true;
}
bool StochHMM::model::_parseTracks ( std::string &  txt)
private

Function to parse header of the model from text file.

Definition at line 581 of file hmm.cpp.

References info, StochHMM::track::parse(), StochHMM::tracks::push_back(), StochHMM::track::setIndex(), StochHMM::stringList::size(), StochHMM::tracks::size(), StochHMM::stringList::splitString(), and trcks.

Referenced by parse().

{
stringList lst;
lst.splitString(txt, "\n");
for(size_t i=0;i<lst.size();i++){
track* trk=new(std::nothrow) track();
if (trk==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
if (trk->parse(lst[i])){
trk->setIndex(trcks.size());
}
else {
std::string info = "Couldn't parse new track line. Please check formatting of : " + lst[i];
std::cerr << info << std::endl;
exit(1);
//errorInfo(sCantParseLine, info.c_str());
//std::cerr << "Couldn't parse new track line. Please check formatting of : " << lst[i] << std::endl;
//exit(1);
}
}
return true;
}
bool StochHMM::model::_processTemplateState ( std::string &  txt,
stringList lst 
)
private

Gets list of states names from model.

Definition at line 778 of file hmm.cpp.

References _splitStates(), StochHMM::clear_whitespace(), StochHMM::stringList::contains(), StochHMM::getKeyValue(), StochHMM::templates::getTemplate(), StochHMM::stringList::indexOf(), StochHMM::stringList::print(), StochHMM::stringList::size(), StochHMM::stringList::splitString(), StochHMM::stringList::stringify(), and templatedStates.

Referenced by _splitStates().

{
if (templatedStates==NULL){
std::cerr << "No template provided for State Definitions. Please provide the template in the model or when calling HMM class" << std::endl;
exit(1);
//errorInfo(sMissingTemplate, "No template provided for State Definitions. Please provide the template in the model or when calling HMM class");
}
std::string templateName;
std::string templateIdentifier;
std::map<std::string,std::string> parameters;
lst.splitString(txt,"\n");
//Process Template Name and Identifier
clear_whitespace(lst[0], " \n");
stringList nmid;
nmid.splitString(lst[0],":\t");
nmid.print();
//Extracting TEMPLATE NAME
if (nmid.contains("TEMPLATE")){
size_t index=nmid.indexOf("TEMPLATE");
index++;
templateName=nmid[index];
}
else{
std::cerr << "State Template definition doesn't contain \"TEMPLATE:\" keyword in first line of State definition of the template. Please check formatting\n";
return false;
}
//Extracting TEMPLATE IDENTIFIER
if (nmid.contains("IDENTIFIER")){
size_t index=nmid.indexOf("IDENTIFIER");
index++;
templateIdentifier=nmid[index];
}
else{
std::cerr << "State Template definition doesn't contain \"IDENTIFIER:\" keyword in first line of State definition of the template. Please check formatting\n";
return false;
}
//Process Template Variables
std::string lastTag;
for(size_t i=1;i<lst.size();i++){
std::string key;
std::string value;
getKeyValue(lst[i],key,value);
if (key.empty()){
parameters[lastTag]+="\n" + value;
}
else{
lastTag=key;
parameters[lastTag]=value;
}
}
//Get filled out model template
std::string filledTemplate = templatedStates->getTemplate(templateName, templateIdentifier, parameters);
//Split filled out template into individual states
stringList sts;
if (!_splitStates(filledTemplate, sts)){ //Split the templated states
std::cerr << "Unable to split templated states\n" << sts.stringify() << std::endl;
return false;
}
return true;
}
bool StochHMM::model::_splitStates ( std::string &  txt,
stringList sts 
)
private

Parse state from text file.

Get templated states using the defined parameters

Definition at line 743 of file hmm.cpp.

References _processTemplateState(), StochHMM::clear_whitespace(), StochHMM::stringList::push_back(), and StochHMM::stringList::size().

Referenced by _parseStates(), and _processTemplateState().

{
size_t start=0;
size_t end=0;
while(start!=std::string::npos){
end=txt.find("STATE:",start+1);
std::string st = txt.substr(start,end-start);
clear_whitespace(st, "#");
if (st.find("TEMPLATE:")!=std::string::npos){
stringList tmpd;
if (!_processTemplateState(st,tmpd)){ //! Get templated states using the defined parameters
std::cerr << "Unable to process template information" << std::endl;
return false;
}
for(size_t i=0;i<tmpd.size();i++){
sts.push_back(tmpd[i]);
}
}
else{
sts.push_back(st);
}
start=txt.find("STATE:",end);
}
return true;
}
std::string StochHMM::model::_stringifyAmbig ( )
private

Converts Tracks information from model to string representation found in text file.

std::string StochHMM::model::_stringifyHeader ( )
private

Adds templated states to using template.

Definition at line 1067 of file hmm.cpp.

References attribTwo, author, command, date, desc, StochHMM::double_to_string(), name, and range.

Referenced by stringify().

{
std::string headerString;
std::string lnSep(50,'=');
headerString+="MODEL INFORMATION\n" + lnSep + "\n";
std::string headers[] = {"MODEL_NAME", "MODEL_DESCRIPTION", "MODEL_CREATION_DATE","MODEL_CREATION_COMMAND", "MODEL_AUTHOR","MODEL_NUM_ATTRIB","MODEL_NUM_ATTRIB_UPPER","MODEL_NUM_ATTRIB_LOWER"};
std::string* head[]={&name, &desc, &date, &command,&author};
for(int i=0;i<5;i++){
if (!(*head[i]).empty()){
headerString+=headers[i] + ":\t" + (*head[i]) + "\n";
}
}
if (attribTwo){
headerString+= headers[7] + ":\t" + double_to_string(range[1]) + "\n";
headerString+= headers[8] + ":\t" + double_to_string(range[0]) + "\n";
}
headerString+="\n";
return headerString;
}
std::string StochHMM::model::_stringifyScaling ( )
private

Converts Ambiguous Character information from model to text string.

Definition at line 1097 of file hmm.cpp.

References scaling, and StochHMM::weights::stringify().

Referenced by stringify().

{
std::string scaleString;
if (scaling){
scaleString+=scaling->stringify();
scaleString+="\n";
}
return scaleString;
}
std::string StochHMM::model::_stringifyStates ( )
private

Converts Scaling definitions from model to text string.

Definition at line 1107 of file hmm.cpp.

References initial, states, and StochHMM::state::stringify().

Referenced by stringify().

{
std::string stateString;
std::string lnSep(50,'#');
stateString+="STATE DEFINITIONS\n" + lnSep + "\n";
if (initial){
stateString+=initial->stringify();
}
stateString+= lnSep + "\n";
for(size_t i=0;i<states.size();i++){
if (states[i]){
stateString+=states[i]->stringify();
stateString+=lnSep + "\n";
}
}
stateString+= "//END";
return stateString;
}
std::string StochHMM::model::_stringifyTracks ( )
private

Converts Header information from model to string representation found in text file.

Definition at line 1090 of file hmm.cpp.

References StochHMM::tracks::stringify(), and trcks.

Referenced by stringify().

{
std::string trackString;
trackString+=trcks.stringify();
trackString+="\n";
return trackString;
}
void StochHMM::model::addState ( state st)

Add state to model

Parameters:
stPointer to state

Definition at line 735 of file hmm.cpp.

References StochHMM::state::getName(), stateByName, and states.

{
states.push_back(st);
stateByName[st->getName()]=st;
return;
};
void StochHMM::model::addTrack ( track trk)
inline

Add track to the model.

Definition at line 331 of file hmm.h.

References StochHMM::tracks::push_back(), and trcks.

{trcks.push_back(trk);};
void StochHMM::model::checkBasicModel ( )
private

in banding the trellis decoding functions

Processes each statea and defines definitions to state and from state for use

Definition at line 975 of file hmm.cpp.

References basicModel, complex_emission_states, complex_transition_states, state_size(), and states.

Referenced by finalize().

{
basicModel = true;
complex_emission_states = new(std::nothrow) std::vector<bool>(state_size(),false);
complex_transition_states = new(std::nothrow) std::vector<bool>(state_size(),false);
for(size_t st = 0 ; st<state_size(); ++st){
(*complex_emission_states)[st] = states[st]->hasComplexEmission();
(*complex_transition_states)[st]= states[st]->hasComplexTransition();
basicModel = false;
}
}
return;
}
void StochHMM::model::checkExplicitDurationStates ( )
private

Checks to see if the model has basic transitions and emissions(no addtl functions)

Definition at line 998 of file hmm.cpp.

References StochHMM::DURATION, explicit_duration_states, state_size(), and states.

Referenced by finalize().

{
explicit_duration_states = new(std::nothrow) std::vector<bool>(state_size(),false);
for(size_t i=0;i<states.size();i++){
std::vector<transition*>* transitions = states[i]->getTransitions();
for(size_t trans=0;trans<transitions->size();trans++){
if ((*transitions)[trans]== NULL){
continue;
}
if ((*transitions)[trans]->getTransitionType() == DURATION){
(*explicit_duration_states)[i]=true;
}
}
}
return;
}
bool StochHMM::model::checkTopology ( )

Check model topology *Iterates through all states to check to see if there are any:

  1. Orphaned States
  2. Dead end States
  3. Uncompleted States

Definition at line 1218 of file hmm.cpp.

References _checkTopology(), getEnding(), initial, and states.

Referenced by finalize().

{
std::vector<bool> states_visited (states.size(),false);
std::vector<uint16_t> visited;
bool ending_defined(false);
while (visited.size()>0){
uint16_t st_iter = visited.back();
visited.pop_back();
if (!states_visited[st_iter]){
std::vector<uint16_t> tmp_visited;
_checkTopology(states[st_iter],tmp_visited);
size_t num_visited = tmp_visited.size();
//Check orphaned
if (num_visited == 0 ){
//No transitions
//std::cerr << "Warning: State: " << states[st_iter]->getName() << " has no transitions defined\n";
}
else if (num_visited == 1 && tmp_visited[0] == st_iter){
//Orphaned
if(states[st_iter]->getEnding() == NULL){
std::cerr << "State: " << states[st_iter]->getName() << " is an orphaned state that has only transition to itself\n";
}
// else{
// std::cerr << "State: " << states[st_iter]->getName() << " may be an orphaned state that only has transitions to itself and END state.\n";
// }
}
for(size_t i=0; i < tmp_visited.size(); i++){
if (!states_visited[tmp_visited[i]]){
visited.push_back(tmp_visited[i]);
}
}
states_visited[st_iter] = true;
}
}
//Check for defined ending
for(size_t i=0; i< states.size() ; i++){
if ( states[i]->getEnding() != NULL){
ending_defined = true;
break;
}
}
if (!ending_defined){
std::cerr << "No END state defined in the model\n";
}
for(size_t i=0; i< states_visited.size(); i++){
if (!states_visited[i]){
std::cerr << "State: " << states[i]->getName() << " doesn't have valid model topology\n\
Please check the model transitions\n";
return false;
}
}
return true;
}
void StochHMM::model::finalize ( )

Finalizes model references from and to states *Each model must be finalized before being used to decode *Check the Functions and Labels of the States

Finalize the model before performing decoding *Sets transitions, checks labels, Determines if model is basic or requires intermittent tracebacks

Definition at line 884 of file hmm.cpp.

References _addStateToFromTransition(), StochHMM::state::_finalizeTransitions(), checkBasicModel(), checkExplicitDurationStates(), checkTopology(), explicit_duration_states, finalized, getName(), info, initial, name, stateByName, StochHMM::stateInfo::stateIterByGff, StochHMM::stateInfo::stateIterByLabel, StochHMM::stateInfo::stateIterByName, and states.

Referenced by _parseStates().

{
if (!finalized){
//Add States To Transitions
std::set<std::string> labels;
std::set<std::string> gff;
std::set<std::string> name;
explicit_duration_states = new(std::nothrow) std::vector<bool>(states.size(),false);
//Create temporary hash of states for layout
for(size_t i=0;i<states.size();i++){
labels.insert(states[i]->getLabel());
gff.insert(states[i]->getGFF());
gff.insert(states[i]->getName());
}
for (size_t i=0; i < states.size() ; ++i){
states[i]->setIter(i);
}
//Add states To and From transition
for(size_t i=0;i<states.size();i++){
states[i]->checkLabels(labels,gff,name);
}
//Now that we've seen all the states in the model
//We need to fix the States transitions vector transi, so that the state
//iterator correlates to the position within the vector
for(size_t i=0;i<states.size();i++){
states[i]->_finalizeTransitions(stateByName);
}
//Check to see if model is basic model
//Meaning that the model doesn't call outside functions or perform
//Tracebacks for explicit duration.
//If explicit duration exist then we'll keep track of which states
//they are in explicit_duration_states
// for(size_t i=0;i<states.size();i++){
// std::vector<transition*>* transitions = states[i]->getTransitions();
// for(size_t trans=0;trans<transitions->size();trans++){
// if ((*transitions)[trans] == NULL){
// continue;
// }
//
// if ((*transitions)[trans]->FunctionDefined()){
// basicModel=false;
// break;
// }
// else if ((*transitions)[trans]->getTransitionType()!=STANDARD || (*transitions)[trans]->getTransitionType()!=LEXICAL){
//
// if ((*transitions)[trans]->getTransitionType() == DURATION){
// (*explicit_duration_states)[i]=true;
// }
//
// basicModel=false;
// break;
// }
// }
// }
//Assign StateInfo
for(size_t i=0; i < states.size();i++){
std::string& st_name = states[i]->getName();
info.stateIterByName[st_name]=i;
info.stateIterByLabel[st_name].push_back(i);
info.stateIterByGff[st_name].push_back(i);
}
finalized=true;
}
return;
}
std::vector<bool>* StochHMM::model::get_explicit ( )
inline
std::string& StochHMM::model::getAuthor ( )
inline

Get Author of model.

Definition at line 94 of file hmm.h.

References author.

{return author;}
std::string& StochHMM::model::getCommand ( )
inline

Get Creation Command of model.

Definition at line 91 of file hmm.h.

References command.

{return command;}
std::string& StochHMM::model::getDate ( )
inline

Get Date of model.

Definition at line 88 of file hmm.h.

References date.

{return date;}
std::string& StochHMM::model::getDescription ( )
inline

Get Description of model.

Definition at line 85 of file hmm.h.

References desc.

{return desc;}
double StochHMM::model::getDistanceToAttrib ( double  val)

Get Distance from the model attrib values to user defined value.

Get distance to value *This is used when from selecting multiple models *User can set an attribute value. Then when evaluating *an attribute of sequence they can see which model is closest *and choose that model

Definition at line 1207 of file hmm.cpp.

References attribTwo, and range.

Referenced by StochHMM::seqTracks::getNext().

{
double mid=range[0];
if (attribTwo){
mid+=(range[1]-range[0])/2;
}
return abs(mid-val);
}
state* StochHMM::model::getEnding ( )
inline

Get pointer to the ending state.

Definition at line 189 of file hmm.h.

References ending.

Referenced by checkTopology().

{return ending;}
std::bitset<STATE_MAX>* StochHMM::model::getEndingFrom ( )
inline

Get list of states that transition to the ending state.

Definition at line 179 of file hmm.h.

References ending, and StochHMM::state::from.

Referenced by StochHMM::trellis::simple_backward(), and StochHMM::trellis::simple_posterior().

{return &(ending->from);}
state* StochHMM::model::getInitial ( )
inline
std::bitset<STATE_MAX>* StochHMM::model::getInitialTo ( )
inline
std::string& StochHMM::model::getName ( )
inline

Get the Name of the Model.

Definition at line 82 of file hmm.h.

References name.

Referenced by _addStateToFromTransition(), finalize(), StochHMM::traceback_path::gff(), print_limited_posterior(), and print_posterior().

{return name;} // Get name of model
weight * StochHMM::model::getScalingFactor ( std::string &  name)

Get Scaling factor defined in model by name

Parameters:
std::stringName of Scaling or Weight defined in model
Returns:
ptr to weight

Create graphvis file for the state of the model

Parameters:
filepathcomplete path to use for graphviz file
q0TRUE will draw the initial state Get pointer to weight by name of weight
nameName of weight
Returns:
pointer to weight

Definition at line 1196 of file hmm.cpp.

References name, and scaling.

{
if (scaling==NULL){
return NULL;
}
else{
return (*scaling)[name];
}
}
state* StochHMM::model::getState ( size_t  iter)
inline
state * StochHMM::model::getState ( const std::string &  txt)

Get pointer to state by the name

Parameters:
conststd::string Name of state
Returns:
ptr_state Pointer to state

Get pointer to state by state name

Parameters:
txtString name of state
Returns:
pointer to state if it exists;
NULL if state doesn't exist in model

Definition at line 872 of file hmm.cpp.

References stateByName.

{
if (stateByName.count(txt)){
return stateByName[txt];
}
else {
return NULL;
}
}
std::string& StochHMM::model::getStateGFF ( size_t  iter)
inline

Get the GFF Tag of the state at index

Parameters:
iterIndex of state

Definition at line 127 of file hmm.h.

References states.

Referenced by print_limited_posterior().

{
if (iter>= states.size()){
std::cerr << "Attempting to access State GFF which is out of range\n";
exit(2);
}
return states[iter]->getGFF();
}
stateInfo* StochHMM::model::getStateInfo ( )
inline

Definition at line 181 of file hmm.h.

References info.

Referenced by StochHMM::seqTracks::loadSeqs().

{return &info;}
std::string& StochHMM::model::getStateLabel ( size_t  iter)
inline

Get the Label of the state at index

Parameters:
iterIndex of state

Definition at line 117 of file hmm.h.

References states.

{
if (iter>= states.size()){
std::cerr << "Attempting to access State Label which is out of range\n";
exit(2);
}
return states[iter]->getLabel();
}
std::string& StochHMM::model::getStateName ( size_t  iter)
inline

Get the name of the state at index

Parameters:
iterIndex of state

Definition at line 107 of file hmm.h.

References states.

Referenced by StochHMM::multiTraceback::print_hits(), print_posterior(), and StochHMM::trellis::update_transitions().

{
if (iter>= states.size()){
std::cerr << "Attempting to access State Name which is out of range\n";
exit(2);
}
return states[iter]->getName();
};
std::bitset<STATE_MAX>* StochHMM::model::getStateXFrom ( size_t  iter)
inline

Get vector of states that transfer to the state at index.

Definition at line 171 of file hmm.h.

References states.

{
if (iter>= states.size()){
return NULL;
}
return &(states[iter]->from);
}
std::bitset<STATE_MAX>* StochHMM::model::getStateXTo ( size_t  iter)
inline

Get vector of states that state at index transitions to.

Definition at line 160 of file hmm.h.

References states.

{
if (iter>= states.size()){
return NULL;
}
return &(states[iter]->to);
}
track* StochHMM::model::getTrack ( size_t  iter)
inline

Get pointer to track at the index

Parameters:
iterIndex of track to get
Returns:
if iter is within range then return pointer to track
else return NULL

Definition at line 217 of file hmm.h.

References StochHMM::tracks::size(), and trcks.

Referenced by StochHMM::seqTracks::_initImportTrackInfo(), and _parseAmbiguous().

{
if (iter >= trcks.size()){
return NULL;
}
return trcks[iter];
}
track * StochHMM::model::getTrack ( const std::string &  name)

Get pointer to track based on Name associated with the track

Parameters:
conststd::string Name associated with Track
Returns:
if name is found returns pointer to name.
if name is not found return NULL

Get pointer to track by track name

Parameters:
nametrack name
Returns:
pointer to track
NULL if track with given name doesn't exist in the model

Definition at line 1048 of file hmm.cpp.

References StochHMM::tracks::getTrack(), and trcks.

{
return trcks.getTrack(name);
}
size_t StochHMM::model::getTrackIter ( const std::string &  txt)
inline

Get index iterator of the track with a particular name

Parameters:
txtName of track to get index for
Returns:
size_t index of track with name

Definition at line 233 of file hmm.h.

References StochHMM::tracks::indexOf(), and trcks.

Referenced by StochHMM::seqTracks::_initImportTrackInfo().

{return trcks.indexOf(txt);}
tracks* StochHMM::model::getTracks ( )
inline

Get pointer to the tracks of the model

Returns:
pointer to tracks defined in model

Definition at line 237 of file hmm.h.

References trcks.

Referenced by StochHMM::seqTracks::_initImportTrackInfo().

{return &trcks;}
bool StochHMM::model::hasComplexEmission ( )
inline

Definition at line 361 of file hmm.h.

References complex_emission_states.

{
return true;
}
return false;
}
bool StochHMM::model::import ( std::string &  modelFile,
StateFuncs funcs 
)

Write a simple GraphViz graph Formatting is very basic and function may disappear. Import and Parse the model from text file

Parameters:
std::stringFilename
StateFuncsptr Pointer to StateFuncts, if no State Functions are (Univariate, Multivariate, Emission Functs, Transition Functions) described then you can use NULL
Returns:
true if import was successful

Import the model file and parse it

Parameters:
modelFileModel filename
funcsPointer to State functions defined by programmer

Definition at line 201 of file hmm.cpp.

References parse(), and StochHMM::slurpFile().

Referenced by import_model().

{
std::string modelString=slurpFile(modelFile);
return parse(modelString,funcs,NULL,NULL);
}
bool StochHMM::model::import ( std::string &  modelFile)

Import and Parse the model from text file

Parameters:
std::stringFilename
Returns:
true if import was successful

Definition at line 212 of file hmm.cpp.

References parse(), and StochHMM::slurpFile().

{
std::string modelString=slurpFile(modelFile);
return parse(modelString,NULL,NULL,NULL);
}
bool StochHMM::model::import ( std::string &  modelFile,
StateFuncs funcs,
templates tmpls,
weights scl 
)

Import and Parse the model from text file

Parameters:
std::stringFilename
StateFuncsptr Pointer to StateFunctions
templatesptr Pointer to Templated State template
weightptr Pointer to weighting factors
Returns:
true if import was successful

Definition at line 207 of file hmm.cpp.

References parse(), and StochHMM::slurpFile().

{
std::string modelString=slurpFile(modelFile);
return parse(modelString, funcs, tmpls, scl);
}
bool StochHMM::model::importFromString ( std::string &  modelString)

Import and parse the model from std::string

See also:
import(std::string&)

Definition at line 228 of file hmm.cpp.

References parse().

{
return parse(modelString,NULL,NULL,NULL);
}
bool StochHMM::model::importFromString ( std::string &  modelString,
StateFuncs funcs 
)

Import and parse the model from std::string.

Definition at line 218 of file hmm.cpp.

References parse().

{
return parse(modelString,funcs,NULL,NULL);
}
bool StochHMM::model::importFromString ( std::string &  modelString,
StateFuncs funcs,
templates tmpls,
weights scl 
)

Import and parse the model from std::string.

Definition at line 223 of file hmm.cpp.

References parse().

{
return parse(modelString, funcs, tmpls, scl);
}
bool StochHMM::model::isBasic ( )
inline

Check to see if model is a basic HMM

Returns:
false if model contains explicit duration transition, or user-defined functions for emission/transitions

Definition at line 241 of file hmm.h.

References basicModel.

Referenced by StochHMM::trellis::fast_complex_viterbi(), StochHMM::trellis::simple_nth_viterbi(), StochHMM::trellis::simple_posterior(), StochHMM::trellis::simple_viterbi(), StochHMM::trellis::sparse_complex_viterbi(), StochHMM::trellis::stochastic_viterbi(), and StochHMM::trellis::viterbi().

{return basicModel;}
state* StochHMM::model::operator[] ( size_t  iter)
inline

Get state by using iterator value.

Definition at line 152 of file hmm.h.

References states.

{
if (iter>= states.size()){
return NULL;
}
return states[iter];
}
bool StochHMM::model::parse ( const std::string &  model,
StateFuncs funcs,
templates tmpls,
weights scl 
)

Parse the model from std::string *This is used by import functions to parse the model

Parses text model file *Splits the model into sections that are then parsed by the individiual classes *parse() functions.

Definition at line 235 of file hmm.cpp.

References _parseAmbiguous(), _parseHeader(), _parseScaling(), _parseStates(), _parseTemplates(), _parseTracks(), scaling, and templatedStates.

Referenced by import(), and importFromString().

{
scaling=scl;
//std::cout << model <<std::endl;
size_t header = model.find("MODEL INFORMATION");
size_t track = model.find("TRACK SYMBOL DEFINITIONS");
size_t ambig = model.find("AMBIGUOUS SYMBOL DEFINITIONS");
size_t templ = model.find("TEMPLATED STATES");
size_t scale = model.find("SCALING FUNCTIONS");
size_t st = model.find("STATE DEFINITIONS");
size_t blank;
size_t nlChar;
//Parse Model Informaton (Optional)
if (header!=std::string::npos){
blank=model.find("\n\n",header); //Get coordinates of splitting Model Information
size_t nlCharEq = model.rfind("####\n",blank);
size_t nlCharNum= model.rfind("====\n",blank);
//Check for optional dividing line
if (nlCharEq!=std::string::npos){
nlChar=nlCharEq+5;
}
else if (nlCharNum!=std::string::npos){
nlChar=nlCharNum+5;
}
else{ //No divider line
nlChar=model.find("\n",header);
nlChar++;
}
std::string head = model.substr(nlChar,blank-nlChar);
if (!_parseHeader(head)){
return false;
}
}
//Parse Tracks (Required)
if (track!=std::string::npos){
blank=model.find("\n\n",track);
size_t nlCharEq = model.rfind("####\n",blank);
size_t nlCharNum= model.rfind("====\n",blank);
//Check for optional dividing line
if (nlCharEq!=std::string::npos){
nlChar=nlCharEq+5;
}
else if (nlCharNum!=std::string::npos){
nlChar=nlCharNum+5;
}
else{ //No divider line
nlChar=model.find("\n",track);
nlChar++;
}
std::string trck (model.substr(nlChar,blank-nlChar));
if (!_parseTracks(trck)){
return false;
}
}
else{
std::cerr << "Required section: TRACK SYMBOL DEFINITIONS missing from the model" << std::endl;
return false;
}
// else{
// errorInfo(sMissingTrackDefinition, "Required section: TRACK SYMBOL DEFINITIONS missing from the model")
// }
//Parse Ambiguous Characters (Optional)
if (ambig!=std::string::npos){
blank=model.find("\n\n",ambig);
size_t nlCharEq = model.rfind("####\n",blank);
size_t nlCharNum= model.rfind("====\n",blank);
//Check for optional dividing line
if (nlCharEq!=std::string::npos){
nlChar=nlCharEq+5;
}
else if (nlCharNum!=std::string::npos){
nlChar=nlCharNum+5;
}
else{ //No divider line
nlChar=model.find("\n",ambig);
nlChar++;
}
std::string amb(model.substr(nlChar,blank-nlChar));
if (!_parseAmbiguous(amb)){
std::cerr << "Model Line:\t" << amb << std::endl;
exit(2);
//return false;
}
//std::cout << ambig << "\t" << amb << std::endl;
}
//Parse Scaling Function (Optional)
if (scale!=std::string::npos){
blank=model.find("\n\n",scale);
size_t nlCharEq = model.rfind("####\n",blank);
size_t nlCharNum= model.rfind("====\n",blank);
//Check for optional dividing line
if (nlCharEq!=std::string::npos){
nlChar=nlCharEq+5;
}
else if (nlCharNum!=std::string::npos){
nlChar=nlCharNum+5;
}
else{ //No divider line
nlChar=model.find("\n",scale);
nlChar++;
}
std::string scaleTxt = model.substr(nlChar,blank-nlChar);
if(!_parseScaling(scaleTxt)){
return false;
}
//std::cout << scale << "\t" << scaleTxt << std::endl;
}
//Parse Templated Tracks (Optional)
if (templ!=std::string::npos){
blank=model.find("\n\n",templ);
size_t nlCharEq = model.rfind("####\n",blank);
size_t nlCharNum= model.rfind("====\n",blank);
//Check for optional dividing line
if (nlCharEq!=std::string::npos){
nlChar=nlCharEq+5;
}
else if (nlCharNum!=std::string::npos){
nlChar=nlCharNum+5;
}
else{ //No divider line
nlChar=model.find("\n",templ);
nlChar++;
}
std::string tempTxt = model.substr(nlChar,blank-nlChar);
if (!_parseTemplates(tempTxt)){
return false;
}
//std::cout << templ << "\t" << tempTxt << std::endl;
}
//Parse State Definitions (Required)
if (st!=std::string::npos){
size_t blankNum = model.find("####\n",st);
size_t blankEq = model.find("====\n",st);
blank=model.find("####\n",st);
if (blankEq!=std::string::npos){
blank=blankEq+5;
}
else if (blankNum!=std::string::npos){
blank=blankNum+5;
}
else{
blank=model.find("\n",st);
blank++;
}
nlChar=model.find("\n//END");
if (nlChar==std::string::npos){
nlChar=model.size()-1;
}
std::string stateTxt= model.substr(blank,nlChar-blank);
if (!_parseStates(stateTxt,funcs)){
return false;
}
}
else{
std::cerr << "Required sections <STATE DEFINITIONS> missing from the model" << std::endl;
return false;
//errorInfo(sMissingStateDefinition, "Required sections <STATE DEFINITIONS> missing from the model")
}
return true;
}
bool StochHMM::model::parse ( std::string &  ,
std::string &   
)

Parse the model from std::string.

void StochHMM::model::print ( )

Print model by std::cout.

Print the string representation to stdout.

Definition at line 1130 of file hmm.cpp.

References stringify().

Referenced by import_model(), and StochHMM::seqJob::printModel().

{
std::cout << stringify() << std::endl;
return;
}
void StochHMM::model::setAuthor ( std::string &  txt)
inline

Set the model author.

Definition at line 318 of file hmm.h.

References author.

{author=txt;};
void StochHMM::model::setCommand ( std::string &  txt)
inline

Set the model creation command.

Definition at line 315 of file hmm.h.

References command.

{command=txt;};
void StochHMM::model::setDate ( std::string &  txt)
inline

Set the model creation date.

Definition at line 312 of file hmm.h.

References date.

{date=txt;};
void StochHMM::model::setDesc ( std::string &  txt)
inline

Set the model desc.

Definition at line 309 of file hmm.h.

References desc.

{desc=txt;};
void StochHMM::model::setEnd ( state st)
inline

Set teh ending state pointer.

Definition at line 340 of file hmm.h.

References ending.

{ending=st;};
void StochHMM::model::setInit ( state st)
inline

Set the initial state pointer

Parameters:
stpointer to initial state

Definition at line 337 of file hmm.h.

References initial.

{initial=st;};
void StochHMM::model::setLowerRange ( float &  value)
inline

Set the lower range of the attribute.

Definition at line 328 of file hmm.h.

References attribTwo, and range.

{range[0]=value;attribTwo=true;};
void StochHMM::model::setName ( std::string &  txt)
inline

Set the name of the model.

Definition at line 306 of file hmm.h.

References name.

{name=txt;};
void StochHMM::model::setNumericalAttrib ( float  value)
inline

Set the attribute of the model If model is going to be chosen from different values, then you can assign value

Definition at line 322 of file hmm.h.

References attribTwo, and range.

{range[0]=value;attribTwo=false;};
void StochHMM::model::setUpperRange ( float &  value)
inline

Set the upper range of the attribute.

Definition at line 325 of file hmm.h.

References attribTwo, and range.

{range[1]=value;attribTwo=true;};
size_t StochHMM::model::state_size ( )
inline
std::string StochHMM::model::stringify ( )

Get text representation of the model

Returns:
std::string of model.

Get string representation of model

Returns:
std::string

Definition at line 1055 of file hmm.cpp.

References _stringifyHeader(), _stringifyScaling(), _stringifyStates(), _stringifyTracks(), and model().

Referenced by print().

{
std::string model;
std::string lnSep(50,'=');
model+="#STOCHHMM MODEL FILE\n\n";
model+=_stringifyHeader();
model+=_stringifyTracks();
model+=_stringifyStates();
return model;
}
size_t StochHMM::model::track_size ( )
inline

Get the number of tracks defined in the model.

Definition at line 211 of file hmm.h.

References StochHMM::tracks::size(), and trcks.

Referenced by StochHMM::seqTracks::_initImportTrackInfo().

{return trcks.size();}

Member Data Documentation

bool StochHMM::model::attribTwo
private

Model Attrib Values.

Definition at line 384 of file hmm.h.

Referenced by _parseHeader(), _stringifyHeader(), getDistanceToAttrib(), model(), setLowerRange(), setNumericalAttrib(), and setUpperRange().

std::string StochHMM::model::author
private

Model Creation Command.

Definition at line 382 of file hmm.h.

Referenced by _parseHeader(), _stringifyHeader(), getAuthor(), and setAuthor().

bool StochHMM::model::basicModel
private

Flag for whether model contains anything other than simple transitions and emissions *If False then the model either contains additional function or emissions

Definition at line 376 of file hmm.h.

Referenced by checkBasicModel(), isBasic(), and model().

std::string StochHMM::model::command
private

Model Creation Date.

Definition at line 381 of file hmm.h.

Referenced by _parseHeader(), _stringifyHeader(), getCommand(), and setCommand().

std::vector<bool>* StochHMM::model::complex_emission_states
private

States that have functions associated with transitions.

Definition at line 405 of file hmm.h.

Referenced by checkBasicModel(), hasComplexEmission(), and model().

std::vector<bool>* StochHMM::model::complex_transition_states
private

States that are explicit duration states.

Definition at line 404 of file hmm.h.

Referenced by checkBasicModel(), and model().

std::string StochHMM::model::date
private

Model Description.

Definition at line 380 of file hmm.h.

Referenced by _parseHeader(), _stringifyHeader(), getDate(), and setDate().

std::string StochHMM::model::desc
private

Model Name.

Definition at line 379 of file hmm.h.

Referenced by _parseHeader(), _stringifyHeader(), getDescription(), and setDesc().

state* StochHMM::model::ending
private

Initial state q0.

Definition at line 395 of file hmm.h.

Referenced by _addStateToFromTransition(), getEnding(), getEndingFrom(), model(), and setEnd().

std::vector<bool>* StochHMM::model::explicit_duration_states
private

Templated states.

Definition at line 402 of file hmm.h.

Referenced by checkExplicitDurationStates(), finalize(), get_explicit(), and model().

bool StochHMM::model::finalized
private

Flag set to tell whether the transitions bitsets have been set foreach *state. Model is also checked for correct order of states

Definition at line 371 of file hmm.h.

Referenced by finalize(), and model().

stateInfo StochHMM::model::info
private

Definition at line 391 of file hmm.h.

Referenced by _parseAmbiguous(), _parseTracks(), finalize(), and getStateInfo().

state* StochHMM::model::initial
private
std::string StochHMM::model::name
private
float StochHMM::model::range[2]
private
weights* StochHMM::model::scaling
private

Ending state.

Definition at line 397 of file hmm.h.

Referenced by _parseScaling(), _parseStates(), _stringifyScaling(), getScalingFactor(), model(), and parse().

std::map<std::string,state*> StochHMM::model::stateByName
private

All the states contained in the model.

Definition at line 390 of file hmm.h.

Referenced by _parseStates(), addState(), finalize(), and getState().

std::vector<state*> StochHMM::model::states
private

Tracks defined by model (Contains alphabet and ambiguous character definitions.

Definition at line 388 of file hmm.h.

Referenced by _parseStates(), _stringifyStates(), addState(), checkBasicModel(), checkExplicitDurationStates(), checkTopology(), finalize(), getState(), getStateGFF(), getStateLabel(), getStateName(), getStateXFrom(), getStateXTo(), operator[](), and state_size().

templates* StochHMM::model::templatedStates
private

Weights or scaling fractors associated with the model.

Definition at line 400 of file hmm.h.

Referenced by _parseTemplates(), _processTemplateState(), model(), and parse().

tracks StochHMM::model::trcks
private

Two attrib Values.

Definition at line 386 of file hmm.h.

Referenced by _parseStates(), _parseTracks(), _stringifyTracks(), addTrack(), getTrack(), getTrackIter(), getTracks(), and track_size().


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