bpp-popgen  3.0.0
bpp::PolymorphismMultiGContainer Class Reference

The PolymorphismMultiGContainer class. More...

#include <Bpp/PopGen/PolymorphismMultiGContainer.h>

+ Collaboration diagram for bpp::PolymorphismMultiGContainer:

Public Member Functions

 PolymorphismMultiGContainer ()
 Build a new PolymorphismMultilocusGenotypeContainer. More...
 
 PolymorphismMultiGContainer (const PolymorphismMultiGContainer &pmgc)
 The copy constructor. More...
 
 ~PolymorphismMultiGContainer ()
 Destroy a PolymorphismMultilocusGenotypeContainer. More...
 
PolymorphismMultiGContaineroperator= (const PolymorphismMultiGContainer &pmgc)
 The assignation operator=. More...
 
void addMultilocusGenotype (const MultilocusGenotype &mg, size_t group)
 Add a MultilocusGenotype to the container. More...
 
const MultilocusGenotypegetMultilocusGenotype (size_t position) const
 Get a MultilocusGenotype at a position. More...
 
MultilocusGenotyperemoveMultilocusGenotype (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_
 

Detailed Description

The PolymorphismMultiGContainer class.

This class is a container of MultilocusGenotype.

Author
Sylvain Gaillard

Definition at line 67 of file PolymorphismMultiGContainer.h.

Constructor & Destructor Documentation

◆ PolymorphismMultiGContainer() [1/2]

PolymorphismMultiGContainer::PolymorphismMultiGContainer ( )

Build a new PolymorphismMultilocusGenotypeContainer.

Definition at line 47 of file PolymorphismMultiGContainer.cpp.

◆ PolymorphismMultiGContainer() [2/2]

PolymorphismMultiGContainer::PolymorphismMultiGContainer ( const PolymorphismMultiGContainer pmgc)

◆ ~PolymorphismMultiGContainer()

PolymorphismMultiGContainer::~PolymorphismMultiGContainer ( )

Destroy a PolymorphismMultilocusGenotypeContainer.

Definition at line 71 of file PolymorphismMultiGContainer.cpp.

References clear().

Member Function Documentation

◆ addGroupName()

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().

◆ addMultilocusGenotype()

◆ clear()

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().

◆ deleteMultilocusGenotype()

void PolymorphismMultiGContainer::deleteMultilocusGenotype ( size_t  position)

Delete a MultilocusGenotype.

Exceptions
IndexOutOfBoundsExceptionif position excedes the size of the container.

Definition at line 134 of file PolymorphismMultiGContainer.cpp.

References groups_, multilocusGenotypes_, and size().

◆ getAllGroupsIds()

◆ getAllGroupsNames()

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().

◆ getGroupId()

◆ getGroupName()

◆ getGroupSize()

size_t PolymorphismMultiGContainer::getGroupSize ( size_t  group) const

Get group size.

Definition at line 238 of file PolymorphismMultiGContainer.cpp.

References groups_, and size().

◆ getLocusGroupSize()

size_t PolymorphismMultiGContainer::getLocusGroupSize ( size_t  group,
size_t  locus_position 
) const

◆ getMultilocusGenotype()

◆ getNumberOfGroups()

size_t PolymorphismMultiGContainer::getNumberOfGroups ( ) const

Get the number of groups.

Definition at line 231 of file PolymorphismMultiGContainer.cpp.

References getAllGroupsIds().

◆ getNumberOfLoci()

size_t PolymorphismMultiGContainer::getNumberOfLoci ( ) const

◆ groupExists()

bool PolymorphismMultiGContainer::groupExists ( size_t  group) const

Tell if a group exists.

Definition at line 219 of file PolymorphismMultiGContainer.cpp.

References groups_, and size().

◆ isAligned()

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().

◆ operator=()

PolymorphismMultiGContainer & PolymorphismMultiGContainer::operator= ( const PolymorphismMultiGContainer pmgc)

◆ removeMultilocusGenotype()

MultilocusGenotype * PolymorphismMultiGContainer::removeMultilocusGenotype ( size_t  position)

Remove a MultilocusGenotype.

Exceptions
IndexOutOfBoundsExceptionif position excedes the size of the container.

Definition at line 122 of file PolymorphismMultiGContainer.cpp.

References groups_, multilocusGenotypes_, and size().

◆ setGroupId()

void PolymorphismMultiGContainer::setGroupId ( size_t  position,
size_t  group_id 
)

Set the Group id of a MultilocusGenotype.

Exceptions
IndexOutOfBoundsExceptionif position excedes the size of the container.

Definition at line 180 of file PolymorphismMultiGContainer.cpp.

References groups_, and size().

Referenced by bpp::PolymorphismMultiGContainerTools::permutMultiG().

◆ setGroupName()

◆ size()

Member Data Documentation

◆ groups_

◆ groups_names_

std::map<size_t, std::string> bpp::PolymorphismMultiGContainer::groups_names_
private

◆ multilocusGenotypes_


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