bpp-popgen  3.0.0
bpp::PolymorphismSequenceContainer Class Referenceabstract

The PolymorphismSequenceContainer class. More...

#include <Bpp/PopGen/PolymorphismSequenceContainer.h>

+ Inheritance diagram for bpp::PolymorphismSequenceContainer:
+ Collaboration diagram for bpp::PolymorphismSequenceContainer:

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 std::vector< std::string > &names, const Alphabet *alpha)
 Build a new empty PolymorphismSequenceContainer with given sequence names. More...
 
 PolymorphismSequenceContainer (const OrderedSequenceContainer &sc)
 Build a PolymorphismSequenceContainer by copying data from an OrderedSequenceContainer. More...
 
 PolymorphismSequenceContainer (const OrderedSequenceContainer &sc, bool count)
 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 SiteContainer &sc, bool count)
 Build a PolymorphismSequenceContainer by copying data from a SiteContainer. More...
 
 PolymorphismSequenceContainer (const PolymorphismSequenceContainer &psc)
 Copy constructor. More...
 
PolymorphismSequenceContaineroperator= (const PolymorphismSequenceContainer &psc)
 Operator= : copy operator. More...
 
virtual ~PolymorphismSequenceContainer ()
 Destroy a PolymorphismSequenceContainer. More...
 
PolymorphismSequenceContainerclone () const
 Clone a PolymorphismSequenceContainer. More...
 
SequenceremoveSequence (size_t index)
 Remove a sequence by index and return a pointer to this removed sequence. More...
 
SequenceremoveSequence (const std::string &name)
 Remove a sequence by name and return a pointer to this removed sequence. More...
 
void deleteSequence (size_t index)
 Delete a sequence by index. More...
 
void deleteSequence (const std::string &name)
 Delete a sequence by name. More...
 
void addSequenceWithFrequency (const Sequence &sequence, unsigned int frequency, bool checkName=true)
 Add a sequence to the container. More...
 
void addSequenceWithFrequency (const Sequence &sequence, size_t sequenceIndex, unsigned int frequency, bool checkName=true)
 
void addSequence (const Sequence &sequence, bool checkName=true)
 
void addSequence (const Sequence &sequence, size_t sequenceIndex, bool checkName=true)
 
void clear ()
 Clear the container of all its sequences. More...
 
size_t getGroupId (size_t index) const
 Get the group identifier of the sequence. More...
 
size_t getGroupId (const std::string &name) const
 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)
 Set the group identifier of a sequence. More...
 
void setGroupId (const std::string &name, size_t group_id)
 Set the group identifier of a sequence. More...
 
size_t getNumberOfGroups () const
 Get the number of groups. More...
 
bool hasOutgroup () const
 
bool isIngroupMember (size_t index) const
 Tell if the sequence is ingroup by index. More...
 
bool isIngroupMember (const std::string &name) const
 Tell if a sequence is ingroup by name. More...
 
void setAsIngroupMember (size_t index)
 Set a sequence as ingroup member by index. More...
 
void setAsIngroupMember (const std::string &name)
 Set a sequence as ingroup member by name. More...
 
void setAsOutgroupMember (size_t index)
 Set a sequence as outgroup member by index. More...
 
void setAsOutgroupMember (const std::string &name)
 Set a sequence as outgroup member by name. More...
 
void setSequenceCount (size_t index, unsigned int count)
 Set the count of a sequence by index. More...
 
void setSequenceCount (const std::string &name, unsigned int count)
 Set the count of a sequence by name. More...
 
void incrementSequenceCount (size_t index)
 Add 1 to the sequence count. More...
 
void incrementSequenceCount (const std::string &name)
 Add 1 to the sequence count. More...
 
void decrementSequenceCount (size_t index)
 Removz 1 to the sequence count. More...
 
void decrementSequenceCount (const std::string &name)
 Remove 1 to the sequence count. More...
 
unsigned int getSequenceCount (size_t index) const
 Get the count of a sequence by index. More...
 
unsigned int getSequenceCount (const std::string &name) const
 Get the count of a sequence by name. More...
 
SiteContainertoSiteContainer () const
 convert the container to a site container, with sequences dulicated according to their respective frequencies. More...
 
void setSequence (const std::string &name, const Sequence &sequence, bool checkName)
 
void setSequence (size_t sequenceIndex, const Sequence &sequence, bool checkName)
 
std::string toString (const std::string &name) const
 
virtual std::string toString (size_t sequenceIndex) const
 
virtual std::string toString (size_t sequenceIndex) const =0
 
virtual std::string toString (size_t sequenceIndex) const
 
virtual std::string toString (size_t sequenceIndex) const =0
 
const CommentsgetComments (const std::string &name) const
 
const CommentsgetComments () const
 
virtual const CommentsgetComments (size_t sequenceIndex) const
 
virtual const CommentsgetComments (size_t sequenceIndex) const =0
 
virtual const CommentsgetComments (size_t sequenceIndex) const
 
virtual const CommentsgetComments (size_t sequenceIndex) const =0
 
void setComments (const std::string &name, const Comments &comments)
 
void setComments (const Comments &comments)
 
void setComments (size_t sequenceIndex, const Comments &comments)
 
virtual void setComments (const std::string &name, const Comments &comments)=0
 
virtual void setComments (size_t sequenceIndex, const Comments &comments)=0
 
void setComments (size_t sequenceIndex, const Comments &comments)
 
virtual void setComments (const std::string &name, const Comments &comments)=0
 
virtual void setComments (size_t sequenceIndex, const Comments &comments)=0
 
virtual const AlphabetgetAlphabet () const=0
 
const AlphabetgetAlphabet () const
 
const AlphabetgetAlphabet () const
 
virtual double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const =0
 
double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const
 
double getStateValueAt (size_t siteIndex, size_t sequenceIndex, int state) const
 
double getStateValueAt (size_t siteIndex, const std::string &sequenceName, int state) const
 
double getStateValueAt (size_t siteIndex, size_t sequenceIndex, int state) const
 
virtual const CommentsgetGeneralComments () const=0
 
const CommentsgetGeneralComments () const
 
const CommentsgetGeneralComments () const
 
virtual void setGeneralComments (const Comments &comments)=0
 
void setGeneralComments (const Comments &comments)
 
void setGeneralComments (const Comments &comments)
 
virtual void deleteGeneralComments ()=0
 
void deleteGeneralComments ()
 
void deleteGeneralComments ()
 
void clearComments ()
 
const CruxSymbolListSitegetSymbolListSite (size_t siteIndex) const
 
CruxSymbolListSitegetSymbolListSite (size_t siteIndex)
 
size_t getSize () const
 
size_t getSize () const
 
const std::shared_ptr< SitegetObject (size_t objectIndex) const
 
std::shared_ptr< SitegetObject (size_t objectIndex)
 
const std::shared_ptr< SequencegetObject (size_t objectIndex) const
 
std::shared_ptr< SequencegetObject (size_t objectIndex)
 
const std::shared_ptr< SequencegetObject (const std::string &name) const
 
std::shared_ptr< SequencegetObject (const std::string &name)
 
void addObject (std::shared_ptr< Site > object, size_t objectIndex, bool checkPosition=false)
 
virtual void addObject (std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false)
 
void addObject (std::shared_ptr< Sequence > object, size_t objectIndex, const std::string &name, bool check=false)
 
virtual void addObject (std::shared_ptr< T > object, size_t objectIndex, const std::string &name, bool check=false)=0
 
virtual void addObject (std::shared_ptr< T > object, const std::string &name, bool checkName=false)
 
void addObject (std::shared_ptr< T > object, const std::string &name, bool checkName=false)
 
void addObject (std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false)
 
void addObject (std::shared_ptr< Site > object, size_t objectIndex, bool checkPosition=false)
 
void addObject (std::shared_ptr< Sequence > object, size_t objectIndex, const std::string &name, bool check=false)
 
void insertObject (std::shared_ptr< Site > object, size_t objectIndex)
 
virtual void insertObject (std::shared_ptr< T > object, size_t objectIndex)
 
void insertObject (std::shared_ptr< Sequence > object, size_t objectIndex, const std::string &name)
 
virtual void insertObject (std::shared_ptr< T > object, size_t objectIndex, const std::string &name)=0
 
void insertObject (std::shared_ptr< T > object, size_t objectIndex)
 
void insertObject (std::shared_ptr< Site > object, size_t objectIndex)
 
void insertObject (std::shared_ptr< Sequence > object, size_t objectIndex, const std::string &name)
 
bool isAvailablePosition (size_t objectIndex) const
 
bool isAvailablePosition (size_t objectIndex) const
 
std::shared_ptr< SiteremoveObject (size_t objectIndex)
 
std::shared_ptr< SequenceremoveObject (size_t objectIndex)
 
std::shared_ptr< SequenceremoveObject (const std::string &name)
 
std::shared_ptr< SitedeleteObject (size_t objectIndex)
 
virtual std::shared_ptr< T > deleteObject (const std::string &name)
 
std::shared_ptr< SequencedeleteObject (size_t objectIndex)
 
void deleteObjects (size_t objectIndex, size_t length)
 
void deleteObjects (size_t objectIndex, size_t length)
 
void appendObject (std::shared_ptr< Site > object)
 
virtual void appendObject (std::shared_ptr< T > object)
 
void appendObject (std::shared_ptr< Sequence > object, const std::string &name, bool check=true)
 
void appendObject (std::shared_ptr< T > object)
 
void appendObject (std::shared_ptr< Site > object)
 
void appendObject (std::shared_ptr< Sequence > object, const std::string &name, bool check=true)
 
void setSize (size_t size)
 
void setSize (size_t size)
 
size_t getNumberOfObjects () const
 
size_t getObjectPosition (const std::string &name) const
 
std::string getObjectName (size_t objectIndex) const
 
bool hasObject (const std::string &name) const
 
std::vector< std::string > getObjectsNames () const
 
void setObjectsNames (const std::vector< std::string > &names)
 
void setObjectName (size_t pos, const std::string &name)
 
void changeName (const std::string &okey, const std::string &nkey)
 
const SitegetSite (size_t siteIndex) const
 
SitegetSite (size_t siteIndex)
 
const SitegetSite (size_t siteIndex) const
 
SitegetSite (size_t siteIndex)
 
void setSite (size_t siteIndex, const Site &site, bool checkPosition=true)
 
void setSite (size_t siteIndex, const Site &site, bool checkPosition=true)
 
std::shared_ptr< SitedeleteSite (size_t siteIndex)
 
std::shared_ptr< SitedeleteSite (size_t siteIndex)
 
void addSite (const Site &site, bool checkPosition=true)
 
void addSite (const Site &site, int position, bool checkPosition=true)
 
void addSite (const Site &site, size_t siteIndex, bool checkPosition=true)
 
void addSite (const Site &site, size_t siteIndex, int position, bool checkPosition=true)
 
void addSite (const Site &site, bool checkPosition=true)
 
void addSite (const Site &site, int position, bool checkPosition=true)
 
void addSite (const Site &site, size_t siteIndex, bool checkPosition=true)
 
void addSite (const Site &site, size_t siteIndex, int position, bool checkPosition=true)
 
void deleteSites (size_t siteIndex, size_t length)
 
void deleteSites (size_t siteIndex, size_t length)
 
size_t getNumberOfSites () const
 
size_t getNumberOfSites () const
 
void reindexSites ()
 
void reindexSites ()
 
Vint getSitePositions () const
 
Vint getSitePositions () const
 
void setSitePositions (Vint vPositions)
 
void setSitePositions (Vint vPositions)
 
const SequencegetSequence (size_t sequenceIndex) const
 
const SequencegetSequence (const std::string &name) const
 
const SequencegetSequence (size_t sequenceIndex) const
 
const SequencegetSequence (const std::string &name) const
 
bool hasSequence (const std::string &name) const
 
bool hasSequence (const std::string &name) const
 
size_t getSequencePosition (const std::string &name) const
 
size_t getSequencePosition (const std::string &name) const
 
size_t getNumberOfSequences () const
 
size_t getNumberOfSequences () const
 
std::vector< std::string > getSequencesNames () const
 
std::vector< std::string > getSequencesNames () const
 
void setSequencesNames (const std::vector< std::string > &names, bool checkNames=true)
 
void setSequencesNames (const std::vector< std::string > &names, bool checkNames=true)
 
VectorSiteContainercreateEmptyContainer () const
 
VectorSiteContainercreateEmptyContainer () const
 
int & valueAt (const std::string &sequenceName, size_t elementIndex)
 
const int & valueAt (const std::string &sequenceName, size_t elementIndex) const
 
int & valueAt (size_t sequenceIndex, size_t elementIndex)
 
const int & valueAt (size_t sequenceIndex, size_t elementIndex) const
 
int & valueAt (const std::string &sequenceName, size_t elementIndex)
 
const int & valueAt (const std::string &sequenceName, size_t elementIndex) const
 
int & valueAt (size_t sequenceIndex, size_t elementIndex)
 
const int & valueAt (size_t sequenceIndex, size_t elementIndex) const
 
int & operator() (const std::string &sequenceName, size_t elementIndex)
 
const int & operator() (const std::string &sequenceName, size_t elementIndex) const
 
int & operator() (size_t sequenceIndex, size_t elementIndex)
 
const int & operator() (size_t sequenceIndex, size_t elementIndex) const
 
double operator() (size_t siteIndex, const std::string &sequenceName, int state) const
 
double operator() (size_t siteIndex, size_t sequenceIndex, int state) const
 
int & operator() (const std::string &sequenceName, size_t elementIndex)
 
const int & operator() (const std::string &sequenceName, size_t elementIndex) const
 
int & operator() (size_t sequenceIndex, size_t elementIndex)
 
const int & operator() (size_t sequenceIndex, size_t elementIndex) const
 
double operator() (size_t siteIndex, const std::string &sequenceName, int state) const
 
double operator() (size_t siteIndex, size_t sequenceIndex, int state) const
 
virtual const std::string & getName (size_t sequenceIndex) const
 
virtual const std::string & getName (size_t sequenceIndex) const
 

Protected Member Functions

void realloc (size_t n)
 
std::shared_ptr< SitegetObject_ (size_t objectIndex) const
 
std::shared_ptr< T > getObject_ (size_t objectIndex) const
 
void addObject_ (std::shared_ptr< Site > object, size_t objectIndex, bool checkPosition=false) const
 
void addObject_ (std::shared_ptr< Sequence > object, size_t objectIndex, const std::string &name, bool check=false) const
 
void addObject_ (std::shared_ptr< T > object, const std::string &name, bool checkName=false) const
 
void addObject_ (std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false) const
 
void addObject_ (std::shared_ptr< Site > object, size_t objectIndex, bool checkPosition=false) const
 
void addObject_ (std::shared_ptr< Sequence > object, size_t objectIndex, const std::string &name, bool check=false) const
 

Protected Attributes

const Alphabetalphabet_
 
Comments comments_
 
std::vector< std::shared_ptr< Site > > positions_
 
std::vector< std::shared_ptr< T > > positions_
 

Private Attributes

std::vector< bool > ingroup_
 
std::vector< unsigned int > count_
 
std::vector< size_t > group_
 
std::vector< std::string > vNames_
 
std::map< std::string, size_t > mNames_
 
std::map< std::string, std::shared_ptr< T > > mObjects_
 

Detailed Description

The PolymorphismSequenceContainer class.

This is a VectorSiteContainer with effectif for each sequence. It also has flag for ingroup and outgroup.

Author
Sylvain Gaillard

Definition at line 102 of file PolymorphismSequenceContainer.h.

Constructor & Destructor Documentation

◆ PolymorphismSequenceContainer() [1/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( const Alphabet alpha)

Build a new empty PolymorphismSequenceContainer.

Definition at line 51 of file PolymorphismSequenceContainer.cpp.

Referenced by clone().

◆ PolymorphismSequenceContainer() [2/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( size_t  size,
const Alphabet alpha 
)

Build a new empty PolymorphismSequenceContainer of given size.

Definition at line 59 of file PolymorphismSequenceContainer.cpp.

◆ PolymorphismSequenceContainer() [3/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( const std::vector< std::string > &  names,
const Alphabet alpha 
)

Build a new empty PolymorphismSequenceContainer with given sequence names.

Definition at line 67 of file PolymorphismSequenceContainer.cpp.

◆ PolymorphismSequenceContainer() [4/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( const OrderedSequenceContainer sc)

Build a PolymorphismSequenceContainer by copying data from an OrderedSequenceContainer.

Parameters
scSequence container to convert.

Definition at line 75 of file PolymorphismSequenceContainer.cpp.

◆ PolymorphismSequenceContainer() [5/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( const OrderedSequenceContainer sc,
bool  count 
)

Build a PolymorphismSequenceContainer by copying data from an OrderedSequenceContainer.

Note
In case of count = false, the constructor with additional argument will be more efficient.
Parameters
scSequence container to convert.
countTell if identical sequences should be collapsed and counted. If not (the historical behavior), sequences are duplicated and stored with a frequency of 1.

Definition at line 83 of file PolymorphismSequenceContainer.cpp.

References addSequenceWithFrequency(), bpp::SequenceTools::areSequencesIdentical(), bpp::VectorSiteContainer::getNumberOfSequences(), bpp::OrderedSequenceContainer::getNumberOfSequences(), bpp::VectorSiteContainer::getSequence(), bpp::OrderedSequenceContainer::getSequence(), group_, incrementSequenceCount(), and ingroup_.

◆ PolymorphismSequenceContainer() [6/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( const SiteContainer sc)

Build a PolymorphismSequenceContainer by copying data from a SiteContainer.

Parameters
scSequence container to convert.

Definition at line 113 of file PolymorphismSequenceContainer.cpp.

◆ PolymorphismSequenceContainer() [7/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( const SiteContainer sc,
bool  count 
)

Build a PolymorphismSequenceContainer by copying data from a SiteContainer.

Note
In case of count = false, the constructor with additional argument will be more efficient.
Parameters
scSequence container to convert.
countTell if identical sequences should be collapsed and counted. If not (the historical behavior), sequences are duplicated and stored with a frequency of 1.

Definition at line 121 of file PolymorphismSequenceContainer.cpp.

References addSequenceWithFrequency(), bpp::SequenceTools::areSequencesIdentical(), bpp::VectorSiteContainer::getNumberOfSequences(), bpp::SiteContainer::getNumberOfSequences(), bpp::VectorSiteContainer::getSequence(), bpp::SiteContainer::getSequence(), group_, incrementSequenceCount(), and ingroup_.

◆ PolymorphismSequenceContainer() [8/8]

PolymorphismSequenceContainer::PolymorphismSequenceContainer ( const PolymorphismSequenceContainer psc)

◆ ~PolymorphismSequenceContainer()

PolymorphismSequenceContainer::~PolymorphismSequenceContainer ( )
virtual

Destroy a PolymorphismSequenceContainer.

Definition at line 188 of file PolymorphismSequenceContainer.cpp.

References clear().

Member Function Documentation

◆ addSequence() [1/2]

void bpp::PolymorphismSequenceContainer::addSequence ( const Sequence sequence,
bool  checkName = true 
)
inlinevirtual

Reimplemented from bpp::VectorSiteContainer.

Definition at line 225 of file PolymorphismSequenceContainer.h.

References addSequenceWithFrequency().

Referenced by bpp::SequenceStatistics::mkTable().

◆ addSequence() [2/2]

void bpp::PolymorphismSequenceContainer::addSequence ( const Sequence sequence,
size_t  sequenceIndex,
bool  checkName = true 
)
inline

Definition at line 228 of file PolymorphismSequenceContainer.h.

References addSequenceWithFrequency().

◆ addSequenceWithFrequency() [1/2]

void PolymorphismSequenceContainer::addSequenceWithFrequency ( const Sequence sequence,
size_t  sequenceIndex,
unsigned int  frequency,
bool  checkName = true 
)

◆ addSequenceWithFrequency() [2/2]

void PolymorphismSequenceContainer::addSequenceWithFrequency ( const Sequence sequence,
unsigned int  frequency,
bool  checkName = true 
)

Add a sequence to the container.

Exceptions
AlphabetMismatchExceptionif the sequence's alphabet doesn't match the container's alphabet.
SequenceExceptionif the sequence's size doesn't match the sequence's size of the container.
SequenceExceptionif the sequence's name already exists in the container.

Definition at line 251 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::addSequence(), count_, group_, and ingroup_.

Referenced by addSequence(), bpp::DataSet::getPolymorphismSequenceContainer(), bpp::PolymorphismSequenceContainerTools::getSelectedSequences(), and PolymorphismSequenceContainer().

◆ clear()

void PolymorphismSequenceContainer::clear ( )
virtual

Clear the container of all its sequences.

Reimplemented from bpp::VectorSiteContainer.

Definition at line 285 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::clear(), count_, group_, and ingroup_.

Referenced by ~PolymorphismSequenceContainer().

◆ clone()

◆ decrementSequenceCount() [1/2]

void PolymorphismSequenceContainer::decrementSequenceCount ( const std::string &  name)

Remove 1 to the sequence count.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.
BadIntegerExceptionif count < 1 ... use deleteSequence instead of setting the count to 0.

Definition at line 504 of file PolymorphismSequenceContainer.cpp.

References decrementSequenceCount(), and bpp::VectorSiteContainer::getSequencePosition().

◆ decrementSequenceCount() [2/2]

void PolymorphismSequenceContainer::decrementSequenceCount ( size_t  index)

Removz 1 to the sequence count.

Exceptions
IndexOutOfBoundsExceptionif index excedes the number of sequences in the container.
BadIntegerExceptionif count < 1 ... use deleteSequence instead of setting the count to 0.

Definition at line 493 of file PolymorphismSequenceContainer.cpp.

References count_, and bpp::VectorSiteContainer::getNumberOfSequences().

Referenced by decrementSequenceCount().

◆ deleteSequence() [1/2]

void PolymorphismSequenceContainer::deleteSequence ( const std::string &  name)

Delete a sequence by name.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 237 of file PolymorphismSequenceContainer.cpp.

References removeSequence().

◆ deleteSequence() [2/2]

void PolymorphismSequenceContainer::deleteSequence ( size_t  index)

◆ getAllGroupsIds()

std::set< size_t > PolymorphismSequenceContainer::getAllGroupsIds ( ) const

Get all the groups identifiers.

Definition at line 318 of file PolymorphismSequenceContainer.cpp.

References group_.

Referenced by bpp::DataSetTools::buildDataSet(), and getNumberOfGroups().

◆ getGroupId() [1/2]

size_t PolymorphismSequenceContainer::getGroupId ( const std::string &  name) const

Get the group identifier of a sequence.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 304 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::getSequencePosition(), and group_.

◆ getGroupId() [2/2]

◆ getNumberOfGroups()

size_t PolymorphismSequenceContainer::getNumberOfGroups ( ) const

Get the number of groups.

Definition at line 353 of file PolymorphismSequenceContainer.cpp.

References getAllGroupsIds().

◆ getSequenceCount() [1/2]

unsigned int PolymorphismSequenceContainer::getSequenceCount ( const std::string &  name) const

Get the count of a sequence by name.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 531 of file PolymorphismSequenceContainer.cpp.

References getSequenceCount(), and bpp::VectorSiteContainer::getSequencePosition().

◆ getSequenceCount() [2/2]

◆ hasOutgroup()

bool PolymorphismSequenceContainer::hasOutgroup ( ) const
Returns
True is the container contains at least one outgroup sequence.

Definition at line 360 of file PolymorphismSequenceContainer.cpp.

References ingroup_.

◆ incrementSequenceCount() [1/2]

void PolymorphismSequenceContainer::incrementSequenceCount ( const std::string &  name)

Add 1 to the sequence count.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 479 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::getSequencePosition(), and incrementSequenceCount().

◆ incrementSequenceCount() [2/2]

void PolymorphismSequenceContainer::incrementSequenceCount ( size_t  index)

Add 1 to the sequence count.

Exceptions
IndexOutOfBoundsExceptionif index excedes the number of sequences in the container.

Definition at line 470 of file PolymorphismSequenceContainer.cpp.

References count_, and bpp::VectorSiteContainer::getNumberOfSequences().

Referenced by incrementSequenceCount(), and PolymorphismSequenceContainer().

◆ isIngroupMember() [1/2]

bool PolymorphismSequenceContainer::isIngroupMember ( const std::string &  name) const

Tell if a sequence is ingroup by name.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 379 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::getSequencePosition(), and ingroup_.

◆ isIngroupMember() [2/2]

◆ operator=()

◆ removeSequence() [1/2]

Sequence * PolymorphismSequenceContainer::removeSequence ( const std::string &  name)
virtual

Remove a sequence by name and return a pointer to this removed sequence.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Reimplemented from bpp::VectorSiteContainer.

Definition at line 209 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::getSequencePosition(), and removeSequence().

◆ removeSequence() [2/2]

Sequence * PolymorphismSequenceContainer::removeSequence ( size_t  index)
virtual

Remove a sequence by index and return a pointer to this removed sequence.

Exceptions
IndexOutOfBoundsExceptionif index excedes the number of sequences.

Reimplemented from bpp::VectorSiteContainer.

Definition at line 197 of file PolymorphismSequenceContainer.cpp.

References count_, bpp::VectorSiteContainer::getNumberOfSequences(), group_, ingroup_, and bpp::VectorSiteContainer::removeSequence().

Referenced by deleteSequence(), and removeSequence().

◆ setAsIngroupMember() [1/2]

void PolymorphismSequenceContainer::setAsIngroupMember ( const std::string &  name)

Set a sequence as ingroup member by name.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 402 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::getSequencePosition(), and ingroup_.

◆ setAsIngroupMember() [2/2]

◆ setAsOutgroupMember() [1/2]

void PolymorphismSequenceContainer::setAsOutgroupMember ( const std::string &  name)

Set a sequence as outgroup member by name.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 426 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::getSequencePosition(), and ingroup_.

◆ setAsOutgroupMember() [2/2]

◆ setGroupId() [1/2]

void PolymorphismSequenceContainer::setGroupId ( const std::string &  name,
size_t  group_id 
)

Set the group identifier of a sequence.

Exceptions
SequenceNotFoundExceptionif name is not found among the sequences' names.

Definition at line 339 of file PolymorphismSequenceContainer.cpp.

References bpp::VectorSiteContainer::getSequencePosition(), and group_.

◆ setGroupId() [2/2]

◆ setSequenceCount() [1/2]

void PolymorphismSequenceContainer::setSequenceCount ( const std::string &  name,
unsigned int  count 
)

Set the count of a sequence by name.

Exceptions
throwSequenceNotFoundException if name is not found among the sequences' names.
BadIntegerExceptionif count < 1 ... use deleteSequence instead of setting the count to 0.

Definition at line 452 of file PolymorphismSequenceContainer.cpp.

References count(), bpp::VectorSiteContainer::getSequencePosition(), and setSequenceCount().

◆ setSequenceCount() [2/2]

void PolymorphismSequenceContainer::setSequenceCount ( size_t  index,
unsigned int  count 
)

Set the count of a sequence by index.

Exceptions
IndexOutOfBoundsExceptionif index excedes the number of sequences in the container.
BadIntegerExceptionif count < 1 ... use deleteSequence instead of setting the count to 0.

Definition at line 441 of file PolymorphismSequenceContainer.cpp.

References count(), count_, and bpp::VectorSiteContainer::getNumberOfSequences().

Referenced by bpp::PolymorphismSequenceContainerTools::getCompleteSites(), bpp::PolymorphismSequenceContainerTools::getSitesWithoutGaps(), and setSequenceCount().

◆ toSiteContainer()

SiteContainer * PolymorphismSequenceContainer::toSiteContainer ( ) const

convert the container to a site container, with sequences dulicated according to their respective frequencies.

Returns
A SiteContainer object, eventually with duplicated sequences. Names of duplicated sequences are happended with _1, _2, etc.

Definition at line 545 of file PolymorphismSequenceContainer.cpp.

References bpp::Sequence::clone(), bpp::VectorSiteContainer::getAlphabet(), bpp::Sequence::getName(), bpp::VectorSiteContainer::getNumberOfSequences(), bpp::VectorSiteContainer::getSequence(), getSequenceCount(), bpp::TextTools::toString(), and bpp::VectorSiteContainer::VectorSiteContainer().

Member Data Documentation

◆ count_

std::vector<unsigned int> bpp::PolymorphismSequenceContainer::count_
private

◆ group_

std::vector<size_t> bpp::PolymorphismSequenceContainer::group_
private

◆ ingroup_

std::vector<bool> bpp::PolymorphismSequenceContainer::ingroup_
private

The documentation for this class was generated from the following files: