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::multiTraceback Class Reference

#include <traceback_path.h>

List of all members.

Public Member Functions

 multiTraceback ()
 Create multiTraceback()
 ~multiTraceback ()
 Destroy multiTraceback.
void begin ()
 Set position in multiTraceback to the beginning.
void end ()
 Set position in multiTraceback to the ending.
void operator++ ()
 Increment the iterator to next position.
void operator-- ()
 Decrement the iterator to previous position.
void operator= (size_t)
void print_path ()
void print_label ()
void print_gff (std::string &)
void print_hits ()
traceback_path path ()
 Get traceback_path at currently set index in multiTraceback.
int counts ()
 Get the number times that traceback_path was recorded in multiple traceback.
traceback_path operator[] (size_t)
void assign (traceback_path &)
void finalize ()
 Sorts the multiTraceback by the number of time a particular tracback path occurred.
void clear ()
size_t size ()
heatTableget_hit_table ()

Private Attributes

size_t vectorIterator
size_t maxSize
std::vector< std::map
< traceback_path, int >
::iterator > 
pathAccess
std::map< traceback_path, int > paths
heatTabletable

Detailed Description

Contains multiple tracebacks. Will store them in sorted unique list (sorted in order of number of occurances);

Definition at line 169 of file traceback_path.h.


Constructor & Destructor Documentation

StochHMM::multiTraceback::multiTraceback ( )

Create multiTraceback()

Definition at line 441 of file traceback_path.cpp.

References maxSize, and vectorIterator.

{
table=NULL;
}
StochHMM::multiTraceback::~multiTraceback ( )

Destroy multiTraceback.

Definition at line 448 of file traceback_path.cpp.

References table.

{
if(table!=NULL){
delete table;
}
}

Member Function Documentation

void StochHMM::multiTraceback::assign ( traceback_path path)

Add traceback_path to multiTraceback

Parameters:
pathTraceback path to add

Definition at line 512 of file traceback_path.cpp.

References path(), and paths.

Referenced by StochHMM::trellis::stochastic_traceback(), and StochHMM::trellis::traceback_stoch_posterior().

{
paths[path]++;
return;
}
void StochHMM::multiTraceback::begin ( )

Set position in multiTraceback to the beginning.

Definition at line 455 of file traceback_path.cpp.

References vectorIterator.

{
return;
}
void StochHMM::multiTraceback::clear ( )
inline

Definition at line 200 of file traceback_path.h.

References paths.

{paths.clear();return;};
int StochHMM::multiTraceback::counts ( )

Get the number times that traceback_path was recorded in multiple traceback.

Definition at line 505 of file traceback_path.cpp.

References pathAccess, and vectorIterator.

{
return (*pathAccess[vectorIterator]).second;
}
void StochHMM::multiTraceback::end ( )

Set position in multiTraceback to the ending.

Definition at line 461 of file traceback_path.cpp.

References paths, and vectorIterator.

{
return;
}
void StochHMM::multiTraceback::finalize ( )

Sorts the multiTraceback by the number of time a particular tracback path occurred.

Definition at line 519 of file traceback_path.cpp.

References maxSize, pathAccess, paths, StochHMM::sortTBVec(), and vectorIterator.

Referenced by print_gff(), print_label(), print_output(), and print_path().

{
maxSize=paths.size();
std::map<traceback_path,int>::iterator pathsIterator;
for(pathsIterator=paths.begin();pathsIterator!=paths.end();pathsIterator++){
pathAccess.push_back(pathsIterator);
}
sort(pathAccess.begin(),pathAccess.end(),sortTBVec);
return;
}
heatTable * StochHMM::multiTraceback::get_hit_table ( )

Generate a hit table from a multiple traceback paths Hit table is 2D table describing how many times a state was called at a particular position in the sequence

Definition at line 534 of file traceback_path.cpp.

References pathAccess, paths, StochHMM::model::state_size(), and table.

Referenced by print_hits().

{
if (table!=NULL){
delete table;
}
//Over the lenght of the sequence
model* hmm = ((*pathAccess[0]).first).getModel();
size_t sequenceSize=((*pathAccess[0]).first).size();
size_t stateSize=hmm->state_size();
std::vector<int> states(stateSize,0);
table = new heatTable(sequenceSize,states);
std::map<traceback_path,int>::iterator it;
for( it =paths.begin(); it!=paths.end();it++){
int count = (*it).second;
for(size_t position=0;position<sequenceSize;position++){
int tbState=(*it).first[position];
(*table)[position][tbState]+=count;
}
}
return table;
}
void StochHMM::multiTraceback::operator++ ( )

Increment the iterator to next position.

Definition at line 467 of file traceback_path.cpp.

References maxSize, and vectorIterator.

{
}
return;
}
void StochHMM::multiTraceback::operator-- ( )

Decrement the iterator to previous position.

Definition at line 475 of file traceback_path.cpp.

References vectorIterator.

{
}
return;
}
void StochHMM::multiTraceback::operator= ( size_t  val)

Set iterator to index val

Parameters:
valIndex value to set

Definition at line 484 of file traceback_path.cpp.

References maxSize, and vectorIterator.

{
if (val<=maxSize){
}
return;
}
traceback_path StochHMM::multiTraceback::operator[] ( size_t  val)

Get traceback_path at index position

Parameters:
valIndex position

Definition at line 494 of file traceback_path.cpp.

References pathAccess.

{
return (*pathAccess[val]).first;
}
traceback_path StochHMM::multiTraceback::path ( )

Get traceback_path at currently set index in multiTraceback.

Definition at line 500 of file traceback_path.cpp.

References pathAccess, and vectorIterator.

Referenced by assign().

{
return (*pathAccess[vectorIterator]).first;
}
void StochHMM::multiTraceback::print_gff ( std::string &  header)

Definition at line 604 of file traceback_path.cpp.

References finalize(), pathAccess, and size().

Referenced by print_output().

{
this->finalize();
for(size_t iter=0; iter<this->size(); iter++){
std::cout << "Traceback occurred:\t " << (*pathAccess[iter]).second << std::endl;
(*pathAccess[iter]).first.print_gff(header);
std::cout << std::endl;
}
return;
}
void StochHMM::multiTraceback::print_hits ( )

Definition at line 561 of file traceback_path.cpp.

References get_hit_table(), StochHMM::model::getStateName(), StochHMM::join(), pathAccess, and StochHMM::model::state_size().

Referenced by print_output().

{
if (table==NULL){
}
std::string header_row = "Position";
model* hmm = ((*pathAccess[0]).first).getModel();
for (size_t state_iter =0; state_iter<hmm->state_size(); state_iter++){
header_row+="\t";
header_row+=hmm->getStateName(state_iter);
}
std::cout << header_row << std::endl;
for(size_t position = 0; position < table->size(); position++){
std::string line = join((*table)[position], '\t');
std::cout << position+1 << "\t" << line << std::endl;
}
return;
}
void StochHMM::multiTraceback::print_label ( )

Definition at line 594 of file traceback_path.cpp.

References finalize(), pathAccess, and size().

Referenced by print_output().

{
this->finalize();
for(size_t iter=0; iter<this->size(); iter++){
std::cout << "Traceback occurred:\t " << (*pathAccess[iter]).second << std::endl;
(*pathAccess[iter]).first.print_label();
std::cout << std::endl;
}
return;
}
void StochHMM::multiTraceback::print_path ( )

Definition at line 584 of file traceback_path.cpp.

References finalize(), pathAccess, and size().

Referenced by print_output().

{
this->finalize();
for(size_t iter=0; iter<this->size(); iter++){
std::cout << "Traceback occurred:\t " << (*pathAccess[iter]).second << std::endl;
(*pathAccess[iter]).first.print_path();
std::cout << std::endl;
}
return;
}
size_t StochHMM::multiTraceback::size ( void  )
inline

Definition at line 201 of file traceback_path.h.

References paths.

Referenced by print_gff(), print_label(), and print_path().

{return paths.size();};

Member Data Documentation

size_t StochHMM::multiTraceback::maxSize
private

Definition at line 207 of file traceback_path.h.

Referenced by finalize(), multiTraceback(), operator++(), and operator=().

std::vector<std::map<traceback_path,int>::iterator> StochHMM::multiTraceback::pathAccess
private
std::map<traceback_path,int> StochHMM::multiTraceback::paths
private

Definition at line 209 of file traceback_path.h.

Referenced by assign(), clear(), end(), finalize(), get_hit_table(), and size().

heatTable* StochHMM::multiTraceback::table
private

Definition at line 210 of file traceback_path.h.

Referenced by get_hit_table(), and ~multiTraceback().

size_t StochHMM::multiTraceback::vectorIterator
private

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