bpp-phyl3
3.0.0
|
A container for paired-site likelihoods (likelihoods over the same sites for different models, especially topologies). An instance of this class is, roughly, a list of models, each of them having a name (stored in the modelNames attribute) and a set of site likelihoods (stored in the logLikelihoods attribute). More...
#include <Bpp/Phyl/Legacy/Likelihood/PairedSiteLikelihoods.h>
Public Member Functions | |
PairedSiteLikelihoods () | |
PairedSiteLikelihoods (const std::vector< std::vector< double >> &siteLogLikelihoods, const std::vector< std::string > &modelNames=std::vector< std::string >()) | |
Build a new object from a site likelihoods array. More... | |
~PairedSiteLikelihoods () | |
void | appendModel (const std::vector< double > &siteLogLikelihoods, const std::string &modelName="") |
Append a model. More... | |
void | appendModel (const bpp::TreeLikelihoodInterface &treelikelihood) |
Append a model. More... | |
void | appendModels (const PairedSiteLikelihoods &psl) |
Append models by concatenation. More... | |
const std::vector< std::vector< double > > & | getLikelihoods () const |
const std::vector< std::string > & | getModelNames () const |
size_t | getNumberOfModels () const |
Get the number of models in the container. More... | |
std::size_t | getNumberOfSites () const |
void | setName (std::size_t pos, std::string &name) |
Set the name of a model. More... | |
std::pair< std::vector< std::string >, std::vector< double > > | computeExpectedLikelihoodWeights (int replicates=10000) const |
Compute the Expected Likelihood Weights of the models. More... | |
Static Public Member Functions | |
static std::vector< int > | bootstrap (std::size_t length, double scaling=1) |
Draw a nonparametric pseudoreplicate. More... | |
Private Attributes | |
std::vector< std::vector< double > > | logLikelihoods_ |
std::vector< std::string > | modelNames_ |
A container for paired-site likelihoods (likelihoods over the same sites for different models, especially topologies). An instance of this class is, roughly, a list of models, each of them having a name (stored in the modelNames attribute) and a set of site likelihoods (stored in the logLikelihoods attribute).
Definition at line 26 of file PairedSiteLikelihoods.h.
PairedSiteLikelihoods::PairedSiteLikelihoods | ( | ) |
Definition at line 21 of file PairedSiteLikelihoods.cpp.
PairedSiteLikelihoods::PairedSiteLikelihoods | ( | const std::vector< std::vector< double >> & | siteLogLikelihoods, |
const std::vector< std::string > & | modelNames = std::vector<std::string>() |
||
) |
Build a new object from a site likelihoods array.
siteLogLikelihoods | An nmodels*nsites array of loglikelihoods. |
modelNames | (Optional) The names of the models. |
Exception | If the number of sites differ between the models, or if the number of names and site loglikelihood records differ. |
Definition at line 26 of file PairedSiteLikelihoods.cpp.
References getNumberOfModels(), getNumberOfSites(), and modelNames_.
|
inline |
Definition at line 49 of file PairedSiteLikelihoods.h.
void PairedSiteLikelihoods::appendModel | ( | const bpp::TreeLikelihoodInterface & | treelikelihood | ) |
Append a model.
treelikelihood | A TreeLikelihood record. |
Exception | If the number of sites is not the same as in the container. |
Definition at line 64 of file PairedSiteLikelihoods.cpp.
References appendModel(), bpp::TreeLikelihoodInterface::getLogLikelihoodPerSite(), bpp::Tree::getName(), and bpp::TreeLikelihoodInterface::tree().
void PairedSiteLikelihoods::appendModel | ( | const std::vector< double > & | siteLogLikelihoods, |
const std::string & | modelName = "" |
||
) |
Append a model.
siteLogLikelihoods | The loglikelihoods of the sites under this model. |
modelName | The name of the model. |
Exception | If the number of sites is not the same as in the container. |
Definition at line 52 of file PairedSiteLikelihoods.cpp.
References getNumberOfModels(), getNumberOfSites(), logLikelihoods_, and modelNames_.
Referenced by appendModel().
void PairedSiteLikelihoods::appendModels | ( | const PairedSiteLikelihoods & | psl | ) |
Append models by concatenation.
psl | the PairedSiteLikelihoods object to append to the caller. |
Exception | If the number of sites in the two object is not equal. |
Definition at line 72 of file PairedSiteLikelihoods.cpp.
References getNumberOfModels(), getNumberOfSites(), logLikelihoods_, and modelNames_.
|
static |
Draw a nonparametric pseudoreplicate.
length | The length of the data. |
scaling | The length of the pseudoreplicate, in fraction of the length of the data. |
Definition at line 143 of file PairedSiteLikelihoods.cpp.
Referenced by computeExpectedLikelihoodWeights().
pair< vector< string >, vector< double > > PairedSiteLikelihoods::computeExpectedLikelihoodWeights | ( | int | replicates = 10000 | ) | const |
Compute the Expected Likelihood Weights of the models.
The weight of a model is :
where is the loglikelihood of model k for replicate b.
replicates | The number of pseudoreplicates over which the weights are to be averaged. |
Definition at line 89 of file PairedSiteLikelihoods.cpp.
References bootstrap(), bpp::exp(), getNumberOfModels(), getNumberOfSites(), logLikelihoods_, and modelNames_.
|
inline |
Definition at line 84 of file PairedSiteLikelihoods.h.
References logLikelihoods_.
Referenced by bpp::IOTreepuzzlePairedSiteLikelihoods::writePairedSiteLikelihoods().
|
inline |
Definition at line 92 of file PairedSiteLikelihoods.h.
References modelNames_.
Referenced by bpp::IOTreepuzzlePairedSiteLikelihoods::writePairedSiteLikelihoods().
|
inline |
Get the number of models in the container.
Definition at line 98 of file PairedSiteLikelihoods.h.
References logLikelihoods_.
Referenced by appendModel(), appendModels(), computeExpectedLikelihoodWeights(), PairedSiteLikelihoods(), and bpp::IOTreepuzzlePairedSiteLikelihoods::writePairedSiteLikelihoods().
|
inline |
Exception | If the container is empty. |
Definition at line 107 of file PairedSiteLikelihoods.h.
References logLikelihoods_.
Referenced by appendModel(), appendModels(), computeExpectedLikelihoodWeights(), PairedSiteLikelihoods(), and bpp::IOTreepuzzlePairedSiteLikelihoods::writePairedSiteLikelihoods().
|
inline |
Set the name of a model.
pos | The position of the target model. |
name | The new name. |
Definition at line 125 of file PairedSiteLikelihoods.h.
References modelNames_.
|
private |
Definition at line 29 of file PairedSiteLikelihoods.h.
Referenced by appendModel(), appendModels(), computeExpectedLikelihoodWeights(), getLikelihoods(), getNumberOfModels(), and getNumberOfSites().
|
private |
Definition at line 30 of file PairedSiteLikelihoods.h.
Referenced by appendModel(), appendModels(), computeExpectedLikelihoodWeights(), getModelNames(), PairedSiteLikelihoods(), and setName().