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

Computes Fst and Fit from haploid data. More...

#include <HFStatistics.hpp>

Public Member Functions

 HFStatistics ()
 Constructor. More...
 
virtual ~HFStatistics ()
 Destructor. More...
 
void reserve (unsigned int numberOfIndividuals)
 Reserve sufficient memory for a given number of individuals. More...
 
void loadIndividual (unsigned int genotype, 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 allele (unsigned int individualIndex) const
 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 populationFrequency (unsigned int populationIndex)
 Sample size of a population. More...
 
double theta ()
 Weir-Cockerham theta-statistic. More...
 
double T1 ()
 Between-population component of variance. More...
 
double T2 ()
 Total 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
 
bool w_flag
 
double w_T
 
double * w_T1
 
double * w_T2
 
double w_nbar
 
double w_nc
 
double * w_pbar
 
double * w_ssquare
 
double w_sum_T1
 
double w_sum_T2
 

Detailed Description

Computes Fst and Fit from haploid data.

The class requires loading data. Data are loaded by haploid (one genotype 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 statistic theta is generalized for multiple alleles. To allow computation of multi-locus statistics, variance components are also available. The two components of the variance are T1 and T2 and theta is T1/T2 (from Weir 1996 "Genetic Data Analysis II", Sinauer associates, Sunderland MA).

Constructor & Destructor Documentation

Constructor.

~HFStatistics ( )
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.)

void loadIndividual ( unsigned int  genotype,
unsigned int  populationLabel 
)

Loads the data for one individual.

Parameters
genotypean integer giving the 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 erased.

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 T1 ( )

Between-population component of variance.

double T2 ( )

Total variance.

double theta ( )

Weir-Cockerham theta-statistic.

Note: equivalent to Fst.


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