52 const std::vector<std::shared_ptr<Sequence>>& vs,
57 for (
auto i = vs.begin(); i < vs.end(); i++)
71 for (
size_t i = 0; i < max; i++)
123 for (
unsigned int i = 0; i < max; i++)
150 for (
size_t i=0;i<nbseq;i++)
159 for (
size_t i=0;i<nbseq;i++)
165 throw Exception(
"VectorSequenceContainer::getSequenceByName: Unknown sequence name: " + name);
170 std::vector<std::string> vs;
172 for (
size_t i=0;i<nbseq;i++)
181 for (
size_t i=0;i<nbseq;i++)
187 throw Exception(
"VectorSequenceContainer::removeSequenceByName: Unknown sequence name: " + name);
193 for (
size_t i=0;i<nbseq;i++)
199 throw Exception(
"VectorSequenceContainer::deleteSequenceByName: Unknown sequence name: " + name);
206 const std::vector<std::string>& names,
213 for (
size_t i = 0; i < names.size(); i++)
216 for (
size_t j = 0; j < i; j++)
218 if (names[j] == names[i])
219 throw Exception(
"VectorSiteContainer::setSequenceNames : Sequence's name already exists in container");
223 for (
size_t i = 0; i < names.size(); i++)
Partial implementation of the OrderedSequenceContainer interface.
AbstractSequenceContainer & operator=(const AbstractSequenceContainer &sc)
virtual const std::string & getName(size_t sequenceIndex) const
Get the name of a particular row of the alignement (aka sequence).
void setGeneralComments(const Comments &comments)
Set the comments of this container.
const Alphabet * getAlphabet() const
Get container's alphabet.
const Comments & getGeneralComments() const
Get the comments of this container.
virtual void setName(const std::string &name)=0
Set the name of this sequence.
virtual const std::string & getName() const =0
Get the name of this sequence.
The OrderedSequenceContainer interface.
virtual const Sequence & getSequence(const std::string &name) const=0
Retrieve a sequence object from the container.
virtual const Sequence & getSequence(size_t sequenceIndex) const =0
Retrieve a sequence object from the container.
virtual std::shared_ptr< Sequence > removeSequence(const std::string &name)=0
Extract (and remove) a sequence from the container.
The SequenceContainer interface.
virtual const Sequence & getSequence(const std::string &name) const =0
Retrieve a sequence object from the container.
virtual size_t getNumberOfSequences() const =0
Get the number of sequences in the container.
virtual std::vector< std::string > getSequenceNames() const =0
Get all the names of the sequences in the container.
virtual const Comments & getGeneralComments() const =0
Get the comments of this container.
The template VectorMappedContainer class.
VectorMappedContainer< T > & operator=(const VectorMappedContainer &vsc)
void setObjectNames(const std::vector< std::string > &names)
The VectorSequenceContainer class.
std::vector< std::string > getSequenceNames() const
get Sequences proper names (may be different from the keys used to store them in the map),...
virtual void addSequence(const Sequence &sequence, bool checkName=true)
Add a sequence at the end of the container.
Sequence & getSequence_(size_t i)
size_t getNumberOfSequences() const
Get the number of sequences in the container.
void deleteSequenceByName(const std::string &name)
remove & return a Sequence with this name.
VectorSequenceContainer(const std::vector< std::shared_ptr< Sequence >> &vs, const Alphabet *alpha)
Build a container with shared Sequences.
const Sequence & getSequence(const std::string &name) const
get the Sequence with this name in the map (same as getSequenceByKey).
void deleteSequence(const std::string &name)
delete the Sequence with this name in the map (same as deleteSequenceByKey).
VectorSequenceContainer & operator=(const VectorSequenceContainer &vsc)
Assign from a VectorSequenceContainer.
std::shared_ptr< Sequence > removeSequenceByName(const std::string &name)
remove & return a Sequence with this name.
VectorSequenceContainer * createEmptyContainer() const
Return a copy of this container, but with no data inside.
bool hasSequenceByName(const std::string &name) const
void setSequenceNames(const std::vector< std::string > &names, bool checkNames=true)
set the proper names of the Sequences, in the order of the vector.
const Sequence & getSequenceByName(const std::string &name) const
void clear()
Delete all objects in the container.
This alphabet is used to deal NumericAlphabet.