eXpress “1.5”

MismatchTable Class Reference

The MismatchTable class is used to store and update mismatch and indel (error) parameters using a first-order Markov model based on nucleotide and position in a read. More...

#include <mismatchmodel.h>

List of all members.

Public Member Functions

 MismatchTable (double alpha)
 MismatchTable constructor initializes the model parameters using the specified (non-logged) pseudo-counts.
 MismatchTable (std::string param_file_name)
 A second constructor that loads the distribution from a parameter file.
void activate (bool active=true)
 Mutator to set the _active member variable to allow for log_likelihood calculations.
void get_indices (const FragHit &f, std::vector< char > &left_indices, std::vector< char > &left_seq, std::vector< char > &left_ref, std::vector< char > &right_indices, std::vector< char > &right_seq, std::vector< char > &right_ref) const
 A member function that computes and returns the parameter table indices used to compute and update the likelihood based on the given FragHit.
double log_likelihood (const FragHit &f) const
 A member function that returns the log likelihood of mismatches and indels in the mapping given the current error model parematers.
void update (const FragHit &, double p, double mass)
 A member function that updates the error model parameters based on a mapping and its (logged) mass.
void fix ()
 Freezes the parameters to allow for faster computation after burn out.
void append_output (std::ofstream &outfile) const
 A member function that appends the final model parameters in tab-separated format to the given file.

Detailed Description

The MismatchTable class is used to store and update mismatch and indel (error) parameters using a first-order Markov model based on nucleotide and position in a read.

Also computes likelihoods of mismatches and indels in given fragment mappings. When the target sequences are proabilistic, this class is responsible for updating those parameters. All values are stored and returned in log space.

Author:
Adam Roberts
Date:
2011 Artistic License 2.0

Definition at line 29 of file mismatchmodel.h.


Constructor & Destructor Documentation

MismatchTable::MismatchTable ( double  alpha)

MismatchTable constructor initializes the model parameters using the specified (non-logged) pseudo-counts.

Parameters:
alphaa double containing the non-logged pseudo-counts for parameter initialization.

Definition at line 19 of file mismatchmodel.cpp.

MismatchTable::MismatchTable ( std::string  param_file_name)

A second constructor that loads the distribution from a parameter file.

Note that the values should not be modified after using this constructor.

Parameters:
param_file_namea string specifying the path to the parameter file.

Member Function Documentation

void MismatchTable::activate ( bool  active = true) [inline]

Mutator to set the _active member variable to allow for log_likelihood calculations.

Used to skip calculations before burn-in completes.

Parameters:
activea boolean specifying whether to activate (true) or deactivate (false)

Definition at line 79 of file mismatchmodel.h.

void MismatchTable::append_output ( std::ofstream &  outfile) const

A member function that appends the final model parameters in tab-separated format to the given file.

The output has 1 row for each read position and the parameters are in columns indexed as (ref, prev, obs) in base 4 with A,C,G,T encoded as 0,1,2,3.

Parameters:
filestream to append to.

Definition at line 119 of file biascorrection.cpp.

void MismatchTable::fix ( )

Freezes the parameters to allow for faster computation after burn out.

Cannot be undone.

Definition at line 567 of file mismatchmodel.cpp.

void MismatchTable::get_indices ( const FragHit f,
std::vector< char > &  left_indices,
std::vector< char > &  left_seq,
std::vector< char > &  left_ref,
std::vector< char > &  right_indices,
std::vector< char > &  right_seq,
std::vector< char > &  right_ref 
) const

A member function that computes and returns the parameter table indices used to compute and update the likelihood based on the given FragHit.

Sequence values are compressed to 2 bits per nucleotide.

Parameters:
fthe FragHit to find the table indices for.
left_indicesvector to store the left read's mismatched positions.
left_seqvector to store the left read's mismatched nucleotides (compressed).
left_refvector to store the left read's reference nucleotides (compressed) at mismatch positions.
right_indicesvector to store the right read's mismatched positions.
right_seqvector to store the rightt read's mismatched nucleotides (compressed).
right_refvector to store the right read's reference nucleotides (compressed) at mismatch positions.

Definition at line 159 of file mismatchmodel.cpp.

double MismatchTable::log_likelihood ( const FragHit f) const

A member function that returns the log likelihood of mismatches and indels in the mapping given the current error model parematers.

Returns 0 if _active is false.

Parameters:
fthe fragment mapping to calculate the log likelihood for.
Returns:
The log likelihood of the mapping based on mismatches and indels.

Definition at line 264 of file mismatchmodel.cpp.

void MismatchTable::update ( const FragHit f,
double  p,
double  mass 
)

A member function that updates the error model parameters based on a mapping and its (logged) mass.

Also updates the sequence parameters if they are probabilistic and active_ is true.

Parameters:
fthe fragment mapping.
pthe logged posterior probablity of the alignment.
massthe logged mass of the fragment.

Definition at line 393 of file mismatchmodel.cpp.


The documentation for this class was generated from the following files:
 All Classes Functions Variables