40 #ifndef BPP_SEQ_CONTAINER_VECTOR_PROBABILISTIC_SEQUENCECONTAINER_H
41 #define BPP_SEQ_CONTAINER_VECTOR_PROBABILISTIC_SEQUENCECONTAINER_H
45 #include "../Alphabet/Alphabet.h"
46 #include "../ProbabilisticSequence.h"
75 const std::vector<std::shared_ptr<ProbabilisticSequence>>& vs,
const Alphabet* alpha);
114 std::string
toString(
const std::string& name)
const
140 const std::string&
getName(
size_t sequenceIndex)
const
194 void setSequenceNames(
const std::vector<std::string>& names,
bool checkNames =
true);
211 addObject(std::shared_ptr<ProbabilisticSequence>(sequence.
clone()), sequenceIndex, sequence.
getName(), checkName);
267 virtual void addSequence(
const std::shared_ptr<ProbabilisticSequence> sequence,
bool checkName =
true)
269 if (sequence->getAlphabet()->getAlphabetType() !=
getAlphabet()->getAlphabetType())
293 addObject(std::shared_ptr<ProbabilisticSequence>(sequence.
clone()), sequenceIndex, sequence.
getName(), checkName);
313 double getStateValueAt(
size_t siteIndex,
const std::string& sequenceName,
int state)
const
318 double operator()(
size_t siteIndex,
const std::string& sequenceName,
int state)
const
320 return getSequence(sequenceName)(siteIndex, state);
328 if (siteIndex >= seq.
size())
334 double operator()(
size_t siteIndex,
size_t sequenceIndex,
int state)
const
Partial implementation of the OrderedSequenceContainer interface.
const Alphabet * getAlphabet() const
Get container's alphabet.
Exception thrown when two alphabets do not match.
virtual std::string getAlphabetType() const =0
Identification method.
virtual size_t getStateIndex(int state) const =0
virtual const std::string & getName() const =0
Get the name of this sequence.
virtual void setComments(const Comments &comments)=0
Set the comments.
virtual const Comments & getComments() const =0
Get the comments.
virtual std::string toString() const =0
Convert the list as a string.
virtual const Alphabet * getAlphabet() const =0
Get the alphabet associated to the list.
virtual double getStateValueAt(size_t siteIndex, int state) const
virtual size_t size() const =0
Get the number of elements in the list.
virtual void setComments(const std::string &name, const Comments &comments)=0
Set the comments of a particular sequence.
The probabilistic sequence interface.
virtual ProbabilisticSequence * clone() const =0
The template VectorMappedContainer class.
const std::shared_ptr< ProbabilisticSequence > getObject(size_t objectIndex) const
void appendObject(std::shared_ptr< ProbabilisticSequence > object, const std::string &name, bool check=true)
size_t getObjectPosition(const std::string &name) const
void clear()
Delete all objects in the container.
std::shared_ptr< ProbabilisticSequence > removeObject(size_t objectIndex)
bool hasObject(const std::string &name) const
std::vector< std::string > getObjectNames() const
void addObject(std::shared_ptr< ProbabilisticSequence > object, size_t objectIndex, const std::string &name, bool check=false)
The VectorProbabilisticSequenceContainer class.
VectorProbabilisticSequenceContainer * createEmptyContainer() const
Return a copy of this container, but with no data inside.
std::vector< std::string > getSequenceNames() const
Get all the names of the sequences in the container.
virtual const Comments & getComments(size_t sequenceIndex) const
const std::string & getName(size_t sequenceIndex) const
Get the name of a particular row of the alignement (aka sequence).
double getStateValueAt(size_t siteIndex, const std::string &sequenceName, int state) const
get value of a state in a position
ProbabilisticSequence & getSequence_(const std::string &name)
void setComments(const std::string &name, const Comments &comments)
Set the comments of a particular sequence.
void clear()
Delete all objects in the container.
ProbabilisticSequence & getSequence_(size_t i)
std::string toString(const std::string &name) const
Convert a particular sequence to a string.
virtual void addSequence(const ProbabilisticSequence &sequence, size_t sequenceIndex, bool checkName=true)
Add a sequence to the container at a particular position.
VectorProbabilisticSequenceContainer(const Alphabet *alpha)
Build an empty container that will contain sequences of a particular alphabet.
size_t getNumberOfSequences() const
Get the number of sequences in the container.
bool hasSequence(const std::string &name) const
Check if a sequence with a given name is present in the container.
void setSequence(size_t sequenceIndex, const ProbabilisticSequence &sequence, bool checkName=true)
std::string toString(size_t sequenceIndex) const
VectorProbabilisticSequenceContainer(const std::vector< std::shared_ptr< ProbabilisticSequence >> &vs, const Alphabet *alpha)
Build a container with shared Sequences.
const ProbabilisticSequence & getSequence(size_t sequenceIndex) const
size_t getSequencePosition(const std::string &name) const
Get the position of a sequence in sequence container from its name.
virtual void addSequence(const ProbabilisticSequence &sequence, bool checkName=true)
Add a sequence at the end of the container.
double operator()(size_t siteIndex, size_t sequenceIndex, int state) const
void setComments(size_t sequenceIndex, const Comments &comments)
const ProbabilisticSequence & getSequence(const std::string &name) const
void setSequenceNames(const std::vector< std::string > &names, bool checkNames=true)
Set all sequence names.
std::shared_ptr< ProbabilisticSequence > removeSequence(const std::string &name)
void setSequence(const std::string &name, const ProbabilisticSequence &sequence, bool checkName=true)
std::shared_ptr< ProbabilisticSequence > removeSequence(size_t sequenceIndex)
VectorProbabilisticSequenceContainer * clone() const
double getStateValueAt(size_t siteIndex, size_t sequenceIndex, int state) const
const Comments & getComments(const std::string &name) const
Get comments of a particular sequence.
virtual void addSequence(const std::shared_ptr< ProbabilisticSequence > sequence, bool checkName=true)
Add a sequence at the end of the container.
VectorProbabilisticSequenceContainer & operator=(const VectorProbabilisticSequenceContainer &vsc)
Assign from a VectorProbabilisticSequenceContainer.
double operator()(size_t siteIndex, const std::string &sequenceName, int state) const
This alphabet is used to deal NumericAlphabet.
std::vector< std::string > Comments
Declaration of Comments type.