40 #ifndef _VECTORSITECONTAINER_H_ 41 #define _VECTORSITECONTAINER_H_ 48 #include <Bpp/Numeric/VectorTools.h> 138 const Site&
getSite(
size_t siteIndex)
const throw (IndexOutOfBoundsException);
139 void setSite(
size_t siteIndex,
const Site& site,
bool checkPosition =
true) throw (Exception);
140 Site*
removeSite(
size_t siteIndex) throw (IndexOutOfBoundsException);
141 void deleteSite(
size_t siteIndex) throw (IndexOutOfBoundsException);
142 void deleteSites(
size_t siteIndex,
size_t length) throw (IndexOutOfBoundsException);
143 void addSite(const
Site& site,
bool checkPosition = true) throw (Exception);
144 void addSite(const
Site& site,
int position,
bool checkPosition = true) throw (Exception);
145 void addSite(const
Site& site,
size_t siteIndex,
bool checkPosition = true) throw (Exception);
146 void addSite(const
Site& site,
size_t siteIndex,
int position,
bool checkPosition = true) throw (Exception);
159 void setComments(
size_t sequenceIndex, const
Comments& comments) throw (IndexOutOfBoundsException);
173 void deleteSequence(
size_t sequenceIndex) throw (IndexOutOfBoundsException);
180 void setSequencesNames(
const std::vector<std::string>& names,
bool checkNames =
true) throw (Exception);
188 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::valueAt(std::string, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
193 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::valueAt(std::string, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
196 int&
operator()(
const std::string& sequenceName,
size_t elementIndex)
200 const int&
operator()(
const std::string& sequenceName,
size_t elementIndex)
const 205 int&
valueAt(
size_t sequenceIndex,
size_t elementIndex)
throw (IndexOutOfBoundsException)
208 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::valueAt(size_t, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
209 return (*
sites_[elementIndex])[sequenceIndex];
211 const int&
valueAt(
size_t sequenceIndex,
size_t elementIndex)
const throw (IndexOutOfBoundsException)
214 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::valueAt(size_t, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
215 return (*
sites_[elementIndex])[sequenceIndex];
219 return (*
sites_[elementIndex])[sequenceIndex];
221 const int&
operator()(
size_t sequenceIndex,
size_t elementIndex)
const 223 return (*
sites_[elementIndex])[sequenceIndex];
228 void addSequence(const
Sequence& sequence,
size_t sequenceIndex,
bool checkName = true) throw (Exception);
231 void setSequence(
size_t sequenceIndex, const
Sequence& sequence,
bool checkName) throw (Exception);
239 #endif // _VECTORSITECONTAINER_H_
Exception thrown when a sequence is not found The sequence not found exception base class...
const int & valueAt(const std::string &sequenceName, size_t elementIndex) const
Element access function.
void addSequence(const Sequence &sequence, bool checkName=true)
Add a sequence to the container.
std::vector< std::string > Comments
Declaration of Comments type.
std::vector< Comments * > comments_
void setSite(size_t siteIndex, const Site &site, bool checkPosition=true)
Set a site in the container.
The SiteContainer interface.
The OrderedSequenceContainer interface.
const Sequence & getSequence(size_t sequenceIndex) const
Retrieve a sequence object from the container.
This alphabet is used to deal NumericAlphabet.
Site * removeSite(size_t siteIndex)
Remove a site from the container.
std::vector< std::string > names_
Partial implementation of the OrderedSequenceContainer interface.
void clear()
Delete all sequences in the container.
void deleteSite(size_t siteIndex)
Delete a site in the container.
void setComments(size_t sequenceIndex, const Comments &comments)
Set the comments of a particular sequence.
void setSequencesNames(const std::vector< std::string > &names, bool checkNames=true)
Set all sequence names.
std::vector< Sequence * > sequences_
Vint getSitePositions() const
Get all position attributes of sites.
int & operator()(const std::string &sequenceName, size_t elementIndex)
Element access operator.
void setSequence(const std::string &name, const Sequence &sequence, bool checkName)
Replace a sequence in the container.
void addSite(const Site &site, bool checkPosition=true)
Add a site in the container.
const int & operator()(const std::string &sequenceName, size_t elementIndex) const
Element access operator.
Sequence * removeSequence(size_t sequenceIndex)
Extract (and remove) a sequence from the container.
void deleteSequence(size_t sequenceIndex)
Delete a sequence of the container.
void deleteSites(size_t siteIndex, size_t length)
Delete a continuous range of sites in the container.
const Site & getSite(size_t siteIndex) const
Get a site from the container.
size_t getNumberOfSites() const
Get the number of sites in the container.
void reindexSites()
Set all positions attributes.
VectorSiteContainer * createEmptyContainer() const
Return a copy of this container, but with no sequence inside.
int & valueAt(size_t sequenceIndex, size_t elementIndex)
Element access operator.
size_t getSequencePosition(const std::string &name) const
Get the position of a sequence in sequence container from its name.
std::vector< Site * > sites_
const int & operator()(size_t sequenceIndex, size_t elementIndex) const
Element access operator.
int & valueAt(const std::string &sequenceName, size_t elementIndex)
Element access function.
VectorSiteContainer * clone() const
std::vector< std::string > getSequencesNames() const
Get all the names of the sequences in the container.
VectorSiteContainer(const std::vector< const Site *> &vs, const Alphabet *alpha, bool checkPositions=true)
Build a new container from a set of sites.
bool hasSequence(const std::string &name) const
Check if a sequence with a given name is present in the container.
int & operator()(size_t sequenceIndex, size_t elementIndex)
Element access operator.
const int & valueAt(size_t sequenceIndex, size_t elementIndex) const
Element access operator.
The SequenceContainer interface.
The VectorSiteContainer class.
size_t getNumberOfSequences() const
Get the number of sequences in the container.