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

Contains methods to generate random trees. More...

Static Public Member Functions

static TreeNode UnlabelledTopology (int leafCount, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false)
 Samples a random unlabelled topology according to the specified model. More...
 
static TreeNode UnlabelledTree (int leafCount, IContinuousDistribution branchLengthDistribution, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false)
 Samples a random unlabelled tree according to the specified model, using branch lengths drawn from the supplied distribution. More...
 
static TreeNode UnlabelledTree (int leafCount, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false)
 Samples a random unlabelled tree according to the specified model, using branch lengths drawn from a Uniform(0, 1) distribution. More...
 
static TreeNode ResolvePolytomies (TreeNode tree, bool rooted=false)
 Randomly resolve all the polytomies in a tree. More...
 
static TreeNode LabelledTopology (IReadOnlyList< string > leafNames, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false, TreeNode constraint=null)
 Samples a random labelled topology according to the specified model. More...
 
static TreeNode LabelledTopology (int leafCount, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false, TreeNode constraint=null)
 Samples a random labelled topology according to the specified model. More...
 
static TreeNode LabelledTree (IReadOnlyList< string > leafNames, IContinuousDistribution branchLengthDistribution, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false, TreeNode constraint=null)
 Samples a random labelled tree according to the specified model, using branch lengths drawn from the supplied distribution. More...
 
static TreeNode LabelledTree (int leafCount, IContinuousDistribution branchLengthDistribution, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false, TreeNode constraint=null)
 Samples a random labelled tree according to the specified model, using branch lengths drawn from the supplied distribution. More...
 
static TreeNode LabelledTree (IReadOnlyList< string > leafNames, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false, TreeNode constraint=null)
 Samples a random labelled tree according to the specified model, using branch lengths drawn from a Uniform(0, 1) distribution. More...
 
static TreeNode LabelledTree (int leafCount, TreeNode.NullHypothesis model=TreeNode.NullHypothesis.PDA, bool rooted=false, TreeNode constraint=null)
 Samples a random labelled tree according to the specified model, using branch lengths drawn from a Uniform(0, 1) distribution. More...
 

Static Public Attributes

static Random RandomNumberGenerator = new ThreadSafeRandom()
 Random number generator used for sampling. More...
 

Detailed Description

Contains methods to generate random trees.

Definition at line 12 of file RandomTree.cs.

Member Function Documentation

◆ LabelledTopology() [1/2]

static TreeNode PhyloTree.TreeBuilding.RandomTree.LabelledTopology ( int  leafCount,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false,
TreeNode  constraint = null 
)
static

Samples a random labelled topology according to the specified model.

Parameters
leafCountThe number of terminal nodes in the topology. Their names will be in the form t1, t2, ..., tN, where N is leafCount .
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
constraintA tree to constrain the sampling. The topology 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 topology, using a constraint with TreeNode.NullHypothesis.YHK will bias the sampled topology distribution.
Returns
A TreeNode object containing a random labelled topology (branch lengths will all be set to double.NaN).
Exceptions
ArgumentExceptionThrown if model is neither TreeNode.NullHypothesis.PDA nor TreeNode.NullHypothesis.YHK.

Definition at line 535 of file RandomTree.cs.

◆ LabelledTopology() [2/2]

static TreeNode PhyloTree.TreeBuilding.RandomTree.LabelledTopology ( IReadOnlyList< string >  leafNames,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false,
TreeNode  constraint = null 
)
static

Samples a random labelled topology according to the specified model.

Parameters
leafNamesThe labels for the terminal nodes of the topology.
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
constraintA tree to constrain the sampling. The topology 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 topology, using a constraint with TreeNode.NullHypothesis.YHK will bias the sampled topology distribution.
Returns
A TreeNode object containing a random labelled topology (branch lengths will all be set to double.NaN).
Exceptions
ArgumentExceptionThrown if model is neither TreeNode.NullHypothesis.PDA nor TreeNode.NullHypothesis.YHK.

Definition at line 292 of file RandomTree.cs.

◆ LabelledTree() [1/4]

static TreeNode PhyloTree.TreeBuilding.RandomTree.LabelledTree ( int  leafCount,
IContinuousDistribution  branchLengthDistribution,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false,
TreeNode  constraint = null 
)
static

Samples a random labelled tree according to the specified model, using branch lengths drawn from the supplied distribution.

Parameters
leafCountThe number of terminal nodes in the topology. Their names will be in the form t1, t2, ..., tN, where N is leafCount .
branchLengthDistributionThe continuous univariate distribution from which the branch lengths will be drawn.
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
constraintA tree to constrain the sampling. The topology 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 topology, using a constraint with TreeNode.NullHypothesis.YHK will bias the sampled topology distribution.
Returns
A TreeNode object containing a random unlabelled tree, with branch lengths.

Definition at line 585 of file RandomTree.cs.

◆ LabelledTree() [2/4]

static TreeNode PhyloTree.TreeBuilding.RandomTree.LabelledTree ( int  leafCount,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false,
TreeNode  constraint = null 
)
static

Samples a random labelled tree according to the specified model, using branch lengths drawn from a Uniform(0, 1) distribution.

Parameters
leafCountThe number of terminal nodes in the topology. Their names will be in the form t1, t2, ..., tN, where N is leafCount .
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
constraintA tree to constrain the sampling. The topology 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 topology, using a constraint with TreeNode.NullHypothesis.YHK will bias the sampled topology distribution.
Returns
A TreeNode object containing a random unlabelled tree, with branch lengths.

Definition at line 620 of file RandomTree.cs.

◆ LabelledTree() [3/4]

static TreeNode PhyloTree.TreeBuilding.RandomTree.LabelledTree ( IReadOnlyList< string >  leafNames,
IContinuousDistribution  branchLengthDistribution,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false,
TreeNode  constraint = null 
)
static

Samples a random labelled tree according to the specified model, using branch lengths drawn from the supplied distribution.

Parameters
leafNamesThe labels for the terminal nodes of the topology.
branchLengthDistributionThe continuous univariate distribution from which the branch lengths will be drawn.
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
constraintA tree to constrain the sampling. The topology 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 topology, using a constraint with TreeNode.NullHypothesis.YHK will bias the sampled topology distribution.
Returns
A TreeNode object containing a random unlabelled tree, with branch lengths.

Definition at line 557 of file RandomTree.cs.

◆ LabelledTree() [4/4]

static TreeNode PhyloTree.TreeBuilding.RandomTree.LabelledTree ( IReadOnlyList< string >  leafNames,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false,
TreeNode  constraint = null 
)
static

Samples a random labelled tree according to the specified model, using branch lengths drawn from a Uniform(0, 1) distribution.

Parameters
leafNamesThe labels for the terminal nodes of the topology.
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
constraintA tree to constrain the sampling. The topology 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 topology, using a constraint with TreeNode.NullHypothesis.YHK will bias the sampled topology distribution.
Returns
A TreeNode object containing a random unlabelled tree, with branch lengths.

Definition at line 606 of file RandomTree.cs.

◆ ResolvePolytomies()

static TreeNode PhyloTree.TreeBuilding.RandomTree.ResolvePolytomies ( TreeNode  tree,
bool  rooted = false 
)
static

Randomly resolve all the polytomies in a tree.

Parameters
treeThe tree containing the polytomies to be resolved.
rootedA bool indicating whether the tree is supposed to be rooted or not. If this is true, a trichotomy at the root node will be resolved.
Returns
The tree, where all the polytomies have been randomly resolved. This is performed in-place, but the return value of this method should be used in case the root node has changed.

Definition at line 217 of file RandomTree.cs.

◆ UnlabelledTopology()

static TreeNode PhyloTree.TreeBuilding.RandomTree.UnlabelledTopology ( int  leafCount,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false 
)
static

Samples a random unlabelled topology according to the specified model.

Parameters
leafCountThe number of terminal nodes in the topology.
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
Returns
A TreeNode object containing a random unlabelled topology (branch lengths will all be set to double.NaN).
Exceptions
ArgumentExceptionThrown if model is neither TreeNode.NullHypothesis.PDA nor TreeNode.NullHypothesis.YHK.

Definition at line 27 of file RandomTree.cs.

◆ UnlabelledTree() [1/2]

static TreeNode PhyloTree.TreeBuilding.RandomTree.UnlabelledTree ( int  leafCount,
IContinuousDistribution  branchLengthDistribution,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false 
)
static

Samples a random unlabelled tree according to the specified model, using branch lengths drawn from the supplied distribution.

Parameters
leafCountThe number of terminal nodes in the topology.
branchLengthDistributionThe continuous univariate distribution from which the branch lengths will be drawn.
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
Returns
A TreeNode object containing a random unlabelled tree, with branch lengths.

Definition at line 150 of file RandomTree.cs.

◆ UnlabelledTree() [2/2]

static TreeNode PhyloTree.TreeBuilding.RandomTree.UnlabelledTree ( int  leafCount,
TreeNode.NullHypothesis  model = TreeNode.NullHypothesis.PDA,
bool  rooted = false 
)
static

Samples a random unlabelled tree according to the specified model, using branch lengths drawn from a Uniform(0, 1) distribution.

Parameters
leafCountThe number of terminal nodes in the topology.
modelThe model to use for growing the tree.
rootedA bool indicating whether the tree should be rooted or not.
Returns
A TreeNode object containing a random unlabelled tree, with branch lengths.

Definition at line 175 of file RandomTree.cs.

Member Data Documentation

◆ RandomNumberGenerator

Random PhyloTree.TreeBuilding.RandomTree.RandomNumberGenerator = new ThreadSafeRandom()
static

Random number generator used for sampling.

Definition at line 17 of file RandomTree.cs.


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