bpp-popgen  3.0.0
bpp::AnalyzedLoci Class Reference

The AnalyzedLoci class. More...

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

+ Collaboration diagram for bpp::AnalyzedLoci:

Public Member Functions

 AnalyzedLoci (size_t number_of_loci)
 Build a void AnalyzedLoci with a specific number of loci. More...
 
 AnalyzedLoci (const AnalyzedLoci &analyzed_loci)
 Copy constructor. More...
 
 ~AnalyzedLoci ()
 Destroy the AnalyzedLoci. More...
 
void setLocusInfo (size_t locus_position, const LocusInfo &locus)
 Set a LocusInfo. More...
 
size_t getLocusInfoPosition (const std::string &locus_name) const
 Get the position of a LocusInfo. More...
 
const LocusInfogetLocusInfoByName (const std::string &locus_name) const
 Get a LocusInfo by name. More...
 
const LocusInfogetLocusInfoAtPosition (size_t locus_position) const
 Get a LocusInfo by its position. More...
 
void addAlleleInfoByLocusName (const std::string &locus_name, const AlleleInfo &allele)
 Add an AlleleInfo to a LocusInfo by LocusInfo name. More...
 
void addAlleleInfoByLocusPosition (size_t locus_position, 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 &locus_name) const
 Get the ploidy of a locus by name. More...
 
unsigned int getPloidyByLocusPosition (size_t locus_position) const
 Get the ploidy of a locus by its position. More...
 

Private Attributes

std::vector< LocusInfo * > loci_
 

Detailed Description

The AnalyzedLoci class.

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

Author
Sylvain Gaillard

Definition at line 64 of file AnalyzedLoci.h.

Constructor & Destructor Documentation

◆ AnalyzedLoci() [1/2]

AnalyzedLoci::AnalyzedLoci ( size_t  number_of_loci)

Build a void AnalyzedLoci with a specific number of loci.

Definition at line 47 of file AnalyzedLoci.cpp.

References loci_.

◆ AnalyzedLoci() [2/2]

AnalyzedLoci::AnalyzedLoci ( const AnalyzedLoci analyzed_loci)

Copy constructor.

Definition at line 57 of file AnalyzedLoci.cpp.

References getLocusInfoAtPosition(), getNumberOfLoci(), and loci_.

◆ ~AnalyzedLoci()

AnalyzedLoci::~AnalyzedLoci ( )

Destroy the AnalyzedLoci.

Definition at line 67 of file AnalyzedLoci.cpp.

References loci_.

Member Function Documentation

◆ addAlleleInfoByLocusName()

void AnalyzedLoci::addAlleleInfoByLocusName ( const std::string &  locus_name,
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 131 of file AnalyzedLoci.cpp.

References bpp::BadIdentifierException::getIdentifier(), and loci_.

Referenced by bpp::DataSet::addAlleleInfoByLocusName(), and bpp::GeneMapperCsvExport::read().

◆ addAlleleInfoByLocusPosition()

void AnalyzedLoci::addAlleleInfoByLocusPosition ( size_t  locus_position,
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 157 of file AnalyzedLoci.cpp.

References bpp::BadIdentifierException::getIdentifier(), and loci_.

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

◆ getLocusInfoAtPosition()

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

Get a LocusInfo by its position.

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

Definition at line 117 of file AnalyzedLoci.cpp.

References loci_.

Referenced by AnalyzedLoci(), and bpp::DataSet::getLocusInfoAtPosition().

◆ getLocusInfoByName()

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

Get a LocusInfo by name.

Exceptions
BadIdentifierExceptionif locus_name is not found.

Definition at line 103 of file AnalyzedLoci.cpp.

References loci_.

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

◆ getLocusInfoPosition()

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

Get the position of a LocusInfo.

Exceptions
BadIdentifierExceptionif locus_name is not found.

Definition at line 90 of file AnalyzedLoci.cpp.

References loci_.

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

◆ getNumberOfAlleles()

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

Get the number of alleles at each locus.

Definition at line 178 of file AnalyzedLoci.cpp.

References loci_.

Referenced by bpp::DarwinVarSingle::write().

◆ getNumberOfLoci()

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

Get the number of loci.

Definition at line 138 of file AnalyzedLoci.h.

References loci_.

Referenced by AnalyzedLoci(), bpp::DataSet::getNumberOfLoci(), and bpp::DataSet::setLocusInfo().

◆ getPloidyByLocusName()

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

Get the ploidy of a locus by name.

Exceptions
LocusNotFoundExceptionif locus_name is not found.

Definition at line 190 of file AnalyzedLoci.cpp.

References loci_.

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

◆ getPloidyByLocusPosition()

unsigned int AnalyzedLoci::getPloidyByLocusPosition ( size_t  locus_position) const

Get the ploidy of a locus by its position.

Exceptions
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 203 of file AnalyzedLoci.cpp.

References loci_.

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

◆ setLocusInfo()

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

Set a LocusInfo.

Exceptions
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 77 of file AnalyzedLoci.cpp.

References loci_.

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

Member Data Documentation

◆ loci_


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