bpp-popgen  2.2.0
bpp::AnalyzedLoci Class Reference

The AnalyzedLoci class. More...

#include <Bpp/PopGen/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) throw (IndexOutOfBoundsException)
 Set a LocusInfo. More...
 
size_t getLocusInfoPosition (const std::string &locus_name) const throw (BadIdentifierException)
 Get the position of a LocusInfo. More...
 
const LocusInfogetLocusInfoByName (const std::string &locus_name) const throw (BadIdentifierException)
 Get a LocusInfo by name. More...
 
const LocusInfogetLocusInfoAtPosition (size_t locus_position) const throw (Exception)
 Get a LocusInfo by its position. More...
 
void addAlleleInfoByLocusName (const std::string &locus_name, const AlleleInfo &allele) throw (Exception)
 Add an AlleleInfo to a LocusInfo by LocusInfo name. More...
 
void addAlleleInfoByLocusPosition (size_t locus_position, const AlleleInfo &allele) throw (Exception)
 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 throw (LocusNotFoundException)
 Get the ploidy of a locus by name. More...
 
unsigned int getPloidyByLocusPosition (size_t locus_position) const throw (IndexOutOfBoundsException)
 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 
)
throw (Exception
)

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 135 of file AnalyzedLoci.cpp.

References bpp::BadIdentifierException::getIdentifier().

◆ addAlleleInfoByLocusPosition()

void AnalyzedLoci::addAlleleInfoByLocusPosition ( size_t  locus_position,
const AlleleInfo allele 
)
throw (Exception
)

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 162 of file AnalyzedLoci.cpp.

References bpp::BadIdentifierException::getIdentifier().

◆ getLocusInfoAtPosition()

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

Get a LocusInfo by its position.

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

Definition at line 120 of file AnalyzedLoci.cpp.

Referenced by AnalyzedLoci().

◆ getLocusInfoByName()

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

Get a LocusInfo by name.

Exceptions
BadIdentifierExceptionif locus_name is not found.

Definition at line 105 of file AnalyzedLoci.cpp.

◆ getLocusInfoPosition()

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

Get the position of a LocusInfo.

Exceptions
BadIdentifierExceptionif locus_name is not found.

Definition at line 91 of file AnalyzedLoci.cpp.

◆ getNumberOfAlleles()

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

Get the number of alleles at each locus.

Definition at line 184 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 144 of file AnalyzedLoci.h.

References loci_.

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

◆ getPloidyByLocusName()

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

Get the ploidy of a locus by name.

Exceptions
LocusNotFoundExceptionif locus_name is not found.

Definition at line 196 of file AnalyzedLoci.cpp.

◆ getPloidyByLocusPosition()

unsigned int AnalyzedLoci::getPloidyByLocusPosition ( size_t  locus_position) const
throw (IndexOutOfBoundsException
)

Get the ploidy of a locus by its position.

Exceptions
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 210 of file AnalyzedLoci.cpp.

◆ setLocusInfo()

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

Set a LocusInfo.

Exceptions
IndexOutOfBoundsExceptionif locus_position is out of bounds.

Definition at line 77 of file AnalyzedLoci.cpp.

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

Member Data Documentation

◆ loci_

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

Definition at line 67 of file AnalyzedLoci.h.

Referenced by AnalyzedLoci(), getNumberOfAlleles(), getNumberOfLoci(), and ~AnalyzedLoci().


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