66 for (
size_t ns=1; ns < vseq.size(); ns++)
153 for (
size_t j = 0; j < n; j++)
171 for (
size_t j = 0; j < n; j++)
192 throw SiteException(
"AlignedSequenceContainer::setSite, site does not have the appropriate length", &site);
200 if (poss == position)
201 throw SiteException(
"AlignedSequenceContainer::setSite: Site position already exists in container", &site);
272 positions_.begin() +
static_cast<ptrdiff_t
>(siteIndex + length));
289 throw SiteException(
"AlignedSequenceContainer::addSite, site does not have the appropriate length", &site);
296 for (
size_t i = 0; i <
positions_.size(); i++)
299 throw SiteException(
"AlignedSequenceContainer::addSite: Site position already exists in container", &site);
324 throw SiteException(
"AlignedSequenceContainer::addSite, site does not have the appropriate length", &site);
330 for (
size_t i = 0; i <
positions_.size(); i++)
333 throw SiteException(
"AlignedSequenceContainer::addSite: Site position already exists in container", &site);
363 throw SiteException(
"AlignedSequenceContainer::addSite, site does not have the appropriate length", &site);
370 for (
size_t i = 0; i <
positions_.size(); i++)
373 throw SiteException(
"AlignedSequenceContainer::addSite: Site position already exists in container", &site);
401 throw SiteException(
"AlignedSequenceContainer::addSite, site does not have the appropriate length", &site);
407 for (
size_t i = 0; i <
positions_.size(); i++)
410 throw SiteException(
"AlignedSequenceContainer::addSite: Site position already exists in container", &site);
430 for (
size_t i = 0; i <
length_; i++)
441 for (
size_t i = 0; i < vPositions.size(); i++)
virtual int getPosition() const
Get the position of this site.
Partial implementation of the OrderedSequenceContainer interface.
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.
Aligned sequences container.
std::vector< int > positions_
size_t getNumberOfSites() const
Get the number of aligned positions in the container.
virtual const Site & getSite(size_t siteIndex) const
Get a site from the container.
void deleteSite(size_t siteIndex)
Delete a site from the container.
Vint getSitePositions() const
Get all position attributes of sites.
void reindexSites()
Set all positions attributes.
virtual void setSite(size_t siteIndex, const Site &site, bool checkPosition=true)
Set a site in the container.
void addSequence(const Sequence &sequence, bool checkName=true)
Add a sequence at the end of the container.
std::shared_ptr< Site > removeSite(size_t siteIndex)
Remove a site from the container.
void addSite(const Site &site, bool checkPosition=true)
Add a site in the container.
void deleteSites(size_t siteIndex, size_t length)
Remove a continuous range of sites in the container.
AlignedSequenceContainer * createEmptyContainer() const
Return a copy of this container, but with no data inside.
bool checkSize_(const Sequence &sequence)
Check sequence's size before insertion in sequence container.
void setSitePositions(Vint vPositions)
Set all position attributes of sites.
AlignedSequenceContainer(std::vector< std::shared_ptr< Sequence >> vseq, const Alphabet *alpha)
Build a container with the specified alphabet, with shared Sequences.
AlignedSequenceContainer & operator=(const AlignedSequenceContainer &asc)
virtual Vint getSitePositions() const =0
Get all position attributes of sites.
virtual size_t getNumberOfSites() const =0
Get the number of aligned positions in the container.
Exception thrown when two alphabets do not match.
virtual std::string getAlphabetType() const =0
Identification method.
virtual void addElement(const T &c)=0
Add a character to the end of the list.
virtual void setElement(size_t pos, const T &c)=0
Set the element at position 'pos' to character 'c'.
virtual void deleteElement(size_t pos)=0
Remove the element at position 'pos'.
virtual const Alphabet * getAlphabet() const =0
Get the alphabet associated to the list.
virtual void deleteElements(size_t pos, size_t len)=0
Remove the elements at position 'pos'.
virtual size_t size() const =0
Get the number of elements in the list.
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 void setSequence(const std::string &name, const Sequence &sequence, bool checkName)=0
Replace a sequence in the container.
Exception thrown when a sequence is not align with others.
virtual size_t getNumberOfSequences() const =0
Get the number of sequences in the container.
virtual const Comments & getGeneralComments() const =0
Get the comments of this container.
The SiteContainer interface.
The site exception base class.
The template VectorPositionedContainer class.
void deleteObject(size_t objectIndex)
Delete an object from the container.
void appendObject(std::shared_ptr< T > object)
void nullify()
Nullify all elements.
VectorPositionedContainer< T > & operator=(const VectorPositionedContainer< T > &vsc)
copy where shared_ptr elements are shared
void setSize(size_t size)
void addObject(std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false)
Add an object.
void insertObject(std::shared_ptr< T > object, size_t objectIndex)
Insert an object.
void clear()
Destroys the vector.
std::shared_ptr< T > removeObject(size_t objectIndex)
Extract and remove a object from the container.
void addObject_(std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false) const
const std::shared_ptr< T > getObject(size_t objectIndex) const
Retrieve an object from the container. Set as protected since they will be public under T specific na...
void deleteObjects(size_t objectIndex, size_t length)
The VectorSequenceContainer class.
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.
VectorSequenceContainer & operator=(const VectorSequenceContainer &vsc)
Assign from a VectorSequenceContainer.
void clear()
Delete all objects in the container.
This alphabet is used to deal NumericAlphabet.