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

Implements diversity analysis at the site level. More...

#include <SitePolymorphism.hpp>

Public Member Functions

 SitePolymorphism ()
 Builds an object. More...
 
 SitePolymorphism (unsigned int npop)
 Builds an object. More...
 
virtual ~SitePolymorphism ()
 Destroys an object. More...
 
 SitePolymorphism (const SitePolymorphism &source)
 Copy constructor. More...
 
SitePolymorphismoperator= (const SitePolymorphism &source)
 Assignment operator. More...
 
void numberOfPopulations (unsigned int npop)
 Sets the number of populations. More...
 
void load (unsigned int populationIndex, char character)
 Adds a character. More...
 
void outgroup (char state)
 Loads outgroup state. More...
 
unsigned int numberOfAlleles () const
 Number of different alleles. More...
 
char allele (unsigned int index) const
 Gets an allele (unsecure) More...
 
unsigned int alleleFrequency (unsigned int alleleIndex) const
 Gets a frequency (unsecure) More...
 
unsigned int alleleFrequency (unsigned int popIndex, unsigned int alleleIndex) const
 Gets the frequency of an allele in one pop (unsecure) More...
 
unsigned int derivedAlleleFrequency () const
 Sums the frequency of derived allele(s) More...
 
unsigned int ns () const
 Number of sequences that were analyzed. More...
 
unsigned int ns (unsigned int popIndex) const
 Gets the number of analyzed sequences for a population. More...
 
bool isOrientable () const
 Checks if the site can be oriented. More...
 
bool isPolymorphic (unsigned int popIndex) const
 
bool hasSpecificAllele (unsigned int popIndex, bool restrictToDerived) const
 
bool haveFixedDifference (unsigned int pop1, unsigned int pop2) const
 
bool haveCommonAllele (unsigned int pop1, unsigned int pop2) const
 
bool haveSharedAllele (unsigned int pop1, unsigned int pop2) const
 

Protected Member Functions

void init ()
 
void clear ()
 
void copy (const SitePolymorphism &site)
 

Protected Attributes

unsigned int m_numberOfPopulations
 
unsigned int m_numberOfStates
 
char * m_states
 
unsigned int ** m_frequencies
 
unsigned int m_numberOfOutgroups
 
char * m_outgroups
 
unsigned int m_ns
 
unsigned int * m_pop_ns
 
bool m_cache_orientable
 

Detailed Description

Implements diversity analysis at the site level.

Data are loaded along with a population index. It is necessary to set the number of populations prior to use.

Outgroup sequence must be loaded separetedly. There can be any number of outgroups, but they must be all consistent otherwise the site will be considered as not orientable.

Constructor & Destructor Documentation

Builds an object.

SitePolymorphism ( unsigned int  npop)

Builds an object.

Parameters
npopnumber of populations
~SitePolymorphism ( )
virtual

Destroys an object.

SitePolymorphism ( const SitePolymorphism source)

Copy constructor.

Member Function Documentation

char allele ( unsigned int  index) const

Gets an allele (unsecure)

Assumes that the index provided lies in the valid range

unsigned int alleleFrequency ( unsigned int  alleleIndex) const

Gets a frequency (unsecure)

The sum of of frequencies of the allele over populations is computed. Not out-of-bounds check is performed.

unsigned int alleleFrequency ( unsigned int  popIndex,
unsigned int  alleleIndex 
) const

Gets the frequency of an allele in one pop (unsecure)

The frequency of the allele in the given population is returned. Not out-of-bounds check is performed.

unsigned int derivedAlleleFrequency ( ) const

Sums the frequency of derived allele(s)

This method assumes that the site is orientable. It will use as outgroup the first outgroup character entered, assuming at least one was entered and that all (if more than one) were identical.

bool isOrientable ( ) const

Checks if the site can be oriented.

Returns true if at least one outgroup datum has been loaded, if all outgroup data are identical (regardless of their value) and if the outgroup allele is one of the allele in the sample.

void load ( unsigned int  populationIndex,
char  character 
)

Adds a character.

Parameters
populationIndexthe index of the population from which is sampled this character (do not use "population label").
characterthe character value (it is assumed it represents a valid character.
unsigned int ns ( ) const

Number of sequences that were analyzed.

unsigned int ns ( unsigned int  popIndex) const

Gets the number of analyzed sequences for a population.

No out-of-bound check is performed

unsigned int numberOfAlleles ( ) const

Number of different alleles.

void numberOfPopulations ( unsigned int  npop)

Sets the number of populations.

NOTE THAT all previous data is lost.

SitePolymorphism & operator= ( const SitePolymorphism source)

Assignment operator.

void outgroup ( char  state)

Loads outgroup state.

There can be any number of outgroup states. Only characters that are considered as valid (whatever the list is) should be loaded.


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