TreeNode 1.5.2
A library to manipulate phylogenetic trees
Loading...
Searching...
No Matches
PhyloTree.TreeBuilding.BirthDeathTree Class Reference

Contains methods to simulate birth-death trees. More...

Static Public Member Functions

static TreeNode UnlabelledTree (double treeAge, double birthRate, double deathRate=0, bool keepDeadLineages=false, CancellationToken cancellationToken=default)
 Simulate an unlabelled birth-death tree, stopping when the age of the tree reaches a certain value. More...
 
static TreeNode LabelledTree (double treeAge, double birthRate, double deathRate=0, bool keepDeadLineages=false, CancellationToken cancellationToken=default)
 Simulate a labelled birth-death tree, stopping when the age of the tree reaches a certain value. More...
 
static TreeNode UnlabelledTree (int leafCount, double birthRate, double deathRate=0, bool keepDeadLineages=false, CancellationToken cancellationToken=default)
 Simulate an unlabelled birth-death tree, stopping when the number of lineages that are alive in the tree reaches a certain value. More...
 
static TreeNode LabelledTree (IReadOnlyList< string > leafNames, double birthRate, double deathRate=0, bool keepDeadLineages=false, TreeNode constraint=null, CancellationToken cancellationToken=default)
 Simulate a labelled birth-death tree, stopping when the number of lineages that are alive in the tree reaches a certain value. More...
 
static TreeNode LabelledTree (int leafCount, double birthRate, double deathRate=0, bool keepDeadLineages=false, TreeNode constraint=null, CancellationToken cancellationToken=default)
 Simulate a labelled birth-death tree, stopping when the number of lineages that are alive in the tree reaches a certain value. More...
 

Detailed Description

Contains methods to simulate birth-death trees.

Definition at line 12 of file BirthDeathTree.cs.

Member Function Documentation

◆ LabelledTree() [1/3]

static TreeNode PhyloTree.TreeBuilding.BirthDeathTree.LabelledTree ( double  treeAge,
double  birthRate,
double  deathRate = 0,
bool  keepDeadLineages = false,
CancellationToken  cancellationToken = default 
)
static

Simulate a labelled birth-death tree, stopping when the age of the tree reaches a certain value.

Parameters
treeAgeThe final age of the tree. Note that the actual age of the tree may be smaller than this; this can happen either if keepDeadLineages is false and one of the two clades descending from the root node goes exinct, or if keepDeadLineages is true and all the clades go extinct. If all the clades go extinct and keepDeadLineages is false, this method will return null.
birthRateThe birth rate of the tree.
deathRateThe death rate of the tree.
keepDeadLineagesIf this is true, dead lineages are kept in the tree. If this is false, they are pruned from the tree.
cancellationTokenA CancellationToken used to cancel the simulation if it takes too long.
Returns
A TreeNode object containing the labelled birth-death tree, or null if all the lineages went extinct and keepDeadLineages is false.

Definition at line 126 of file BirthDeathTree.cs.

◆ LabelledTree() [2/3]

static TreeNode PhyloTree.TreeBuilding.BirthDeathTree.LabelledTree ( int  leafCount,
double  birthRate,
double  deathRate = 0,
bool  keepDeadLineages = false,
TreeNode  constraint = null,
CancellationToken  cancellationToken = default 
)
static

Simulate a labelled birth-death tree, stopping when the number of lineages that are alive in the tree reaches a certain value.

Parameters
leafCountThe final number of lineages that are alive in the tree (their names will be in the form t1, t2, ..., tN, where N is leafCount ). Note that, if keepDeadLineages is true, the actual number of leaves in the tree may be larger than this, because the leaves corresponding to dead lineages are kept (their names will be empty). If all the lineages go extinct before the target number of lineages is reaced, the method will return a smaller tree (without any leaf names) if keepDeadLineages is true, or null if it is false.
birthRateThe birth rate of the tree.
deathRateThe death rate of the tree.
keepDeadLineagesIf this is true, dead lineages are kept in the tree. If this is false, they are pruned from the tree.
constraintA tree to constrain the sampling. The tree produced by this method will be compatible with this tree. The constraint tree can be multifurcating. Please note that, as the constraint is applied at every step while growing the tree, this will bias the sampled topology distribution.
cancellationTokenA CancellationToken used to cancel the simulation if it takes too long.
Returns
A TreeNode object containing the unlabelled birth-death tree, or null if all the lineages went extinct and keepDeadLineages is false.

Definition at line 489 of file BirthDeathTree.cs.

◆ LabelledTree() [3/3]

static TreeNode PhyloTree.TreeBuilding.BirthDeathTree.LabelledTree ( IReadOnlyList< string >  leafNames,
double  birthRate,
double  deathRate = 0,
bool  keepDeadLineages = false,
TreeNode  constraint = null,
CancellationToken  cancellationToken = default 
)
static

Simulate a labelled birth-death tree, stopping when the number of lineages that are alive in the tree reaches a certain value.

Parameters
leafNamesThe names for the terminal nodes of the tree. Note that, if keepDeadLineages is true, the actual number of leaves in the tree may be larger than this, because the leaves corresponding to dead lineages are kept (their names will be empty). If all the lineages go extinct before the target number of lineages is reaced, the method will return a smaller tree (without any leaf names) if keepDeadLineages is true, or null if it is false.
birthRateThe birth rate of the tree.
deathRateThe death rate of the tree.
keepDeadLineagesIf this is true, dead lineages are kept in the tree. If this is false, they are pruned from the tree.
constraintA tree to constrain the sampling. The tree produced by this method will be compatible with this tree. The constraint tree can be multifurcating. Please note that, as the constraint is applied at every step while growing the tree, this will bias the sampled topology distribution.
cancellationTokenA CancellationToken used to cancel the simulation if it takes too long.
Returns
A TreeNode object containing the unlabelled birth-death tree, or null if all the lineages went extinct and keepDeadLineages is false.

Definition at line 267 of file BirthDeathTree.cs.

◆ UnlabelledTree() [1/2]

static TreeNode PhyloTree.TreeBuilding.BirthDeathTree.UnlabelledTree ( double  treeAge,
double  birthRate,
double  deathRate = 0,
bool  keepDeadLineages = false,
CancellationToken  cancellationToken = default 
)
static

Simulate an unlabelled birth-death tree, stopping when the age of the tree reaches a certain value.

Parameters
treeAgeThe final age of the tree. Note that the actual age of the tree may be smaller than this; this can happen either if keepDeadLineages is false and one of the two clades descending from the root node goes exinct, or if keepDeadLineages is true and all the clades go extinct. If all the clades go extinct and keepDeadLineages is false, this method will return null.
birthRateThe birth rate of the tree.
deathRateThe death rate of the tree.
keepDeadLineagesIf this is true, dead lineages are kept in the tree. If this is false, they are pruned from the tree.
cancellationTokenA CancellationToken used to cancel the simulation if it takes too long.
Returns
A TreeNode object containing the unlabelled birth-death tree, or null if all the lineages went extinct and keepDeadLineages is false.

Definition at line 29 of file BirthDeathTree.cs.

◆ UnlabelledTree() [2/2]

static TreeNode PhyloTree.TreeBuilding.BirthDeathTree.UnlabelledTree ( int  leafCount,
double  birthRate,
double  deathRate = 0,
bool  keepDeadLineages = false,
CancellationToken  cancellationToken = default 
)
static

Simulate an unlabelled birth-death tree, stopping when the number of lineages that are alive in the tree reaches a certain value.

Parameters
leafCountThe final number of lineages that are alive in the tree. Note that, if keepDeadLineages is true, the actual number of leaves in the tree may be larger than this, because the leaves corresponding to dead lineages are kept. If all the lineages go extinct before the target number of lineages is reaced, the method will return a smaller tree if keepDeadLineages is true, or null if it is false.
birthRateThe birth rate of the tree.
deathRateThe death rate of the tree.
keepDeadLineagesIf this is true, dead lineages are kept in the tree. If this is false, they are pruned from the tree.
cancellationTokenA CancellationToken used to cancel the simulation if it takes too long.
Returns
A TreeNode object containing the unlabelled birth-death tree, or null if all the lineages went extinct and keepDeadLineages is false.

Definition at line 164 of file BirthDeathTree.cs.


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