40 #ifndef _COMPRESSEDVECTORSITECONTAINER_H_ 41 #define _COMPRESSEDVECTORSITECONTAINER_H_ 48 #include <Bpp/Numeric/VectorTools.h> 142 const Site&
getSite(
size_t siteIndex)
const throw (IndexOutOfBoundsException);
143 void setSite(
size_t siteIndex,
const Site& site,
bool checkPosition =
false) throw (Exception);
144 Site*
removeSite(
size_t siteIndex) throw (IndexOutOfBoundsException);
145 void deleteSite(
size_t siteIndex) throw (IndexOutOfBoundsException);
146 void deleteSites(
size_t siteIndex,
size_t length) throw (IndexOutOfBoundsException);
147 void addSite(const
Site& site,
bool checkPosition = false) throw (Exception);
148 void addSite(const
Site& site,
int position,
bool checkPosition = false) throw (Exception)
152 void addSite(
const Site& site,
size_t siteIndex,
bool checkPosition =
false) throw (Exception);
153 void addSite(const
Site& site,
size_t siteIndex,
int position,
bool checkPosition = false) throw (Exception)
155 addSite(site, siteIndex, checkPosition);
169 void setComments(
size_t sequenceIndex,
const Comments& comments)
throw (IndexOutOfBoundsException);
183 throw NotImplementedException(
"CompressedVectorSiteContainer::removeSequence.");
189 throw NotImplementedException(
"CompressedVectorSiteContainer::removeSequence.");
192 void deleteSequence(
size_t sequenceIndex)
throw (IndexOutOfBoundsException, NotImplementedException)
195 throw NotImplementedException(
"CompressedVectorSiteContainer::deleteSequence.");
201 throw NotImplementedException(
"CompressedVectorSiteContainer::deleteSequence.");
208 void setSequencesNames(
const std::vector<std::string>& names,
bool checkNames =
true) throw (Exception);
216 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::operator(std::string, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
221 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::operator(std::string, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
224 int&
operator()(
const std::string& sequenceName,
size_t elementIndex)
228 const int&
operator()(
const std::string& sequenceName,
size_t elementIndex)
const 233 int&
valueAt(
size_t sequenceIndex,
size_t elementIndex)
throw (IndexOutOfBoundsException)
236 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::operator(size_t, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
239 const int&
valueAt(
size_t sequenceIndex,
size_t elementIndex)
const throw (IndexOutOfBoundsException)
242 if (elementIndex >=
getNumberOfSites())
throw IndexOutOfBoundsException(
"VectorSiteContainer::operator(size_t, size_t).", elementIndex, 0,
getNumberOfSites() - 1);
249 const int&
operator()(
size_t sequenceIndex,
size_t elementIndex)
const 255 void addSequence(
const Sequence& sequence,
bool checkName =
true) throw (Exception, NotImplementedException)
258 throw NotImplementedException(
"CompressedVectorSiteContainer::addSequence.");
261 void addSequence(
const Sequence& sequence,
size_t sequenceIndex,
bool checkName =
true) throw (Exception, NotImplementedException)
264 throw NotImplementedException(
"CompressedVectorSiteContainer::addSequence.");
267 void setSequence(
const std::string& name,
const Sequence& sequence,
bool checkName)
throw (Exception, NotImplementedException)
270 throw NotImplementedException(
"CompressedVectorSiteContainer::setSequence.");
273 void setSequence(
size_t sequenceIndex,
const Sequence& sequence,
bool checkName)
throw (Exception, NotImplementedException)
276 throw NotImplementedException(
"CompressedVectorSiteContainer::setSequence.");
289 #endif // _COMPRESSEDVECTORSITECONTAINER_H_
Exception thrown when a sequence is not found The sequence not found exception base class...
std::vector< std::string > Comments
Declaration of Comments type.
void addSequence(const Sequence &sequence, bool checkName=true)
Add a sequence to the container.
const Site & getSite(size_t siteIndex) const
Get a site from the container.
The SiteContainer interface.
This alphabet is used to deal NumericAlphabet.
Sequence * removeSequence(size_t sequenceIndex)
Extract (and remove) a sequence from the container.
int & valueAt(size_t sequenceIndex, size_t elementIndex)
Element access operator.
std::vector< size_t > index_
const Sequence & getSequence(size_t sequenceIndex) const
Retrieve a sequence object from the container.
void setSite(size_t siteIndex, const Site &site, bool checkPosition=false)
Set a site in the container.
void reindexSites()
Set all positions attributes.
CompressedVectorSiteContainer(const std::vector< const Site *> &vs, const Alphabet *alpha)
Build a new container from a set of sites.
Partial implementation of the OrderedSequenceContainer interface.
size_t getNumberOfSites() const
Get the number of sites in the container.
const int & operator()(size_t sequenceIndex, size_t elementIndex) const
Element access operator.
CompressedVectorSiteContainer * createEmptyContainer() const
Return a copy of this container, but with no sequence inside.
void deleteSequence(const std::string &name)
Delete a sequence of the container.
void addSequence(const Sequence &sequence, size_t sequenceIndex, bool checkName=true)
Vint getSitePositions() const
Get all position attributes of sites.
const int & operator()(const std::string &sequenceName, size_t elementIndex) const
Element access operator.
A low memory, yet restricted, version of the VectorSiteContainer class.
CompressedVectorSiteContainer * clone() const
std::vector< Sequence * > sequences_
Sequence * removeSequence(const std::string &name)
Extract (and remove) a sequence from the container.
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 addSite(const Site &site, bool checkPosition=false)
Add a site in the container.
void setSequencesNames(const std::vector< std::string > &names, bool checkNames=true)
Set all sequence names.
int & operator()(size_t sequenceIndex, size_t elementIndex)
Element access operator.
int & valueAt(const std::string &sequenceName, size_t elementIndex)
Element access function.
std::vector< std::string > getSequencesNames() const
Get all the names of the sequences in the container.
void clear()
Delete all sequences in the container.
CompressedVectorSiteContainer & operator=(const CompressedVectorSiteContainer &vsc)
const int & valueAt(size_t sequenceIndex, size_t elementIndex) const
Element access operator.
virtual ~CompressedVectorSiteContainer()
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.
size_t getSequencePosition(const std::string &name) const
Get the position of a sequence in sequence container from its name.
std::vector< std::string > names_
size_t getSiteIndex_(const Site &site)
const int & valueAt(const std::string &sequenceName, size_t elementIndex) const
Element access function.
std::vector< Site * > sites_
void setSequence(const std::string &name, const Sequence &sequence, bool checkName)
Replace a sequence in the container.
void deleteSequence(size_t sequenceIndex)
Delete a sequence of the container.
void setSequence(size_t sequenceIndex, const Sequence &sequence, bool checkName)
Replace a sequence in the container.
int & operator()(const std::string &sequenceName, size_t elementIndex)
Element access operator.
std::vector< Comments * > comments_
Site * removeSite(size_t siteIndex)
Remove a site from the container.
void deleteSites(size_t siteIndex, size_t length)
Delete a continuous range of sites in the container.