bpp-phyl  2.2.0
bpp::PatternTools Class Reference

Utilitary methods to compute site patterns. More...

#include <Bpp/Phyl/PatternTools.h>

Static Public Member Functions

static SiteContainer * getSequenceSubset (const SiteContainer &sequenceSet, const Node &node) throw (Exception)
 Extract the sequences corresponding to a given subtree. More...
 
static SiteContainer * getSequenceSubset (const SiteContainer &sequenceSet, const std::vector< std::string > &names) throw (Exception)
 Extract the sequences corresponding to a given set of names. More...
 
static SiteContainer * shrinkSiteSet (const SiteContainer &sequenceSet) throw (Exception)
 Compress a site container by removing duplicated sites. More...
 
static Vint getIndexes (const SiteContainer &sequences1, const SiteContainer &sequences2)
 Look for the occurence of each site in sequences1 in sequences2 and send the position of the first occurence, or -1 if not found. More...
 

Detailed Description

Utilitary methods to compute site patterns.

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

Definition at line 63 of file PatternTools.h.

Member Function Documentation

◆ getIndexes()

Vint PatternTools::getIndexes ( const SiteContainer &  sequences1,
const SiteContainer &  sequences2 
)
static

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

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

Definition at line 109 of file PatternTools.cpp.

◆ getSequenceSubset() [1/2]

SiteContainer * PatternTools::getSequenceSubset ( const SiteContainer &  sequenceSet,
const Node node 
)
throw (Exception
)
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 occured.

Definition at line 59 of file PatternTools.cpp.

References bpp::TreeTemplateTools::getLeaves().

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

◆ getSequenceSubset() [2/2]

SiteContainer * PatternTools::getSequenceSubset ( const SiteContainer &  sequenceSet,
const std::vector< std::string > &  names 
)
throw (Exception
)
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 occured.

Definition at line 74 of file PatternTools.cpp.

◆ shrinkSiteSet()

SiteContainer * PatternTools::shrinkSiteSet ( const SiteContainer &  sequenceSet)
throw (Exception
)
static

Compress a site container by removing duplicated sites.

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

Definition at line 88 of file PatternTools.cpp.


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