bpp-phyl3  3.0.0
bpp::PatternTools Class Reference

Utilitary methods to compute site patterns. More...

#include <Bpp/Phyl/PatternTools.h>

Static Public Member Functions

template<class N , class E , class I >
static std::unique_ptr< AlignmentDataInterfacegetSequenceSubset (const AlignmentDataInterface &sequenceSet, const std::shared_ptr< N > node, const AssociationTreeGraphImplObserver< N, E, I > &tree)
 Extract the sequences corresponding to a given subtree. More...
 
template<class N , class E , class I >
static std::unique_ptr< SiteContainerInterfacegetSequenceSubset (const SiteContainerInterface &sequenceSet, const std::shared_ptr< N > node, const AssociationTreeGraphImplObserver< N, E, I > &tree)
 Extract the sequences corresponding to a given subtree. More...
 
template<class N , class E , class I >
static std::unique_ptr< ProbabilisticSiteContainerInterfacegetSequenceSubset (const ProbabilisticSiteContainerInterface &sequenceSet, const std::shared_ptr< N > node, const AssociationTreeGraphImplObserver< N, E, I > &tree)
 Extract the sequences corresponding to a given subtree. More...
 
static std::unique_ptr< AlignmentDataInterfacegetSequenceSubset (const AlignmentDataInterface &sequenceSet, const Node &node)
 Extract the sequences corresponding to a given subtree. More...
 
static std::unique_ptr< SiteContainerInterfacegetSequenceSubset (const SiteContainerInterface &sequenceSet, const Node &node)
 Extract the sequences corresponding to a given subtree. More...
 
static std::unique_ptr< ProbabilisticSiteContainerInterfacegetSequenceSubset (const ProbabilisticSiteContainerInterface &sequenceSet, const Node &node)
 Extract the sequences corresponding to a given subtree. More...
 
static std::unique_ptr< AlignmentDataInterfacegetSequenceSubset (const AlignmentDataInterface &sequenceSet, const std::vector< std::string > &names)
 Extract the sequences corresponding to a given set of names. More...
 
static std::unique_ptr< SiteContainerInterfacegetSequenceSubset (const SiteContainerInterface &sequenceSet, const std::vector< std::string > &names)
 Extract the sequences in a SiteContainer corresponding to a given set of names. More...
 
static std::unique_ptr< ProbabilisticSiteContainerInterfacegetSequenceSubset (const ProbabilisticSiteContainerInterface &sequenceSet, const std::vector< std::string > &names)
 Extract the sequences in a ProbabilisticSiteContainer corresponding to a given set of names. More...
 
static std::unique_ptr< AlignmentDataInterfaceshrinkSiteSet (const AlignmentDataInterface &siteSet)
 Compress a site container by removing duplicated sites. More...
 
static std::unique_ptr< SiteContainerInterfaceshrinkSiteSet (const SiteContainerInterface &siteSet)
 Compress a site container by removing duplicated sites. More...
 
static std::unique_ptr< ProbabilisticSiteContainerInterfaceshrinkSiteSet (const ProbabilisticSiteContainerInterface &siteSet)
 Compress a site container by removing duplicated sites. More...
 
static Vint getIndexes (const AlignmentDataInterface &sequences1, const AlignmentDataInterface &sequences2)
 Look for the occurrence of each site in sequences1 in sequences2 and send the position of the first occurrence, or -1 if not found. More...
 

Detailed Description

Utilitary methods to compute site patterns.

These methods are mainly designed to save computation in likelihood and parsimony methods.

Definition at line 31 of file PatternTools.h.

Member Function Documentation

◆ getIndexes()

Vint PatternTools::getIndexes ( const AlignmentDataInterface sequences1,
const AlignmentDataInterface sequences2 
)
static

Look for the occurrence of each site in sequences1 in sequences2 and send the position of the first occurrence, or -1 if not found.

Parameters
sequences1First container.
sequences2Second container.
Returns
A vector of positions.

Definition at line 263 of file PatternTools.cpp.

References bpp::SiteTools::areSymbolListsIdentical(), and bpp::TemplateAlignmentDataInterface< class >::getNumberOfSites().

◆ getSequenceSubset() [1/9]

std::unique_ptr< AlignmentDataInterface > PatternTools::getSequenceSubset ( const AlignmentDataInterface sequenceSet,
const Node node 
)
static

Extract the sequences corresponding to a given subtree.

Parameters
sequenceSetThe container to look in.
nodeThe root node of the subtree to check.
Returns
A new site container with corresponding sequences.
Exceptions
Exceptionif an error occurred.

Definition at line 20 of file PatternTools.cpp.

◆ getSequenceSubset() [2/9]

template<class N , class E , class I >
static std::unique_ptr<AlignmentDataInterface> bpp::PatternTools::getSequenceSubset ( const AlignmentDataInterface sequenceSet,
const std::shared_ptr< N >  node,
const AssociationTreeGraphImplObserver< N, E, I > &  tree 
)
inlinestatic

Extract the sequences corresponding to a given subtree.

Parameters
sequenceSetThe container to look in.
nodeThe root node of the subtree to check.
treeThe tree owing the node.
Returns
A new site container with corresponding sequences.
Exceptions
Exceptionif an error occurred.

Definition at line 44 of file PatternTools.h.

Referenced by bpp::AbstractTreeParsimonyScore::init_(), bpp::DRASRTreeLikelihoodData::initLikelihoodsWithPatterns(), bpp::DRNonHomogeneousTreeLikelihood::setData(), bpp::RHomogeneousTreeLikelihood::setData(), bpp::RNonHomogeneousTreeLikelihood::setData(), and bpp::DRHomogeneousTreeLikelihood::setData().

◆ getSequenceSubset() [3/9]

std::unique_ptr< AlignmentDataInterface > PatternTools::getSequenceSubset ( const AlignmentDataInterface sequenceSet,
const std::vector< std::string > &  names 
)
static

Extract the sequences corresponding to a given set of names.

Parameters
sequenceSetThe container to look in.
namesThe names of the sequences to look for.
Returns
A new site container with corresponding sequences.
Exceptions
Exceptionif an error occurred.

Definition at line 115 of file PatternTools.cpp.

References bpp::TemplateAlignmentDataInterface< class >::getAlphabet().

◆ getSequenceSubset() [4/9]

std::unique_ptr< ProbabilisticSiteContainerInterface > PatternTools::getSequenceSubset ( const ProbabilisticSiteContainerInterface sequenceSet,
const Node node 
)
static

◆ getSequenceSubset() [5/9]

template<class N , class E , class I >
static std::unique_ptr<ProbabilisticSiteContainerInterface> bpp::PatternTools::getSequenceSubset ( const ProbabilisticSiteContainerInterface sequenceSet,
const std::shared_ptr< N >  node,
const AssociationTreeGraphImplObserver< N, E, I > &  tree 
)
inlinestatic

◆ getSequenceSubset() [6/9]

std::unique_ptr< ProbabilisticSiteContainerInterface > PatternTools::getSequenceSubset ( const ProbabilisticSiteContainerInterface sequenceSet,
const std::vector< std::string > &  names 
)
static

Extract the sequences in a ProbabilisticSiteContainer corresponding to a given set of names.

Parameters
sequenceSetThe container to look in.
namesThe names of the sequences to look for.
Returns
A new site container with corresponding sequences.
Exceptions
Exceptionif an error occurred.

Definition at line 162 of file PatternTools.cpp.

References bpp::TemplateSiteContainerInterface< class, class, class >::getAlphabet(), bpp::TemplateSiteContainerInterface< class, class, class >::getSiteCoordinates(), bpp::TemplateSiteContainerInterface< class, class, class >::hasSequence(), and bpp::TemplateSiteContainerInterface< class, class, class >::sequence().

◆ getSequenceSubset() [7/9]

std::unique_ptr< SiteContainerInterface > PatternTools::getSequenceSubset ( const SiteContainerInterface sequenceSet,
const Node node 
)
static

◆ getSequenceSubset() [8/9]

template<class N , class E , class I >
static std::unique_ptr<SiteContainerInterface> bpp::PatternTools::getSequenceSubset ( const SiteContainerInterface sequenceSet,
const std::shared_ptr< N >  node,
const AssociationTreeGraphImplObserver< N, E, I > &  tree 
)
inlinestatic

◆ getSequenceSubset() [9/9]

std::unique_ptr< SiteContainerInterface > PatternTools::getSequenceSubset ( const SiteContainerInterface sequenceSet,
const std::vector< std::string > &  names 
)
static

Extract the sequences in a SiteContainer corresponding to a given set of names.

Parameters
sequenceSetThe container to look in.
namesThe names of the sequences to look for.
Returns
A new site container with corresponding sequences.
Exceptions
Exceptionif an error occurred.

Definition at line 141 of file PatternTools.cpp.

References TemplateSiteContainerInterface< Site, Sequence, std::string >::getAlphabet(), TemplateSiteContainerInterface< Site, Sequence, std::string >::getSiteCoordinates(), TemplateSiteContainerInterface< Site, Sequence, std::string >::hasSequence(), and TemplateSiteContainerInterface< Site, Sequence, std::string >::sequence().

◆ shrinkSiteSet() [1/3]

std::unique_ptr< AlignmentDataInterface > PatternTools::shrinkSiteSet ( const AlignmentDataInterface siteSet)
static

Compress a site container by removing duplicated sites.

Parameters
siteSetThe container to look in.
Returns
A new site container with unique sites.
Exceptions
Exceptionif an error occurred.

Definition at line 185 of file PatternTools.cpp.

◆ shrinkSiteSet() [2/3]

std::unique_ptr< ProbabilisticSiteContainerInterface > PatternTools::shrinkSiteSet ( const ProbabilisticSiteContainerInterface siteSet)
static

◆ shrinkSiteSet() [3/3]

std::unique_ptr< SiteContainerInterface > PatternTools::shrinkSiteSet ( const SiteContainerInterface siteSet)
static

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