eXpress “1.5”

Target Class Reference

The Target class is used to store objects for the targets being mapped to. More...

#include <targets.h>

List of all members.

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 Sequenceseq (bool rev=false) const
 An accessor for the the target's Sequence (const).
Sequenceseq (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.
Bundlebundle () 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

Detailed Description

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.

Author:
Adam Roberts
Date:
2011 Artistic License 2.0

Definition at line 90 of file targets.h.


Constructor & Destructor Documentation

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.

Parameters:
ida unique TargID identifier.
namea string that stores the target name.
seqa string that stores the target sequence.
prob_seqa bool that specifies if the sequence is to be treated probablistically. For RDD detection.
alphaa double that specifies the intial pseudo-counts (non-logged).
libsa pointer to the struct containing pointers to the global parameter tables (bias_table, mismatch_table, fld).
known_bias_bossa pointer to bias parameters provided as input, NULL if none given.
known_flda pointer to a fragment length distribution provided as input, NULL if none given.

Definition at line 26 of file targets.cpp.


Member Function Documentation

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.

Parameters:
hthe FragHit that is being added.
va double for the (logged) approximate variance (uncertainty) on the probability p.
massa 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.

Parameters:
fraga FragHit alignment to return the likelihood of.

Definition at line 129 of file targets.cpp.

void Target::alpha ( double  alpha) [inline]

Mutator for the alpha (prior count) parameter of the target.

Parameters:
hhnon-logged value to set alpha to.

Definition at line 272 of file targets.h.

void Target::bundle ( Bundle b) [inline]

A mutator to set the Bundle this Target is a member of.

Parameters:
ba pointer to the Bundle to set this Target as a member of.

Definition at line 336 of file targets.h.

Bundle* Target::bundle ( ) const [inline]

An accessor for the pointer to the Bundle this Target is a member of.

Returns:
A pointer to the Bundle this target is a member of.

Definition at line 331 of file targets.h.

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.

Parameters:
with_biasa boolean specifying whether or not the average bias should be included in the return value.
Returns:
The cached effective length of the target.

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.

Parameters:
fldan optional pointer to a different LengthDistribution than the global one, for thread-safety.
with_biasa boolean specifying whether or not the average bias should be included in the return value.
Returns:
The estimated effective length of the target calculated as $ \tilde{l} = \bar{bias}\sum_{l=1}^{L(t)} D(l)(L(t) - l + 1) $.

Definition at line 162 of file targets.cpp.

void Target::haplotype ( boost::shared_ptr< HaplotypeHandler hh) [inline]

Mutator for the HaplotypeHandler of the target.

Parameters:
hha shared pointer to the HaplotypeHandler.

Definition at line 265 of file targets.h.

TargID Target::id ( ) const [inline]

An accessor for the target id.

Returns:
The target ID.

Definition at line 238 of file targets.h.

void Target::incr_counts ( bool  uniq,
size_t  incr_amt = 1 
) [inline]

A member function that increases the count of fragments mapped to this target.

Parameters:
uniqa bool specifying whether or not the fragment uniquely maps to this target.
incr_amta size_t to increase the counts by.

Definition at line 354 of file targets.h.

size_t Target::length ( ) const [inline]

An accessor for the length of the target sequence.

Returns:
The target sequence length.

Definition at line 277 of file targets.h.

void Target::lock ( ) const [inline]

A member function that locks the target mutex to provide thread safety.

The lock should be held by any thread that calls a method of the Target.

Definition at line 224 of file targets.h.

double Target::mass ( bool  with_pseudo = true) const

An accessor for the current (logged) probabilistically assigned fragment mass.

Parameters:
with_pseudoa boolean specifying whether pseudo-counts should be included in returned mass.
Returns:
The logged 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.

Returns:
The total (logged) variance on mass.

Definition at line 106 of file targets.cpp.

const std::string& Target::name ( ) const [inline]

An accessor for the target name.

Returns:
string containing target name.

Definition at line 233 of file targets.h.

double Target::rho ( ) const

An accessor for he current estimated relative abundance of the target.

The value is logged and includes pseudo-counts.

Returns:
The current estimated rho.

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.

Parameters:
with_pseudoa bool specifying whether or not pseudo-counts should be included in the calculation.
neighborsa vector of Target pointers for neighbors to include in the binned likelihood.
Returns:
A value proportional to the log likelihood the given fragment originated from this target.

Definition at line 110 of file targets.cpp.

const Sequence& Target::seq ( bool  rev = false) const [inline]

An accessor for the the target's Sequence (const).

Parameters:
reva bool specifying whether to return the reverse complement.
Returns:
Const reference to the target's Sequence object.

Definition at line 244 of file targets.h.

Sequence& Target::seq ( bool  rev) [inline]

An accessor for the the target's Sequence (non-const).

Parameters:
reva bool specifying whether to return the reverse complement.
Returns:
Non-const reference to the target's Sequence object.

Definition at line 255 of file targets.h.

void Target::solvable ( bool  s) [inline]

A mutator that sets the _solvable flag.

Parameters:
aboolean specifying whether or not the target has a unique solution for its abundance estimate.

Definition at line 428 of file targets.h.

bool Target::solvable ( ) const [inline]

An accessor for the _solvable flag.

Returns:
a boolean specifying whether or not the target has a unique solution for its abundance estimate.

Definition at line 422 of file targets.h.

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]

An accessor for the the (logged) total mass of ambiguous fragments mapping to the target.

Returns:
The (logged) total mass of ambiguous fragments mapping to the target.

Definition at line 309 of file targets.h.

size_t Target::tot_counts ( ) const [inline]

An accessor for the current count of fragments mapped to this target either uniquely or ambiguously.

Returns:
The total fragment count.

Definition at line 320 of file targets.h.

size_t Target::uniq_counts ( ) const [inline]

An accessor for the the current count of fragments uniquely mapped to this target.

Returns:
The unique fragment count.

Definition at line 326 of file targets.h.

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.

Parameters:
bias_tablea pointer to a BiasBoss to use as parameters. Bias not updated if NULL.
fldan 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]

An accessor for the (logged) weighted sum of the variance on assignments.

Returns:
The (logged) weighted sum of the variance on the assignments.

Definition at line 302 of file targets.h.


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