16 if (locusPosition < loci_.size())
17 loci_[locusPosition].reset(locus.
clone());
20 locusPosition, 0, loci_.size());
26 const std::string& locusName)
const
28 for (
size_t i = 0; i < loci_.size(); ++i)
30 if (loci_[i] && loci_[i]->getName() == locusName)
39 const std::string& locusName)
const
41 for (
const auto& locus : loci_)
43 if (locus && locus->getName() == locusName)
53 size_t locusPosition)
const
55 if (locusPosition >= loci_.size())
56 throw IndexOutOfBoundsException(
"AnalyzedLoci::getLocusInfoAtPosition: locus_position out of bounds.", locusPosition, 0, loci_.size());
57 if (loci_[locusPosition])
58 return *loci_[locusPosition];
69 bool locusFound =
false;
70 for (
auto& locus : loci_)
72 if (locus->getName() == locusName)
77 locus->addAlleleInfo(allele);
95 if (locusPosition < loci_.size())
99 loci_[locusPosition]->addAlleleInfo(allele);
108 locusPosition, 0, loci_.size());
115 vector<size_t> alleleCount;
116 for (
const auto& locus: loci_)
118 alleleCount.push_back(locus->getNumberOfAlleles());
127 for (
const auto& locus : loci_)
129 if (locus && locus->getName() == locusName)
130 return locus->getPloidy();
140 if (locusPosition >= loci_.size())
141 throw IndexOutOfBoundsException(
"AnalyzedLoci::getPloidyByLocusPosition: locus_position out of bounds.", locusPosition, 0, loci_.size());
142 return loci_[locusPosition]->getPloidy();
The AlleleInfo interface.
std::vector< size_t > getNumberOfAlleles() const
Get the number of alleles at each locus.
void addAlleleInfoByLocusName(const std::string &locusName, const AlleleInfo &allele)
Add an AlleleInfo to a LocusInfo by LocusInfo name.
const LocusInfo & getLocusInfoByName(const std::string &locusName) const
Get a LocusInfo by name.
unsigned int getPloidyByLocusName(const std::string &locusName) const
Get the ploidy of a locus by name.
const LocusInfo & getLocusInfoAtPosition(size_t locusPosition) const
Get a LocusInfo by its position.
unsigned int getPloidyByLocusPosition(size_t locusPosition) const
Get the ploidy of a locus by its position.
void addAlleleInfoByLocusPosition(size_t locusosition, const AlleleInfo &allele)
Add an AlleleInfo to a LocusInfo by its position.
void setLocusInfo(size_t locusPosition, const LocusInfo &locus)
Set a LocusInfo.
size_t getLocusInfoPosition(const std::string &locusName) const
Get the position of a LocusInfo.
The BadIdentifierException class.
virtual const std::string getIdentifier() const
Return the value of the identifier as a string.
LocusInfo * clone() const override
The LocusNotFoundException class.