bpp-popgen3  3.0.0
bpp::AnalyzedLoci Class Reference

The AnalyzedLoci class. More...

#include <Bpp/PopGen/DataSet/AnalyzedLoci.h>

+ Inheritance diagram for bpp::AnalyzedLoci:
+ Collaboration diagram for bpp::AnalyzedLoci:

Public Member Functions

 AnalyzedLoci (size_t numberOfLoci)
 Build a void AnalyzedLoci with a specific number of loci. More...
 
 AnalyzedLoci (const AnalyzedLoci &analyzedLoci)
 Copy constructor. More...
 
AnalyzedLocioperator= (const AnalyzedLoci &analyzedLoci)
 
virtual ~AnalyzedLoci ()=default
 Destroy the AnalyzedLoci. More...
 
AnalyzedLociclone () const
 
void setLocusInfo (size_t locusPosition, const LocusInfo &locus)
 Set a LocusInfo. More...
 
size_t getLocusInfoPosition (const std::string &locusName) const
 Get the position of a LocusInfo. More...
 
const LocusInfogetLocusInfoByName (const std::string &locusName) const
 Get a LocusInfo by name. More...
 
const LocusInfogetLocusInfoAtPosition (size_t locusPosition) const
 Get a LocusInfo by its position. More...
 
void addAlleleInfoByLocusName (const std::string &locusName, const AlleleInfo &allele)
 Add an AlleleInfo to a LocusInfo by LocusInfo name. More...
 
void addAlleleInfoByLocusPosition (size_t locusosition, const AlleleInfo &allele)
 Add an AlleleInfo to a LocusInfo by its position. More...
 
size_t getNumberOfLoci () const
 Get the number of loci. More...
 
std::vector< size_t > getNumberOfAlleles () const
 Get the number of alleles at each locus. More...
 
unsigned int getPloidyByLocusName (const std::string &locusName) const
 Get the ploidy of a locus by name. More...
 
unsigned int getPloidyByLocusPosition (size_t locusPosition) const
 Get the ploidy of a locus by its position. More...
 

Private Attributes

std::vector< std::unique_ptr< LocusInfo > > loci_
 

Detailed Description

The AnalyzedLoci class.

This is a LocusInfo container. Its instantiation requires a number of locus which is fixed and can't be modified.

Author
Sylvain Gaillard

Definition at line 29 of file AnalyzedLoci.h.

Constructor & Destructor Documentation

◆ AnalyzedLoci() [1/2]

bpp::AnalyzedLoci::AnalyzedLoci ( size_t  numberOfLoci)
inline

Build a void AnalyzedLoci with a specific number of loci.

Definition at line 40 of file AnalyzedLoci.h.

Referenced by clone().

◆ AnalyzedLoci() [2/2]

bpp::AnalyzedLoci::AnalyzedLoci ( const AnalyzedLoci analyzedLoci)
inline

Copy constructor.

Definition at line 45 of file AnalyzedLoci.h.

References loci_.

◆ ~AnalyzedLoci()

virtual bpp::AnalyzedLoci::~AnalyzedLoci ( )
virtualdefault

Destroy the AnalyzedLoci.

Member Function Documentation

◆ addAlleleInfoByLocusName()

void AnalyzedLoci::addAlleleInfoByLocusName ( const std::string &  locusName,
const AlleleInfo allele 
)

Add an AlleleInfo to a LocusInfo by LocusInfo name.

Exceptions
BadIdentifierExceptionif the allele's id is already in use.
LocusNotFoundExceptionif locus_name is not found.

Definition at line 66 of file AnalyzedLoci.cpp.

References bpp::BadIdentifierException::getIdentifier().

Referenced by bpp::GeneMapperCsvExport::read().

◆ addAlleleInfoByLocusPosition()

void AnalyzedLoci::addAlleleInfoByLocusPosition ( size_t  locusosition,
const AlleleInfo allele 
)

Add an AlleleInfo to a LocusInfo by its position.

Exceptions
BadIdentifierExceptionif the allele's id is already in use.
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 92 of file AnalyzedLoci.cpp.

References bpp::BadIdentifierException::getIdentifier().

◆ clone()

AnalyzedLoci* bpp::AnalyzedLoci::clone ( ) const
inlinevirtual

Implements bpp::Clonable.

Definition at line 71 of file AnalyzedLoci.h.

References AnalyzedLoci().

Referenced by bpp::DataSet::setAnalyzedLoci().

◆ getLocusInfoAtPosition()

const LocusInfo & AnalyzedLoci::getLocusInfoAtPosition ( size_t  locusPosition) const

Get a LocusInfo by its position.

Exceptions
NullPointerExceptionif the LocusInfo is not defined.
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 52 of file AnalyzedLoci.cpp.

◆ getLocusInfoByName()

const LocusInfo & AnalyzedLoci::getLocusInfoByName ( const std::string &  locusName) const

Get a LocusInfo by name.

Exceptions
BadIdentifierExceptionif locus_name is not found.

Definition at line 38 of file AnalyzedLoci.cpp.

◆ getLocusInfoPosition()

size_t AnalyzedLoci::getLocusInfoPosition ( const std::string &  locusName) const

Get the position of a LocusInfo.

Exceptions
BadIdentifierExceptionif locus_name is not found.

Definition at line 25 of file AnalyzedLoci.cpp.

Referenced by bpp::GeneMapperCsvExport::read().

◆ getNumberOfAlleles()

std::vector< size_t > AnalyzedLoci::getNumberOfAlleles ( ) const

Get the number of alleles at each locus.

Definition at line 113 of file AnalyzedLoci.cpp.

◆ getNumberOfLoci()

size_t bpp::AnalyzedLoci::getNumberOfLoci ( ) const
inline

Get the number of loci.

Definition at line 125 of file AnalyzedLoci.h.

References loci_.

◆ getPloidyByLocusName()

unsigned int AnalyzedLoci::getPloidyByLocusName ( const std::string &  locusName) const

Get the ploidy of a locus by name.

Exceptions
LocusNotFoundExceptionif locus_name is not found.

Definition at line 125 of file AnalyzedLoci.cpp.

◆ getPloidyByLocusPosition()

unsigned int AnalyzedLoci::getPloidyByLocusPosition ( size_t  locusPosition) const

Get the ploidy of a locus by its position.

Exceptions
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 138 of file AnalyzedLoci.cpp.

◆ operator=()

AnalyzedLoci& bpp::AnalyzedLoci::operator= ( const AnalyzedLoci analyzedLoci)
inline

Definition at line 55 of file AnalyzedLoci.h.

References loci_.

◆ setLocusInfo()

void AnalyzedLoci::setLocusInfo ( size_t  locusPosition,
const LocusInfo locus 
)

Set a LocusInfo.

Exceptions
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 12 of file AnalyzedLoci.cpp.

References bpp::LocusInfo::clone().

Referenced by bpp::GeneMapperCsvExport::read(), and bpp::PopgenlibIO::read().

Member Data Documentation

◆ loci_

std::vector<std::unique_ptr<LocusInfo> > bpp::AnalyzedLoci::loci_
private

Definition at line 33 of file AnalyzedLoci.h.

Referenced by AnalyzedLoci(), getNumberOfLoci(), and operator=().


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