43 #ifndef BPP_SEQ_CONTAINER_MAPSEQUENCECONTAINER_H
44 #define BPP_SEQ_CONTAINER_MAPSEQUENCECONTAINER_H
49 #include "../Alphabet/Alphabet.h"
50 #include "../Sequence.h"
119 void addSequence(
const std::string& key,
const Sequence& sequence,
bool checkNames =
true);
124 std::vector<std::string>
getKeys()
const;
130 std::string
getKey(
size_t pos)
const;
136 std::string
getKey(
const std::string& name)
const;
164 void setSequence(
const std::string& name,
const Sequence& sequence,
bool checkName =
true);
171 int&
valueAt(
const std::string& sequenceName,
size_t elementIndex)
175 const int&
valueAt(
const std::string& sequenceName,
size_t elementIndex)
const
179 int&
operator()(
const std::string& sequenceName,
size_t elementIndex)
183 const int&
operator()(
const std::string& sequenceName,
size_t elementIndex)
const
188 int&
valueAt(
size_t sequenceIndex,
size_t elementIndex)
192 const int&
valueAt(
size_t sequenceIndex,
size_t elementIndex)
const
200 const int&
operator()(
size_t sequenceIndex,
size_t elementIndex)
const
235 double getStateValueAt(
size_t siteIndex,
const std::string& sequenceName,
int state)
const
240 double operator()(
size_t siteIndex,
const std::string& sequenceName,
int state)
const
242 return getSequence(sequenceName)(siteIndex, state);
261 if (siteIndex >= seq.
size())
267 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.
virtual bool isResolvedIn(int state1, int state2) const =0
Tells if a given (potentially unresolved) state can be resolved in another resolved state.
virtual double getStateValueAt(size_t siteIndex, int state) const
virtual size_t size() const =0
Get the number of elements in the list.
MapSequenceContainer class.
MapSequenceContainer * createEmptyContainer() const
Return a copy of this container, but with no data inside.
const int & operator()(const std::string &sequenceName, size_t elementIndex) const
Element access operator.
void deleteSequence(const std::string &name)
void clear()
Delete all data in the container.
void addSequence(const std::string &key, const Sequence &sequence, bool checkNames=true)
Add a sequence and key.
const int & valueAt(const std::string &sequenceName, size_t elementIndex) const
Element access function.
MapSequenceContainer(const std::map< std::string, Sequence * > &ms, const Alphabet *alpha)
void setSequenceByKey(const std::string &key, const Sequence &sequence, bool checkNames=true)
Set a sequence.
MapSequenceContainer & operator=(const MapSequenceContainer &msc)
double getStateValueAt(size_t siteIndex, size_t sequenceIndex, int state) const
Sequence * removeSequence(const std::string &name)
Extract (and remove) a sequence from the container.
MapSequenceContainer * clone() const
size_t getSequencePosition(const std::string &name) const
Get the position of a sequence in sequence container from its name.
const int & valueAt(size_t sequenceIndex, size_t elementIndex) const
Element access operator.
virtual ~MapSequenceContainer()
Sequence * removeSequenceByKey(const std::string &key)
Remove a sequence.
double operator()(size_t siteIndex, size_t sequenceIndex, int state) const
int & valueAt(size_t sequenceIndex, size_t elementIndex)
Element access operator.
void addSequence(const Sequence &sequence, bool checkNames=true)
The SequenceContainer method. Calls the addSeqeucne(key, Sequence) method while using the resut of se...
int & operator()(size_t sequenceIndex, size_t elementIndex)
Element access operator.
bool hasSequence(const std::string &name) const
Check if a sequence with a given name is present in the container.
size_t getNumberOfSequences() const
Get the number of sequences in the container.
const Sequence & getSequenceByKey(const std::string &key) const
Get a sequence.
const int & operator()(size_t sequenceIndex, size_t elementIndex) const
Element access operator.
std::vector< std::string > getKeys() const
std::map< std::string, Sequence * > sequences_
int & operator()(const std::string &sequenceName, size_t elementIndex)
Element access operator.
double getStateValueAt(size_t siteIndex, const std::string &sequenceName, int state) const
get value of a state in a position
std::vector< std::string > getSequencesNames() const
Get all the names of the sequences in the container.
const Sequence & getSequence(const std::string &name) const
Retrieve a sequence object from the container.
void setSequencesNames(const std::vector< std::string > &names, bool checkNames)
Set all sequence names.
double operator()(size_t siteIndex, const std::string &sequenceName, int state) const
Sequence & getSequence_(size_t i)
MapSequenceContainer(const Alphabet *alpha)
void deleteSequenceByKey(const std::string &key)
Delete a sequence.
std::string getKey(size_t pos) const
void setSequence(const std::string &name, const Sequence &sequence, bool checkName=true)
Replace a sequence in the container.
int & valueAt(const std::string &sequenceName, size_t elementIndex)
Element access function.
virtual void setComments(size_t sequenceIndex, const Comments &comments)=0
virtual const std::string & getName() const =0
Get the name of this sequence.
This alphabet is used to deal NumericAlphabet.
std::vector< std::string > Comments
Declaration of Comments type.