40 #include <Bpp/Text/TextTools.h> 60 ploidy_(locus_info.getPloidy()),
61 alleles_(vector<
AlleleInfo*>(locus_info.getNumberOfAlleles()))
73 for (
unsigned int i = 0; i <
alleles_.size(); i++)
86 for (
unsigned int i = 0; i < alleles_.size(); i++)
88 if (alleles_[i]->getId() == allele.getId())
91 alleles_.push_back(allele.clone());
96 for (
unsigned int i = 0; i < alleles_.size(); i++)
98 if (alleles_[i]->getId() == id)
99 return *(alleles_[i]);
106 if (key >= alleles_.size())
107 throw IndexOutOfBoundsException(
"LocusInfo::getAlleleInfoByKey: key out of bounds.", key, 0, alleles_.size());
108 return *(alleles_[key]);
114 for (
unsigned int i = 0; i < alleles_.size(); i++)
116 if (alleles_[i]->getId() == id)
129 for (
unsigned int i = 0; i <
alleles_.size(); i++)
static unsigned int DIPLOID
std::vector< AlleleInfo * > alleles_
AlleleInfo * clone() const =0
The BadIdentifierException class.
const AlleleInfo & getAlleleInfoByKey(size_t key) const
Retrieve an AlleleInfo object of the LocusInfo.
unsigned int getAlleleInfoKey(const std::string &id) const
Get the position of an AlleleInfo.
static unsigned int HAPLOID
The AlleleNotFoundException class.
void clear()
Delete all alleles from the locus.
static unsigned int UNKNOWN
const AlleleInfo & getAlleleInfoById(const std::string &id) const
Retrieve an AlleleInfo object of the LocusInfo.
LocusInfo(const std::string &name, const unsigned int ploidy=DIPLOID)
Build a new LocusInfo object.
static unsigned int HAPLODIPLOID
size_t getNumberOfAlleles() const
Get the number of alleles at this locus.
virtual ~LocusInfo()
Destroy the LocusInfo.
void addAlleleInfo(const AlleleInfo &allele)
Add an AlleleInfo to the LocusInfo.
The AlleleInfo interface.