CMAPLE 1.0.0
C++ MAximum Parsimonious Likelihood Estimation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cmaple::ParamsBuilder Class Reference

#include <tools.h>

Public Member Functions

 ParamsBuilder ()
 Default constructor - Initializing a builder using the default values.
 
ParamsBuilderwithRandomSeed (const uint64_t &seed)
 Specify a seed number for random generators. Default: the clock of the PC. Be careful! To make the results reproducible, users should specify the seed number.
 
ParamsBuilderwithThreshProb (const double &thresh_prob)
 Specify a relative probability threshold, which is used to ignore possible states with very low probabilities. Default: 1e-8.
 
ParamsBuilderwithMinBlengthFactor (const double &min_blength_factor)
 Specify a factor to compute the minimum branch length (if fixed_min_blength is specified, this factor is ignored). Default: 0.2
<Minimum branch length> = <min_blength_factor> * <default branch length>
where <default branch length> is one mutation per site.
 
ParamsBuilderwithMaxBlengthFactor (const double &max_blength_factor)
 Specify a factor to compute the maximum branch length. Default: 40
<Maximum branch length> = <max_blength_factor> * <default branch length>
where <default branch length> is one mutation per site.
 
ParamsBuilderwithFixedMinBlength (const double &fixed_min_blength)
 Specify a minimum value of the branch lengths. Default: the minimum branch length is computed from 'min_blength_factor'.
 
ParamsBuilderwithMutationUpdatePeriod (const int32_t &mutation_update_period)
 Specify the period (in term of the number of sample placements) to update the substitution rate matrix. Default: 25.
 
ParamsBuilderwithNumTreeTraversal (const int32_t &num_tree_traversal)
 Specify the number of times we traverse the tree looking for topological improvements (applying SPR moves). Default: 1.
 
ParamsBuilderwithSPRThresh (const double &SPR_thresh)
 Specify a threshold that avoids CMAPLE trying to apply SPR moves on nodes that have the placement cost (i.e. the likelihood contribution by placing a node on the tree) exceeds this threshold. Default: -1e-5.
 
ParamsBuilderwithStopTreeSearchThresh (const double &stop_search_thresh)
 Specify a threshold to stop the tree search. If the total log likelihood improvement obtained by an iteration of tree search is lower than this threshold, CMAPLE stops doing tree search . Default: 1.
 
std::unique_ptr< cmaple::Params > build ()
 Build the Params object after initializing parameters.
 

Detailed Description

A PatternBuilder to build an instance of Params which stores all program parameters.
One can build an instance of Params and specify several parameters by: ParamsBuilder().withRandomSeed().withFixedMinBlength().with<...>().build();

Member Function Documentation

◆ withRandomSeed()

ParamsBuilder & cmaple::ParamsBuilder::withRandomSeed ( const uint64_t &  seed)

Specify a seed number for random generators. Default: the clock of the PC. Be careful! To make the results reproducible, users should specify the seed number.

Parameters
[in]seedA non-negative number
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif seed is negative

◆ withThreshProb()

ParamsBuilder & cmaple::ParamsBuilder::withThreshProb ( const double &  thresh_prob)

Specify a relative probability threshold, which is used to ignore possible states with very low probabilities. Default: 1e-8.

Parameters
[in]thresh_probA positive relative probability threshold
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif thresh_prob is non-positive

◆ withMinBlengthFactor()

ParamsBuilder & cmaple::ParamsBuilder::withMinBlengthFactor ( const double &  min_blength_factor)

Specify a factor to compute the minimum branch length (if fixed_min_blength is specified, this factor is ignored). Default: 0.2
<Minimum branch length> = <min_blength_factor> * <default branch length>
where <default branch length> is one mutation per site.

Parameters
[in]min_blength_factorA positive factor to compute the minimum branch length
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif min_blength_factor is non-positive

◆ withMaxBlengthFactor()

ParamsBuilder & cmaple::ParamsBuilder::withMaxBlengthFactor ( const double &  max_blength_factor)

Specify a factor to compute the maximum branch length. Default: 40
<Maximum branch length> = <max_blength_factor> * <default branch length>
where <default branch length> is one mutation per site.

Parameters
[in]max_blength_factorA positive factor to compute the maximum branch length
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif max_blength_factor is non-positive

◆ withFixedMinBlength()

ParamsBuilder & cmaple::ParamsBuilder::withFixedMinBlength ( const double &  fixed_min_blength)

Specify a minimum value of the branch lengths. Default: the minimum branch length is computed from 'min_blength_factor'.

Parameters
[in]fixed_min_blengthA positive value for the minimum branch lengths
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif fixed_min_blength is non-positive

◆ withMutationUpdatePeriod()

ParamsBuilder & cmaple::ParamsBuilder::withMutationUpdatePeriod ( const int32_t &  mutation_update_period)

Specify the period (in term of the number of sample placements) to update the substitution rate matrix. Default: 25.

Parameters
[in]mutation_update_periodA positive value for the period (in term of the number of sample placements)
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif mutation_update_period is non-positive

◆ withNumTreeTraversal()

ParamsBuilder & cmaple::ParamsBuilder::withNumTreeTraversal ( const int32_t &  num_tree_traversal)

Specify the number of times we traverse the tree looking for topological improvements (applying SPR moves). Default: 1.

Parameters
[in]num_tree_traversalA positive number of tree traversals
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif num_tree_traversal is non-positive

◆ withSPRThresh()

ParamsBuilder & cmaple::ParamsBuilder::withSPRThresh ( const double &  SPR_thresh)

Specify a threshold that avoids CMAPLE trying to apply SPR moves on nodes that have the placement cost (i.e. the likelihood contribution by placing a node on the tree) exceeds this threshold. Default: -1e-5.

Parameters
[in]SPR_threshA positive threshold to consider applying SPR moves at nodes
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif SPR_thresh is non-positive

◆ withStopTreeSearchThresh()

ParamsBuilder & cmaple::ParamsBuilder::withStopTreeSearchThresh ( const double &  stop_search_thresh)

Specify a threshold to stop the tree search. If the total log likelihood improvement obtained by an iteration of tree search is lower than this threshold, CMAPLE stops doing tree search . Default: 1.

Parameters
[in]stop_search_threshA positive value for the threshold to stop the tree search
Returns
A reference to the ParamsBuilder instance
Exceptions
std::invalid_argumentif stop_search_thresh is non-positive

◆ build()

std::unique_ptr< cmaple::Params > cmaple::ParamsBuilder::build ( )

Build the Params object after initializing parameters.

Returns
a unique pointer to an instance of Params

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