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

Contains methods to simulate sequence evolution. More...

Public Member Functions

delegate double GetScale (double conservation)
 Represents a function that can be evaluated to return the scaling factor to use in order to obtain the specified average conservation . More...
 

Static Public Member Functions

static Dictionary< string, SequenceSimulateSequences (this TreeNode tree, Sequence ancestralSequence, RateMatrix rateMatrix, double scale=1, IndelModel indelModel=null)
 Simulates the evolution of the specified ancestral sequence over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model. More...
 
static Dictionary< string, SequenceSimulateSequences (this TreeNode tree, int ancestralSequenceLength, RateMatrix rateMatrix, double scale=1, IndelModel indelModel=null)
 Simulates the evolution of a random ancestral sequence with the specified length over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model. More...
 
static Dictionary< string, SequenceSimulateAllSequences (this TreeNode tree, Sequence ancestralSequence, RateMatrix rateMatrix, double scale=1, IndelModel indelModel=null)
 Simulates the evolution of the specified ancestral sequence over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model. More...
 
static Dictionary< string, SequenceSimulateAllSequences (this TreeNode tree, int ancestralSequenceLength, RateMatrix rateMatrix, double scale=1, IndelModel indelModel=null)
 Simulates the evolution of a random ancestral sequence with the specified length over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model. More...
 
static GetScale ConservationToScale (TreeNode tree, RateMatrix rateMatrix, double minRate=1e-5, double maxRate=1e4)
 Returns a method that can be evaluated to determine the scaling factor that, when applied to a sequence simulation done using the specified tree and rate matrix, will produce at the tips a sequence alignment with the specified (average) percent identity. More...
 
static Dictionary< string, string > ToStringAlignment (this Dictionary< string, Sequence > alignment)
 Converts a sequence alignment where the sequences are stored as Sequences into an alignment where the sequences are stored as strings. More...
 

Properties

static Random RandomNumberGenerator = new ThreadSafeRandom() [get, set]
 The random number generator used to simulate sequence evolution. If you change this, please ensure that it is thread-safe. More...
 

Detailed Description

Contains methods to simulate sequence evolution.

Definition at line 16 of file SequenceSimulation.cs.

Member Function Documentation

◆ ConservationToScale()

static GetScale PhyloTree.SequenceSimulation.SequenceSimulation.ConservationToScale ( TreeNode  tree,
RateMatrix  rateMatrix,
double  minRate = 1e-5,
double  maxRate = 1e4 
)
static

Returns a method that can be evaluated to determine the scaling factor that, when applied to a sequence simulation done using the specified tree and rate matrix, will produce at the tips a sequence alignment with the specified (average) percent identity.

Parameters
treeThe TreeNode on which the sequence simulations will be performed.
rateMatrixThe rate matrix that will be used for the sequence simulations.
minRateMinimum rate value to test.
maxRateMaximum rate value to test.
Returns
A method that can be evaluated to determine the scaling factor that, when applied to a sequence simulation done using the specified tree and rate matrix, will produce at the tips a sequence alignment with the specified (average) percent identity.

Definition at line 211 of file SequenceSimulation.public.cs.

◆ GetScale()

delegate double PhyloTree.SequenceSimulation.SequenceSimulation.GetScale ( double  conservation)

Represents a function that can be evaluated to return the scaling factor to use in order to obtain the specified average conservation .

Parameters
conservationThe average conservation whose corresponding scaling factor will be returned.
Returns
The scaling factor that will produce the speicfied average conservation .

◆ SimulateAllSequences() [1/2]

static Dictionary< string, Sequence > PhyloTree.SequenceSimulation.SequenceSimulation.SimulateAllSequences ( this TreeNode  tree,
int  ancestralSequenceLength,
RateMatrix  rateMatrix,
double  scale = 1,
IndelModel  indelModel = null 
)
static

Simulates the evolution of a random ancestral sequence with the specified length over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model.

Parameters
treeThe tree over which the sequence evolves. This is assumed to be rooted (i.e., the ancestral sequence is placed at the root of the tree).
ancestralSequenceLengthThe length of the ancestral sequence whose evolution is being simulated. Note that if insertions/deletions are allowed to happen, the final length of the (aligned) sequences may differ from this.
rateMatrixThe rate matrix that governs the evolution of the sequence.
scaleA scaling factor. If this is different from 1, the effect is the same as multiplying the branch lengths of the tree or the rate matrix by the supplied value.
indelModelThe model for insertions/deletions. If this is null, no insertions/deletions are allowed to happen.
Returns
A Dictionary<String, Sequence> containing entries for all the nodes in the tree. For each entry, the key is a string containing the TreeNode.Id of the node, and the value is a Sequence containing the sequence. The sequences are all aligned.

Definition at line 187 of file SequenceSimulation.public.cs.

◆ SimulateAllSequences() [2/2]

static Dictionary< string, Sequence > PhyloTree.SequenceSimulation.SequenceSimulation.SimulateAllSequences ( this TreeNode  tree,
Sequence  ancestralSequence,
RateMatrix  rateMatrix,
double  scale = 1,
IndelModel  indelModel = null 
)
static

Simulates the evolution of the specified ancestral sequence over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model.

Parameters
treeThe tree over which the sequence evolves. This is assumed to be rooted (i.e., the ancestral sequence is placed at the root of the tree).
ancestralSequenceThe ancestral sequence whose evolution is being simulated.
rateMatrixThe rate matrix that governs the evolution of the sequence.
scaleA scaling factor. If this is different from 1, the effect is the same as multiplying the branch lengths of the tree or the rate matrix by the supplied value.
indelModelThe model for insertions/deletions. If this is null, no insertions/deletions are allowed to happen.
Returns
A Dictionary<String, Sequence> containing entries for all the nodes in the tree. For each entry, the key is a string containing the TreeNode.Id of the node, and the value is a Sequence containing the sequence. The sequences are all aligned.

Definition at line 116 of file SequenceSimulation.public.cs.

◆ SimulateSequences() [1/2]

static Dictionary< string, Sequence > PhyloTree.SequenceSimulation.SequenceSimulation.SimulateSequences ( this TreeNode  tree,
int  ancestralSequenceLength,
RateMatrix  rateMatrix,
double  scale = 1,
IndelModel  indelModel = null 
)
static

Simulates the evolution of a random ancestral sequence with the specified length over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model.

Parameters
treeThe tree over which the sequence evolves. This is assumed to be rooted (i.e., the ancestral sequence is placed at the root of the tree).
ancestralSequenceLengthThe length of the ancestral sequence whose evolution is being simulated. Note that if insertions/deletions are allowed to happen, the final length of the (aligned) sequences may differ from this.
rateMatrixThe rate matrix that governs the evolution of the sequence.
scaleA scaling factor. If this is different from 1, the effect is the same as multiplying the branch lengths of the tree or the rate matrix by the supplied value.
indelModelThe model for insertions/deletions. If this is null, no insertions/deletions are allowed to happen.
Returns
A Dictionary<String, Sequence> containing entries for all the nodes in the tree that have names. For each entry, the key is a string containing the TreeNode.Name of the node, and the value is a Sequence containing the sequence. The sequences are all aligned.

Definition at line 97 of file SequenceSimulation.public.cs.

◆ SimulateSequences() [2/2]

static Dictionary< string, Sequence > PhyloTree.SequenceSimulation.SequenceSimulation.SimulateSequences ( this TreeNode  tree,
Sequence  ancestralSequence,
RateMatrix  rateMatrix,
double  scale = 1,
IndelModel  indelModel = null 
)
static

Simulates the evolution of the specified ancestral sequence over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model.

Parameters
treeThe tree over which the sequence evolves. This is assumed to be rooted (i.e., the ancestral sequence is placed at the root of the tree).
ancestralSequenceThe ancestral sequence whose evolution is being simulated.
rateMatrixThe rate matrix that governs the evolution of the sequence.
scaleA scaling factor. If this is different from 1, the effect is the same as multiplying the branch lengths of the tree or the rate matrix by the supplied value.
indelModelThe model for insertions/deletions. If this is null, no insertions/deletions are allowed to happen.
Returns
A Dictionary<String, Sequence> containing entries for all the nodes in the tree that have names. For each entry, the key is a string containing the TreeNode.Name of the node, and the value is a Sequence containing the sequence. The sequences are all aligned.

Definition at line 23 of file SequenceSimulation.public.cs.

◆ ToStringAlignment()

static Dictionary< string, string > PhyloTree.SequenceSimulation.SequenceSimulation.ToStringAlignment ( this Dictionary< string, Sequence alignment)
static

Converts a sequence alignment where the sequences are stored as Sequences into an alignment where the sequences are stored as strings.

Parameters
alignmentThe alignment to convert.
Returns
A Dictionary<String, String> where both keys and values are string.

Definition at line 310 of file SequenceSimulation.public.cs.

Property Documentation

◆ RandomNumberGenerator

Random PhyloTree.SequenceSimulation.SequenceSimulation.RandomNumberGenerator = new ThreadSafeRandom()
staticgetset

The random number generator used to simulate sequence evolution. If you change this, please ensure that it is thread-safe.

Definition at line 21 of file SequenceSimulation.cs.


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