bpp-popgen  3.0.0
MultilocusGenotype.h
Go to the documentation of this file.
1 //
2 // File MultilocusGenotype.h
3 // Author : Sylvain Gaillard
4 // Last modification : April 4, 2008
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 _MULTILOCUSGENOTYPE_H_
41 #define _MULTILOCUSGENOTYPE_H_
42 
43 // From STL
44 #include <vector>
45 #include <string>
46 
47 #include <Bpp/Exceptions.h>
48 
49 // From Pop
50 #include "MonolocusGenotype.h"
51 #include "MonolocusGenotypeTools.h"
54 #include "LocusInfo.h"
55 
56 namespace bpp
57 {
66 {
67 private:
68  std::vector<MonolocusGenotype*> loci_;
69 
70 public:
71  // Constructors and Destructor
77  MultilocusGenotype(size_t loci_number);
78 
82  MultilocusGenotype(const MultilocusGenotype& genotype);
83 
88 
89 public:
93  void setMonolocusGenotype(size_t locus_position,
94  const MonolocusGenotype& monogen);
95 
102  void setMonolocusGenotypeByAlleleKey(size_t locus_position,
103  const std::vector<size_t>& allele_keys);
104 
111  void setMonolocusGenotypeByAlleleId(size_t locus_position,
112  const std::vector<std::string>& allele_id,
113  const LocusInfo& locus_info);
114 
120  void setMonolocusGenotypeAsMissing(size_t locus_position);
121 
127  bool isMonolocusGenotypeMissing(size_t locus_position) const;
128 
132  const MonolocusGenotype& getMonolocusGenotype(size_t locus_position) const;
133 
139  size_t size() const;
140 
144  size_t countNonMissingLoci() const;
145 
149  size_t countHomozygousLoci() const;
150 
154  size_t countHeterozygousLoci() const;
155 };
156 } // end of namespace bpp;
157 
158 #endif // _MULTILOCUSGENOTYPE_H_
159 
The LocusInfo class.
Definition: LocusInfo.h:64
The MonolocusGenotype virtual class.
The MultilocusGenotype class.
void setMonolocusGenotypeAsMissing(size_t locus_position)
Set a MonolocusGenotype as missing data.
void setMonolocusGenotype(size_t locus_position, const MonolocusGenotype &monogen)
Set a MonolocusGenotype.
~MultilocusGenotype()
Destroy a MultilocusGenotype.
void setMonolocusGenotypeByAlleleKey(size_t locus_position, const std::vector< size_t > &allele_keys)
Set a MonolocusGenotype by allele keys.
MultilocusGenotype(size_t loci_number)
Build a MultilocusGenotype linked to an AnalyzedLoci object.
const MonolocusGenotype & getMonolocusGenotype(size_t locus_position) const
Get a MonolocusGenotype.
size_t countHeterozygousLoci() const
Count the number of heterozygous MonolocusGenotype.
std::vector< MonolocusGenotype * > loci_
size_t countHomozygousLoci() const
Count the number of homozygous MonolocusGenotype.
bool isMonolocusGenotypeMissing(size_t locus_position) const
Tell if a MonolocusGenotype is a missing data.
size_t countNonMissingLoci() const
Count the number of non missing MonolocusGenotype.
size_t size() const
Count the number of loci.
void setMonolocusGenotypeByAlleleId(size_t locus_position, const std::vector< std::string > &allele_id, const LocusInfo &locus_info)
Set a MonolocusGenotype by allele id.