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

Computes Fis, Fst and Fit from diploid data. More...

#include <FStatistics.hpp>

Public Member Functions

 FStatistics ()
 Constructor. More...
 
virtual ~FStatistics ()
 Destructor. More...
 
void reserve (unsigned int numberOfIndividuals)
 Reserve sufficient memory for a given number of individuals. More...
 
void loadIndividual (unsigned int genotype1, unsigned int genotype2, unsigned int populationLabel)
 Loads the data for one individual. More...
 
unsigned int populationLabel (unsigned int populationIndex)
 Label of a population. More...
 
unsigned int alleleValue (unsigned int alleleIndex)
 Value of an allele. More...
 
unsigned int firstAllele (unsigned int individualIndex) const
 First allele of a given individual (no checking)
 
unsigned int secondAllele (unsigned int individualIndex) const
 Second allele of a given individual (no checking)
 
unsigned int individualLabel (unsigned int individualIndex) const
 Population label of a given individual (no checking)
 
unsigned int numberOfAlleles ()
 Number of alleles. More...
 
unsigned int numberOfPopulations ()
 Number of populations. More...
 
unsigned int numberOfGenotypes () const
 Number of loaded genotypes. More...
 
unsigned int alleleFrequencyTotal (unsigned int alleleIndex)
 Absolute total allele frequency. More...
 
unsigned int alleleFrequencyPerPopulation (unsigned int populationIndex, unsigned int alleleIndex)
 Absolute allele frequency in a population. More...
 
unsigned int genotypeFrequencyTotal (unsigned int alleleIndex1, unsigned int alleleIndex2)
 Absolute genotype frequency. More...
 
unsigned int genotypeFrequencyPerPopulation (unsigned int populationIndex, unsigned int alleleIndex1, unsigned int alleleIndex2)
 Absolute genotype frequency in a population. More...
 
unsigned int populationFrequency (unsigned int populationIndex)
 Sample size of a population. More...
 
double F ()
 Weir-Cockerham F-statistic. More...
 
double theta ()
 Weir-Cockerham theta-statistic. More...
 
double f ()
 Weir-Cockerham f-statistic. More...
 
double Vpopulation ()
 Between-population component of variance. More...
 
double Vindividual ()
 Within-population, between-individual component of variance. More...
 
double Vallele ()
 Within-individual component of variance. More...
 

Protected Member Functions

void d_init ()
 
void d_clear ()
 
void s_init ()
 
void s_clear ()
 
void s_compute ()
 
void processPopulations ()
 
void processAlleles ()
 
unsigned int getPopulationIndex (unsigned int) const
 
unsigned int getAlleleIndex (unsigned int) const
 
void w_init ()
 
void w_clear ()
 
void w_compute ()
 

Protected Attributes

bool d_flag
 
unsigned int d_reserved
 
unsigned int d_numberOfGenotypes
 
unsigned int * d_genotypes
 
unsigned int * d_populationLabels
 
bool s_flag
 
unsigned int s_numberOfAlleles
 
unsigned int * s_alleleValueMapping
 
unsigned int s_numberOfPopulations
 
unsigned int * s_populationLabelMapping
 
unsigned int * s_populationFrequencies
 
unsigned int * s_alleleFrequenciesTotal
 
unsigned int ** s_alleleFrequenciesPerPopulation
 
unsigned int ** s_genotypeFrequenciesTotal
 
unsigned int *** s_genotypeFrequenciesPerPopulation
 
bool w_flag
 
double w_F
 
double w_T
 
double w_f
 
double * w_a
 
double * w_b
 
double * w_c
 
double w_nbar
 
double w_nc
 
double * w_pbar
 
double * w_ssquare
 
double * w_hbar
 
double w_sum_a
 
double w_sum_b
 
double w_sum_c
 
double w_sum_abc
 
double w_sum_bc
 

Detailed Description

Computes Fis, Fst and Fit from diploid data.

The class requires loading data. Data are loaded by individual (two genotypes per individual). The analyses are cached: they are performed upon the first call to statistics accessors. The cache is emptied whenever a datum is loaded.

The computations are performed after Weir and Cockerham. The statistics F, theta and f are generalized for multiple alleles. To allow computation of multi-locus statistics, variance components are also available. The three components of the variance are Vpopulation (between-population), Vindividual (within-population, between-individual) and Vallele (within- individual). The formulas to compute the F-statistics are as follows:

Constructor & Destructor Documentation

Constructor.

~FStatistics ( )
virtual

Destructor.

Member Function Documentation

unsigned int alleleFrequencyPerPopulation ( unsigned int  populationIndex,
unsigned int  alleleIndex 
)

Absolute allele frequency in a population.

unsigned int alleleFrequencyTotal ( unsigned int  alleleIndex)

Absolute total allele frequency.

unsigned int alleleValue ( unsigned int  alleleIndex)

Value of an allele.

The index corresponds to the local mapping of alleles regardless of the ranking of allele values. (No out of bound checking.)

double F ( )

Weir-Cockerham F-statistic.

Note: equivalent to Fit.

double f ( )

Weir-Cockerham f-statistic.

Note: equivalent to Fis.

unsigned int genotypeFrequencyPerPopulation ( unsigned int  populationIndex,
unsigned int  alleleIndex1,
unsigned int  alleleIndex2 
)

Absolute genotype frequency in a population.

Note that allele AB is considered different to BA (this means that values can be accessed both sides of the diagonal.

unsigned int genotypeFrequencyTotal ( unsigned int  alleleIndex1,
unsigned int  alleleIndex2 
)

Absolute genotype frequency.

Note that allele AB is considered different to BA (this means that values can be accessed both sides of the diagonal.

void loadIndividual ( unsigned int  genotype1,
unsigned int  genotype2,
unsigned int  populationLabel 
)

Loads the data for one individual.

Parameters
genotype1an integer giving the first allele.
genotype2an integer giving the second allele.
populationLabelan integer indication belonging to a population.

Genotypes and population labels are not required to be consecutive (both are labels, not indices). They are internally mapped to indices (the mapping can be obtained by accessors populationLabel and allele).

All genotypes are considered to be valid (no missing data). If statistics were computed previous to call to this function, all data will be erase.

unsigned int numberOfAlleles ( )

Number of alleles.

unsigned int numberOfGenotypes ( ) const

Number of loaded genotypes.

unsigned int numberOfPopulations ( )

Number of populations.

unsigned int populationFrequency ( unsigned int  populationIndex)

Sample size of a population.

unsigned int populationLabel ( unsigned int  populationIndex)

Label of a population.

The index corresponds to the local mapping of populations regardless of the ranking of population labels. (No out of bound checking.)

void reserve ( unsigned int  numberOfIndividuals)

Reserve sufficient memory for a given number of individuals.

This method makes the load function faster by allocating all required memory at once.

Parameters
numberOfIndividualsa strictly positive integer.
double theta ( )

Weir-Cockerham theta-statistic.

Note: equivalent to Fst.

double Vallele ( )

Within-individual component of variance.

double Vindividual ( )

Within-population, between-individual component of variance.

double Vpopulation ( )

Between-population component of variance.


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