bpp-popgen3  3.0.0
MultilocusGenotype.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef _MULTILOCUSGENOTYPE_H_
6 #define _MULTILOCUSGENOTYPE_H_
7 
8 // From STL
9 #include <vector>
10 #include <string>
11 #include <memory>
12 
13 #include <Bpp/Exceptions.h>
14 
15 // From Pop
16 #include "MonolocusGenotype.h"
17 #include "MonolocusGenotypeTools.h"
20 #include "LocusInfo.h"
21 
22 namespace bpp
23 {
32  public virtual Clonable
33 {
34 private:
35  std::vector<std::unique_ptr<MonolocusGenotypeInterface>> loci_;
36 
37 public:
43  MultilocusGenotype(size_t lociNumber);
44 
48  MultilocusGenotype(const MultilocusGenotype& genotype);
49 
53  virtual ~MultilocusGenotype();
54 
55  MultilocusGenotype* clone() const override { return new MultilocusGenotype(*this); }
56 
57 public:
62  size_t locusPosition,
63  const MonolocusGenotypeInterface& monogen);
64 
72  size_t locusPosition,
73  const std::vector<size_t>& alleleKeys);
74 
82  size_t locusPosition,
83  const std::vector<std::string>& alleleId,
84  const LocusInfo& locusInfo);
85 
91  void setMonolocusGenotypeAsMissing(size_t locusPosition);
92 
98  bool isMonolocusGenotypeMissing(size_t locusPosition) const;
99 
103  const MonolocusGenotypeInterface& monolocusGenotype(size_t locusPosition) const;
104 
110  size_t size() const;
111 
115  size_t countNonMissingLoci() const;
116 
120  size_t countHomozygousLoci() const;
121 
125  size_t countHeterozygousLoci() const;
126 };
127 } // end of namespace bpp;
128 
129 #endif // _MULTILOCUSGENOTYPE_H_
The LocusInfo class.
Definition: LocusInfo.h:31
The MonolocusGenotype virtual class.
The MultilocusGenotype class.
const MonolocusGenotypeInterface & monolocusGenotype(size_t locusPosition) const
Get a MonolocusGenotype.
void setMonolocusGenotypeByAlleleId(size_t locusPosition, const std::vector< std::string > &alleleId, const LocusInfo &locusInfo)
Set a MonolocusGenotype by allele id.
virtual ~MultilocusGenotype()
Destroy a MultilocusGenotype.
MultilocusGenotype(size_t lociNumber)
Build a MultilocusGenotype linked to an AnalyzedLoci object.
bool isMonolocusGenotypeMissing(size_t locusPosition) const
Tell if a MonolocusGenotype is a missing data.
void setMonolocusGenotypeByAlleleKey(size_t locusPosition, const std::vector< size_t > &alleleKeys)
Set a MonolocusGenotype by allele keys.
size_t countHeterozygousLoci() const
Count the number of heterozygous MonolocusGenotype.
MultilocusGenotype * clone() const override
size_t countHomozygousLoci() const
Count the number of homozygous MonolocusGenotype.
void setMonolocusGenotypeAsMissing(size_t locusPosition)
Set a MonolocusGenotype as missing data.
void setMonolocusGenotype(size_t locusPosition, const MonolocusGenotypeInterface &monogen)
Set a MonolocusGenotype.
size_t countNonMissingLoci() const
Count the number of non missing MonolocusGenotype.
std::vector< std::unique_ptr< MonolocusGenotypeInterface > > loci_
size_t size() const
Count the number of loci.