bpp-phyl3  3.0.0
bpp::SitePatterns Class Reference

Data structure for site patterns. More...

#include <Bpp/Phyl/SitePatterns.h>

+ Inheritance diagram for bpp::SitePatterns:
+ Collaboration diagram for bpp::SitePatterns:

Classes

class  SortableSite
 Class used for site pattern sorting. More...
 

Public Types

typedef Eigen::Matrix< size_t, 1, -1 > IndicesType
 

Public Member Functions

 SitePatterns (const AlignmentDataInterface &sequences, std::vector< std::string > names={})
 Build a new SitePattern object. More...
 
SitePatternsclone () const
 
const std::vector< unsigned int > & getWeights () const
 
const IndicesTypegetIndices () const
 
std::unique_ptr< AlignmentDataInterfacegetSites () const
 

Private Member Functions

void init_ (const AlignmentDataInterface &sequences, std::vector< std::string > names={})
 

Private Attributes

std::vector< std::string > names_
 
std::vector< std::shared_ptr< const CoreSiteInterface > > sites_
 
std::vector< unsigned int > weights_
 
IndicesType indices_
 
std::shared_ptr< const Alphabetalpha_
 

Detailed Description

Data structure for site patterns.

'names' are the sequence names 'sites' points toward a unique site 'weights' is the number of sites identical to this sites 'indices' are the positions in the original container

Definition at line 33 of file SitePatterns.h.

Member Typedef Documentation

◆ IndicesType

typedef Eigen::Matrix<size_t, 1, -1> bpp::SitePatterns::IndicesType

Definition at line 37 of file SitePatterns.h.

Constructor & Destructor Documentation

◆ SitePatterns()

SitePatterns::SitePatterns ( const AlignmentDataInterface sequences,
std::vector< std::string >  names = {} 
)

Build a new SitePattern object.

Look for patterns (unique sites) within a site container.

Parameters
sequencesThe container to look in.
namesThe vector of the names of the sequences that are effectively used in the computation. If not empty, the sites are filtered with the sequences names.

Definition at line 17 of file SitePatterns.cpp.

References bpp::TemplateAlignmentDataInterface< class >::getSequenceNames(), init_(), names_, and bpp::VectorTools::vectorIntersection().

Referenced by clone().

Member Function Documentation

◆ clone()

SitePatterns* bpp::SitePatterns::clone ( ) const
inlinevirtual

Implements bpp::Clonable.

Definition at line 88 of file SitePatterns.h.

References SitePatterns().

◆ getIndices()

const IndicesType& bpp::SitePatterns::getIndices ( ) const
inline
Returns
The position of each unique site.

Definition at line 103 of file SitePatterns.h.

References indices_.

Referenced by bpp::DRTreeParsimonyData::init(), bpp::DRASDRTreeLikelihoodData::initLikelihoods(), and bpp::LikelihoodCalculationSingleProcess::setPatterns_().

◆ getSites()

unique_ptr< AlignmentDataInterface > SitePatterns::getSites ( ) const
Returns
A new container with each unique site.

Definition at line 110 of file SitePatterns.cpp.

References alpha_, names_, and sites_.

Referenced by bpp::DRTreeParsimonyData::init(), bpp::DRASDRTreeLikelihoodData::initLikelihoods(), and bpp::LikelihoodCalculationSingleProcess::setPatterns_().

◆ getWeights()

const std::vector<unsigned int>& bpp::SitePatterns::getWeights ( ) const
inline
Returns
The number of times each unique site was found.

Definition at line 99 of file SitePatterns.h.

References weights_.

Referenced by bpp::DRTreeParsimonyData::init(), bpp::DRASDRTreeLikelihoodData::initLikelihoods(), and bpp::LikelihoodCalculationSingleProcess::setPatterns_().

◆ init_()

Member Data Documentation

◆ alpha_

std::shared_ptr<const Alphabet> bpp::SitePatterns::alpha_
private

Definition at line 71 of file SitePatterns.h.

Referenced by getSites().

◆ indices_

IndicesType bpp::SitePatterns::indices_
private

Definition at line 70 of file SitePatterns.h.

Referenced by getIndices(), and init_().

◆ names_

std::vector<std::string> bpp::SitePatterns::names_
private

Definition at line 67 of file SitePatterns.h.

Referenced by getSites(), and SitePatterns().

◆ sites_

std::vector<std::shared_ptr<const CoreSiteInterface> > bpp::SitePatterns::sites_
private

Definition at line 68 of file SitePatterns.h.

Referenced by getSites(), and init_().

◆ weights_

std::vector<unsigned int> bpp::SitePatterns::weights_
private

Definition at line 69 of file SitePatterns.h.

Referenced by getWeights(), and init_().


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