bpp-popgen  3.0.0
MultiSeqIndividual.h
Go to the documentation of this file.
1 //
2 // File MultiSeqIndividual.h
3 // Author : Sylvain Gaillard
4 // Last modification : Tuesday August 03 2004
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for population genetics analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #ifndef _MULTISEQINDIVIDUAL_H_
41 #define _MULTISEQINDIVIDUAL_H_
42 
43 // From STL
44 #include <map>
45 #include <vector>
46 #include <string>
47 
48 #include <Bpp/Clonable.h>
49 #include <Bpp/Exceptions.h>
50 #include <Bpp/Graphics/Point2D.h>
51 
52 // From bpp-seq
53 #include <Bpp/Seq/Sequence.h>
56 
57 // From bpp-popgen
58 #include "Locality.h"
59 #include "Date.h"
60 #include "../MultilocusGenotype.h"
61 #include "../GeneralExceptions.h"
62 
63 namespace bpp
64 {
78 {
79 private:
80  std::string id_;
81  unsigned short sex_;
85  std::map<std::string, VectorSequenceContainer*> sequences_;
87 
88 public:
89  // Constructors and destructor :
94 
98  MultiSeqIndividual(const std::string& id);
99 
110  MultiSeqIndividual(const std::string& id,
111  const Date& date,
112  const Point2D<double>& coord,
113  Locality<double>* locality,
114  const unsigned short sex);
115 
120 
124  virtual ~MultiSeqIndividual();
125 
126 public:
127  // Methodes
135 
141  void setId(const std::string id);
142 
148  std::string getId() const;
149 
155  void setSex(const unsigned short sex);
156 
162  unsigned short getSex() const;
163 
169  void setDate(const Date& date);
170 
177  const Date* getDate() const;
178 
182  bool hasDate() const;
183 
189  void setCoord(const Point2D<double>& coord);
190 
197  void setCoord(const double x, const double y);
198 
205  const Point2D<double>* getCoord() const;
206 
210  bool hasCoord() const;
211 
220  void setX(const double x);
221 
230  void setY(const double y);
231 
238  double getX() const;
239 
246  double getY() const;
247 
253  void setLocality(const Locality<double>* locality);
254 
260  const Locality<double>* getLocality() const;
261 
265  bool hasLocality() const;
266 
272  const VectorSequenceContainer* getVectorSequenceContainer(const std::string& id) const;
273 
282  void addSequence(const std::string& id, const Sequence& sequence);
283 
292  const Sequence& getSequence(const std::string& id, const std::string& name) const;
293 
302  const Sequence& getSequence(const std::string& id, const size_t i) const;
303 
309  std::vector<std::string> getSequencesKeys() const;
310 
319  Sequence* removeSequence(const std::string& id, const std::string& name);
320 
327  void deleteSequence(const std::string& id, const std::string& name);
328 
332  bool hasSequences() const;
333 
337  size_t getNumberOfSequenceSet() const;
338 
342  size_t getNumberOfSequences(const std::string& id) const;
343 
349  void addGenotype(const MultilocusGenotype& genotype);
350 
354  const MultilocusGenotype* getGenotype() const;
355 
359  bool hasGenotype() const;
360 };
361 } // end of namespace bpp;
362 
363 #endif // _MULTISEQINDIVIDUAL_H_
364 
The Date class.
Definition: Date.h:57
const Locality< double > * getLocality() const
Get the locality of the MultiSeqIndividual.
double getY() const
Get the Y coordinate of the MultiSeqIndividual.
Sequence * removeSequence(const std::string &id, const std::string &name)
Remove a named sequence from a named sequence set.
bool hasSequences() const
Tell if the MultiSeqIndividual has some sequences.
virtual ~MultiSeqIndividual()
Destroy an MultiSeqIndividual.
const MultilocusGenotype * getGenotype() const
Get the genotype.
const Point2D< double > * getCoord() const
Get the coordinates of the Induvidual.
void setLocality(const Locality< double > *locality)
Set the locality of the MultiSeqIndividual.
void setCoord(const Point2D< double > &coord)
Set the coodinates of the MultiSeqIndividual.
const Date * getDate() const
Get the date of the MultiSeqIndividual.
void setY(const double y)
Set the Y coordinate of th MultiSeqIndividual.
unsigned short getSex() const
Get the sex of the MultiSeqIndividual.
void setId(const std::string id)
Set the id of the MultiSeqIndividual.
MultiSeqIndividual()
Build a void new MultiSeqIndividual.
bool hasLocality() const
Tell if this MultiSeqIndividual has a locality.
void setDate(const Date &date)
Set the date of the MultiSeqIndividual.
const Sequence & getSequence(const std::string &id, const std::string &name) const
Get a named sequence from a named sequence set.
std::vector< std::string > getSequencesKeys() const
Get the sequence set ids.
std::string getId() const
Get the id of the MultiSeqIndividual.
void addSequence(const std::string &id, const Sequence &sequence)
Add a sequence in a named sequence set.
bool hasDate() const
Tell if this MultiSeqIndividual has a date.
Point2D< double > * coord_
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.
std::map< std::string, VectorSequenceContainer * > sequences_
MultiSeqIndividual & operator=(const MultiSeqIndividual &ind)
The MultiSeqIndividual copy operator.
void addGenotype(const MultilocusGenotype &genotype)
Add a genotype.
double getX() const
Get the X coordinate of the MultiSeqIndividual.
void deleteSequence(const std::string &id, const std::string &name)
Delete a named sequence from a named sequence set.
void setSex(const unsigned short sex)
Set the sex of the MultiSeqIndividual.
void setX(const double x)
Set the X coordinate of the MultiSeqIndividual.
bool hasGenotype() const
Tell if the MultiSeqIndividual has a MultilocusGenotype.
MultilocusGenotype * genotype_
size_t getNumberOfSequences(const std::string &id) const
Get the number of sequences in a sequence set.
const Locality< double > * locality_
size_t getNumberOfSequenceSet() const
Count the number of sequece set.
The MultilocusGenotype class.