bpp-popgen3  3.0.0
bpp::MultilocusGenotype Class Reference

The MultilocusGenotype class. More...

#include <Bpp/PopGen/MultilocusGenotype.h>

+ Inheritance diagram for bpp::MultilocusGenotype:
+ Collaboration diagram for bpp::MultilocusGenotype:

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...
 
MultilocusGenotypeclone () 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 MonolocusGenotypeInterfacemonolocusGenotype (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_
 

Detailed Description

The MultilocusGenotype class.

This is a MonolocusGenotype container.

Author
Sylvain Gaillard

Definition at line 31 of file MultilocusGenotype.h.

Constructor & Destructor Documentation

◆ MultilocusGenotype() [1/2]

MultilocusGenotype::MultilocusGenotype ( size_t  lociNumber)

Build a MultilocusGenotype linked to an AnalyzedLoci object.

Exceptions
BadIntegerExceptionif lociNumber < 1.

Definition at line 12 of file MultilocusGenotype.cpp.

References loci_.

Referenced by clone().

◆ MultilocusGenotype() [2/2]

MultilocusGenotype::MultilocusGenotype ( const MultilocusGenotype genotype)

◆ ~MultilocusGenotype()

MultilocusGenotype::~MultilocusGenotype ( )
virtual

Destroy a MultilocusGenotype.

Definition at line 39 of file MultilocusGenotype.cpp.

References loci_.

Member Function Documentation

◆ clone()

MultilocusGenotype* bpp::MultilocusGenotype::clone ( ) const
inlineoverridevirtual

◆ countHeterozygousLoci()

size_t MultilocusGenotype::countHeterozygousLoci ( ) const

Count the number of heterozygous MonolocusGenotype.

Definition at line 151 of file MultilocusGenotype.cpp.

References count(), and loci_.

◆ countHomozygousLoci()

size_t MultilocusGenotype::countHomozygousLoci ( ) const

Count the number of homozygous MonolocusGenotype.

Definition at line 135 of file MultilocusGenotype.cpp.

References count(), and loci_.

◆ countNonMissingLoci()

size_t MultilocusGenotype::countNonMissingLoci ( ) const

Count the number of non missing MonolocusGenotype.

Definition at line 124 of file MultilocusGenotype.cpp.

References count(), and loci_.

◆ isMonolocusGenotypeMissing()

◆ monolocusGenotype()

◆ setMonolocusGenotype()

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

◆ setMonolocusGenotypeAsMissing()

void MultilocusGenotype::setMonolocusGenotypeAsMissing ( size_t  locusPosition)

Set a MonolocusGenotype as missing data.

Exceptions
IndexOutOfBoundsExceptionif locus_position exceeds the number of loci.

Definition at line 98 of file MultilocusGenotype.cpp.

References loci_.

◆ setMonolocusGenotypeByAlleleId()

void MultilocusGenotype::setMonolocusGenotypeByAlleleId ( size_t  locusPosition,
const std::vector< std::string > &  alleleId,
const LocusInfo locusInfo 
)

Set a MonolocusGenotype by allele id.

Exceptions
IndexOutOfBoundsExceptionif locus_position exceeds the number of loci.
AlleleNotFoundExceptionif 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().

◆ setMonolocusGenotypeByAlleleKey()

void MultilocusGenotype::setMonolocusGenotypeByAlleleKey ( size_t  locusPosition,
const std::vector< size_t > &  alleleKeys 
)

Set a MonolocusGenotype by allele keys.

Exceptions
IndexOutOfBoundsExceptionif locus_position exceeds the number of loci.
Exceptionif 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()

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

Member Data Documentation

◆ loci_


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