67 const unsigned short sex) :
70 date_(new
Date(date)),
71 coord_(new
Point2D<double>(coord)),
195 return date_.get() != 0;
285 throw (
NullPointerException(
"Individual::getLocality: no locality associated to this individual."));
312 if (
string(e.
what()).find(
"name") <
string(e.
what()).size())
328 return sequences_->getSequence(sequence_name);
399 vector<size_t> seqpos;
400 vector<string> seqkeys =
sequences_->getKeys();
401 for (
size_t i = 0; i < seqkeys.size(); i++)
438 for (
size_t i = 0; i < pos.size(); i++)
440 if (pos[i] == position)
495 throw Exception(
"Individual::initGenotype: individual already has a genotype.");
537 genotype_->setMonolocusGenotype(locus_position, monogen);
550 throw NullPointerException(
"Individual::setMonolocusGenotypeByAlleleKey: individual has no genotype.");
553 genotype_->setMonolocusGenotypeByAlleleKey(locus_position, allele_keys);
561 throw Exception(
"Individual::setMonolocusGenotypeByAlleleKey: no key in allele_keys.");
570 throw NullPointerException(
"Individual::setMonolocusGenotypeByAlleleId: individual has no genotype.");
573 genotype_->setMonolocusGenotypeByAlleleId(locus_position, allele_id, locus_info);
593 return genotype_->getMonolocusGenotype(locus_position);
625 return genotype_->countHeterozygousLoci();
The AlleleNotFoundException class.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
std::vector< const Alphabet * > getAlphabets() const
The BadIdentifierException class.
int getBadInteger() const
virtual const Alphabet * getAlphabet() const=0
const char * what() const noexcept override
std::size_t getBadIndex() const
const std::array< std::size_t, 2 > & getBounds() const
double getY() const
Get the Y coordinate of the Individual.
std::unique_ptr< Point2D< double > > coord_
bool hasCoord() const
Tell if this Individual has coordinates.
const Sequence & getSequenceAtPosition(const size_t sequence_position) const
Get a sequence by its position.
std::vector< size_t > getSequencesPositions() const
Get the sequences' positions.
bool hasSequences() const
Tell if the Individual has some sequences.
virtual ~Individual()
Destroy an Individual.
void setMonolocusGenotypeByAlleleKey(size_t locus_position, const std::vector< size_t > allele_keys)
Set a MonolocusGenotype.
Individual()
Build a void new Individual.
unsigned short getSex() const
Get the sex of the Individual.
void setSex(const unsigned short sex)
Set the sex of the Individual.
std::unique_ptr< Date > date_
std::vector< std::string > getSequencesNames() const
Get the sequences' names.
size_t countNonMissingLoci() const
Count the number of non missing MonolocusGenotype.
void addSequence(size_t sequence_key, const Sequence &sequence)
Add a sequence to the Individual.
void setGenotype(const MultilocusGenotype &genotype)
Set a genotype.
void setMonolocusGenotypeByAlleleId(size_t locus_position, const std::vector< std::string > allele_id, const LocusInfo &locus_info)
Set a MonolocusGenotype.
std::unique_ptr< MapSequenceContainer > sequences_
void initGenotype(size_t loci_number)
Init the genotype.
const std::string & getId() const
Get the id of the Individual.
void setCoord(const Point2D< double > &coord)
Set the coodinates of the Individual.
void setY(const double y)
Set the Y coordinate of th Individual.
void setId(const std::string &id)
Set the id of the Individual.
bool hasGenotype() const
Tell if the Individual has a MultilocusGenotype.
Individual & operator=(const Individual &ind)
The Individual copy operator.
void deleteSequenceByName(const std::string &sequence_name)
Delete a sequence.
const Sequence & getSequenceByName(const std::string &sequence_name) const
Get a sequence by its name.
void setDate(const Date &date)
Set the date of the Individual.
const MultilocusGenotype & getGenotype() const
Get the genotype.
const OrderedSequenceContainer & getSequences() const
Get a reference to the sequence container.
const Locality< double > * getLocality() const
Get the locality of the Individual.
const Locality< double > * locality_
bool hasSequenceAtPosition(size_t position) const
Tell if the Individual has a sequence at a given position.
size_t countHomozygousLoci() const
Count the number of homozygous MonolocusGenotype.
void deleteSequenceAtPosition(size_t sequence_position)
Delete a sequence.
void setMonolocusGenotype(size_t locus_position, const MonolocusGenotype &monogen)
Set a MonolocusGenotype.
void setX(const double x)
Set the X coordinate of the Individual.
void setLocality(const Locality< double > *locality)
Set the locality of the Individual.
bool hasDate() const
Tell if this Individual has a date.
const MonolocusGenotype & getMonolocusGenotype(size_t locus_position)
Get a MonolocusGenotype.
void setSequences(const MapSequenceContainer &msc)
Set all the sequences with a MapSequenceContainer.
size_t getSequencePosition(const std::string &sequence_name) const
Get the position of a sequence.
void deleteGenotype()
Delete the genotype of the individual.
std::unique_ptr< MultilocusGenotype > genotype_
size_t countHeterozygousLoci() const
Count the number of heterozygous MonolocusGenotype.
double getX() const
Get the X coordinate of the Individual.
const Date & getDate() const
Get the date of the Individual.
const Alphabet * getSequenceAlphabet() const
Return the alphabet of the sequences.
size_t getNumberOfSequences() const
Get the number of sequences.
const Point2D< double > & getCoord() const
Get the coordinates of the Induvidual.
bool hasLocality() const
Tell if this Individual has a locality.
The MonolocusGenotype virtual class.
The MultilocusGenotype class.
virtual const std::string getSequenceId() const
virtual const std::string & getName() const=0
int toInt(const std::string &s, char scientificNotation='e')
std::string toString(T t)