bpp-popgen
2.2.0
|
The PolymorphismSequenceContainer class. More...
#include <Bpp/PopGen/PolymorphismSequenceContainer.h>
Public Member Functions | |
PolymorphismSequenceContainer (const Alphabet *alpha) | |
Build a new empty PolymorphismSequenceContainer. More... | |
PolymorphismSequenceContainer (size_t size, const Alphabet *alpha) | |
Build a new empty PolymorphismSequenceContainer of given size. More... | |
PolymorphismSequenceContainer (const OrderedSequenceContainer &sc) | |
Build a PolymorphismSequenceContainer by copying data from an OrderedSequenceContainer. More... | |
PolymorphismSequenceContainer (const SiteContainer &sc) | |
Build a PolymorphismSequenceContainer by copying data from a SiteContainer. More... | |
PolymorphismSequenceContainer (const PolymorphismSequenceContainer &psc) | |
Copy constructor. More... | |
PolymorphismSequenceContainer & | operator= (const PolymorphismSequenceContainer &psc) |
Operator= : copy operator. More... | |
virtual | ~PolymorphismSequenceContainer () |
Destroy a PolymorphismSequenceContainer. More... | |
PolymorphismSequenceContainer * | clone () const |
Clone a PolymorphismSequenceContainer. More... | |
Sequence * | removeSequence (size_t index) throw (IndexOutOfBoundsException) |
Remove a sequence by index and return a pointer to this removed sequence. More... | |
Sequence * | removeSequence (const std::string &name) throw (SequenceNotFoundException) |
Remove a sequence by name and return a pointer to this removed sequence. More... | |
void | deleteSequence (size_t index) throw (IndexOutOfBoundsException) |
Delete a sequence by index. More... | |
void | deleteSequence (const std::string &name) throw (SequenceNotFoundException) |
Delete a sequence by name. More... | |
void | addSequenceWithFrequency (const Sequence &sequence, unsigned int frequency, bool checkName=true) throw (Exception) |
Add a sequence to the container. More... | |
void | addSequenceWithFrequency (const Sequence &sequence, size_t sequenceIndex, unsigned int frequency, bool checkName=true) throw (Exception) |
void | addSequence (const Sequence &sequence, bool checkName=true) throw (Exception) |
void | addSequence (const Sequence &sequence, size_t sequenceIndex, bool checkName=true) throw (Exception) |
void | clear () |
Clear the container of all its sequences. More... | |
size_t | getGroupId (size_t index) const throw (IndexOutOfBoundsException) |
Get the group identifier of the sequence. More... | |
size_t | getGroupId (const std::string &name) const throw (SequenceNotFoundException) |
Get the group identifier of a sequence. More... | |
std::set< size_t > | getAllGroupsIds () const |
Get all the groups identifiers. More... | |
void | setGroupId (size_t index, size_t group_id) throw (IndexOutOfBoundsException) |
Set the group identifier of a sequence. More... | |
void | setGroupId (const std::string &name, size_t group_id) throw (SequenceNotFoundException) |
Set the group identifier of a sequence. More... | |
size_t | getNumberOfGroups () const |
Get the number of groups. More... | |
bool | isIngroupMember (size_t index) const throw (IndexOutOfBoundsException) |
Tell if the sequence is ingroup by index. More... | |
bool | isIngroupMember (const std::string &name) const throw (SequenceNotFoundException) |
Tell if a sequence is ingroup by name. More... | |
void | setAsIngroupMember (size_t index) throw (IndexOutOfBoundsException) |
Set a sequence as ingroup member by index. More... | |
void | setAsIngroupMember (const std::string &name) throw (SequenceNotFoundException) |
Set a sequence as ingroup member by name. More... | |
void | setAsOutgroupMember (size_t index) throw (IndexOutOfBoundsException) |
Set a sequence as outgroup member by index. More... | |
void | setAsOutgroupMember (const std::string &name) throw (SequenceNotFoundException) |
Set a sequence as outgroup member by name. More... | |
void | setSequenceCount (size_t index, unsigned int count) throw (Exception) |
Set the count of a sequence by index. More... | |
void | setSequenceCount (const std::string &name, unsigned int count) throw (Exception) |
Set the count of a sequence by name. More... | |
void | incrementSequenceCount (size_t index) throw (IndexOutOfBoundsException) |
Add 1 to the sequence count. More... | |
void | incrementSequenceCount (const std::string &name) throw (SequenceNotFoundException) |
Add 1 to the sequence count. More... | |
void | decrementSequenceCount (size_t index) throw (IndexOutOfBoundsException, BadIntegerException) |
Removz 1 to the sequence count. More... | |
void | decrementSequenceCount (const std::string &name) throw (SequenceNotFoundException, BadIntegerException) |
Remove 1 to the sequence count. More... | |
unsigned int | getSequenceCount (size_t index) const throw (IndexOutOfBoundsException) |
Get the count of a sequence by index. More... | |
unsigned int | getSequenceCount (const std::string &name) const throw (SequenceNotFoundException) |
Get the count of a sequence by name. More... | |
Private Attributes | |
std::vector< bool > | ingroup_ |
std::vector< unsigned int > | count_ |
std::vector< size_t > | group_ |
The PolymorphismSequenceContainer class.
This is a VectorSiteContainer with effectif for each sequence. It also has flag for ingroup and outgroup.
Definition at line 102 of file PolymorphismSequenceContainer.h.
PolymorphismSequenceContainer::PolymorphismSequenceContainer | ( | const Alphabet * | alpha | ) |
Build a new empty PolymorphismSequenceContainer.
Definition at line 49 of file PolymorphismSequenceContainer.cpp.
Referenced by clone().
PolymorphismSequenceContainer::PolymorphismSequenceContainer | ( | size_t | size, |
const Alphabet * | alpha | ||
) |
Build a new empty PolymorphismSequenceContainer of given size.
Definition at line 57 of file PolymorphismSequenceContainer.cpp.
PolymorphismSequenceContainer::PolymorphismSequenceContainer | ( | const OrderedSequenceContainer & | sc | ) |
Build a PolymorphismSequenceContainer by copying data from an OrderedSequenceContainer.
Definition at line 65 of file PolymorphismSequenceContainer.cpp.
PolymorphismSequenceContainer::PolymorphismSequenceContainer | ( | const SiteContainer & | sc | ) |
Build a PolymorphismSequenceContainer by copying data from a SiteContainer.
Definition at line 73 of file PolymorphismSequenceContainer.cpp.
PolymorphismSequenceContainer::PolymorphismSequenceContainer | ( | const PolymorphismSequenceContainer & | psc | ) |
Copy constructor.
Definition at line 81 of file PolymorphismSequenceContainer.cpp.
References count_, getGroupId(), getSequenceCount(), group_, ingroup_, and isIngroupMember().
|
virtual |
Destroy a PolymorphismSequenceContainer.
Definition at line 118 of file PolymorphismSequenceContainer.cpp.
References clear().
|
inline |
Definition at line 194 of file PolymorphismSequenceContainer.h.
References addSequenceWithFrequency().
Referenced by bpp::SequenceStatistics::mkTable().
|
inline |
Definition at line 197 of file PolymorphismSequenceContainer.h.
References addSequenceWithFrequency().
void PolymorphismSequenceContainer::addSequenceWithFrequency | ( | const Sequence & | sequence, |
unsigned int | frequency, | ||
bool | checkName = true |
||
) | |||
throw | ( | Exception | |
) |
Add a sequence to the container.
AlphabetMismatchException | if the sequence's alphabet doesn't match the container's alphabet. |
SequenceException | if the sequence's size doesn't match the sequence's size of the container. |
SequenceException | if the sequence's name already exists in the container. |
Definition at line 181 of file PolymorphismSequenceContainer.cpp.
Referenced by addSequence(), bpp::DataSet::getPolymorphismSequenceContainer(), and bpp::PolymorphismSequenceContainerTools::getSelectedSequences().
void PolymorphismSequenceContainer::addSequenceWithFrequency | ( | const Sequence & | sequence, |
size_t | sequenceIndex, | ||
unsigned int | frequency, | ||
bool | checkName = true |
||
) | |||
throw | ( | Exception | |
) |
Definition at line 198 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::clear | ( | ) |
Clear the container of all its sequences.
Definition at line 215 of file PolymorphismSequenceContainer.cpp.
References count_, group_, and ingroup_.
Referenced by ~PolymorphismSequenceContainer().
|
inline |
Clone a PolymorphismSequenceContainer.
Definition at line 150 of file PolymorphismSequenceContainer.h.
References PolymorphismSequenceContainer().
Referenced by bpp::PolymorphismSequenceContainerTools::excludeFlankingGap().
void PolymorphismSequenceContainer::decrementSequenceCount | ( | size_t | index | ) | |
throw | ( | IndexOutOfBoundsException, | |||
BadIntegerException | |||||
) |
Removz 1 to the sequence count.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
BadIntegerException | if count < 1 ... use deleteSequence instead of setting the count to 0. |
Definition at line 413 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::decrementSequenceCount | ( | const std::string & | name | ) | |
throw | ( | SequenceNotFoundException, | |||
BadIntegerException | |||||
) |
Remove 1 to the sequence count.
SequenceNotFoundException | if name is not found among the sequences' names. |
BadIntegerException | if count < 1 ... use deleteSequence instead of setting the count to 0. |
Definition at line 424 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::deleteSequence | ( | size_t | index | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Delete a sequence by index.
IndexOutOfBoundsException | if index excedes the number of sequences. |
Definition at line 153 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::PolymorphismSequenceContainerTools::extractGroup(), bpp::PolymorphismSequenceContainerTools::extractIngroup(), and bpp::PolymorphismSequenceContainerTools::extractOutgroup().
void PolymorphismSequenceContainer::deleteSequence | ( | const std::string & | name | ) | |
throw | ( | SequenceNotFoundException | |||
) |
Delete a sequence by name.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 167 of file PolymorphismSequenceContainer.cpp.
std::set< size_t > PolymorphismSequenceContainer::getAllGroupsIds | ( | ) | const |
Get all the groups identifiers.
Definition at line 248 of file PolymorphismSequenceContainer.cpp.
References group_.
Referenced by getNumberOfGroups().
size_t PolymorphismSequenceContainer::getGroupId | ( | size_t | index | ) | const |
throw | ( | IndexOutOfBoundsException | |||
) |
Get the group identifier of the sequence.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
Definition at line 225 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::PolymorphismSequenceContainerTools::get3Prime(), bpp::PolymorphismSequenceContainerTools::get5Prime(), bpp::PolymorphismSequenceContainerTools::getCompleteSites(), bpp::PolymorphismSequenceContainerTools::getIntrons(), bpp::PolymorphismSequenceContainerTools::getNonCodingSites(), bpp::PolymorphismSequenceContainerTools::getOnePosition(), bpp::PolymorphismSequenceContainerTools::getSelectedSequences(), bpp::PolymorphismSequenceContainerTools::getSelectedSites(), bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps(), operator=(), and PolymorphismSequenceContainer().
size_t PolymorphismSequenceContainer::getGroupId | ( | const std::string & | name | ) | const |
throw | ( | SequenceNotFoundException | |||
) |
Get the group identifier of a sequence.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 234 of file PolymorphismSequenceContainer.cpp.
size_t PolymorphismSequenceContainer::getNumberOfGroups | ( | ) | const |
Get the number of groups.
Definition at line 283 of file PolymorphismSequenceContainer.cpp.
References getAllGroupsIds().
unsigned int PolymorphismSequenceContainer::getSequenceCount | ( | size_t | index | ) | const |
throw | ( | IndexOutOfBoundsException | |||
) |
Get the count of a sequence by index.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
Definition at line 442 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::SequenceStatistics::dvh(), bpp::PolymorphismSequenceContainerTools::getCompleteSites(), bpp::PolymorphismSequenceContainerTools::getSelectedSequences(), bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps(), operator=(), and PolymorphismSequenceContainer().
unsigned int PolymorphismSequenceContainer::getSequenceCount | ( | const std::string & | name | ) | const |
throw | ( | SequenceNotFoundException | |||
) |
Get the count of a sequence by name.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 451 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::incrementSequenceCount | ( | size_t | index | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Add 1 to the sequence count.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
Definition at line 390 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::incrementSequenceCount | ( | const std::string & | name | ) | |
throw | ( | SequenceNotFoundException | |||
) |
Add 1 to the sequence count.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 399 of file PolymorphismSequenceContainer.cpp.
bool PolymorphismSequenceContainer::isIngroupMember | ( | size_t | index | ) | const |
throw | ( | IndexOutOfBoundsException | |||
) |
Tell if the sequence is ingroup by index.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
Definition at line 290 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::PolymorphismSequenceContainerTools::get3Prime(), bpp::PolymorphismSequenceContainerTools::get5Prime(), bpp::PolymorphismSequenceContainerTools::getCompleteSites(), bpp::PolymorphismSequenceContainerTools::getIntrons(), bpp::PolymorphismSequenceContainerTools::getNonCodingSites(), bpp::PolymorphismSequenceContainerTools::getOnePosition(), bpp::PolymorphismSequenceContainerTools::getSelectedSequences(), bpp::PolymorphismSequenceContainerTools::getSelectedSites(), bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps(), operator=(), and PolymorphismSequenceContainer().
bool PolymorphismSequenceContainer::isIngroupMember | ( | const std::string & | name | ) | const |
throw | ( | SequenceNotFoundException | |||
) |
Tell if a sequence is ingroup by name.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 299 of file PolymorphismSequenceContainer.cpp.
PolymorphismSequenceContainer & PolymorphismSequenceContainer::operator= | ( | const PolymorphismSequenceContainer & | psc | ) |
Operator= : copy operator.
Definition at line 97 of file PolymorphismSequenceContainer.cpp.
References count_, getGroupId(), getSequenceCount(), group_, ingroup_, and isIngroupMember().
Sequence * PolymorphismSequenceContainer::removeSequence | ( | size_t | index | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Remove a sequence by index and return a pointer to this removed sequence.
IndexOutOfBoundsException | if index excedes the number of sequences. |
Definition at line 127 of file PolymorphismSequenceContainer.cpp.
Sequence * PolymorphismSequenceContainer::removeSequence | ( | const std::string & | name | ) | |
throw | ( | SequenceNotFoundException | |||
) |
Remove a sequence by name and return a pointer to this removed sequence.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 139 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::setAsIngroupMember | ( | size_t | index | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Set a sequence as ingroup member by index.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
Definition at line 313 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::PolymorphismSequenceContainerTools::get3Prime(), bpp::PolymorphismSequenceContainerTools::get5Prime(), bpp::PolymorphismSequenceContainerTools::getCompleteSites(), bpp::PolymorphismSequenceContainerTools::getIntrons(), bpp::PolymorphismSequenceContainerTools::getNonCodingSites(), bpp::PolymorphismSequenceContainerTools::getOnePosition(), bpp::PolymorphismSequenceContainerTools::getSelectedSequences(), bpp::PolymorphismSequenceContainerTools::getSelectedSites(), and bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps().
void PolymorphismSequenceContainer::setAsIngroupMember | ( | const std::string & | name | ) | |
throw | ( | SequenceNotFoundException | |||
) |
Set a sequence as ingroup member by name.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 322 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::setAsOutgroupMember | ( | size_t | index | ) | |
throw | ( | IndexOutOfBoundsException | |||
) |
Set a sequence as outgroup member by index.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
Definition at line 337 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::PolymorphismSequenceContainerTools::get3Prime(), bpp::PolymorphismSequenceContainerTools::get5Prime(), bpp::PolymorphismSequenceContainerTools::getCompleteSites(), bpp::PolymorphismSequenceContainerTools::getIntrons(), bpp::PolymorphismSequenceContainerTools::getNonCodingSites(), bpp::PolymorphismSequenceContainerTools::getOnePosition(), bpp::PolymorphismSequenceContainerTools::getSelectedSequences(), bpp::PolymorphismSequenceContainerTools::getSelectedSites(), bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps(), bpp::SequenceStatistics::mkTable(), and bpp::PolymorphismSequenceContainerTools::read().
void PolymorphismSequenceContainer::setAsOutgroupMember | ( | const std::string & | name | ) | |
throw | ( | SequenceNotFoundException | |||
) |
Set a sequence as outgroup member by name.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 346 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::setGroupId | ( | size_t | index, |
size_t | group_id | ||
) | |||
throw | ( | IndexOutOfBoundsException | |
) |
Set the group identifier of a sequence.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
Definition at line 260 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::PolymorphismSequenceContainerTools::get3Prime(), bpp::PolymorphismSequenceContainerTools::get5Prime(), bpp::PolymorphismSequenceContainerTools::getCompleteSites(), bpp::PolymorphismSequenceContainerTools::getIntrons(), bpp::PolymorphismSequenceContainerTools::getNonCodingSites(), bpp::PolymorphismSequenceContainerTools::getOnePosition(), bpp::DataSet::getPolymorphismSequenceContainer(), bpp::PolymorphismSequenceContainerTools::getSelectedSequences(), bpp::PolymorphismSequenceContainerTools::getSelectedSites(), and bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps().
void PolymorphismSequenceContainer::setGroupId | ( | const std::string & | name, |
size_t | group_id | ||
) | |||
throw | ( | SequenceNotFoundException | |
) |
Set the group identifier of a sequence.
SequenceNotFoundException | if name is not found among the sequences' names. |
Definition at line 269 of file PolymorphismSequenceContainer.cpp.
void PolymorphismSequenceContainer::setSequenceCount | ( | size_t | index, |
unsigned int | count | ||
) | |||
throw | ( | Exception | |
) |
Set the count of a sequence by index.
IndexOutOfBoundsException | if index excedes the number of sequences in the container. |
BadIntegerException | if count < 1 ... use deleteSequence instead of setting the count to 0. |
Definition at line 361 of file PolymorphismSequenceContainer.cpp.
Referenced by bpp::PolymorphismSequenceContainerTools::getCompleteSites(), and bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps().
void PolymorphismSequenceContainer::setSequenceCount | ( | const std::string & | name, |
unsigned int | count | ||
) | |||
throw | ( | Exception | |
) |
Set the count of a sequence by name.
throw | SequenceNotFoundException if name is not found among the sequences' names. |
BadIntegerException | if count < 1 ... use deleteSequence instead of setting the count to 0. |
Definition at line 372 of file PolymorphismSequenceContainer.cpp.
|
private |
Definition at line 107 of file PolymorphismSequenceContainer.h.
Referenced by clear(), operator=(), and PolymorphismSequenceContainer().
|
private |
Definition at line 108 of file PolymorphismSequenceContainer.h.
Referenced by clear(), getAllGroupsIds(), operator=(), and PolymorphismSequenceContainer().
|
private |
Definition at line 106 of file PolymorphismSequenceContainer.h.
Referenced by clear(), operator=(), and PolymorphismSequenceContainer().