96
* @brief The PolymorphismSequenceContainer class.
98
* This is a VectorSiteContainer with effectif for each sequence.
99
* It also has flag for ingroup and outgroup.
101
* @author Sylvain Gaillard
103
class PolymorphismSequenceContainer:
104
public VectorSiteContainer
95
* @brief The PolymorphismSequenceContainer class.
97
* This is a VectorSiteContainer with effectif for each sequence.
98
* It also has flag for ingroup and outgroup.
100
* @author Sylvain Gaillard
102
class PolymorphismSequenceContainer :
103
public VectorSiteContainer
106
std::vector<bool> ingroup_;
107
std::vector<size_t> count_;
108
std::vector<size_t> group_;
111
// Constructors and destructor
113
* @brief Build a new empty PolymorphismSequenceContainer.
115
PolymorphismSequenceContainer(const Alphabet* alpha);
118
* @brief Build a new empty PolymorphismSequenceContainer of given size.
120
PolymorphismSequenceContainer(size_t size, const Alphabet* alpha);
123
* @brief Build a PolymorphismSequenceContainer by copying data from an OrderedSequenceContainer.
125
PolymorphismSequenceContainer(const OrderedSequenceContainer& sc);
128
* @brief Build a PolymorphismSequenceContainer by copying data from a SiteContainer.
130
PolymorphismSequenceContainer(const SiteContainer& sc);
133
* @brief Copy constructor.
135
PolymorphismSequenceContainer(const PolymorphismSequenceContainer& psc);
138
* @brief Operator= : copy operator.
140
PolymorphismSequenceContainer& operator=(const PolymorphismSequenceContainer& psc);
143
* @brief Destroy a PolymorphismSequenceContainer.
145
virtual ~PolymorphismSequenceContainer();
148
* @brief Clone a PolymorphismSequenceContainer.
150
PolymorphismSequenceContainer* clone() const
107
std::vector<bool> ingroup_;
108
std::vector<unsigned int> count_;
109
std::vector<unsigned int> group_;
111
public: // Constructors and destructor
113
* @brief Build a new empty PolymorphismSequenceContainer.
115
PolymorphismSequenceContainer(const Alphabet* alpha);
118
* @brief Build a new empty PolymorphismSequenceContainer of given size.
120
PolymorphismSequenceContainer(unsigned int size, const Alphabet* alpha);
123
* @brief Build a PolymorphismSequenceContainer by copying data from an OrderedSequenceContainer.
125
PolymorphismSequenceContainer(const OrderedSequenceContainer& sc);
128
* @brief Build a PolymorphismSequenceContainer by copying data from a SiteContainer.
130
PolymorphismSequenceContainer(const SiteContainer& sc);
133
* @brief Copy constructor.
135
PolymorphismSequenceContainer(const PolymorphismSequenceContainer& psc);
138
* @brief Operator= : copy operator.
140
PolymorphismSequenceContainer& operator=(const PolymorphismSequenceContainer& psc);
143
* @brief Destroy a PolymorphismSequenceContainer.
145
virtual ~PolymorphismSequenceContainer();
148
* @brief Clone a PolymorphismSequenceContainer.
150
PolymorphismSequenceContainer* clone() const
152
return new PolymorphismSequenceContainer(*this);
156
public: // Other methods
158
* @brief Remove a sequence by index and return a pointer to this removed sequence.
160
* @throw IndexOutOfBoundsException if index excedes the number of sequences.
162
Sequence * removeSequence(unsigned int index) throw (IndexOutOfBoundsException);
165
* @brief Remove a sequence by name and return a pointer to this removed sequence.
167
* @throw SequenceNotFoundException if name is not found among the sequences' names.
169
Sequence * removeSequence(const std::string &name) throw (SequenceNotFoundException);
172
* @brief Delete a sequence by index.
174
* @throw IndexOutOfBoundsException if index excedes the number of sequences.
176
void deleteSequence(unsigned int index) throw (IndexOutOfBoundsException);
179
* @brief Delete a sequence by name.
181
* @throw SequenceNotFoundException if name is not found among the sequences' names.
183
void deleteSequence(const std::string &name) throw (SequenceNotFoundException);
186
* @brief Add a sequence to the container.
188
* @throw AlphabetMismatchException if the sequence's alphabet doesn't match the container's alphabet.
189
* @throw SequenceException if the sequence's size doesn't match the sequence's size of the container.
190
* @throw SequenceException if the sequence's name already exists in the container.
192
void addSequence(const Sequence &sequence,unsigned int effectif=1, bool checkNames=true) throw (Exception);
195
* @brief Clear the container of all its sequences.
200
* @brief Get the group identifier of the sequence.
202
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
204
unsigned int getGroupId(unsigned int index) const throw (IndexOutOfBoundsException);
207
* @brief Get the group identifier of a sequence.
209
* @throw SequenceNotFoundException if name is not found among the sequences' names.
211
unsigned int getGroupId(const std::string & name) const throw (SequenceNotFoundException);
214
* @brief Get all the groups identifiers.
216
std::set<unsigned int> getAllGroupsIds() const;
219
* @brief Set the group identifier of a sequence.
221
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
223
void setGroupId(unsigned int index, unsigned int group_id) throw (IndexOutOfBoundsException);
226
* @brief Set the group identifier of a sequence.
228
* @throw SequenceNotFoundException if name is not found among the sequences' names.
230
void setGroupId(const std::string & name, unsigned int group_id) throw (SequenceNotFoundException);
233
* @brief Get the number of groups.
235
unsigned int getNumberOfGroups() const;
238
* @brief Tell if the sequence is ingroup by index.
240
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
242
bool isIngroupMember(unsigned int index) const throw (IndexOutOfBoundsException);
245
* @brief Tell if a sequence is ingroup by name.
247
* @throw SequenceNotFoundException if name is not found among the sequences' names.
249
bool isIngroupMember(const std::string &name) const throw (SequenceNotFoundException);
252
* @brief Set a sequence as ingroup member by index.
254
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
256
void setAsIngroupMember(unsigned int index) throw (IndexOutOfBoundsException);
259
* @brief Set a sequence as ingroup member by name.
261
* @throw SequenceNotFoundException if name is not found among the sequences' names.
263
void setAsIngroupMember(const std::string &name) throw (SequenceNotFoundException);
266
* @brief Set a sequence as outgroup member by index.
268
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
270
void setAsOutgroupMember(unsigned int index) throw (IndexOutOfBoundsException);
273
* @brief Set a sequence as outgroup member by name.
275
* @throw SequenceNotFoundException if name is not found among the sequences' names.
277
void setAsOutgroupMember(const std::string &name) throw (SequenceNotFoundException);
280
* @brief Set the count of a sequence by index.
282
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
283
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
285
void setSequenceCount(unsigned int index, unsigned int count) throw (Exception);
288
* @brief Set the count of a sequence by name.
290
* @throw throw SequenceNotFoundException if name is not found among the sequences' names.
291
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
293
void setSequenceCount(const std::string &name, unsigned int count) throw (Exception);
296
* @brief Add 1 to the sequence count.
298
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
300
void incrementSequenceCount(unsigned int index) throw (IndexOutOfBoundsException);
303
* @brief Add 1 to the sequence count.
305
* @throw throw SequenceNotFoundException if name is not found among the sequences' names.
307
void incrementSequenceCount(const std::string &name) throw (SequenceNotFoundException);
310
* @brief Remove 1 to the sequence count.
312
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
313
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
315
void decrementSequenceCount(unsigned int index) throw (Exception);
318
* @brief Remove 1 to the sequence count.
320
* @throw throw SequenceNotFoundException if name is not found among the sequences' names.
321
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
323
void decrementSequenceCount(const std::string & name) throw (Exception);
326
* @brief Get the count of a sequence by index.
328
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
330
unsigned int getSequenceCount(unsigned int index) const throw (IndexOutOfBoundsException);
333
* @brief Get the count of a sequence by name.
335
* @throw SequenceNotFoundException if name is not found among the sequences' names.
337
unsigned int getSequenceCount(const std::string &name) const throw (SequenceNotFoundException);
341
} //end of namespace bpp;
343
#endif //_POLYMORPHISMSEQUENCECONTAINER_H_
152
return new PolymorphismSequenceContainer(*this);
158
* @brief Remove a sequence by index and return a pointer to this removed sequence.
160
* @throw IndexOutOfBoundsException if index excedes the number of sequences.
162
Sequence* removeSequence(size_t index) throw (IndexOutOfBoundsException);
165
* @brief Remove a sequence by name and return a pointer to this removed sequence.
167
* @throw SequenceNotFoundException if name is not found among the sequences' names.
169
Sequence* removeSequence(const std::string& name) throw (SequenceNotFoundException);
172
* @brief Delete a sequence by index.
174
* @throw IndexOutOfBoundsException if index excedes the number of sequences.
176
void deleteSequence(size_t index) throw (IndexOutOfBoundsException);
179
* @brief Delete a sequence by name.
181
* @throw SequenceNotFoundException if name is not found among the sequences' names.
183
void deleteSequence(const std::string& name) throw (SequenceNotFoundException);
186
* @brief Add a sequence to the container.
188
* @throw AlphabetMismatchException if the sequence's alphabet doesn't match the container's alphabet.
189
* @throw SequenceException if the sequence's size doesn't match the sequence's size of the container.
190
* @throw SequenceException if the sequence's name already exists in the container.
192
void addSequence(const Sequence& sequence, size_t effectif = 1, bool checkNames = true) throw (Exception);
195
* @brief Clear the container of all its sequences.
200
* @brief Get the group identifier of the sequence.
202
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
204
size_t getGroupId(size_t index) const throw (IndexOutOfBoundsException);
207
* @brief Get the group identifier of a sequence.
209
* @throw SequenceNotFoundException if name is not found among the sequences' names.
211
size_t getGroupId(const std::string& name) const throw (SequenceNotFoundException);
214
* @brief Get all the groups identifiers.
216
std::set<size_t> getAllGroupsIds() const;
219
* @brief Set the group identifier of a sequence.
221
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
223
void setGroupId(size_t index, size_t group_id) throw (IndexOutOfBoundsException);
226
* @brief Set the group identifier of a sequence.
228
* @throw SequenceNotFoundException if name is not found among the sequences' names.
230
void setGroupId(const std::string& name, size_t group_id) throw (SequenceNotFoundException);
233
* @brief Get the number of groups.
235
size_t getNumberOfGroups() const;
238
* @brief Tell if the sequence is ingroup by index.
240
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
242
bool isIngroupMember(size_t index) const throw (IndexOutOfBoundsException);
245
* @brief Tell if a sequence is ingroup by name.
247
* @throw SequenceNotFoundException if name is not found among the sequences' names.
249
bool isIngroupMember(const std::string& name) const throw (SequenceNotFoundException);
252
* @brief Set a sequence as ingroup member by index.
254
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
256
void setAsIngroupMember(size_t index) throw (IndexOutOfBoundsException);
259
* @brief Set a sequence as ingroup member by name.
261
* @throw SequenceNotFoundException if name is not found among the sequences' names.
263
void setAsIngroupMember(const std::string& name) throw (SequenceNotFoundException);
266
* @brief Set a sequence as outgroup member by index.
268
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
270
void setAsOutgroupMember(size_t index) throw (IndexOutOfBoundsException);
273
* @brief Set a sequence as outgroup member by name.
275
* @throw SequenceNotFoundException if name is not found among the sequences' names.
277
void setAsOutgroupMember(const std::string& name) throw (SequenceNotFoundException);
280
* @brief Set the count of a sequence by index.
282
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
283
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
285
void setSequenceCount(size_t index, size_t count) throw (Exception);
288
* @brief Set the count of a sequence by name.
290
* @throw throw SequenceNotFoundException if name is not found among the sequences' names.
291
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
293
void setSequenceCount(const std::string& name, size_t count) throw (Exception);
296
* @brief Add 1 to the sequence count.
298
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
300
void incrementSequenceCount(size_t index) throw (IndexOutOfBoundsException);
303
* @brief Add 1 to the sequence count.
305
* @throw throw SequenceNotFoundException if name is not found among the sequences' names.
307
void incrementSequenceCount(const std::string& name) throw (SequenceNotFoundException);
310
* @brief Remove 1 to the sequence count.
312
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
313
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
315
void decrementSequenceCount(size_t index) throw (Exception);
318
* @brief Remove 1 to the sequence count.
320
* @throw throw SequenceNotFoundException if name is not found among the sequences' names.
321
* @throw BadIntegerException if count < 1 ... use deleteSequence instead of setting the count to 0.
323
void decrementSequenceCount(const std::string& name) throw (Exception);
326
* @brief Get the count of a sequence by index.
328
* @throw IndexOutOfBoundsException if index excedes the number of sequences in the container.
330
size_t getSequenceCount(size_t index) const throw (IndexOutOfBoundsException);
333
* @brief Get the count of a sequence by name.
335
* @throw SequenceNotFoundException if name is not found among the sequences' names.
337
size_t getSequenceCount(const std::string& name) const throw (SequenceNotFoundException);
339
} // end of namespace bpp;
341
#endif // _POLYMORPHISMSEQUENCECONTAINER_H_