5 #ifndef _POLYMORPHISMSEQUENCECONTAINER_H_
6 #define _POLYMORPHISMSEQUENCECONTAINER_H_
154 std::unique_ptr<Sequence>
removeSequence(
size_t sequencePosition)
override;
171 std::unique_ptr<Sequence>&
sequence,
172 unsigned int frequency)
175 count_.push_back(frequency);
182 size_t sequencePosition,
183 std::unique_ptr<Sequence>&
sequence,
185 unsigned int frequency)
188 count_.insert(
count_.begin() +
static_cast<ptrdiff_t
>(sequencePosition), frequency);
189 ingroup_.insert(
ingroup_.begin() +
static_cast<ptrdiff_t
>(sequencePosition),
true);
190 group_.insert(
group_.begin() +
static_cast<ptrdiff_t
>(sequencePosition), 0);
195 std::unique_ptr<Sequence>&
sequence)
override
The PolymorphismSequenceContainer class.
PolymorphismSequenceContainer * clone() const override
Clone a PolymorphismSequenceContainer.
void setGroupId(size_t index, size_t group_id)
Set the group identifier of a sequence.
std::vector< unsigned int > count_
std::unique_ptr< SiteContainerInterface > toSiteContainer() const
convert the container to a site container, with sequences dulicated according to their respective fre...
size_t getGroupId(size_t index) const
Get the group identifier of the sequence.
void setAsIngroupMember(size_t index)
Set a sequence as ingroup member by index.
void setAsOutgroupMember(size_t index)
Set a sequence as outgroup member by index.
void insertSequence(size_t sequencePosition, std::unique_ptr< Sequence > &sequence, const std::string &sequenceKey) override
void addSequenceWithFrequency(const std::string &sequenceKey, std::unique_ptr< Sequence > &sequence, unsigned int frequency)
Add a sequence to the container.
virtual ~PolymorphismSequenceContainer()
Destroy a PolymorphismSequenceContainer.
PolymorphismSequenceContainer(size_t size, std::shared_ptr< const Alphabet > alpha)
Build a new empty PolymorphismSequenceContainer of given size.
PolymorphismSequenceContainer(std::shared_ptr< const Alphabet > alpha)
Build a new empty PolymorphismSequenceContainer.
bool isIngroupMember(const std::string &name) const
Tell if a sequence is ingroup by name.
size_t getGroupId(const std::string &name) const
Get the group identifier of a sequence.
bool isIngroupMember(size_t index) const
Tell if the sequence is ingroup by index.
size_t getNumberOfGroups() const
Get the number of groups.
void clear() override
Clear the container of all its sequences.
unsigned int getSequenceCount(size_t index) const
Get the count of a sequence by index.
PolymorphismSequenceContainer & operator=(const PolymorphismSequenceContainer &psc)
Operator= : copy operator.
void incrementSequenceCount(size_t index)
Add 1 to the sequence count.
void decrementSequenceCount(size_t index)
Removz 1 to the sequence count.
std::set< size_t > getAllGroupsIds() const
Get all the groups identifiers.
void setSequenceCount(size_t index, unsigned int count)
Set the count of a sequence by index.
PolymorphismSequenceContainer(const SequenceContainerInterface &sc)
Build a PolymorphismSequenceContainer by copying data from a SequenceContainer.
void setGroupId(const std::string &name, size_t group_id)
Set the group identifier of a sequence.
void addSequence(const std::string &sequenceKey, std::unique_ptr< Sequence > &sequence) override
std::unique_ptr< Sequence > removeSequence(size_t sequencePosition) override
PolymorphismSequenceContainer(const std::vector< std::string > &names, std::shared_ptr< const Alphabet > alpha)
Build a new empty PolymorphismSequenceContainer with given sequence names.
void deleteSequence(size_t sequencePosition) override
void insertSequenceWithFrequency(size_t sequencePosition, std::unique_ptr< Sequence > &sequence, const std::string &sequenceKey, unsigned int frequency)
std::vector< size_t > group_
std::vector< bool > ingroup_
void addSequence(const std::string &sequenceKey, std::unique_ptr< SequenceType > &sequence) override
const SequenceType & sequence(const std::string &sequenceKey) const override
void insertSequence(size_t sequencePosition, std::unique_ptr< SequenceType > &sequence, const std::string &sequenceKey) override
size_t getSequencePosition(const std::string &sequenceKey) const override
size_t getNumberOfSequences() const override
const std::string & sequenceKey(size_t sequencePosition) const override