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

#include <externalFuncs.h>

List of all members.

Public Member Functions

 emissionFuncParam (std::string &, StateFuncs *, track *)
 emissionFuncParam ()
bool parse (stringList &, tracks &, weights *, StateFuncs *)
 Parse the stringList from model import.
void setEmissionFunc (std::string &, emissionFunc *, weight *)
std::string & getTrackName ()
std::string & getName ()
trackgetTrack ()
double evaluate (const std::string *, size_t)
double evaluate (sequences &, size_t)
double evaluate (sequence &, size_t)
void print ()
 Print the externalFuncts to stdout.
std::string stringify ()
 prints the string representation of the externFuncs to stdout

Private Attributes

emissionFuncemissionFunction
 Return string representation of the externFuncs definition in the model.
std::string trackName
size_t trackNumber
 What track to pass to the function.
trackemissionFuncTrack
std::string emissionFuncName
 Pointer to track function uses.
weightemissionFuncScaling
 < Name of the external function as used in the model

Detailed Description

Definition at line 135 of file externalFuncs.h.


Constructor & Destructor Documentation

StochHMM::emissionFuncParam::emissionFuncParam ( std::string &  functionName,
StateFuncs funcs,
track trk 
)

Definition at line 231 of file externalFuncs.cpp.

References emissionFuncName, emissionFunction, emissionFuncTrack, StochHMM::StateFuncs::getEmissionFunction(), StochHMM::track::getIndex(), StochHMM::track::getName(), trackName, and trackNumber.

{
emissionFunction=funcs->getEmissionFunction(functionName);
trackName=trk->getName();
trackNumber=trk->getIndex();
emissionFuncName = functionName;
return;
}
StochHMM::emissionFuncParam::emissionFuncParam ( )

Create emissionFuncParam from a stringList parsed from model for given track and applying a weight as defined in the model

Parameters:
lststringList from parsing the line in the function
trckstracks defined in the model
wtspointer to weights as defined in the model
funcspointer to the state functions defined by user and referenced in the model

Definition at line 250 of file externalFuncs.cpp.

References emissionFunction.

{
//parse(lst,trcks, wts,funcs);
}

Member Function Documentation

double StochHMM::emissionFuncParam::evaluate ( const std::string *  fullSequence,
size_t  pos 
)

Definition at line 353 of file externalFuncs.cpp.

References emissionFuncScaling, and StochHMM::weight::getWeightedScore().

Referenced by StochHMM::emm::get_emission(), and StochHMM::transition::getTransition().

{
double val = (*emissionFunction)(fullSequence, pos);
if (emissionFuncScaling!=NULL){
}
return val;
}
double StochHMM::emissionFuncParam::evaluate ( sequences seqs,
size_t  pos 
)

Definition at line 363 of file externalFuncs.cpp.

References emissionFuncScaling, StochHMM::sequences::getUndigitized(), StochHMM::weight::getWeightedScore(), and trackNumber.

{
double val = (*emissionFunction)(seqs.getUndigitized(trackNumber),pos);
if (emissionFuncScaling!=NULL){
}
return val;
}
double StochHMM::emissionFuncParam::evaluate ( sequence seq,
size_t  pos 
)

Definition at line 373 of file externalFuncs.cpp.

References emissionFuncScaling, StochHMM::sequence::getUndigitized(), and StochHMM::weight::getWeightedScore().

{
double val = (*emissionFunction)(seq.getUndigitized(),pos);
if (emissionFuncScaling!=NULL){
}
return val;
}
std::string& StochHMM::emissionFuncParam::getName ( )
inline
track* StochHMM::emissionFuncParam::getTrack ( )
inline

Definition at line 157 of file externalFuncs.h.

References emissionFuncTrack.

Referenced by StochHMM::emm::stringify().

std::string& StochHMM::emissionFuncParam::getTrackName ( )
inline

Get track name to pass to the function (as defined in the model)

Returns:
std::string Track Name as defined in the model to be passed to the function

Definition at line 153 of file externalFuncs.h.

References trackName.

Referenced by StochHMM::emm::_processTags(), and StochHMM::transition::stringify().

{return trackName;};
bool StochHMM::emissionFuncParam::parse ( stringList lst,
tracks trcks,
weights wts,
StateFuncs funcs 
)

Parse the stringList from model import.

Definition at line 257 of file externalFuncs.cpp.

References StochHMM::stringList::contains(), StochHMM::weights::count(), emissionFuncName, emissionFuncScaling, emissionFunction, emissionFuncTrack, StochHMM::StateFuncs::getEmissionFunction(), StochHMM::track::getIndex(), StochHMM::tracks::getTrack(), StochHMM::stringList::indexOf(), StochHMM::isNumeric(), StochHMM::weight::setAbsolute(), StochHMM::stringToDouble(), trackName, and trackNumber.

Referenced by StochHMM::emm::_processTags().

{
size_t idx;
//FUNCTION NAME (REQUIRED)
if (lst.contains("FUNCTION")){
idx=lst.indexOf("FUNCTION");
idx++;
emissionFuncName = lst[idx];
if (funcs!=NULL){
emissionFunction = funcs->getEmissionFunction(emissionFuncName);
}
}
else{
std::cerr << "Tag was parsed but contains no FUNCTION: . Please check the formatting of the tags\n" << std::endl;
return false;
//errorInfo(sCantParseLine, "Tag was parsed but contains no FUNCTION: . Please check the formatting of the tags\n");
}
//Implement Which track to pass to function
if (lst.contains("TRACK")){
idx=lst.indexOf("TRACK");
idx++;
trackName=lst[idx];
emissionFuncTrack = trcks.getTrack(trackName);
}
else{
std::cerr << "Tag was parsed but contains no TRACK: . Please check the formatting of the tags\n" << std::endl;
return false;
//errorInfo(sCantParseLine, "Tag was parsed but contains no TRACK: . Please check the formatting of the tags\n");
}
if (lst.contains("SCALE")){
idx=lst.indexOf("SCALE");
idx++;
if (isNumeric(lst[idx])){
emissionFuncScaling = new(std::nothrow) weight;
if (emissionFuncScaling==NULL){
std::cerr << "OUT OF MEMORY\nFile" << __FILE__ << "Line:\t"<< __LINE__ << std::endl;
exit(1);
}
double tempValue;
if (!stringToDouble(lst[idx], tempValue)){
std::cerr << "SCALE value could not be converted to numerical value: "<< lst[idx] << std::endl;
return false;
}
}
else{
std::string weightName=lst[idx];
if (wts->count(weightName)){
emissionFuncScaling = (*wts)[weightName];
}
}
}
return true;
}
void StochHMM::emissionFuncParam::print ( )

Print the externalFuncts to stdout.

Definition at line 327 of file externalFuncs.cpp.

References stringify().

{
std::cout<<stringify()<<std::endl;
}
void StochHMM::emissionFuncParam::setEmissionFunc ( std::string &  ,
emissionFunc ,
weight  
)
std::string StochHMM::emissionFuncParam::stringify ( )

prints the string representation of the externFuncs to stdout

Get string representation of the externalFuncs

Returns:
std::string Representation of externalFuncs

Definition at line 333 of file externalFuncs.cpp.

References StochHMM::double_to_string(), emissionFuncName, emissionFuncScaling, StochHMM::weight::getAbsolute(), StochHMM::weight::getName(), StochHMM::weight::isAbsolute(), and trackName.

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

{
std::string exFuncString;
exFuncString+="[ FUNCTION:\t" + emissionFuncName + "\t";
exFuncString+="TRACK:\t" + trackName + "\t";
if (emissionFuncScaling!=NULL){
exFuncString+="SCALE:\t" + double_to_string(emissionFuncScaling->getAbsolute());
}
else{
exFuncString+="SCALE:\t" + emissionFuncScaling->getName();
}
}
exFuncString += " ]";
return exFuncString;
}

Member Data Documentation

std::string StochHMM::emissionFuncParam::emissionFuncName
private

Pointer to track function uses.

Definition at line 172 of file externalFuncs.h.

Referenced by emissionFuncParam(), getName(), parse(), and stringify().

weight* StochHMM::emissionFuncParam::emissionFuncScaling
private

< Name of the external function as used in the model

Definition at line 174 of file externalFuncs.h.

Referenced by evaluate(), parse(), and stringify().

emissionFunc* StochHMM::emissionFuncParam::emissionFunction
private

Return string representation of the externFuncs definition in the model.

Definition at line 167 of file externalFuncs.h.

Referenced by emissionFuncParam(), and parse().

track* StochHMM::emissionFuncParam::emissionFuncTrack
private

Definition at line 170 of file externalFuncs.h.

Referenced by emissionFuncParam(), getTrack(), and parse().

std::string StochHMM::emissionFuncParam::trackName
private

Definition at line 168 of file externalFuncs.h.

Referenced by emissionFuncParam(), getTrackName(), parse(), and stringify().

size_t StochHMM::emissionFuncParam::trackNumber
private

What track to pass to the function.

Definition at line 169 of file externalFuncs.h.

Referenced by emissionFuncParam(), evaluate(), and parse().


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