Egglib 2.1.11
C++ library reference manual
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
LinkageDisequilibrium Class Reference

Analyzes linkage disequilibrium per pair of polymorphic sites. More...

#include <LinkageDisequilibrium.hpp>

Inheritance diagram for LinkageDisequilibrium:
BaseDiversity

Public Member Functions

 LinkageDisequilibrium ()
 Default constructor.
 
virtual ~LinkageDisequilibrium ()
 Destructor.
 
void load (CharMatrix &data, double minimumExploitableData=1., unsigned int ignoreFrequency=0, std::string characterMapping=dnaMapping)
 Analyzes polymorphic sites of an alignment. More...
 
unsigned int numberOfPairs () const
 Number of pairs contained in the instance.
 
int d (unsigned int pair_index)
 Alignment distance between a given pair.
 
double D (unsigned int pair_index)
 D statistic for a given pair.
 
double Dp (unsigned int pair_index)
 D' statistic for a given pair.
 
double r (unsigned int pair_index)
 r statistic for a given pair
 
double r2 (unsigned int pair_index)
 r2 statistic for a given pair
 
unsigned int site1 (unsigned int pair_index)
 position of the first site for a given pair
 
unsigned int site2 (unsigned int pair_index)
 position of the second site for a given pair
 
double correl () const
 correlation coefficient between r2 and distance
 
unsigned int Rmin (CharMatrix &data) const
 Computes the minimal number of recombination events. More...
 
- Public Member Functions inherited from BaseDiversity
 BaseDiversity ()
 Constructor. More...
 
virtual ~BaseDiversity ()
 Destructor. More...
 
virtual void reserve (unsigned int numberOfSites)
 Reserve sufficient memory for a given number of polymorphic sites. More...
 
const SitePolymorphismget_site (unsigned int index) const
 Gets a site.
 
unsigned int get_position (unsigned int index) const
 Gets a site position.
 

Protected Member Functions

void add (CharMatrix &data, unsigned int position1, unsigned int position2)
 
void init ()
 
void clear ()
 
void reset ()
 Clears and re-initializes object.
 
double min (double a, double b)
 
double max (double a, double b)
 
void check (unsigned int pos)
 
- Protected Member Functions inherited from BaseDiversity
void importSites (CharMatrix &data, bool allowMultipleMutations, double minimumExploitableData, unsigned int ignoreFrequency, std::string characterMapping, bool useZeroAsAncestral, bool ignoreOutgroup)
 
void analyzeSite (CharMatrix &data, unsigned int index, double maxMissingData, bool ignoreOutgroup)
 
unsigned int getPopIndex (unsigned int label) const
 

Static Protected Member Functions

static void _correl (unsigned int n, const int *x, const double *y, double &r, double &a)
 

Protected Attributes

int * _d
 
double * _D
 
double * _Dp
 
double * _r
 
double * _r2
 
unsigned int * _site1
 
unsigned int * _site2
 
unsigned int _n
 
- Protected Attributes inherited from BaseDiversity
SitePolymorphism ** v_sites
 
bool * v_orientables
 
unsigned int * v_sitePositions
 
unsigned int v_reserved
 
unsigned int v_ns
 
unsigned int v_S
 
unsigned int v_So
 
unsigned int v_eta
 
double v_nseff
 
unsigned int v_lseff
 
double v_nseffo
 
unsigned int v_lseffo
 
unsigned int v_npop
 
unsigned int * v_popLabel
 
bool p_allowMultipleMutations
 
double p_minimumExploitableData
 
std::string p_characterMapping
 
unsigned int p_pos_sep_mapping
 
bool p_useZeroAsAncestral
 
unsigned int p_ignoreFrequency
 

Additional Inherited Members

- Static Public Attributes inherited from BaseDiversity
static const std::string dnaMapping = "ACGT MRWSYKBDHVN?-"
 Predefined mapping string for DNA data. More...
 
static const std::string rnaMapping = "ACGU MRWSYKBDHVN?-"
 Predefined mapping string for RNA data. More...
 
static const std::string aaMapping = "GALMFWKQESPVICYHRNDT X-"
 Predefined mapping string for amino acid data. More...
 

Detailed Description

Analyzes linkage disequilibrium per pair of polymorphic sites.

The class considers an alignment and detects polymorphic sites using the BaseDiversity functionality (shared with other classes of the module). Only sites with exactly two alleles are considered. Statistics of pairwise linkage disequilibrium can be accessed by pair index (note that out-of-range errors are not checked). Population labels are ignored (but outgroups are excluded from the analysis).

Member Function Documentation

void load ( CharMatrix data,
double  minimumExploitableData = 1.,
unsigned int  ignoreFrequency = 0,
std::string  characterMapping = dnaMapping 
)

Analyzes polymorphic sites of an alignment.

Parameters
dataan alignment object (subclass of CharMatrix). The presence of outgroup or of different populations will be detected based on the populationLabel members of the passed object. The populationLabel 999 will be interpreted as outgroups. If several outgroups are passed, sites were the outgroups are not consistent will be treated as "non- orientable".
minimumExploitableDatasite where the non-missing data (as defined by characterMapping) are at a frequency larger than this value will be removed from the analysis. Use 1. to take only 'complete' sites into account and 0. to use all sites.
ignoreFrequencyremoves sites that are polymorphic because of an allele at absolute frequency smaller than or equal to this value. If ignoreFrequency=1, no sites are removed, if ignoreFrequency=1, singleton sites are ignored. Such sites are completely removed from the analysis (not counted in lseff). Note that if more than one mutation is allowed, the site is removed only if all the alleles but one are smaller than or equal to this value. For example, an alignment column AAAAAAGAAT is ignored with an ignoreFrequency of 1, but AAAAAAGGAT is conserved (including the third allele T which is a singleton).
characterMappinga string giving the list of characters that should be considered as valid data. If a space is present in the string, the characters left of the space will be treated as valid data and the characters right of the space will be treated as missing data, that is tolerated but ignored. All characters not in the string will cause an EggInvalidCharacterError to be raised.
unsigned int Rmin ( CharMatrix data) const

Computes the minimal number of recombination events.

The computation is performed as described in Hudson, RR and NL Kaplan. 1985. Statistical properties of the number of recombination events in the history of a sample of DNA sequences. Genetics 111: 147-164. The returned parameter is the minimal number of recombination events, given by the number of non-overlapping pairs of segregating sites violating the rule of the four gamete. Only sites with two alleles are considered. Note that homoplasy (multiple mutations) mimicks recombination. The result of this function is not stored in this instance, and re-computed at each call.

Parameters
datathe same CharMatrix instance as passed to the load method. The instance must not have been modified.

The documentation for this class was generated from the following files:

Hosted by 
Get EggLib at SourceForge.net. Fast, secure and Free Open Source software downloads