eXpress “1.5”
|
The Target class is used to store objects for the targets being mapped to. More...
#include <targets.h>
Public Member Functions | |
Target (TargID id, const std::string &name, const std::string &seq, bool prob_seq, double alpha, const Librarian *libs, const BiasBoss *known_bias_boss, const LengthDistribution *known_fld) | |
Target Constructor. | |
void | lock () const |
A member function that locks the target mutex to provide thread safety. | |
void | unlock () const |
A member function that unlocks the target mutex. | |
const std::string & | name () const |
An accessor for the target name. | |
TargID | id () const |
An accessor for the target id. | |
const Sequence & | seq (bool rev=false) const |
An accessor for the the target's Sequence (const). | |
Sequence & | seq (bool rev) |
An accessor for the the target's Sequence (non-const). | |
void | haplotype (boost::shared_ptr< HaplotypeHandler > hh) |
Mutator for the HaplotypeHandler of the target. | |
void | alpha (double alpha) |
Mutator for the alpha (prior count) parameter of the target. | |
size_t | length () const |
An accessor for the length of the target sequence. | |
double | rho () const |
An accessor for he current estimated relative abundance of the target. | |
double | mass (bool with_pseudo=true) const |
An accessor for the current (logged) probabilistically assigned fragment mass. | |
double | mass_var () const |
An accessor for the total (logged) variance on mass. | |
double | var_sum () const |
An accessor for the (logged) weighted sum of the variance on assignments. | |
double | tot_ambig_mass () const |
An accessor for the the (logged) total mass of ambiguous fragments mapping to the target. | |
void | round_reset () |
A member function that prepares the target object for the next round of batch EM. | |
size_t | tot_counts () const |
An accessor for the current count of fragments mapped to this target either uniquely or ambiguously. | |
size_t | uniq_counts () const |
An accessor for the the current count of fragments uniquely mapped to this target. | |
Bundle * | bundle () const |
An accessor for the pointer to the Bundle this Target is a member of. | |
void | bundle (Bundle *b) |
A mutator to set the Bundle this Target is a member of. | |
void | add_hit (const FragHit &h, double v, double mass) |
A member function that increases the expected fragment counts and variance based on the assignment parameters of the given FagHit. | |
void | incr_counts (bool uniq, size_t incr_amt=1) |
A member function that increases the count of fragments mapped to this target. | |
double | sample_likelihood (bool with_pseudo, const std::vector< const Target * > *neighbors=NULL) const |
A member function that returns (a value proportional to) the probability of randomly sampling a fragment from the target. | |
double | align_likelihood (const FragHit &frag) const |
A member function that returns (a value proportional to) the log likelihood the given fragment has the given alignment. | |
double | est_effective_length (const LengthDistribution *fld=NULL, bool with_bias=true) const |
A member function that calculates and returns the estimated effective length of the target (logged) using the average bias. | |
double | cached_effective_length (bool with_bias=true) const |
An accessor for the most recently estimated effective length (logged) as calculated by the bias updater thread. | |
void | update_target_bias_buffer (const BiasBoss *bias_table=NULL, const LengthDistribution *fld=NULL) |
A member function that causes the target bias to be re-calculated by the _bias_table based on curent parameters. | |
void | swap_bias_parameters () |
Swaps in the buffered bias parameters for atomic updating. | |
bool | solvable () const |
An accessor for the _solvable flag. | |
void | solvable (bool s) |
A mutator that sets the _solvable flag. | |
Friends | |
class | HaplotypeHandler |
class | TargetTable |
The Target class is used to store objects for the targets being mapped to.
Besides storing basic information about the object (id, length), it also stores a mass based on the number of fragments mapping to the object as well as parameters for variance. To help with updating these values, it computes the likelihood that a given fragment originated from it. These values are stored and returned in log space.
Target::Target | ( | TargID | id, |
const std::string & | name, | ||
const std::string & | seq, | ||
bool | prob_seq, | ||
double | alpha, | ||
const Librarian * | libs, | ||
const BiasBoss * | known_bias_boss, | ||
const LengthDistribution * | known_fld | ||
) |
Target Constructor.
id | a unique TargID identifier. |
name | a string that stores the target name. |
seq | a string that stores the target sequence. |
prob_seq | a bool that specifies if the sequence is to be treated probablistically. For RDD detection. |
alpha | a double that specifies the intial pseudo-counts (non-logged). |
libs | a pointer to the struct containing pointers to the global parameter tables (bias_table, mismatch_table, fld). |
known_bias_boss | a pointer to bias parameters provided as input, NULL if none given. |
known_fld | a pointer to a fragment length distribution provided as input, NULL if none given. |
Definition at line 26 of file targets.cpp.
void Target::add_hit | ( | const FragHit & | h, |
double | v, | ||
double | mass | ||
) |
A member function that increases the expected fragment counts and variance based on the assignment parameters of the given FagHit.
h | the FragHit that is being added. |
v | a double for the (logged) approximate variance (uncertainty) on the probability p. |
mass | a double specifying the (logged) mass of the fragment being mapped. |
Definition at line 52 of file targets.cpp.
double Target::align_likelihood | ( | const FragHit & | frag | ) | const |
A member function that returns (a value proportional to) the log likelihood the given fragment has the given alignment.
frag | a FragHit alignment to return the likelihood of. |
Definition at line 129 of file targets.cpp.
void Target::alpha | ( | double | alpha | ) | [inline] |
void Target::bundle | ( | Bundle * | b | ) | [inline] |
Bundle* Target::bundle | ( | ) | const [inline] |
double Target::cached_effective_length | ( | bool | with_bias = true | ) | const |
An accessor for the most recently estimated effective length (logged) as calculated by the bias updater thread.
with_bias | a boolean specifying whether or not the average bias should be included in the return value. |
Definition at line 186 of file targets.cpp.
double Target::est_effective_length | ( | const LengthDistribution * | fld = NULL , |
bool | with_bias = true |
||
) | const |
A member function that calculates and returns the estimated effective length of the target (logged) using the average bias.
fld | an optional pointer to a different LengthDistribution than the global one, for thread-safety. |
with_bias | a boolean specifying whether or not the average bias should be included in the return value. |
Definition at line 162 of file targets.cpp.
void Target::haplotype | ( | boost::shared_ptr< HaplotypeHandler > | hh | ) | [inline] |
Mutator for the HaplotypeHandler of the target.
hh | a shared pointer to the HaplotypeHandler. |
TargID Target::id | ( | ) | const [inline] |
void Target::incr_counts | ( | bool | uniq, |
size_t | incr_amt = 1 |
||
) | [inline] |
size_t Target::length | ( | ) | const [inline] |
void Target::lock | ( | ) | const [inline] |
double Target::mass | ( | bool | with_pseudo = true | ) | const |
An accessor for the current (logged) probabilistically assigned fragment mass.
with_pseudo | a boolean specifying whether pseudo-counts should be included in returned mass. |
Definition at line 99 of file targets.cpp.
double Target::mass_var | ( | ) | const |
An accessor for the total (logged) variance on mass.
Includes variance due to the initial pseudo-counts.
Definition at line 106 of file targets.cpp.
const std::string& Target::name | ( | ) | const [inline] |
double Target::rho | ( | ) | const |
An accessor for he current estimated relative abundance of the target.
The value is logged and includes pseudo-counts.
Definition at line 90 of file targets.cpp.
double Target::sample_likelihood | ( | bool | with_pseudo, |
const std::vector< const Target * > * | neighbors = NULL |
||
) | const |
A member function that returns (a value proportional to) the probability of randomly sampling a fragment from the target.
with_pseudo | a bool specifying whether or not pseudo-counts should be included in the calculation. |
neighbors | a vector of Target pointers for neighbors to include in the binned likelihood. |
Definition at line 110 of file targets.cpp.
const Sequence& Target::seq | ( | bool | rev = false | ) | const [inline] |
Sequence& Target::seq | ( | bool | rev | ) | [inline] |
void Target::solvable | ( | bool | s | ) | [inline] |
bool Target::solvable | ( | ) | const [inline] |
void Target::swap_bias_parameters | ( | ) |
Swaps in the buffered bias parameters for atomic updating.
The target mutex should be held by the caller.
Definition at line 203 of file targets.cpp.
double Target::tot_ambig_mass | ( | ) | const [inline] |
size_t Target::tot_counts | ( | ) | const [inline] |
size_t Target::uniq_counts | ( | ) | const [inline] |
void Target::update_target_bias_buffer | ( | const BiasBoss * | bias_table = NULL , |
const LengthDistribution * | fld = NULL |
||
) |
A member function that causes the target bias to be re-calculated by the _bias_table based on curent parameters.
The results are buffered until swap_bias_parameters is called to allow for atomic updating.
bias_table | a pointer to a BiasBoss to use as parameters. Bias not updated if NULL. |
fld | an optional pointer to a different LengthDistribution than the global one, for thread-safety. |
Definition at line 193 of file targets.cpp.
double Target::var_sum | ( | ) | const [inline] |