bpp-popgen3
3.0.0
|
The MultilocusGenotype class. More...
#include <Bpp/PopGen/MultilocusGenotype.h>
Public Member Functions | |
MultilocusGenotype (size_t lociNumber) | |
Build a MultilocusGenotype linked to an AnalyzedLoci object. More... | |
MultilocusGenotype (const MultilocusGenotype &genotype) | |
Copy constructor. More... | |
virtual | ~MultilocusGenotype () |
Destroy a MultilocusGenotype. More... | |
MultilocusGenotype * | clone () const override |
void | setMonolocusGenotype (size_t locusPosition, const MonolocusGenotypeInterface &monogen) |
Set a MonolocusGenotype. More... | |
void | setMonolocusGenotypeByAlleleKey (size_t locusPosition, const std::vector< size_t > &alleleKeys) |
Set a MonolocusGenotype by allele keys. More... | |
void | setMonolocusGenotypeByAlleleId (size_t locusPosition, const std::vector< std::string > &alleleId, const LocusInfo &locusInfo) |
Set a MonolocusGenotype by allele id. More... | |
void | setMonolocusGenotypeAsMissing (size_t locusPosition) |
Set a MonolocusGenotype as missing data. More... | |
bool | isMonolocusGenotypeMissing (size_t locusPosition) const |
Tell if a MonolocusGenotype is a missing data. More... | |
const MonolocusGenotypeInterface & | monolocusGenotype (size_t locusPosition) const |
Get a MonolocusGenotype. More... | |
size_t | size () const |
Count the number of loci. More... | |
size_t | countNonMissingLoci () const |
Count the number of non missing MonolocusGenotype. More... | |
size_t | countHomozygousLoci () const |
Count the number of homozygous MonolocusGenotype. More... | |
size_t | countHeterozygousLoci () const |
Count the number of heterozygous MonolocusGenotype. More... | |
Private Attributes | |
std::vector< std::unique_ptr< MonolocusGenotypeInterface > > | loci_ |
The MultilocusGenotype class.
This is a MonolocusGenotype container.
Definition at line 31 of file MultilocusGenotype.h.
MultilocusGenotype::MultilocusGenotype | ( | size_t | lociNumber | ) |
Build a MultilocusGenotype linked to an AnalyzedLoci object.
BadIntegerException | if lociNumber < 1. |
Definition at line 12 of file MultilocusGenotype.cpp.
References loci_.
Referenced by clone().
MultilocusGenotype::MultilocusGenotype | ( | const MultilocusGenotype & | genotype | ) |
Copy constructor.
Definition at line 25 of file MultilocusGenotype.cpp.
References bpp::MonolocusGenotypeInterface::clone(), isMonolocusGenotypeMissing(), loci_, monolocusGenotype(), and size().
|
virtual |
Destroy a MultilocusGenotype.
Definition at line 39 of file MultilocusGenotype.cpp.
References loci_.
|
inlineoverridevirtual |
Implements bpp::Clonable.
Definition at line 55 of file MultilocusGenotype.h.
References MultilocusGenotype().
Referenced by bpp::PolymorphismMultiGContainer::PolymorphismMultiGContainer().
size_t MultilocusGenotype::countHeterozygousLoci | ( | ) | const |
Count the number of heterozygous MonolocusGenotype.
Definition at line 151 of file MultilocusGenotype.cpp.
size_t MultilocusGenotype::countHomozygousLoci | ( | ) | const |
Count the number of homozygous MonolocusGenotype.
Definition at line 135 of file MultilocusGenotype.cpp.
size_t MultilocusGenotype::countNonMissingLoci | ( | ) | const |
Count the number of non missing MonolocusGenotype.
Definition at line 124 of file MultilocusGenotype.cpp.
bool MultilocusGenotype::isMonolocusGenotypeMissing | ( | size_t | locusPosition | ) | const |
Tell if a MonolocusGenotype is a missing data.
IndexOutOfBoundsException | if locus_position exceeds the number of loci. |
Definition at line 105 of file MultilocusGenotype.cpp.
References loci_.
Referenced by bpp::MultilocusGenotypeStatistics::countBiAllelicForGroups(), bpp::MultilocusGenotypeStatistics::countHeterozygousForGroups(), bpp::MultilocusGenotypeStatistics::countNonMissingForGroups(), bpp::MultilocusGenotypeStatistics::getAllelesMapForGroups(), bpp::MultilocusGenotypeStatistics::getHeterozygousFrqForGroups(), MultilocusGenotype(), bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), and bpp::PopgenlibIO::write().
const MonolocusGenotypeInterface & MultilocusGenotype::monolocusGenotype | ( | size_t | locusPosition | ) | const |
Get a MonolocusGenotype.
Definition at line 112 of file MultilocusGenotype.cpp.
References loci_.
Referenced by bpp::MultilocusGenotypeStatistics::countBiAllelicForGroups(), bpp::MultilocusGenotypeStatistics::countHeterozygousForGroups(), bpp::MultilocusGenotypeStatistics::getAllelesMapForGroups(), bpp::MultilocusGenotypeStatistics::getHeterozygousFrqForGroups(), MultilocusGenotype(), bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permuteMonoG(), bpp::DarwinVarSingle::write(), and bpp::PopgenlibIO::write().
void MultilocusGenotype::setMonolocusGenotype | ( | size_t | locusPosition, |
const MonolocusGenotypeInterface & | monogen | ||
) |
Set a MonolocusGenotype.
Definition at line 46 of file MultilocusGenotype.cpp.
References bpp::MonolocusGenotypeInterface::clone(), and loci_.
Referenced by setMonolocusGenotypeByAlleleKey().
void MultilocusGenotype::setMonolocusGenotypeAsMissing | ( | size_t | locusPosition | ) |
Set a MonolocusGenotype as missing data.
IndexOutOfBoundsException | if locus_position exceeds the number of loci. |
Definition at line 98 of file MultilocusGenotype.cpp.
References loci_.
void MultilocusGenotype::setMonolocusGenotypeByAlleleId | ( | size_t | locusPosition, |
const std::vector< std::string > & | alleleId, | ||
const LocusInfo & | locusInfo | ||
) |
Set a MonolocusGenotype by allele id.
IndexOutOfBoundsException | if locus_position exceeds the number of loci. |
AlleleNotFoundException | if at least one of the id is not found in the LocusInfo. |
Definition at line 71 of file MultilocusGenotype.cpp.
References bpp::LocusInfo::getAlleleInfoKey(), bpp::IndexOutOfBoundsException::getBadIndex(), bpp::IndexOutOfBoundsException::getBounds(), bpp::AlleleNotFoundException::getIdentifier(), and setMonolocusGenotypeByAlleleKey().
void MultilocusGenotype::setMonolocusGenotypeByAlleleKey | ( | size_t | locusPosition, |
const std::vector< size_t > & | alleleKeys | ||
) |
Set a MonolocusGenotype by allele keys.
IndexOutOfBoundsException | if locus_position exceeds the number of loci. |
Exception | if there is no key in allele_keys. |
Definition at line 56 of file MultilocusGenotype.cpp.
References bpp::MonolocusGenotypeTools::buildMonolocusGenotypeByAlleleKey(), loci_, and setMonolocusGenotype().
Referenced by setMonolocusGenotypeByAlleleId().
size_t MultilocusGenotype::size | ( | ) | const |
Count the number of loci.
Return the size of _loci.
Definition at line 119 of file MultilocusGenotype.cpp.
References loci_.
Referenced by MultilocusGenotype(), and bpp::PopgenlibIO::write().
|
private |
Definition at line 35 of file MultilocusGenotype.h.
Referenced by countHeterozygousLoci(), countHomozygousLoci(), countNonMissingLoci(), isMonolocusGenotypeMissing(), monolocusGenotype(), MultilocusGenotype(), setMonolocusGenotype(), setMonolocusGenotypeAsMissing(), setMonolocusGenotypeByAlleleKey(), size(), and ~MultilocusGenotype().