bpp-popgen
2.2.0
|
#include <Bpp/PopGen/Group.h>
Public Member Functions | |
Group (size_t group_id) | |
Build a void new Group. More... | |
Group (const Group &group) | |
Copy constructor. More... | |
Group (const Group &group, size_t group_id) | |
A duplication constructor with new Group Id. More... | |
~Group () | |
Destroy an Group. More... | |
Group & | operator= (const Group &group) |
The assignation operator =. More... | |
void | setGroupId (size_t group_id) |
Set the id of the Group. More... | |
const std::string & | getGroupName () const |
Get the name of the Group. More... | |
void | setGroupName (const std::string &group_name) |
Set the name of the Group. More... | |
size_t | getGroupId () const |
Get the id of the Group. More... | |
void | addIndividual (const Individual &ind) throw (BadIdentifierException) |
Add an Individual. More... | |
void | addEmptyIndividual (const std::string &individual_id) throw (BadIdentifierException) |
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 &individual_id) const throw (IndividualNotFoundException) |
Get the position of an Individual. More... | |
const Individual & | getIndividualById (const std::string &individual_id) const throw (IndividualNotFoundException) |
Get a reference to an Individual. More... | |
const Individual & | getIndividualAtPosition (size_t individual_position) const throw (IndexOutOfBoundsException) |
Get a reference to an Individual by its position. More... | |
std::auto_ptr< Individual > | removeIndividualById (const std::string &individual_id) throw (IndividualNotFoundException) |
Remove an Individual from the Group. More... | |
std::auto_ptr< Individual > | removeIndividualAtPosition (size_t individual_position) throw (IndexOutOfBoundsException) |
Remove an Individual from the Group. More... | |
void | deleteIndividualById (const std::string &individual_id) throw (IndividualNotFoundException) |
Delete an Individual from the Group. More... | |
void | deleteIndividualAtPosition (size_t individual_position) throw (IndexOutOfBoundsException) |
Delete an Individual from the Group. More... | |
void | clear () |
Clear the Group. More... | |
void | setIndividualSexAtPosition (size_t individual_position, const unsigned short sex) throw (IndexOutOfBoundsException) |
Set the sex of an Individual. More... | |
unsigned short | getIndividualSexAtPosition (size_t individual_position) const throw (IndexOutOfBoundsException) |
Get the sex of an Individual. More... | |
void | setIndividualDateAtPosition (size_t individual_position, const Date &date) throw (IndexOutOfBoundsException) |
Set the date of an Individual. More... | |
const Date & | getIndividualDateAtPosition (size_t individual_position) const throw (Exception) |
Get the date of an Individual. More... | |
void | setIndividualCoordAtPosition (size_t individual_position, const Point2D< double > &coord) throw (IndexOutOfBoundsException) |
Set the coordinates of an Individual. More... | |
const Point2D< double > & | getIndividualCoordAtPosition (size_t individual_position) const throw (Exception) |
Get the coordinates of an Individual. More... | |
void | setIndividualLocalityAtPosition (size_t individual_position, const Locality< double > *locality) throw (IndexOutOfBoundsException) |
Set the locality of an Individual. More... | |
const Locality< double > & | getIndividualLocalityAtPosition (size_t individual_position) const throw (Exception) |
Get the locality of an Individual. More... | |
void | addIndividualSequenceAtPosition (size_t individual_position, size_t sequence_position, const Sequence &sequence) throw (Exception) |
Add a sequence to an Individual. More... | |
const Sequence & | getIndividualSequenceByName (size_t individual_position, const std::string &sequence_name) const throw (Exception) |
Get a sequence of an Individual. More... | |
const Sequence & | getIndividualSequenceAtPosition (size_t individual_position, size_t sequence_position) const throw (Exception) |
Get a sequence of an Individual. More... | |
void | deleteIndividualSequenceByName (size_t individual_position, const std::string &sequence_name) throw (Exception) |
Delete a sequence of an Individual. More... | |
void | deleteIndividualSequenceAtPosition (size_t individual_position, size_t sequence_position) throw (Exception) |
Delete a sequence of an Individual. More... | |
bool | hasIndividualSequences (size_t individual_position) const throw (IndexOutOfBoundsException) |
Tell if the Individual has some sequences. More... | |
std::vector< std::string > | getIndividualSequencesNames (size_t individual_position) const throw (Exception) |
Get the sequences' names from an Individual. More... | |
size_t | getIndividualSequencePosition (size_t individual_position, const std::string &sequence_name) const throw (Exception) |
Get the position of a sequence in an Individual. More... | |
size_t | getIndividualNumberOfSequences (size_t individual_position) const throw (Exception) |
Get the number of sequences in an Individual. More... | |
void | setIndividualSequences (size_t individual_position, const MapSequenceContainer &msc) throw (IndexOutOfBoundsException) |
Set all the sequences by copying an OrderedSequenceContainer. More... | |
void | setIndividualGenotype (size_t individual_position, const MultilocusGenotype &genotype) throw (IndexOutOfBoundsException) |
Set the genotype of an Individual. More... | |
void | initIndividualGenotype (size_t individual_position, size_t loci_number) throw (Exception) |
Initialyze the genotype of an Individual. More... | |
void | deleteIndividualGenotype (size_t individual_position) throw (IndexOutOfBoundsException) |
Delete the genotype of an Individual. More... | |
bool | hasIndividualGenotype (size_t individual_position) const throw (IndexOutOfBoundsException) |
Tell if an Individual has a genotype. More... | |
void | setIndividualMonolocusGenotype (size_t individual_position, size_t locus_position, const MonolocusGenotype &monogen) throw (Exception) |
Set a MonolocusGenotype of an Individual. More... | |
void | setIndividualMonolocusGenotypeByAlleleKey (size_t individual_position, size_t locus_position, const std::vector< size_t > &allele_keys) throw (Exception) |
Set a MonolocusGenotype of an Individual. More... | |
void | setIndividualMonolocusGenotypeByAlleleId (size_t individual_position, size_t locus_position, const std::vector< std::string > &allele_id, const LocusInfo &locus_info) throw (Exception) |
Set a MonolocusGenotype of an Individual. More... | |
const MonolocusGenotype & | getIndividualMonolocusGenotype (size_t individual_position, size_t locus_position) const throw (Exception) |
Get a MonolocusGenotype of an Individual. More... | |
bool | hasSequenceData () const |
Tell if at least one individual has at least one sequence. More... | |
const Alphabet * | getAlphabet () const throw (NullPointerException) |
Get the alphabet used for the sequences. More... | |
size_t | getGroupSizeForLocus (size_t locus_position) const |
Get the number of individual that have a data at the specified locus. More... | |
size_t | getGroupSizeForSequence (size_t sequence_position) 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< Individual * > | individuals_ |
The Group class.
A Group is an ensemble of Individuals with some statistics like the average allele number.
Group::Group | ( | const Group & | group | ) |
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 51 of file Group.cpp.
References addIndividual(), getIndividualAtPosition(), and getNumberOfIndividuals().
Group::Group | ( | const Group & | group, |
size_t | group_id | ||
) |
A duplication constructor with new Group Id.
Definition at line 62 of file Group.cpp.
References addIndividual(), getIndividualAtPosition(), and getNumberOfIndividuals().
void Group::addEmptyIndividual | ( | const std::string & | individual_id | ) | |
throw | ( | BadIdentifierException | |||
) |
Add an empty Individual to the Group.
BadIdentifierException | if individual_id is already in use. |
void Group::addIndividual | ( | const Individual & | ind | ) | |
throw | ( | BadIdentifierException | |||
) |
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 98 of file Group.cpp.
Referenced by Group(), operator=(), and bpp::DataSet::splitGroup().
void Group::addIndividualSequenceAtPosition | ( | size_t | individual_position, |
size_t | sequence_position, | ||
const Sequence & | sequence | ||
) | |||
throw | ( | Exception | |
) |
Add a sequence to an Individual.
IndexOutOfBoundsException | if individual_position excedes 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 sequence_position is already in use. |
Definition at line 304 of file Group.cpp.
References bpp::BadIdentifierException::getIdentifier().
void Group::clear | ( | ) |
Clear the Group.
Delete all the Individuals of the group.
Definition at line 178 of file Group.cpp.
References individuals_.
void Group::deleteIndividualAtPosition | ( | size_t | individual_position | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Delete an Individual from the Group.
individual_position | 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 & | individual_id | ) | |
throw | ( | IndividualNotFoundException | |||
) |
Delete an Individual from the Group.
individual_id | The id of the Individual to delete. |
IndividualNotFoundException | if individual_id is not found. |
Search an Individual in the Group by cheking 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 | individual_position | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Delete the genotype of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
void Group::deleteIndividualSequenceAtPosition | ( | size_t | individual_position, |
size_t | sequence_position | ||
) | |||
throw | ( | Exception | |
) |
Delete a sequence of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_position is not found. |
void Group::deleteIndividualSequenceByName | ( | size_t | individual_position, |
const std::string & | sequence_name | ||
) | |||
throw | ( | Exception | |
) |
Delete a sequence of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_name is not found. |
const Alphabet * Group::getAlphabet | ( | ) | const | |
throw | ( | NullPointerException | ||
) |
Get the alphabet used for the sequences.
Definition at line 587 of file Group.cpp.
References getNumberOfIndividuals(), hasIndividualSequences(), and individuals_.
|
inline |
|
inline |
size_t Group::getGroupSizeForLocus | ( | size_t | locus_position | ) | const |
Get the number of individual that have a data at the specified locus.
Definition at line 597 of file Group.cpp.
References individuals_.
size_t Group::getGroupSizeForSequence | ( | size_t | sequence_position | ) | const |
Get the number of individual that have a sequence at the specified position.
Definition at line 608 of file Group.cpp.
References individuals_.
const Individual & Group::getIndividualAtPosition | ( | size_t | individual_position | ) | const |
throw | ( | IndexOutOfBoundsException | |||
) |
Get a reference to an Individual by its position.
individual_position | The position of the Individual in the group. |
IndividualNotFoundException | if individual_id is not found. |
Definition at line 197 of file Group.cpp.
Referenced by Group(), and operator=().
const Individual & Group::getIndividualById | ( | const std::string & | individual_id | ) | const |
throw | ( | IndividualNotFoundException | |||
) |
Get a reference to an Individual.
individual_id | The id of the Individual to find. |
const Point2D< double > & Group::getIndividualCoordAtPosition | ( | size_t | individual_position | ) | const |
throw | ( | Exception | |||
) |
Get the coordinates of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if the individual has no coordinate. |
const Date & Group::getIndividualDateAtPosition | ( | size_t | individual_position | ) | const |
throw | ( | Exception | |||
) |
Get the date of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if the Individual has no date. |
const Locality< double > & Group::getIndividualLocalityAtPosition | ( | size_t | individual_position | ) | const |
throw | ( | Exception | |||
) |
Get the locality of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if the individual has no locality. |
const MonolocusGenotype & Group::getIndividualMonolocusGenotype | ( | size_t | individual_position, |
size_t | locus_position | ||
) | const | ||
throw | ( | Exception | |
) |
Get a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locus_position excedes the number of locus. |
size_t Group::getIndividualNumberOfSequences | ( | size_t | individual_position | ) | const |
throw | ( | Exception | |||
) |
Get the number of sequences in an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
size_t Group::getIndividualPosition | ( | const std::string & | individual_id | ) | const |
throw | ( | IndividualNotFoundException | |||
) |
Get the position of an Individual.
IndividualNotFoundException | if individual_id is not found. |
const Sequence & Group::getIndividualSequenceAtPosition | ( | size_t | individual_position, |
size_t | sequence_position | ||
) | const | ||
throw | ( | Exception | |
) |
Get a sequence of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_position is not found. |
const Sequence & Group::getIndividualSequenceByName | ( | size_t | individual_position, |
const std::string & | sequence_name | ||
) | const | ||
throw | ( | Exception | |
) |
Get a sequence of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_name is not found. |
size_t Group::getIndividualSequencePosition | ( | size_t | individual_position, |
const std::string & | sequence_name | ||
) | const | ||
throw | ( | Exception | |
) |
Get the position of a sequence in an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
SequenceNotFoundException | if sequence_name is not found. |
vector< string > Group::getIndividualSequencesNames | ( | size_t | individual_position | ) | const |
throw | ( | Exception | |||
) |
Get the sequences' names from an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if there is no sequence container defined in the individual. |
unsigned short Group::getIndividualSexAtPosition | ( | size_t | individual_position | ) | const |
throw | ( | IndexOutOfBoundsException | |||
) |
Get the sex of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
size_t Group::getMaxNumberOfSequences | ( | ) | const |
Get the maximum number of sequence.
Give the value of the highest sequence key. This value is usefull to discover the missing sequences data for each individual.
Definition at line 210 of file Group.cpp.
References getNumberOfIndividuals(), and individuals_.
size_t Group::getNumberOfIndividuals | ( | ) | const |
Get the number of Individual in the Group.
Definition at line 205 of file Group.cpp.
References individuals_.
Referenced by getAlphabet(), getMaxNumberOfSequences(), Group(), hasSequenceData(), and operator=().
bool Group::hasIndividualGenotype | ( | size_t | individual_position | ) | const |
throw | ( | IndexOutOfBoundsException | |||
) |
Tell if an Individual has a genotype.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
bool Group::hasIndividualSequences | ( | size_t | individual_position | ) | const |
throw | ( | IndexOutOfBoundsException | |||
) |
Tell if the Individual has some sequences.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
Definition at line 398 of file Group.cpp.
Referenced by getAlphabet(), and hasSequenceData().
bool Group::hasSequenceData | ( | ) | const |
Tell if at least one individual has at least one sequence.
Definition at line 577 of file Group.cpp.
References getNumberOfIndividuals(), and hasIndividualSequences().
void Group::initIndividualGenotype | ( | size_t | individual_position, |
size_t | loci_number | ||
) | |||
throw | ( | Exception | |
) |
Initialyze the genotype of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
BadIntegerException | if loci_number < 1. |
Exception | if the individual already has a genotype. |
The assignation operator =.
Definition at line 78 of file Group.cpp.
References addIndividual(), getGroupId(), getIndividualAtPosition(), getNumberOfIndividuals(), and setGroupId().
std::auto_ptr< Individual > Group::removeIndividualAtPosition | ( | size_t | individual_position | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Remove an Individual from the Group.
individual_position | The position in the Group of the Individual to remove. |
Remove the individual at the specified position and return a pointer to this Individual.
std::auto_ptr< Individual > Group::removeIndividualById | ( | const std::string & | individual_id | ) | |
throw | ( | IndividualNotFoundException | |||
) |
Remove an Individual from the Group.
individual_id | The id of the Individual to remove. |
IndividualNotFoundException | if individual_id is not found. |
Search an Individual in the Group by cheking the id and remove it if it is found then return a pointer to this Individual.
void Group::setGroupId | ( | size_t | group_id | ) |
void Group::setGroupName | ( | const std::string & | group_name | ) |
void Group::setIndividualCoordAtPosition | ( | size_t | individual_position, |
const Point2D< double > & | coord | ||
) | |||
throw | ( | IndexOutOfBoundsException | |
) |
Set the coordinates of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
void Group::setIndividualDateAtPosition | ( | size_t | individual_position, |
const Date & | date | ||
) | |||
throw | ( | IndexOutOfBoundsException | |
) |
Set the date of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
void Group::setIndividualGenotype | ( | size_t | individual_position, |
const MultilocusGenotype & | genotype | ||
) | |||
throw | ( | IndexOutOfBoundsException | |
) |
Set the genotype of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
void Group::setIndividualLocalityAtPosition | ( | size_t | individual_position, |
const Locality< double > * | locality | ||
) | |||
throw | ( | IndexOutOfBoundsException | |
) |
Set the locality of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
void Group::setIndividualMonolocusGenotype | ( | size_t | individual_position, |
size_t | locus_position, | ||
const MonolocusGenotype & | monogen | ||
) | |||
throw | ( | Exception | |
) |
Set a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locus_position excedes the number of locus. |
void Group::setIndividualMonolocusGenotypeByAlleleId | ( | size_t | individual_position, |
size_t | locus_position, | ||
const std::vector< std::string > & | allele_id, | ||
const LocusInfo & | locus_info | ||
) | |||
throw | ( | Exception | |
) |
Set a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locus_position excedes the number of locus. |
AlleleNotFoundException | if at least one id is not found in locus_info. |
Definition at line 537 of file Group.cpp.
References bpp::AlleleNotFoundException::getIdentifier().
void Group::setIndividualMonolocusGenotypeByAlleleKey | ( | size_t | individual_position, |
size_t | locus_position, | ||
const std::vector< size_t > & | allele_keys | ||
) | |||
throw | ( | Exception | |
) |
Set a MonolocusGenotype of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
NullPointerException | if the individual has no genotype. |
IndexOutOfBoundsException | if locus_position excedes the number of locus. |
Exception | if there is no key in allele_keys. |
void Group::setIndividualSequences | ( | size_t | individual_position, |
const MapSequenceContainer & | msc | ||
) | |||
throw | ( | IndexOutOfBoundsException | |
) |
void Group::setIndividualSexAtPosition | ( | size_t | individual_position, |
const unsigned short | sex | ||
) | |||
throw | ( | IndexOutOfBoundsException | |
) |
Set the sex of an Individual.
IndexOutOfBoundsException | if individual_position excedes the number of individuals. |
|
protected |
Definition at line 73 of file Group.h.
Referenced by getGroupId(), and setGroupId().
|
protected |
Definition at line 75 of file Group.h.
Referenced by clear(), getAlphabet(), getGroupSizeForLocus(), getGroupSizeForSequence(), getMaxNumberOfSequences(), and getNumberOfIndividuals().
|
protected |
Definition at line 74 of file Group.h.
Referenced by getGroupName(), and setGroupName().