eXpress “1.5”

SeqWeightTable Class Reference

The SeqWeightTable class keeps track of sequence-specific bias parameters. More...

#include <biascorrection.h>

List of all members.

Public Member Functions

 SeqWeightTable (size_t window_size, size_t order, double alpha)
 SeqWeightTable Constructor.
 SeqWeightTable (size_t window_size, size_t order, std::string param_file_name, std::string identifier)
 A second constructor that loads the distribution from a parameter file.
void copy_observed (const SeqWeightTable &other)
 A member function that overwrites the "observed" parameters with those from another SeqWeightTable.
void copy_expected (const SeqWeightTable &other)
 A member function that overwrites the "expected" parameters with those from another SeqWeightTable.
void increment_expected (const Sequence &seq, double mass, const std::vector< double > &fl_cdf)
 A member function that increments the expected counts for a sliding window through the given target sequence by some mass.
void normalize_expected ()
 A member function that normalizes the expected counts and fills in the lower-ordered marginals.
void increment_observed (const Sequence &seq, size_t i, double mass)
 A member function that increments the observed counts for the given fragment sequence by some (logged) mass.
double get_weight (const Sequence &seq, size_t i) const
 A member function that calculates the bias weight (logged) of a window.
void append_output (std::ofstream &outfile) const
 A member function that appends the marginal and conditional probabilities for the foreground and background Markov models to the given file, formatted in tables for easy readability.

Detailed Description

The SeqWeightTable class keeps track of sequence-specific bias parameters.

Allows for the bias associated with a given sequence to be calculated, and for the bias parameters to be updated based on additional observations. All values are stored in log space.

Author:
Adam Roberts
Date:
2011 Artistic License 2.0

Definition at line 33 of file biascorrection.h.


Constructor & Destructor Documentation

SeqWeightTable::SeqWeightTable ( size_t  window_size,
size_t  order,
double  alpha 
)

SeqWeightTable Constructor.

Parameters:
window_sizean unsigned integer specifying the size of the bias window surrounding fragment ends.
ordera size_t specifying the order to use for the Markov chains modelling the sequence.
alphaa double specifying the strength of the uniform prior (logged pseudo-counts for each parameter).

Definition at line 31 of file biascorrection.cpp.

SeqWeightTable::SeqWeightTable ( size_t  window_size,
size_t  order,
std::string  param_file_name,
std::string  identifier 
)

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

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

Parameters:
window_sizean unsigned integer specifying the size of the bias window surrounding fragment ends. Must match file.
ordera size_t specifying the order to use for the Markov chains modelling the sequence. Must match file.
param_file_namea string specifying the path to the parameter file.
identifiera string specifying the header for these parameters in the file.

Member Function Documentation

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

A member function that appends the marginal and conditional probabilities for the foreground and background Markov models to the given file, formatted in tables for easy readability.

Parameters:
outfilethe file to append to.
void SeqWeightTable::copy_expected ( const SeqWeightTable other)

A member function that overwrites the "expected" parameters with those from another SeqWeightTable.

Parameters:
otheranother SeqWeightTable from which to copy the parameters.

Definition at line 95 of file biascorrection.cpp.

void SeqWeightTable::copy_observed ( const SeqWeightTable other)

A member function that overwrites the "observed" parameters with those from another SeqWeightTable.

Parameters:
otheranother SeqWeightTable from which to copy the parameters.

Definition at line 91 of file biascorrection.cpp.

double SeqWeightTable::get_weight ( const Sequence seq,
size_t  i 
) const

A member function that calculates the bias weight (logged) of a window.

This is the ratio of the observed and expected weights given by the two Markov models.

Parameters:
seqthe target sequence.
ithe central point of the bias window, ie the fragment end.
Returns:
The bias weight for the window.

Definition at line 114 of file biascorrection.cpp.

void SeqWeightTable::increment_expected ( const Sequence seq,
double  mass,
const std::vector< double > &  fl_cdf 
)

A member function that increments the expected counts for a sliding window through the given target sequence by some mass.

Parameters:
seqthe target sequence.
massthe amount to increment by in the parameter table.
fl_cdfthe fragment length CDF.

Definition at line 99 of file biascorrection.cpp.

void SeqWeightTable::increment_observed ( const Sequence seq,
size_t  i,
double  mass 
)

A member function that increments the observed counts for the given fragment sequence by some (logged) mass.

Parameters:
seqthe target sequence (possibly reverse complemented) to which the fragment end maps.
ithe index into the sequence at which to center the bias window, ie where the fragment starts/ends.
massthe amount to increment by (logged)

Definition at line 108 of file biascorrection.cpp.


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