16 throw BadIntegerException(
"MultilocusGenotype::MultilocusGenotype: loci_number must be > 0.",
static_cast<int>(loci_number));
19 for (
size_t i = 0; i < loci_number; ++i)
26 loci_(genotype.size())
28 for (
size_t i = 0; i < genotype.
size(); ++i)
50 if (locusPosition <
loci_.size())
58 const std::vector<size_t>& alleleKeys)
60 if (alleleKeys.size() < 1)
61 throw Exception(
"MultilocusGenotype::setMonolocusGenotypeByAlleleKey: no key in alleleKeys.");
63 if (locusPosition <
loci_.size())
73 const vector<string>& alleleId,
76 vector<size_t> alleleKeys;
77 for (
size_t i = 0; i < alleleId.size(); i++)
100 if (locusPosition >=
loci_.size())
101 throw IndexOutOfBoundsException(
"MultilocusGenotype::setMonolocusGenotypeAsMissing: locusPosition out of bounds.", locusPosition, 0,
loci_.size());
102 loci_[locusPosition] =
nullptr;
107 if (locusPosition >=
loci_.size())
109 return loci_[locusPosition] ==
nullptr;
114 if (locusPosition >=
loci_.size())
116 return *
loci_[locusPosition];
127 for (
size_t i = 0; i <
loci_.size(); ++i)
138 for (
size_t i = 0; i <
loci_.size(); ++i)
154 for (
size_t i = 0; i <
loci_.size(); i++)
The AlleleNotFoundException class.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
The BiAlleleMonolocusGenotype class.
std::size_t getBadIndex() const
const std::array< std::size_t, 2 > & getBounds() const
unsigned int getAlleleInfoKey(const std::string &id) const
Get the position of an AlleleInfo.
The MonolocusGenotype virtual class.
MonolocusGenotypeInterface * clone() const override=0
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.
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.
std::size_t count(const std::string &s, const std::string &pattern)