eXpress “1.5”
|
The SeqWeightTable class keeps track of sequence-specific bias parameters. More...
#include <biascorrection.h>
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. |
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.
Definition at line 33 of file biascorrection.h.
SeqWeightTable::SeqWeightTable | ( | size_t | window_size, |
size_t | order, | ||
double | alpha | ||
) |
SeqWeightTable Constructor.
window_size | an unsigned integer specifying the size of the bias window surrounding fragment ends. |
order | a size_t specifying the order to use for the Markov chains modelling the sequence. |
alpha | a 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.
window_size | an unsigned integer specifying the size of the bias window surrounding fragment ends. Must match file. |
order | a size_t specifying the order to use for the Markov chains modelling the sequence. Must match file. |
param_file_name | a string specifying the path to the parameter file. |
identifier | a string specifying the header for these parameters in the file. |
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.
outfile | the file to append to. |
void SeqWeightTable::copy_expected | ( | const SeqWeightTable & | other | ) |
A member function that overwrites the "expected" parameters with those from another SeqWeightTable.
other | another 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.
other | another 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.
seq | the target sequence. |
i | the central point of the bias window, ie the fragment end. |
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.
seq | the target sequence. |
mass | the amount to increment by in the parameter table. |
fl_cdf | the 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.
seq | the target sequence (possibly reverse complemented) to which the fragment end maps. |
i | the index into the sequence at which to center the bias window, ie where the fragment starts/ends. |
mass | the amount to increment by (logged) |
Definition at line 108 of file biascorrection.cpp.