bpp-popgen3
3.0.0
|
The PolymorphismMultiGContainer class. More...
#include <Bpp/PopGen/PolymorphismMultiGContainer.h>
Public Member Functions | |
PolymorphismMultiGContainer () | |
Build a new PolymorphismMultilocusGenotypeContainer. More... | |
PolymorphismMultiGContainer (const PolymorphismMultiGContainer &pmgc) | |
The copy constructor. More... | |
virtual | ~PolymorphismMultiGContainer () |
Destroy a PolymorphismMultilocusGenotypeContainer. More... | |
PolymorphismMultiGContainer * | clone () const override |
PolymorphismMultiGContainer & | operator= (const PolymorphismMultiGContainer &pmgc) |
The assignation operator=. More... | |
void | addMultilocusGenotype (std::unique_ptr< MultilocusGenotype > &mg, size_t group) |
Add a MultilocusGenotype to the container. More... | |
const MultilocusGenotype & | multilocusGenotype (size_t position) const |
Get a MultilocusGenotype at a position. More... | |
std::unique_ptr< MultilocusGenotype > | removeMultilocusGenotype (size_t position) |
Remove a MultilocusGenotype. More... | |
void | deleteMultilocusGenotype (size_t position) |
Delete a MultilocusGenotype. More... | |
bool | isAligned () const |
Tell if the MultilocusGenotypes are aligned (i.e. same size). More... | |
size_t | getNumberOfLoci () const |
Get the number of loci if the MultilocusGenotypes are aligned. More... | |
size_t | getGroupId (size_t position) const |
Get the Group id of a MultilocusGenotype. More... | |
void | setGroupId (size_t position, size_t groupId) |
Set the Group id of a MultilocusGenotype. More... | |
std::set< size_t > | getAllGroupsIds () const |
Get the groups' ids. More... | |
std::vector< std::string > | getAllGroupsNames () const |
Get the groups names or ids if not available. More... | |
bool | groupExists (size_t group) const |
Tell if a group exists. More... | |
size_t | getNumberOfGroups () const |
Get the number of groups. More... | |
size_t | getGroupSize (size_t group) const |
Get group size. More... | |
std::string | getGroupName (size_t groupId) const |
Get the group name for a given group id or just the id if not available juste return it's id. More... | |
void | setGroupName (size_t groupId, const std::string &name) |
Set the name for the given group id. More... | |
void | addGroupName (size_t groupId, const std::string &name) |
Inserts a name for the given group id. More... | |
size_t | getLocusGroupSize (size_t group, size_t locusPosition) const |
Get the size of a group for a given locus. More... | |
size_t | size () const |
Get the number of MultilocusGenotype. More... | |
void | clear () |
Clear the container. More... | |
Private Attributes | |
std::vector< std::unique_ptr< MultilocusGenotype > > | multilocusGenotypes_ |
std::vector< size_t > | groups_ |
std::map< size_t, std::string > | groupsNames_ |
The PolymorphismMultiGContainer class.
This class is a container of MultilocusGenotype.
Definition at line 33 of file PolymorphismMultiGContainer.h.
|
inline |
Build a new PolymorphismMultilocusGenotypeContainer.
Definition at line 46 of file PolymorphismMultiGContainer.h.
Referenced by clone().
PolymorphismMultiGContainer::PolymorphismMultiGContainer | ( | const PolymorphismMultiGContainer & | pmgc | ) |
The copy constructor.
Definition at line 12 of file PolymorphismMultiGContainer.cpp.
References bpp::MultilocusGenotype::clone(), getAllGroupsIds(), getGroupId(), getGroupName(), groups_, groupsNames_, multilocusGenotype(), multilocusGenotypes_, and size().
|
inlinevirtual |
Destroy a PolymorphismMultilocusGenotypeContainer.
Definition at line 60 of file PolymorphismMultiGContainer.h.
References clear().
void PolymorphismMultiGContainer::addGroupName | ( | size_t | groupId, |
const std::string & | name | ||
) |
Inserts a name for the given group id.
Definition at line 217 of file PolymorphismMultiGContainer.cpp.
References groupsNames_.
void PolymorphismMultiGContainer::addMultilocusGenotype | ( | std::unique_ptr< MultilocusGenotype > & | mg, |
size_t | group | ||
) |
Add a MultilocusGenotype to the container.
Definition at line 50 of file PolymorphismMultiGContainer.cpp.
References groups_, groupsNames_, and multilocusGenotypes_.
void PolymorphismMultiGContainer::clear | ( | ) |
Clear the container.
Definition at line 251 of file PolymorphismMultiGContainer.cpp.
References groups_, groupsNames_, and multilocusGenotypes_.
Referenced by operator=(), and ~PolymorphismMultiGContainer().
|
inlineoverridevirtual |
Implements bpp::Clonable.
Definition at line 65 of file PolymorphismMultiGContainer.h.
References PolymorphismMultiGContainer().
void PolymorphismMultiGContainer::deleteMultilocusGenotype | ( | size_t | position | ) |
Delete a MultilocusGenotype.
IndexOutOfBoundsException | if position exceeds the size of the container. |
Definition at line 85 of file PolymorphismMultiGContainer.cpp.
References groups_, multilocusGenotypes_, and size().
std::set< size_t > PolymorphismMultiGContainer::getAllGroupsIds | ( | ) | const |
Get the groups' ids.
Definition at line 139 of file PolymorphismMultiGContainer.cpp.
References groups_, and size().
Referenced by getNumberOfGroups(), operator=(), bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permuteMonoG(), and PolymorphismMultiGContainer().
std::vector< std::string > PolymorphismMultiGContainer::getAllGroupsNames | ( | ) | const |
Get the groups names or ids if not available.
Definition at line 151 of file PolymorphismMultiGContainer.cpp.
References groupsNames_, and bpp::TextTools::toString().
Referenced by bpp::MultilocusGenotypeStatistics::getDistanceMatrix().
size_t PolymorphismMultiGContainer::getGroupId | ( | size_t | position | ) | const |
Get the Group id of a MultilocusGenotype.
IndexOutOfBoundsException | if position exceeds the size of the container. |
Definition at line 121 of file PolymorphismMultiGContainer.cpp.
References groups_, and size().
Referenced by bpp::MultilocusGenotypeStatistics::countBiAllelicForGroups(), bpp::MultilocusGenotypeStatistics::countHeterozygousForGroups(), bpp::MultilocusGenotypeStatistics::countNonMissingForGroups(), bpp::PolymorphismMultiGContainerTools::extractGroups(), bpp::MultilocusGenotypeStatistics::getAllelesMapForGroups(), bpp::MultilocusGenotypeStatistics::getHeterozygousFrqForGroups(), operator=(), bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permuteMonoG(), and PolymorphismMultiGContainer().
std::string PolymorphismMultiGContainer::getGroupName | ( | size_t | groupId | ) | const |
Get the group name for a given group id or just the id if not available juste return it's id.
Definition at line 193 of file PolymorphismMultiGContainer.cpp.
References groupsNames_, and bpp::TextTools::toString().
Referenced by bpp::PolymorphismMultiGContainerTools::extractGroups(), operator=(), bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permuteMonoG(), and PolymorphismMultiGContainer().
size_t PolymorphismMultiGContainer::getGroupSize | ( | size_t | group | ) | const |
size_t PolymorphismMultiGContainer::getLocusGroupSize | ( | size_t | group, |
size_t | locusPosition | ||
) | const |
Get the size of a group for a given locus.
Definition at line 224 of file PolymorphismMultiGContainer.cpp.
References bpp::IndexOutOfBoundsException::getBadIndex(), bpp::IndexOutOfBoundsException::getBounds(), groups_, multilocusGenotypes_, and size().
Referenced by bpp::MultilocusGenotypeStatistics::getVarianceComponents(), bpp::MultilocusGenotypeStatistics::getWCMultilocusFis(), and bpp::MultilocusGenotypeStatistics::getWCMultilocusFst().
|
inline |
Get the number of groups.
Definition at line 143 of file PolymorphismMultiGContainer.h.
References getAllGroupsIds().
size_t PolymorphismMultiGContainer::getNumberOfLoci | ( | ) | const |
Get the number of loci if the MultilocusGenotypes are aligned.
Exception | if MultilocusGenotypes are not aligned. |
Definition at line 110 of file PolymorphismMultiGContainer.cpp.
References isAligned(), multilocusGenotypes_, and size().
Referenced by bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupMonoG(), and bpp::PolymorphismMultiGContainerTools::permuteMonoG().
bool PolymorphismMultiGContainer::groupExists | ( | size_t | group | ) | const |
Tell if a group exists.
Definition at line 168 of file PolymorphismMultiGContainer.cpp.
References groups_.
bool PolymorphismMultiGContainer::isAligned | ( | ) | const |
Tell if the MultilocusGenotypes are aligned (i.e. same size).
Definition at line 95 of file PolymorphismMultiGContainer.cpp.
References multilocusGenotypes_, and size().
Referenced by getNumberOfLoci().
const MultilocusGenotype & PolymorphismMultiGContainer::multilocusGenotype | ( | size_t | position | ) | const |
Get a MultilocusGenotype at a position.
IndexOutOfBoundsException | if position exceeds the size of the container. |
Definition at line 64 of file PolymorphismMultiGContainer.cpp.
References multilocusGenotypes_, and size().
Referenced by bpp::MultilocusGenotypeStatistics::countBiAllelicForGroups(), bpp::MultilocusGenotypeStatistics::countHeterozygousForGroups(), bpp::MultilocusGenotypeStatistics::countNonMissingForGroups(), bpp::PolymorphismMultiGContainerTools::extractGroups(), bpp::MultilocusGenotypeStatistics::getAllelesMapForGroups(), bpp::MultilocusGenotypeStatistics::getHeterozygousFrqForGroups(), operator=(), bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permuteMonoG(), and PolymorphismMultiGContainer().
PolymorphismMultiGContainer & PolymorphismMultiGContainer::operator= | ( | const PolymorphismMultiGContainer & | pmgc | ) |
The assignation operator=.
Definition at line 31 of file PolymorphismMultiGContainer.cpp.
References clear(), getAllGroupsIds(), getGroupId(), getGroupName(), groups_, groupsNames_, multilocusGenotype(), multilocusGenotypes_, and size().
unique_ptr< MultilocusGenotype > PolymorphismMultiGContainer::removeMultilocusGenotype | ( | size_t | position | ) |
Remove a MultilocusGenotype.
IndexOutOfBoundsException | if position exceeds the size of the container. |
Definition at line 73 of file PolymorphismMultiGContainer.cpp.
References groups_, multilocusGenotypes_, and size().
void PolymorphismMultiGContainer::setGroupId | ( | size_t | position, |
size_t | groupId | ||
) |
Set the Group id of a MultilocusGenotype.
IndexOutOfBoundsException | if position exceeds the size of the container. |
Definition at line 130 of file PolymorphismMultiGContainer.cpp.
void PolymorphismMultiGContainer::setGroupName | ( | size_t | groupId, |
const std::string & | name | ||
) |
Set the name for the given group id.
Definition at line 206 of file PolymorphismMultiGContainer.cpp.
References groupsNames_.
size_t PolymorphismMultiGContainer::size | ( | ) | const |
Get the number of MultilocusGenotype.
Definition at line 244 of file PolymorphismMultiGContainer.cpp.
References multilocusGenotypes_.
Referenced by bpp::MultilocusGenotypeStatistics::countBiAllelicForGroups(), bpp::MultilocusGenotypeStatistics::countHeterozygousForGroups(), bpp::MultilocusGenotypeStatistics::countNonMissingForGroups(), deleteMultilocusGenotype(), bpp::PolymorphismMultiGContainerTools::extractGroups(), bpp::MultilocusGenotypeStatistics::getAllelesMapForGroups(), getAllGroupsIds(), getGroupId(), bpp::MultilocusGenotypeStatistics::getHeterozygousFrqForGroups(), getLocusGroupSize(), getNumberOfLoci(), isAligned(), multilocusGenotype(), operator=(), bpp::PolymorphismMultiGContainerTools::permuteAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permuteIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permuteMonoG(), PolymorphismMultiGContainer(), removeMultilocusGenotype(), and setGroupId().
|
private |
Definition at line 38 of file PolymorphismMultiGContainer.h.
Referenced by addMultilocusGenotype(), clear(), deleteMultilocusGenotype(), getAllGroupsIds(), getGroupId(), getGroupSize(), getLocusGroupSize(), groupExists(), operator=(), PolymorphismMultiGContainer(), removeMultilocusGenotype(), and setGroupId().
|
private |
Definition at line 39 of file PolymorphismMultiGContainer.h.
Referenced by addGroupName(), addMultilocusGenotype(), clear(), getAllGroupsNames(), getGroupName(), operator=(), PolymorphismMultiGContainer(), and setGroupName().
|
private |
Definition at line 37 of file PolymorphismMultiGContainer.h.
Referenced by addMultilocusGenotype(), clear(), deleteMultilocusGenotype(), getLocusGroupSize(), getNumberOfLoci(), isAligned(), multilocusGenotype(), operator=(), PolymorphismMultiGContainer(), removeMultilocusGenotype(), and size().