bpp-popgen  2.2.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 SeqLib
53 #include <Bpp/Seq/Sequence.h>
54 #include <Bpp/Seq/SequenceExceptions.h>
55 #include <Bpp/Seq/Container/VectorSequenceContainer.h>
56 
57 // From PopGenLib
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_;
83  Point2D<double>* coord_;
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 throw (NullPointerException);
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 throw (NullPointerException);
206 
210  bool hasCoord() const;
211 
220  void setX(const double x) throw (NullPointerException);
221 
230  void setY(const double y) throw (NullPointerException);
231 
238  double getX() const throw (NullPointerException);
239 
246  double getY() const throw (NullPointerException);
247 
253  void setLocality(const Locality<double>* locality);
254 
260  const Locality<double>* getLocality() const throw (NullPointerException);
261 
265  bool hasLocality() const;
266 
272  const VectorSequenceContainer* getVectorSequenceContainer(const std::string& id) const
273  throw (Exception);
274 
283  void addSequence(const std::string& id, const Sequence& sequence)
284  throw (Exception);
285 
294  const Sequence& getSequence(const std::string& id, const std::string& name)
295  const throw (Exception);
296 
305  const Sequence& getSequence(const std::string& id, const size_t i)
306  const throw (Exception);
307 
313  std::vector<std::string> getSequencesKeys() const;
314 
323  Sequence* removeSequence(const std::string& id, const std::string& name);
324 
331  void deleteSequence(const std::string& id, const std::string& name);
332 
336  bool hasSequences() const;
337 
341  size_t getNumberOfSequenceSet() const;
342 
346  size_t getNumberOfSequences(const std::string& id) const
347  throw (Exception);
348 
354  void addGenotype(const MultilocusGenotype& genotype);
355 
359  const MultilocusGenotype* getGenotype() const throw (NullPointerException);
360 
364  bool hasGenotype() const;
365 };
366 } // end of namespace bpp;
367 
368 #endif // _MULTISEQINDIVIDUAL_H_
369 
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.
STL namespace.
size_t getNumberOfSequenceSet() const
Count the number of sequece set.
Sequence * removeSequence(const std::string &id, const std::string &name)
Remove a named sequence from a named sequence 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.
The Date class.
Definition: Date.h:56
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.
void deleteSequence(const std::string &id, const std::string &name)
Delete a named sequence from a named sequence set.
*** 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.