48 groups_(std::vector<size_t>()),
49 groups_names_(std::map<size_t, std::string>()) {}
52 groups_(std::vector<size_t>(pmgc.size())),
53 groups_names_(std::map<size_t, std::string>())
55 for (
size_t i = 0; i < pmgc.
size(); i++)
61 for (set<size_t>::iterator it = grp_ids.begin(); it != grp_ids.end(); it++)
81 for (
size_t i = 0; i < pmgc.
size(); i++)
87 for (set<size_t>::iterator it = grp_ids.begin(); it != grp_ids.end(); it++)
103 map<size_t, string>::const_iterator it =
groups_names_.find(group);
115 if (position >= size())
116 throw IndexOutOfBoundsException(
"PolymorphismMultiGContainer::getMultilocusGenotype: position out of bounds.", position, 0, size() - 1);
117 return multilocusGenotypes_[position];
124 if (position >= size())
125 throw IndexOutOfBoundsException(
"PolymorphismMultiGContainer::removeMultilocusGenotype: position out of bounds.", position, 0, size() - 1);
127 multilocusGenotypes_.erase(multilocusGenotypes_.begin() + position);
128 groups_.erase(groups_.begin() + position);
136 if (position >= size())
137 throw IndexOutOfBoundsException(
"PolymorphismMultiGContainer::deleteMultilocusGenotype: position out of bounds.", position, 0, size() - 1);
138 delete multilocusGenotypes_[position];
139 multilocusGenotypes_.erase(multilocusGenotypes_.begin() + position);
140 groups_.erase(groups_.begin() + position);
148 for (
size_t i = 0; i <
size(); i++)
163 throw Exception(
"MultilocusGenotypes are not aligned.");
173 if (position >= size())
174 throw IndexOutOfBoundsException(
"PolymorphismMultiGContainer::getGroupId: position out of bounds.", position, 0, size() - 1);
175 return groups_[position];
182 if (position >= size())
183 throw IndexOutOfBoundsException(
"PolymorphismMultiGContainer::setGroupId: position out of bounds.", position, 0, size() - 1);
184 groups_[position] = group_id;
191 set<size_t> groups_ids;
192 for (
size_t i = 0; i <
size(); i++)
203 vector<string> grps_names;
204 map<size_t, string>::const_iterator it;
207 string name = it->second;
209 grps_names.push_back(name);
221 for (
size_t i = 0; i <
size(); i++)
241 for (
size_t i = 0; i <
size(); i++)
254 map<size_t, string>::const_iterator it = groups_names_.find(group_id);
255 if (it != groups_names_.end() )
266 map<size_t, string>::iterator it = groups_names_.find(group_id);
267 if (it != groups_names_.end() )
287 for (
size_t i = 0; i <
size(); i++)