52 sequences_(map<string, VectorSequenceContainer*>()),
60 sequences_(map<string, VectorSequenceContainer*>()),
64 const std::string&
id,
66 const Point2D<double>& coord,
68 const unsigned short sex) :
71 date_(new
Date(date)),
72 coord_(new Point2D<double>(coord)),
74 sequences_(map<string, VectorSequenceContainer*>()),
82 sequences_(map<string, VectorSequenceContainer*>()),
89 catch (NullPointerException)
97 catch (NullPointerException)
105 catch (NullPointerException)
112 for (
size_t i = 0; i < keys.size(); i++)
138 catch (NullPointerException)
146 catch (NullPointerException)
154 catch (NullPointerException)
161 for (
size_t i = 0; i < keys.size(); i++)
209 else if (*
date_ != date)
223 throw (NullPointerException(
"MultiSeqIndividual::getDate: no date associated to this individual."));
240 coord_ =
new Point2D<double>(coord);
242 else if (*
coord_ != coord)
245 coord_ =
new Point2D<double>(coord);
255 coord_ =
new Point2D<double>(x, y);
257 else if (this->
getX() != x || this->
getY() != y)
260 coord_ =
new Point2D<double>(x, y);
269 return new Point2D<double>(*coord_);
271 throw (NullPointerException(
"MultiSeqIndividual::getCoord: no coord associated to this individual."));
288 throw (NullPointerException(
"MultiSeqIndividual::setX: no coord associated to this individual."));
298 throw (NullPointerException(
"MultiSeqIndividual::setY: no coord associated to this individual."));
308 throw (NullPointerException(
"MultiSeqIndividual::getX: no coord associated to this individual."));
318 throw (NullPointerException(
"MultiSeqIndividual::getY: no coord associated to this individual."));
336 throw (NullPointerException(
"MultiSeqIndividual::getLocality: no locality associated to this individual."));
351 map<string, VectorSequenceContainer*>::const_iterator it;
352 it = sequences_.find(
id);
354 if (it == sequences_.end())
356 string mes =
"MultiSeqIndividual::getSequence: sequence set not found (" +
id 358 throw (Exception(mes));
360 return const_cast<const VectorSequenceContainer*
>(it->second);
370 sequences_[id]->addSequence(sequence);
372 catch (AlphabetMismatchException& ame)
374 throw (AlphabetMismatchException(
"MultiSeqIndividual::addSequence: alphabets don't match.", ame.getAlphabets()[0], ame.getAlphabets()[1]));
378 throw (
BadIdentifierException(
"MultiSeqIndividual::addSequence: sequence's name already in use.", sequence.getName()));
385 const throw (Exception)
387 map<string, VectorSequenceContainer*>::const_iterator it;
388 it = sequences_.find(
id);
390 if (it == sequences_.end())
392 string mes =
"MultiSeqIndividual::getSequence: sequence set not found (" +
id 394 throw (Exception(mes));
398 return const_cast<const VectorSequenceContainer*
>(it->second)->getSequence(name);
400 catch (SequenceNotFoundException& snfe)
409 const throw (Exception)
411 map<string, VectorSequenceContainer*>::const_iterator it;
412 it = sequences_.find(
id);
414 if (it == sequences_.end())
416 string mes =
"MultiSeqIndividual::getSequence: sequence set not found (" +
id 418 throw (Exception(mes));
422 return const_cast<const VectorSequenceContainer*
>(it->second)->getSequence(i);
424 catch (IndexOutOfBoundsException& ioobe)
435 map<string, VectorSequenceContainer*>::const_iterator it;
438 keys.push_back(it->first);
462 map<string, VectorSequenceContainer*>::const_iterator it;
463 it = sequences_.find(
id);
465 if (it == sequences_.end())
467 string mes =
"MultiSeqIndividual::getSequence: sequence set not found (" +
id 469 throw (Exception(mes));
472 return const_cast<const VectorSequenceContainer*
>(it->second)->getNumberOfSequences();
MultiSeqIndividual & operator=(const MultiSeqIndividual &ind)
The MultiSeqIndividual copy operator.
std::map< std::string, VectorSequenceContainer * > sequences_
size_t getNumberOfSequences(const std::string &id) const
Get the number of sequences in a sequence set.
unsigned short getSex() const
Get the sex of the MultiSeqIndividual.
void setX(const double x)
Set the X coordinate of the MultiSeqIndividual.
bool hasLocality() const
Tell if this MultiSeqIndividual has a locality.
bool hasSequences() const
Tell if the MultiSeqIndividual has some sequences.
The BadIdentifierException class.
size_t getNumberOfSequenceSet() const
Count the number of sequece set.
const Sequence & getSequence(const std::string &id, const std::string &name) const
Get a named sequence from a named sequence set.
bool hasGenotype() const
Tell if the MultiSeqIndividual has a MultilocusGenotype.
void addGenotype(const MultilocusGenotype &genotype)
Add a genotype.
The MultilocusGenotype class.
void setId(const std::string id)
Set the id of the MultiSeqIndividual.
bool hasDate() const
Tell if this MultiSeqIndividual has a date.
double getX() const
Get the X coordinate of the MultiSeqIndividual.
const Locality< double > * getLocality() const
Get the locality of the MultiSeqIndividual.
virtual ~MultiSeqIndividual()
Destroy an MultiSeqIndividual.
std::string getId() const
Get the id of the MultiSeqIndividual.
const MultilocusGenotype * getGenotype() const
Get the genotype.
MultilocusGenotype * genotype_
void setY(const double y)
Set the Y coordinate of th MultiSeqIndividual.
void setCoord(const Point2D< double > &coord)
Set the coodinates of the MultiSeqIndividual.
double getY() const
Get the Y coordinate of the MultiSeqIndividual.
Point2D< double > * coord_
MultiSeqIndividual()
Build a void new MultiSeqIndividual.
const Locality< double > * locality_
void setLocality(const Locality< double > *locality)
Set the locality of the MultiSeqIndividual.
const VectorSequenceContainer * getVectorSequenceContainer(const std::string &id) const
Get a pointer to the VectorSequenceContainer at a named locus.
bool hasCoord() const
Tell if this MultiSeqIndividual has coordinates.
*** UNUSED CLASS ***The MultiSeqIndividual class.
void setDate(const Date &date)
Set the date of the MultiSeqIndividual.
void setSex(const unsigned short sex)
Set the sex of the MultiSeqIndividual.
std::vector< std::string > getSequencesKeys() const
Get the sequence set ids.
const Date * getDate() const
Get the date of the MultiSeqIndividual.
void addSequence(const std::string &id, const Sequence &sequence)
Add a sequence in a named sequence set.
const Point2D< double > * getCoord() const
Get the coordinates of the Induvidual.