bpp-popgen3  3.0.0
bpp::PolymorphismMultiGContainer Class Reference

The PolymorphismMultiGContainer class. More...

#include <Bpp/PopGen/PolymorphismMultiGContainer.h>

+ Inheritance diagram for bpp::PolymorphismMultiGContainer:
+ Collaboration diagram for bpp::PolymorphismMultiGContainer:

Public Member Functions

 PolymorphismMultiGContainer ()
 Build a new PolymorphismMultilocusGenotypeContainer. More...
 
 PolymorphismMultiGContainer (const PolymorphismMultiGContainer &pmgc)
 The copy constructor. More...
 
virtual ~PolymorphismMultiGContainer ()
 Destroy a PolymorphismMultilocusGenotypeContainer. More...
 
PolymorphismMultiGContainerclone () const override
 
PolymorphismMultiGContaineroperator= (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 MultilocusGenotypemultilocusGenotype (size_t position) const
 Get a MultilocusGenotype at a position. More...
 
std::unique_ptr< 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 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_
 

Detailed Description

The PolymorphismMultiGContainer class.

This class is a container of MultilocusGenotype.

Author
Sylvain Gaillard

Definition at line 33 of file PolymorphismMultiGContainer.h.

Constructor & Destructor Documentation

◆ PolymorphismMultiGContainer() [1/2]

bpp::PolymorphismMultiGContainer::PolymorphismMultiGContainer ( )
inline

Build a new PolymorphismMultilocusGenotypeContainer.

Definition at line 46 of file PolymorphismMultiGContainer.h.

Referenced by clone().

◆ PolymorphismMultiGContainer() [2/2]

PolymorphismMultiGContainer::PolymorphismMultiGContainer ( const PolymorphismMultiGContainer pmgc)

◆ ~PolymorphismMultiGContainer()

virtual bpp::PolymorphismMultiGContainer::~PolymorphismMultiGContainer ( )
inlinevirtual

Destroy a PolymorphismMultilocusGenotypeContainer.

Definition at line 60 of file PolymorphismMultiGContainer.h.

References clear().

Member Function Documentation

◆ addGroupName()

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_.

◆ addMultilocusGenotype()

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_.

◆ clear()

void PolymorphismMultiGContainer::clear ( )

Clear the container.

Definition at line 251 of file PolymorphismMultiGContainer.cpp.

References groups_, groupsNames_, and multilocusGenotypes_.

Referenced by operator=(), and ~PolymorphismMultiGContainer().

◆ clone()

PolymorphismMultiGContainer* bpp::PolymorphismMultiGContainer::clone ( ) const
inlineoverridevirtual

Implements bpp::Clonable.

Definition at line 65 of file PolymorphismMultiGContainer.h.

References PolymorphismMultiGContainer().

◆ deleteMultilocusGenotype()

void PolymorphismMultiGContainer::deleteMultilocusGenotype ( size_t  position)

Delete a MultilocusGenotype.

Exceptions
IndexOutOfBoundsExceptionif position exceeds the size of the container.

Definition at line 85 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 151 of file PolymorphismMultiGContainer.cpp.

References groupsNames_, 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 180 of file PolymorphismMultiGContainer.cpp.

References groups_.

◆ getLocusGroupSize()

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

◆ getNumberOfGroups()

size_t bpp::PolymorphismMultiGContainer::getNumberOfGroups ( ) const
inline

Get the number of groups.

Definition at line 143 of file PolymorphismMultiGContainer.h.

References getAllGroupsIds().

◆ getNumberOfLoci()

size_t PolymorphismMultiGContainer::getNumberOfLoci ( ) const

◆ groupExists()

bool PolymorphismMultiGContainer::groupExists ( size_t  group) const

Tell if a group exists.

Definition at line 168 of file PolymorphismMultiGContainer.cpp.

References groups_.

◆ isAligned()

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

◆ multilocusGenotype()

◆ operator=()

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

◆ removeMultilocusGenotype()

unique_ptr< MultilocusGenotype > PolymorphismMultiGContainer::removeMultilocusGenotype ( size_t  position)

Remove a MultilocusGenotype.

Exceptions
IndexOutOfBoundsExceptionif position exceeds the size of the container.

Definition at line 73 of file PolymorphismMultiGContainer.cpp.

References groups_, multilocusGenotypes_, and size().

◆ setGroupId()

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

Set the Group id of a MultilocusGenotype.

Exceptions
IndexOutOfBoundsExceptionif position exceeds the size of the container.

Definition at line 130 of file PolymorphismMultiGContainer.cpp.

References groups_, and size().

◆ setGroupName()

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

Member Data Documentation

◆ groups_

◆ groupsNames_

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

◆ multilocusGenotypes_

std::vector<std::unique_ptr<MultilocusGenotype> > bpp::PolymorphismMultiGContainer::multilocusGenotypes_
private

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