bpp-popgen
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... | |
~PolymorphismMultiGContainer () | |
Destroy a PolymorphismMultilocusGenotypeContainer. More... | |
PolymorphismMultiGContainer & | operator= (const PolymorphismMultiGContainer &pmgc) |
The assignation operator=. More... | |
void | addMultilocusGenotype (const MultilocusGenotype &mg, size_t group) |
Add a MultilocusGenotype to the container. More... | |
const MultilocusGenotype * | getMultilocusGenotype (size_t position) const |
Get a MultilocusGenotype at a position. More... | |
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 group_id) |
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 group_id) 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 group_id, std::string name) |
Set the name for the given group id. More... | |
void | addGroupName (size_t group_id, std::string name) |
Inserts a name for the given group id. More... | |
size_t | getLocusGroupSize (size_t group, size_t locus_position) 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< MultilocusGenotype * > | multilocusGenotypes_ |
std::vector< size_t > | groups_ |
std::map< size_t, std::string > | groups_names_ |
The PolymorphismMultiGContainer class.
This class is a container of MultilocusGenotype.
Definition at line 67 of file PolymorphismMultiGContainer.h.
PolymorphismMultiGContainer::PolymorphismMultiGContainer | ( | ) |
Build a new PolymorphismMultilocusGenotypeContainer.
Definition at line 47 of file PolymorphismMultiGContainer.cpp.
PolymorphismMultiGContainer::PolymorphismMultiGContainer | ( | const PolymorphismMultiGContainer & | pmgc | ) |
The copy constructor.
Definition at line 51 of file PolymorphismMultiGContainer.cpp.
References getAllGroupsIds(), getGroupId(), getGroupName(), getMultilocusGenotype(), groups_, groups_names_, multilocusGenotypes_, and size().
PolymorphismMultiGContainer::~PolymorphismMultiGContainer | ( | ) |
Destroy a PolymorphismMultilocusGenotypeContainer.
Definition at line 71 of file PolymorphismMultiGContainer.cpp.
References clear().
void PolymorphismMultiGContainer::addGroupName | ( | size_t | group_id, |
std::string | name | ||
) |
Inserts a name for the given group id.
Definition at line 276 of file PolymorphismMultiGContainer.cpp.
References groups_names_.
Referenced by bpp::DataSet::getPolymorphismMultiGContainer().
void PolymorphismMultiGContainer::addMultilocusGenotype | ( | const MultilocusGenotype & | mg, |
size_t | group | ||
) |
Add a MultilocusGenotype to the container.
Definition at line 99 of file PolymorphismMultiGContainer.cpp.
References groups_, groups_names_, and multilocusGenotypes_.
Referenced by bpp::PolymorphismMultiGContainerTools::extractGroups(), bpp::DataSet::getPolymorphismMultiGContainer(), bpp::PolymorphismMultiGContainerTools::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), and bpp::PolymorphismMultiGContainerTools::permutMonoG().
void PolymorphismMultiGContainer::clear | ( | ) |
Clear the container.
Definition at line 311 of file PolymorphismMultiGContainer.cpp.
References groups_, groups_names_, and multilocusGenotypes_.
Referenced by operator=(), and ~PolymorphismMultiGContainer().
void PolymorphismMultiGContainer::deleteMultilocusGenotype | ( | size_t | position | ) |
Delete a MultilocusGenotype.
IndexOutOfBoundsException | if position excedes the size of the container. |
Definition at line 134 of file PolymorphismMultiGContainer.cpp.
References groups_, multilocusGenotypes_, and size().
std::set< size_t > PolymorphismMultiGContainer::getAllGroupsIds | ( | ) | const |
Get the groups' ids.
Definition at line 189 of file PolymorphismMultiGContainer.cpp.
References groups_, and size().
Referenced by bpp::PolymorphismMultiGContainerTools::extractGroups(), getNumberOfGroups(), operator=(), bpp::PolymorphismMultiGContainerTools::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permutMonoG(), and PolymorphismMultiGContainer().
std::vector< std::string > PolymorphismMultiGContainer::getAllGroupsNames | ( | ) | const |
Get the groups names or ids if not available.
Definition at line 201 of file PolymorphismMultiGContainer.cpp.
References groups_names_, 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 excedes the size of the container. |
Definition at line 171 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::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permutMonoG(), bpp::PolymorphismMultiGContainerTools::permutMultiG(), and PolymorphismMultiGContainer().
std::string PolymorphismMultiGContainer::getGroupName | ( | size_t | group_id | ) | 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 251 of file PolymorphismMultiGContainer.cpp.
References groups_names_, and bpp::TextTools::toString().
Referenced by bpp::PolymorphismMultiGContainerTools::extractGroups(), operator=(), bpp::PolymorphismMultiGContainerTools::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permutMonoG(), and PolymorphismMultiGContainer().
size_t PolymorphismMultiGContainer::getGroupSize | ( | size_t | group | ) | const |
Get group size.
Definition at line 238 of file PolymorphismMultiGContainer.cpp.
size_t PolymorphismMultiGContainer::getLocusGroupSize | ( | size_t | group, |
size_t | locus_position | ||
) | const |
Get the size of a group for a given locus.
Definition at line 284 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().
const MultilocusGenotype * PolymorphismMultiGContainer::getMultilocusGenotype | ( | size_t | position | ) | const |
Get a MultilocusGenotype at a position.
IndexOutOfBoundsException | if position excedes the size of the container. |
Definition at line 113 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::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permutMonoG(), and PolymorphismMultiGContainer().
size_t PolymorphismMultiGContainer::getNumberOfGroups | ( | ) | const |
Get the number of groups.
Definition at line 231 of file PolymorphismMultiGContainer.cpp.
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 160 of file PolymorphismMultiGContainer.cpp.
References isAligned(), multilocusGenotypes_, and size().
Referenced by bpp::PolymorphismMultiGContainerTools::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), and bpp::PolymorphismMultiGContainerTools::permutMonoG().
bool PolymorphismMultiGContainer::groupExists | ( | size_t | group | ) | const |
Tell if a group exists.
Definition at line 219 of file PolymorphismMultiGContainer.cpp.
bool PolymorphismMultiGContainer::isAligned | ( | ) | const |
Tell if the MultilocusGenotypes are aligned (i.e. same size).
Definition at line 145 of file PolymorphismMultiGContainer.cpp.
References multilocusGenotypes_, and size().
Referenced by getNumberOfLoci().
PolymorphismMultiGContainer & PolymorphismMultiGContainer::operator= | ( | const PolymorphismMultiGContainer & | pmgc | ) |
The assignation operator=.
Definition at line 78 of file PolymorphismMultiGContainer.cpp.
References clear(), getAllGroupsIds(), getGroupId(), getGroupName(), getMultilocusGenotype(), groups_, groups_names_, multilocusGenotypes_, and size().
MultilocusGenotype * PolymorphismMultiGContainer::removeMultilocusGenotype | ( | size_t | position | ) |
Remove a MultilocusGenotype.
IndexOutOfBoundsException | if position excedes the size of the container. |
Definition at line 122 of file PolymorphismMultiGContainer.cpp.
References groups_, multilocusGenotypes_, and size().
void PolymorphismMultiGContainer::setGroupId | ( | size_t | position, |
size_t | group_id | ||
) |
Set the Group id of a MultilocusGenotype.
IndexOutOfBoundsException | if position excedes the size of the container. |
Definition at line 180 of file PolymorphismMultiGContainer.cpp.
References groups_, and size().
Referenced by bpp::PolymorphismMultiGContainerTools::permutMultiG().
void PolymorphismMultiGContainer::setGroupName | ( | size_t | group_id, |
std::string | name | ||
) |
Set the name for the given group id.
Definition at line 264 of file PolymorphismMultiGContainer.cpp.
References groups_names_.
Referenced by bpp::PolymorphismMultiGContainerTools::extractGroups(), bpp::PolymorphismMultiGContainerTools::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), and bpp::PolymorphismMultiGContainerTools::permutMonoG().
size_t PolymorphismMultiGContainer::size | ( | ) | const |
Get the number of MultilocusGenotype.
Definition at line 304 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(), getGroupSize(), bpp::MultilocusGenotypeStatistics::getHeterozygousFrqForGroups(), getLocusGroupSize(), getMultilocusGenotype(), getNumberOfLoci(), groupExists(), isAligned(), operator=(), bpp::PolymorphismMultiGContainerTools::permutAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupAlleles(), bpp::PolymorphismMultiGContainerTools::permutIntraGroupMonoG(), bpp::PolymorphismMultiGContainerTools::permutMonoG(), bpp::PolymorphismMultiGContainerTools::permutMultiG(), PolymorphismMultiGContainer(), removeMultilocusGenotype(), and setGroupId().
|
private |
Definition at line 71 of file PolymorphismMultiGContainer.h.
Referenced by addMultilocusGenotype(), clear(), deleteMultilocusGenotype(), getAllGroupsIds(), getGroupId(), getGroupSize(), getLocusGroupSize(), groupExists(), operator=(), PolymorphismMultiGContainer(), removeMultilocusGenotype(), and setGroupId().
|
private |
Definition at line 72 of file PolymorphismMultiGContainer.h.
Referenced by addGroupName(), addMultilocusGenotype(), clear(), getAllGroupsNames(), getGroupName(), operator=(), PolymorphismMultiGContainer(), and setGroupName().
|
private |
Definition at line 70 of file PolymorphismMultiGContainer.h.
Referenced by addMultilocusGenotype(), clear(), deleteMultilocusGenotype(), getLocusGroupSize(), getMultilocusGenotype(), getNumberOfLoci(), isAligned(), operator=(), PolymorphismMultiGContainer(), removeMultilocusGenotype(), and size().