bpp-popgen3
3.0.0
|
#include <Bpp/PopGen/DataSet/Group.h>
Public Member Functions | |
Group (size_t groupId) | |
Build a void new Group. More... | |
Group (const Group &group) | |
Copy constructor. More... | |
Group & | operator= (const Group &group) |
The assignation operator =. More... | |
Group (const Group &group, size_t groupId) | |
A duplication constructor with new Group Id. More... | |
virtual | ~Group ()=default |
Destroy a Group. More... | |
Group * | clone () const override |
void | setGroupId (size_t groupId) |
Set the id of the Group. More... | |
const std::string & | getGroupName () const |
Get the name of the Group. More... | |
void | setGroupName (const std::string &groupName) |
Set the name of the Group. More... | |
size_t | getGroupId () const |
Get the id of the Group. More... | |
void | addIndividual (const Individual &ind) |
Add an Individual. More... | |
void | addEmptyIndividual (const std::string &individualId) |
Add an empty Individual to the Group. More... | |
size_t | getNumberOfIndividuals () const |
Get the number of Individual in the Group. More... | |
size_t | getMaxNumberOfSequences () const |
Get the maximum number of sequence. More... | |
size_t | getIndividualPosition (const std::string &individualId) const |
Get the position of an Individual. More... | |
const Individual & | getIndividualById (const std::string &individualId) const |
Get a reference to an Individual. More... | |
const Individual & | getIndividualAtPosition (size_t individualPosition) const |
Get a reference to an Individual by its position. More... | |
std::unique_ptr< Individual > | removeIndividualById (const std::string &individualId) |
Remove an Individual from the Group. More... | |
std::unique_ptr< Individual > | removeIndividualAtPosition (size_t individualPosition) |
Remove an Individual from the Group. More... | |
void | deleteIndividualById (const std::string &individualId) |
Delete an Individual from the Group. More... | |
void | deleteIndividualAtPosition (size_t individualPosition) |
Delete an Individual from the Group. More... | |
void | clear () |
Clear the Group. More... | |
void | setIndividualSexAtPosition (size_t individualPosition, const unsigned short sex) |
Set the sex of an Individual. More... | |
unsigned short | getIndividualSexAtPosition (size_t individualPosition) const |
Get the sex of an Individual. More... | |
void | setIndividualDateAtPosition (size_t individualPosition, const Date &date) |
Set the date of an Individual. More... | |
const Date & | getIndividualDateAtPosition (size_t individualPosition) const |
Get the date of an Individual. More... | |
void | setIndividualCoordAtPosition (size_t individualPosition, const Point2D< double > &coord) |
Set the coordinates of an Individual. More... | |
const Point2D< double > & | getIndividualCoordAtPosition (size_t individualPosition) const |
Get the coordinates of an Individual. More... | |
void | setIndividualLocalityAtPosition (size_t individualPosition, std::shared_ptr< const Locality< double >> locality) |
Set the locality of an Individual. More... | |
std::shared_ptr< const Locality< double > > | getIndividualLocalityAtPosition (size_t individualPosition) const |
Get the locality of an Individual. More... | |
void | addIndividualSequenceAtPosition (size_t individualPosition, size_t sequencePosition, std::unique_ptr< Sequence > &sequence) |
Add a sequence to an Individual. More... | |
const Sequence & | getIndividualSequenceByName (size_t individualPosition, const std::string &sequence_name) const |
Get a sequence of an Individual. More... | |
const Sequence & | getIndividualSequenceAtPosition (size_t individualPosition, size_t sequencePosition) const |
Get a sequence of an Individual. More... | |
void | deleteIndividualSequenceByName (size_t individualPosition, const std::string &sequence_name) |
Delete a sequence of an Individual. More... | |
void | deleteIndividualSequenceAtPosition (size_t individualPosition, size_t sequencePosition) |
Delete a sequence of an Individual. More... | |
bool | hasIndividualSequences (size_t individualPosition) const |
Tell if the Individual has some sequences. More... | |
std::vector< std::string > | getIndividualSequencesNames (size_t individualPosition) const |
Get the sequences' names from an Individual. More... | |
size_t | getIndividualSequencePosition (size_t individualPosition, const std::string &sequence_name) const |
Get the position of a sequence in an Individual. More... | |
size_t | getIndividualNumberOfSequences (size_t individualPosition) const |
Get the number of sequences in an Individual. More... | |
void | setIndividualSequences (size_t individualPosition, const SequenceContainerInterface &sc) |
Set all the sequences by copying an OrderedSequenceContainer. More... | |
void | setIndividualGenotype (size_t individualPosition, const MultilocusGenotype &genotype) |
Set the genotype of an Individual. More... | |
void | initIndividualGenotype (size_t individualPosition, size_t loci_number) |
Initialize the genotype of an Individual. More... | |
void | deleteIndividualGenotype (size_t individualPosition) |
Delete the genotype of an Individual. More... | |
bool | hasIndividualGenotype (size_t individualPosition) const |
Tell if an Individual has a genotype. More... | |
void | setIndividualMonolocusGenotype (size_t individualPosition, size_t locusPosition, const MonolocusGenotypeInterface &monogen) |
Set a MonolocusGenotype of an Individual. More... | |
void | setIndividualMonolocusGenotypeByAlleleKey (size_t individualPosition, size_t locusPosition, const std::vector< size_t > &alleleKeys) |
Set a MonolocusGenotype of an Individual. More... | |
void | setIndividualMonolocusGenotypeByAlleleId (size_t individualPosition, size_t locusPosition, const std::vector< std::string > &alleleId, const LocusInfo &locusInfo) |
Set a MonolocusGenotype of an Individual. More... | |
const MonolocusGenotypeInterface & | getIndividualMonolocusGenotype (size_t individualPosition, size_t locusPosition) const |
Get a MonolocusGenotype of an Individual. More... | |
bool | hasSequenceData () const |
Tell if at least one individual has at least one sequence. More... | |
std::shared_ptr< const Alphabet > | getAlphabet () const |
Get the alphabet used for the sequences. More... | |
size_t | getGroupSizeForLocus (size_t locusPosition) const |
Get the number of individual that have a data at the specified locus. More... | |
size_t | getGroupSizeForSequence (size_t sequencePosition) const |
Get the number of individual that have a sequence at the specified position. More... | |
Protected Attributes | |
size_t | id_ |
std::string | name_ |
std::vector< std::unique_ptr< Individual > > | individuals_ |
The Group class.
A Group is an ensembl of Individuals with some statistics like the average allele number.
|
inline |
|
inline |
Copy constructor.
If you need to use a copy constructor in a DataSet context, use the one which specify a new Group Id.
Definition at line 59 of file Group.h.
References addIndividual(), getIndividualAtPosition(), and getNumberOfIndividuals().
|
inline |
A duplication constructor with new Group Id.
Definition at line 88 of file Group.h.
References addIndividual(), getIndividualAtPosition(), and getNumberOfIndividuals().
|
virtualdefault |
Destroy a Group.
void Group::addEmptyIndividual | ( | const std::string & | individualId | ) |
Add an empty Individual to the Group.
BadIdentifierException | if individualId is already in use. |
void Group::addIndividual | ( | const Individual & | ind | ) |
Add an Individual.
Add an Individual to the group.
ind | The Individual to add to the Group. |
BadIdentifierException | if individual's identifier is already in use. |
Definition at line 12 of file Group.cpp.
References bpp::Individual::getId().
Referenced by Group(), operator=(), and bpp::DataSet::splitGroup().
void Group::addIndividualSequenceAtPosition | ( | size_t | individualPosition, |
size_t | sequencePosition, | ||
std::unique_ptr< Sequence > & | sequence | ||
) |
Add a sequence to an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
AlphabetMismatchException | if the sequence's alphabet doesn't match the container's alphabet. |
BadIdentifierException | if the sequence's name is already in use. |
BadIntegerException | if sequencePosition is already in use. |
Definition at line 203 of file Group.cpp.
References bpp::AlphabetMismatchException::getFirstAlphabet(), bpp::BadIdentifierException::getIdentifier(), and bpp::AlphabetMismatchException::getSecondAlphabet().
|
inline |
Clear the Group.
Delete all the Individuals of the group.
Definition at line 245 of file Group.h.
References individuals_.
|
inlineoverridevirtual |
void Group::deleteIndividualAtPosition | ( | size_t | individualPosition | ) |
Delete an Individual from the Group.
individualPosition | The position in the Group of the Individual to delete. |
Free the memory by calling the destructor of the Individual.
void Group::deleteIndividualById | ( | const std::string & | individualId | ) |
Delete an Individual from the Group.
individualId | The id of the Individual to delete. |
IndividualNotFoundException | if individualId is not found. |
Search an Individual in the Group by checking the id and delete it if it is foundi and free the memory by calling the destructor of the Individual.
void Group::deleteIndividualGenotype | ( | size_t | individualPosition | ) |
Delete the genotype of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
void Group::deleteIndividualSequenceAtPosition | ( | size_t | individualPosition, |
size_t | sequencePosition | ||
) |
Delete a sequence of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequencePosition is not found. |
Definition at line 279 of file Group.cpp.
References bpp::SequenceNotFoundException::getSequenceId().
void Group::deleteIndividualSequenceByName | ( | size_t | individualPosition, |
const std::string & | sequence_name | ||
) |
Delete a sequence of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_name is not found. |
Definition at line 261 of file Group.cpp.
References bpp::SequenceNotFoundException::getSequenceId().
shared_ptr< const Alphabet > Group::getAlphabet | ( | ) | const |
|
inline |
|
inline |
size_t Group::getGroupSizeForLocus | ( | size_t | locusPosition | ) | const |
size_t Group::getGroupSizeForSequence | ( | size_t | sequencePosition | ) | const |
const Individual & Group::getIndividualAtPosition | ( | size_t | individualPosition | ) | const |
Get a reference to an Individual by its position.
individualPosition | The position of the Individual in the group. |
IndividualNotFoundException | if individualId is not found. |
Definition at line 102 of file Group.cpp.
Referenced by Group(), bpp::DataSet::mergeGroups(), and operator=().
const Individual & Group::getIndividualById | ( | const std::string & | individualId | ) | const |
Get a reference to an Individual.
individualId | The id of the Individual to find. |
const Point2D< double > & Group::getIndividualCoordAtPosition | ( | size_t | individualPosition | ) | const |
Get the coordinates of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if the individual has no coordinate. |
const Date & Group::getIndividualDateAtPosition | ( | size_t | individualPosition | ) | const |
Get the date of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if the Individual has no date. |
std::shared_ptr< const Locality< double > > Group::getIndividualLocalityAtPosition | ( | size_t | individualPosition | ) | const |
Get the locality of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if the individual has no locality. |
const MonolocusGenotypeInterface & Group::getIndividualMonolocusGenotype | ( | size_t | individualPosition, |
size_t | locusPosition | ||
) | const |
Get a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locusPosition exceeds the number of locus. |
Definition at line 464 of file Group.cpp.
References bpp::IndexOutOfBoundsException::getBadIndex(), and bpp::IndexOutOfBoundsException::getBounds().
size_t Group::getIndividualNumberOfSequences | ( | size_t | individualPosition | ) | const |
Get the number of sequences in an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
size_t Group::getIndividualPosition | ( | const std::string & | individualId | ) | const |
Get the position of an Individual.
IndividualNotFoundException | if individualId is not found. |
const Sequence & Group::getIndividualSequenceAtPosition | ( | size_t | individualPosition, |
size_t | sequencePosition | ||
) | const |
Get a sequence of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequencePosition is not found. |
Definition at line 243 of file Group.cpp.
References bpp::SequenceNotFoundException::getSequenceId().
const Sequence & Group::getIndividualSequenceByName | ( | size_t | individualPosition, |
const std::string & | sequence_name | ||
) | const |
Get a sequence of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_name is not found. |
Definition at line 225 of file Group.cpp.
References bpp::SequenceNotFoundException::getSequenceId().
size_t Group::getIndividualSequencePosition | ( | size_t | individualPosition, |
const std::string & | sequence_name | ||
) | const |
Get the position of a sequence in an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_name is not found. |
Definition at line 318 of file Group.cpp.
References bpp::SequenceNotFoundException::getSequenceId().
vector< string > Group::getIndividualSequencesNames | ( | size_t | individualPosition | ) | const |
Get the sequences' names from an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
unsigned short Group::getIndividualSexAtPosition | ( | size_t | individualPosition | ) | const |
Get the sex of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
size_t Group::getMaxNumberOfSequences | ( | ) | const |
|
inline |
Get the number of Individual in the Group.
Definition at line 158 of file Group.h.
References individuals_.
Referenced by Group(), bpp::DataSet::mergeGroups(), and operator=().
bool Group::hasIndividualGenotype | ( | size_t | individualPosition | ) | const |
Tell if an Individual has a genotype.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
bool Group::hasIndividualSequences | ( | size_t | individualPosition | ) | const |
Tell if the Individual has some sequences.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
bool Group::hasSequenceData | ( | ) | const |
void Group::initIndividualGenotype | ( | size_t | individualPosition, |
size_t | loci_number | ||
) |
Initialize the genotype of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
BadIntegerException | if loci_number < 1. |
Exception | if the individual already has a genotype. |
Definition at line 364 of file Group.cpp.
References bpp::BadIntegerException::getBadInteger().
The assignation operator =.
Definition at line 73 of file Group.h.
References addIndividual(), getIndividualAtPosition(), getNumberOfIndividuals(), id_, individuals_, and name_.
std::unique_ptr< Individual > Group::removeIndividualAtPosition | ( | size_t | individualPosition | ) |
Remove an Individual from the Group.
individualPosition | The position in the Group of the Individual to remove. |
Remove the individual at the specified position and return a pointer to this Individual.
unique_ptr< Individual > Group::removeIndividualById | ( | const std::string & | individualId | ) |
Remove an Individual from the Group.
individualId | The id of the Individual to remove. |
IndividualNotFoundException | if individualId is not found. |
Search an Individual in the Group by checking the id and remove it if it is found then return a pointer to this Individual.
|
inline |
|
inline |
void Group::setIndividualCoordAtPosition | ( | size_t | individualPosition, |
const Point2D< double > & | coord | ||
) |
Set the coordinates of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
void Group::setIndividualDateAtPosition | ( | size_t | individualPosition, |
const Date & | date | ||
) |
Set the date of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
void Group::setIndividualGenotype | ( | size_t | individualPosition, |
const MultilocusGenotype & | genotype | ||
) |
Set the genotype of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
void Group::setIndividualLocalityAtPosition | ( | size_t | individualPosition, |
std::shared_ptr< const Locality< double >> | locality | ||
) |
Set the locality of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
void Group::setIndividualMonolocusGenotype | ( | size_t | individualPosition, |
size_t | locusPosition, | ||
const MonolocusGenotypeInterface & | monogen | ||
) |
Set a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locusPosition exceeds the number of locus. |
Definition at line 396 of file Group.cpp.
References bpp::IndexOutOfBoundsException::getBadIndex(), and bpp::IndexOutOfBoundsException::getBounds().
void Group::setIndividualMonolocusGenotypeByAlleleId | ( | size_t | individualPosition, |
size_t | locusPosition, | ||
const std::vector< std::string > & | alleleId, | ||
const LocusInfo & | locusInfo | ||
) |
Set a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locusPosition exceeds the number of locus. |
AlleleNotFoundException | if at least one id is not found in locus_info. |
Definition at line 442 of file Group.cpp.
References bpp::IndexOutOfBoundsException::getBadIndex(), bpp::IndexOutOfBoundsException::getBounds(), and bpp::AlleleNotFoundException::getIdentifier().
void Group::setIndividualMonolocusGenotypeByAlleleKey | ( | size_t | individualPosition, |
size_t | locusPosition, | ||
const std::vector< size_t > & | alleleKeys | ||
) |
Set a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locusPosition exceeds the number of locus. |
Exception | if there is no key in allele_keys. |
Definition at line 417 of file Group.cpp.
References bpp::IndexOutOfBoundsException::getBadIndex(), and bpp::IndexOutOfBoundsException::getBounds().
void Group::setIndividualSequences | ( | size_t | individualPosition, |
const SequenceContainerInterface & | sc | ||
) |
Set all the sequences by copying an OrderedSequenceContainer.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
void Group::setIndividualSexAtPosition | ( | size_t | individualPosition, |
const unsigned short | sex | ||
) |
Set the sex of an Individual.
IndexOutOfBoundsException | if individualPosition exceeds the number of individuals. |
|
protected |
Definition at line 38 of file Group.h.
Referenced by getGroupId(), operator=(), and setGroupId().
|
protected |
Definition at line 40 of file Group.h.
Referenced by clear(), getNumberOfIndividuals(), and operator=().
|
protected |
Definition at line 39 of file Group.h.
Referenced by getGroupName(), operator=(), and setGroupName().