bpp-popgen3
3.0.0
|
#include <Bpp/PopGen/LocusInfo.h>
Public Member Functions | |
LocusInfo (const std::string &name, const unsigned int ploidy=DIPLOID) | |
Build a new LocusInfo object. More... | |
LocusInfo (const LocusInfo &locusInfo) | |
Copy constructor. More... | |
LocusInfo & | operator= (const LocusInfo &locusInfo) |
virtual | ~LocusInfo ()=default |
Destroy the LocusInfo. More... | |
LocusInfo * | clone () const override |
const std::string & | getName () const |
Get the name of the locus. More... | |
unsigned int | getPloidy () const |
Get the ploidy of the locus. More... | |
void | addAlleleInfo (const AlleleInfo &allele) |
Add an AlleleInfo to the LocusInfo. More... | |
const AlleleInfo & | getAlleleInfoById (const std::string &id) const |
Retrieve an AlleleInfo object of the LocusInfo. More... | |
const AlleleInfo & | getAlleleInfoByKey (size_t key) const |
Retrieve an AlleleInfo object of the LocusInfo. More... | |
unsigned int | getAlleleInfoKey (const std::string &id) const |
Get the position of an AlleleInfo. More... | |
size_t | getNumberOfAlleles () const |
Get the number of alleles at this locus. More... | |
void | clear () |
Delete all alleles from the locus. More... | |
Static Public Attributes | |
static unsigned int | HAPLODIPLOID = 0 |
static unsigned int | HAPLOID = 1 |
static unsigned int | DIPLOID = 2 |
static unsigned int | UNKNOWN = 9999 |
Private Attributes | |
std::string | name_ |
unsigned int | ploidy_ |
std::vector< std::unique_ptr< AlleleInfo > > | alleles_ |
The LocusInfo class.
This is an AlleleInfo container with additional data like a name, the ploidy and some comments.
Definition at line 29 of file LocusInfo.h.
|
inline |
Build a new LocusInfo object.
name | The name of the locus. |
ploidy | The ploidy of the locus. |
Definition at line 51 of file LocusInfo.h.
Referenced by clone().
|
inline |
Copy constructor.
Definition at line 60 of file LocusInfo.h.
References alleles_, bpp::AlleleInfo::clone(), getAlleleInfoByKey(), and getNumberOfAlleles().
|
virtualdefault |
Destroy the LocusInfo.
void LocusInfo::addAlleleInfo | ( | const AlleleInfo & | allele | ) |
Add an AlleleInfo to the LocusInfo.
BadIdentifierException | if the AlleleInfo's id already exists. |
Definition at line 21 of file LocusInfo.cpp.
References bpp::AlleleInfo::clone(), and bpp::AlleleInfo::getId().
Referenced by bpp::Genetix::read().
|
inline |
|
inlineoverridevirtual |
Implements bpp::Clonable.
Definition at line 88 of file LocusInfo.h.
References LocusInfo().
Referenced by bpp::AnalyzedLoci::setLocusInfo().
const AlleleInfo & LocusInfo::getAlleleInfoById | ( | const std::string & | id | ) | const |
Retrieve an AlleleInfo object of the LocusInfo.
AlleleNotFoundException | if the id is not found. |
Definition at line 32 of file LocusInfo.cpp.
const AlleleInfo & LocusInfo::getAlleleInfoByKey | ( | size_t | key | ) | const |
Retrieve an AlleleInfo object of the LocusInfo.
IndexOutOfBoundsException | if key exceeds the number of alleles. |
Definition at line 42 of file LocusInfo.cpp.
Referenced by LocusInfo(), operator=(), bpp::DarwinVarSingle::write(), and bpp::PopgenlibIO::write().
unsigned int LocusInfo::getAlleleInfoKey | ( | const std::string & | id | ) | const |
Get the position of an AlleleInfo.
AlleleNotFoundException | if the AlleleInfo's id is not found. |
Definition at line 49 of file LocusInfo.cpp.
Referenced by bpp::MultilocusGenotype::setMonolocusGenotypeByAlleleId().
|
inline |
Get the name of the locus.
Definition at line 94 of file LocusInfo.h.
References name_.
Referenced by bpp::DarwinVarSingle::write(), and bpp::PopgenlibIO::write().
|
inline |
Get the number of alleles at this locus.
Definition at line 134 of file LocusInfo.h.
References alleles_.
Referenced by LocusInfo(), operator=(), bpp::DarwinVarSingle::write(), and bpp::PopgenlibIO::write().
|
inline |
Get the ploidy of the locus.
Definition at line 101 of file LocusInfo.h.
References ploidy_.
Referenced by bpp::PopgenlibIO::write().
Definition at line 71 of file LocusInfo.h.
References alleles_, bpp::AlleleInfo::clone(), getAlleleInfoByKey(), getNumberOfAlleles(), name_, and ploidy_.
|
private |
Definition at line 35 of file LocusInfo.h.
Referenced by clear(), getNumberOfAlleles(), LocusInfo(), and operator=().
|
static |
Definition at line 40 of file LocusInfo.h.
Referenced by bpp::PopgenlibIO::parseLoci_(), and bpp::PopgenlibIO::write().
|
static |
Definition at line 38 of file LocusInfo.h.
Referenced by bpp::PopgenlibIO::parseLoci_(), and bpp::PopgenlibIO::write().
|
static |
Definition at line 39 of file LocusInfo.h.
Referenced by bpp::PopgenlibIO::parseLoci_(), and bpp::PopgenlibIO::write().
|
private |
Definition at line 33 of file LocusInfo.h.
Referenced by getName(), and operator=().
|
private |
Definition at line 34 of file LocusInfo.h.
Referenced by getPloidy(), and operator=().
|
static |
Definition at line 41 of file LocusInfo.h.
Referenced by bpp::PopgenlibIO::parseLoci_(), bpp::GeneMapperCsvExport::read(), and bpp::PopgenlibIO::write().