bpp-popgen  3.0.0
bpp::MultiSeqIndividual Class Reference

#include <Bpp/PopGen/DataSet/MultiSeqIndividual.h>

+ Collaboration diagram for bpp::MultiSeqIndividual:

Public Member Functions

 MultiSeqIndividual ()
 Build a void new MultiSeqIndividual. More...
 
 MultiSeqIndividual (const std::string &id)
 Build a new MultiSeqIndividual with an identifier. More...
 
 MultiSeqIndividual (const std::string &id, const Date &date, const Point2D< double > &coord, Locality< double > *locality, const unsigned short sex)
 Build a new MultiSeqIndividual with parameters. More...
 
 MultiSeqIndividual (const MultiSeqIndividual &ind)
 The MultiSeqIndividual copy constructor. More...
 
virtual ~MultiSeqIndividual ()
 Destroy an MultiSeqIndividual. More...
 
MultiSeqIndividualoperator= (const MultiSeqIndividual &ind)
 The MultiSeqIndividual copy operator. More...
 
void setId (const std::string id)
 Set the id of the MultiSeqIndividual. More...
 
std::string getId () const
 Get the id of the MultiSeqIndividual. More...
 
void setSex (const unsigned short sex)
 Set the sex of the MultiSeqIndividual. More...
 
unsigned short getSex () const
 Get the sex of the MultiSeqIndividual. More...
 
void setDate (const Date &date)
 Set the date of the MultiSeqIndividual. More...
 
const DategetDate () const
 Get the date of the MultiSeqIndividual. More...
 
bool hasDate () const
 Tell if this MultiSeqIndividual has a date. More...
 
void setCoord (const Point2D< double > &coord)
 Set the coodinates of the MultiSeqIndividual. More...
 
void setCoord (const double x, const double y)
 Set the coordinates of the MultiSeqIndividual. More...
 
const Point2D< double > * getCoord () const
 Get the coordinates of the Induvidual. More...
 
bool hasCoord () const
 Tell if this MultiSeqIndividual has coordinates. More...
 
void setX (const double x)
 Set the X coordinate of the MultiSeqIndividual. More...
 
void setY (const double y)
 Set the Y coordinate of th MultiSeqIndividual. More...
 
double getX () const
 Get the X coordinate of the MultiSeqIndividual. More...
 
double getY () const
 Get the Y coordinate of the MultiSeqIndividual. More...
 
void setLocality (const Locality< double > *locality)
 Set the locality of the MultiSeqIndividual. More...
 
const Locality< double > * getLocality () const
 Get the locality of the MultiSeqIndividual. More...
 
bool hasLocality () const
 Tell if this MultiSeqIndividual has a locality. More...
 
const VectorSequenceContainergetVectorSequenceContainer (const std::string &id) const
 Get a pointer to the VectorSequenceContainer at a named locus. More...
 
void addSequence (const std::string &id, const Sequence &sequence)
 Add a sequence in a named sequence set. More...
 
const SequencegetSequence (const std::string &id, const std::string &name) const
 Get a named sequence from a named sequence set. More...
 
const SequencegetSequence (const std::string &id, const size_t i) const
 Get an indexed sequence from a named sequence set. More...
 
std::vector< std::string > getSequencesKeys () const
 Get the sequence set ids. More...
 
SequenceremoveSequence (const std::string &id, const std::string &name)
 Remove a named sequence from a named sequence set. More...
 
void deleteSequence (const std::string &id, const std::string &name)
 Delete a named sequence from a named sequence set. More...
 
bool hasSequences () const
 Tell if the MultiSeqIndividual has some sequences. More...
 
size_t getNumberOfSequenceSet () const
 Count the number of sequece set. More...
 
size_t getNumberOfSequences (const std::string &id) const
 Get the number of sequences in a sequence set. More...
 
void addGenotype (const MultilocusGenotype &genotype)
 Add a genotype. More...
 
const MultilocusGenotypegetGenotype () const
 Get the genotype. More...
 
bool hasGenotype () const
 Tell if the MultiSeqIndividual has a MultilocusGenotype. More...
 

Private Attributes

std::string id_
 
unsigned short sex_
 
Datedate_
 
Point2D< double > * coord_
 
const Locality< double > * locality_
 
std::map< std::string, VectorSequenceContainer * > sequences_
 
MultilocusGenotypegenotype_
 

Detailed Description

*** UNUSED CLASS ***

The MultiSeqIndividual class.

*** UNUSED CLASS ***

This class is designed to store data on a single individual. This individual can store numerous sequences for each place. It was the first working implementation which manages sequences as a map of sequence container. We have replaced it with a simplest individual with only one sequence per locus.

Author
Sylvain Gaillard

Definition at line 77 of file MultiSeqIndividual.h.

Constructor & Destructor Documentation

◆ MultiSeqIndividual() [1/4]

MultiSeqIndividual::MultiSeqIndividual ( )

Build a void new MultiSeqIndividual.

Definition at line 47 of file MultiSeqIndividual.cpp.

◆ MultiSeqIndividual() [2/4]

MultiSeqIndividual::MultiSeqIndividual ( const std::string &  id)

Build a new MultiSeqIndividual with an identifier.

Definition at line 55 of file MultiSeqIndividual.cpp.

◆ MultiSeqIndividual() [3/4]

MultiSeqIndividual::MultiSeqIndividual ( const std::string &  id,
const Date date,
const Point2D< double > &  coord,
Locality< double > *  locality,
const unsigned short  sex 
)

Build a new MultiSeqIndividual with parameters.

Parameters
idThe id of the MultiSeqIndividual as a string.
dateThe date of the MultiSeqIndividual as a Date object.
coordThe coordinates of the MultiSeqIndividual as a Coord object.
localityThe locality of the MultiSeqIndividual as a pointer to a Locality object.
sexThe sex of the MultiSeqIndividual as an unsigned short.

Definition at line 63 of file MultiSeqIndividual.cpp.

◆ MultiSeqIndividual() [4/4]

◆ ~MultiSeqIndividual()

MultiSeqIndividual::~MultiSeqIndividual ( )
virtual

Destroy an MultiSeqIndividual.

Definition at line 122 of file MultiSeqIndividual.cpp.

References coord_, and date_.

Member Function Documentation

◆ addGenotype()

void MultiSeqIndividual::addGenotype ( const MultilocusGenotype genotype)

Add a genotype.

Parameters
genotypeThe MultilocusGenotype to add.

Definition at line 475 of file MultiSeqIndividual.cpp.

References genotype_.

◆ addSequence()

void MultiSeqIndividual::addSequence ( const std::string &  id,
const Sequence sequence 
)

Add a sequence in a named sequence set.

Parameters
idThe id of the sequence set.
sequenceThe sequence to add.
Exceptions
AlphabetMismatchExceptionif the sequence's alphabet doesn't match the container's alphabet.
BadIdentifierExceptionif sequence's name is already in use.

Definition at line 365 of file MultiSeqIndividual.cpp.

References bpp::AlphabetMismatchException::getAlphabets(), bpp::Sequence::getName(), and sequences_.

◆ deleteSequence()

void bpp::MultiSeqIndividual::deleteSequence ( const std::string &  id,
const std::string &  name 
)

Delete a named sequence from a named sequence set.

Parameters
idThe id of the sequence set.
nameThe name of the sequence.

◆ getCoord()

const Point2D< double > * MultiSeqIndividual::getCoord ( ) const

Get the coordinates of the Induvidual.

Returns
A pointer toward a Point2D object if the MultiSeqIndividual has coordinates. Otherwise throw a NullPointerException.

Definition at line 266 of file MultiSeqIndividual.cpp.

References coord_, and hasCoord().

Referenced by MultiSeqIndividual(), and operator=().

◆ getDate()

const Date * MultiSeqIndividual::getDate ( ) const

Get the date of the MultiSeqIndividual.

Returns
A pointer toward a Date object if the MultiSeqIndividual has a date. Otherwise throw a NullPointerException.

Definition at line 218 of file MultiSeqIndividual.cpp.

References date_, and hasDate().

Referenced by MultiSeqIndividual(), and operator=().

◆ getGenotype()

const MultilocusGenotype * MultiSeqIndividual::getGenotype ( ) const

Get the genotype.

Definition at line 482 of file MultiSeqIndividual.cpp.

References genotype_.

Referenced by MultiSeqIndividual(), and operator=().

◆ getId()

std::string MultiSeqIndividual::getId ( ) const

Get the id of the MultiSeqIndividual.

Returns
The id of the MultiSeqIndividual as a string.

Definition at line 180 of file MultiSeqIndividual.cpp.

References id_.

Referenced by operator=().

◆ getLocality()

const Locality< double > * MultiSeqIndividual::getLocality ( ) const

Get the locality of the MultiSeqIndividual.

Returns
A pointer to the Locality of the MultiSeqIndividual.

Definition at line 331 of file MultiSeqIndividual.cpp.

References hasLocality(), and locality_.

Referenced by MultiSeqIndividual(), and operator=().

◆ getNumberOfSequences()

size_t MultiSeqIndividual::getNumberOfSequences ( const std::string &  id) const

Get the number of sequences in a sequence set.

Definition at line 456 of file MultiSeqIndividual.cpp.

References sequences_.

◆ getNumberOfSequenceSet()

size_t MultiSeqIndividual::getNumberOfSequenceSet ( ) const

Count the number of sequece set.

Definition at line 449 of file MultiSeqIndividual.cpp.

References sequences_.

◆ getSequence() [1/2]

const Sequence & MultiSeqIndividual::getSequence ( const std::string &  id,
const size_t  i 
) const

Get an indexed sequence from a named sequence set.

Parameters
idThe id of the sequence set.
iThe index of the sequence in the sequence set.
Returns
A reference to the sequence.

Definition at line 406 of file MultiSeqIndividual.cpp.

References getSequence(), and sequences_.

◆ getSequence() [2/2]

const Sequence & MultiSeqIndividual::getSequence ( const std::string &  id,
const std::string &  name 
) const

Get a named sequence from a named sequence set.

Parameters
idThe id of the sequence set.
nameThe name of the sequence.
Returns
A reference to the sequence.

Definition at line 383 of file MultiSeqIndividual.cpp.

References sequences_.

Referenced by getSequence().

◆ getSequencesKeys()

std::vector< std::string > MultiSeqIndividual::getSequencesKeys ( ) const

Get the sequence set ids.

Returns
All the keys of the sequence sets in a vector.

Definition at line 429 of file MultiSeqIndividual.cpp.

References sequences_.

Referenced by MultiSeqIndividual(), and operator=().

◆ getSex()

unsigned short MultiSeqIndividual::getSex ( ) const

Get the sex of the MultiSeqIndividual.

Returns
The sex of the MultiSeqIndividual as an unsigned short.

Definition at line 195 of file MultiSeqIndividual.cpp.

References sex_.

Referenced by operator=().

◆ getVectorSequenceContainer()

const VectorSequenceContainer * MultiSeqIndividual::getVectorSequenceContainer ( const std::string &  id) const

Get a pointer to the VectorSequenceContainer at a named locus.

Parameters
idThe id of the sequence set (i.e. locus).

Definition at line 349 of file MultiSeqIndividual.cpp.

References sequences_.

Referenced by MultiSeqIndividual(), and operator=().

◆ getX()

double MultiSeqIndividual::getX ( ) const

Get the X coordinate of the MultiSeqIndividual.

Returns
The X coordinate as a double if the MultiSeqIndividual has coordinates. Otherwise throw a NullPointerException.

Definition at line 303 of file MultiSeqIndividual.cpp.

References coord_, bpp::Point2D< class >::getX(), and hasCoord().

Referenced by setCoord().

◆ getY()

double MultiSeqIndividual::getY ( ) const

Get the Y coordinate of the MultiSeqIndividual.

Returns
The Y coordinate as a double if the MultiSeqIndividual has coordinates. Otherwise throw a NullPointerException.

Definition at line 313 of file MultiSeqIndividual.cpp.

References coord_, bpp::Point2D< class >::getY(), and hasCoord().

Referenced by setCoord().

◆ hasCoord()

bool MultiSeqIndividual::hasCoord ( ) const

Tell if this MultiSeqIndividual has coordinates.

Definition at line 276 of file MultiSeqIndividual.cpp.

References coord_.

Referenced by getCoord(), getX(), getY(), setCoord(), setX(), and setY().

◆ hasDate()

bool MultiSeqIndividual::hasDate ( ) const

Tell if this MultiSeqIndividual has a date.

Definition at line 228 of file MultiSeqIndividual.cpp.

References date_.

Referenced by getDate(), and setDate().

◆ hasGenotype()

bool MultiSeqIndividual::hasGenotype ( ) const

Tell if the MultiSeqIndividual has a MultilocusGenotype.

Definition at line 489 of file MultiSeqIndividual.cpp.

References genotype_.

Referenced by MultiSeqIndividual(), and operator=().

◆ hasLocality()

bool MultiSeqIndividual::hasLocality ( ) const

Tell if this MultiSeqIndividual has a locality.

Definition at line 341 of file MultiSeqIndividual.cpp.

References locality_.

Referenced by getLocality().

◆ hasSequences()

bool MultiSeqIndividual::hasSequences ( ) const

Tell if the MultiSeqIndividual has some sequences.

Definition at line 442 of file MultiSeqIndividual.cpp.

References sequences_.

Referenced by MultiSeqIndividual(), and operator=().

◆ operator=()

MultiSeqIndividual & MultiSeqIndividual::operator= ( const MultiSeqIndividual ind)

◆ removeSequence()

Sequence* bpp::MultiSeqIndividual::removeSequence ( const std::string &  id,
const std::string &  name 
)

Remove a named sequence from a named sequence set.

Parameters
idThe id of the sequence set.
nameThe name of the sequence.
Returns
A pointer to a copy of the removed sequence.

◆ setCoord() [1/2]

void MultiSeqIndividual::setCoord ( const double  x,
const double  y 
)

Set the coordinates of the MultiSeqIndividual.

Parameters
xThe X coordinate as a double.
yThe Y coordinate as a double.

Definition at line 251 of file MultiSeqIndividual.cpp.

References coord_, getX(), getY(), and hasCoord().

◆ setCoord() [2/2]

void MultiSeqIndividual::setCoord ( const Point2D< double > &  coord)

Set the coodinates of the MultiSeqIndividual.

Parameters
coordA Point2D object.

Definition at line 236 of file MultiSeqIndividual.cpp.

References coord_, and hasCoord().

Referenced by MultiSeqIndividual(), and operator=().

◆ setDate()

void MultiSeqIndividual::setDate ( const Date date)

Set the date of the MultiSeqIndividual.

Parameters
dateThe date as a Date object.

Definition at line 203 of file MultiSeqIndividual.cpp.

References date_, and hasDate().

Referenced by MultiSeqIndividual(), and operator=().

◆ setId()

void MultiSeqIndividual::setId ( const std::string  id)

Set the id of the MultiSeqIndividual.

Parameters
idThe id of the MultiSeqIndividual as a string.

Definition at line 173 of file MultiSeqIndividual.cpp.

References id_.

Referenced by operator=().

◆ setLocality()

void MultiSeqIndividual::setLocality ( const Locality< double > *  locality)

Set the locality of the MultiSeqIndividual.

Parameters
localityA pointer to a Locality object.

Definition at line 324 of file MultiSeqIndividual.cpp.

References locality_.

Referenced by MultiSeqIndividual(), and operator=().

◆ setSex()

void MultiSeqIndividual::setSex ( const unsigned short  sex)

Set the sex of the MultiSeqIndividual.

Parameters
sexAn unsigned short coding for the sex.

Definition at line 188 of file MultiSeqIndividual.cpp.

References sex_.

Referenced by operator=().

◆ setX()

void MultiSeqIndividual::setX ( const double  x)

Set the X coordinate of the MultiSeqIndividual.

Parameters
xThe X coordinate as a double.

Set the X coordinate if the MultiSeqIndividual has coordinates. Otherwise throw a NullPointerException.

Definition at line 283 of file MultiSeqIndividual.cpp.

References coord_, hasCoord(), and bpp::Point2D< class >::setX().

◆ setY()

void MultiSeqIndividual::setY ( const double  y)

Set the Y coordinate of th MultiSeqIndividual.

Parameters
yThe Y coordinate as a double.

Set the Y coordinate if the MultiSeqIndividual has coordinates. Otherwise throw a NullPointerException.

Definition at line 293 of file MultiSeqIndividual.cpp.

References coord_, hasCoord(), and bpp::Point2D< class >::setY().

Member Data Documentation

◆ coord_

Point2D<double>* bpp::MultiSeqIndividual::coord_
private

◆ date_

Date* bpp::MultiSeqIndividual::date_
private

◆ genotype_

MultilocusGenotype* bpp::MultiSeqIndividual::genotype_
private

◆ id_

std::string bpp::MultiSeqIndividual::id_
private

Definition at line 80 of file MultiSeqIndividual.h.

Referenced by getId(), and setId().

◆ locality_

const Locality<double>* bpp::MultiSeqIndividual::locality_
private

◆ sequences_

◆ sex_

unsigned short bpp::MultiSeqIndividual::sex_
private

Definition at line 81 of file MultiSeqIndividual.h.

Referenced by getSex(), and setSex().


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