24 auto seqTmp0 = unique_ptr<Sequence>(sc.
sequence(0).clone());
41 auto seqTmp = unique_ptr<Sequence>(seq.
clone());
53 ingroup_(psc.getNumberOfSequences()),
54 count_(psc.getNumberOfSequences()),
55 group_(psc.getNumberOfSequences())
75 for (
size_t i = 0; i < nbSeq; i++)
101 count_.erase(
count_.begin() +
static_cast<ptrdiff_t
>(sequencePosition));
102 ingroup_.erase(
ingroup_.begin() +
static_cast<ptrdiff_t
>(sequencePosition));
103 group_.erase(
group_.begin() +
static_cast<ptrdiff_t
>(sequencePosition));
154 for (
size_t i = 0; i <
group_.size(); i++)
156 grp_ids.insert(
group_[i]);
228 throw BadIntegerException(
"PolymorphismSequenceContainer::setSequenceCount: count can't be < 1.",
static_cast<int>(
count));
279 if (
count_[index] - 1 < 1)
280 throw BadIntegerException(
"PolymorphismSequenceContainer::decrementSequenceCount: count can't be < 1.",
static_cast<int>(
count_[index] - 1));
336 for (
unsigned int j = 0; j < freq; ++j)
338 unique_ptr<Sequence> seqdup(seq.clone());
340 sites->addSequence(seqdup->getName(), seqdup);
345 unique_ptr<Sequence> seqdup(seq.clone());
346 sites->addSequence(seqdup->getName(), seqdup);
std::shared_ptr< const Alphabet > getAlphabet() const override
The PolymorphismSequenceContainer class.
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 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(std::shared_ptr< const Alphabet > alpha)
Build a new empty PolymorphismSequenceContainer.
bool isIngroupMember(size_t index) const
Tell if the sequence is ingroup by index.
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.
std::unique_ptr< Sequence > removeSequence(size_t sequencePosition) override
void deleteSequence(size_t sequencePosition) override
std::vector< size_t > group_
std::vector< bool > ingroup_
Sequence * clone() const override
virtual const SequenceType & sequence(const HashType &sequenceKey) const override=0
virtual size_t getNumberOfSequences() const =0
std::unique_ptr< SequenceType > removeSequence(size_t sequencePosition) override
Vint getSiteCoordinates() const override
const SequenceType & sequence(const std::string &sequenceKey) const override
size_t getSequencePosition(const std::string &sequenceKey) const override
size_t getNumberOfSequences() const override
TemplateVectorSiteContainer< SiteType, SequenceType > & operator=(const TemplateVectorSiteContainer< SiteType, SequenceType > &vsc)
std::string toString(T t)
std::size_t count(const std::string &s, const std::string &pattern)
TemplateVectorSiteContainer< Site, Sequence > VectorSiteContainer