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

Represents a sequence of characters. More...

Inheritance diagram for PhyloTree.SequenceSimulation.Sequence:

Public Member Functions

 Sequence (ReadOnlySpan< char > sequence)
 Creates a new Sequence. More...
 
 Sequence (ReadOnlySpan< char > sequence, IReadOnlyList< char > states)
 Creates a new Sequence. More...
 
 Sequence (ReadOnlySpan< char > sequence, IReadOnlyList< char > states, IReadOnlyList< double > conservation)
 Creates a new Sequence. More...
 
 Sequence (ReadOnlySpan< char > sequence, IReadOnlyList< char > states, IReadOnlyList< double > conservation, IReadOnlyList< double > indelProfile)
 Creates a new Sequence. More...
 
override string ToString ()
 
IEnumerator< char > GetEnumerator ()
 
Sequence Evolve (RateMatrix rateMatrix, double time)
 Simulates the evolution of the Sequence over the specified amount of time , using the specified rate matrix. No indels are allowed to happen. More...
 
Sequence Evolve (RateMatrix rateMatrix, IndelModel indelModel, double time)
 Simulates the evolution of the Sequence over the specified amount of time , using the specified rate matrix. Insertions and deletions happen according to the specified indelModel . More...
 
Sequence Evolve (RateMatrix rateMatrix, IndelModel indelModel, double time, out Insertion[] insertions)
 Simulates the evolution of the Sequence over the specified amount of time , using the specified rate matrix. Insertions and deletions happen according to the specified indelModel . More...
 
Dictionary< string, SequenceEvolve (TreeNode tree, RateMatrix rateMatrix, double scale=1, IndelModel indelModel=null)
 Simulates the evolution of the sequence over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model. More...
 
Dictionary< string, SequenceEvolveAll (TreeNode tree, RateMatrix rateMatrix, double scale=1, IndelModel indelModel=null)
 Simulates the evolution of the sequence over a phylogenetic tree , with the specified rate matrix, scale factor, and insertion/deletion model. More...
 

Static Public Member Functions

static implicit operator string (Sequence sequence)
 Converts a Sequence to a string More...
 
static Sequence RandomSequence (int length, RateMatrix rateMatrix)
 Create a random sequence with the specified length , using the states and equilibrium frequencies from the rateMatrix . More...
 
static Sequence RandomSequence (int length, IReadOnlyList< char > states)
 Create a random sequence with the specified length containing all states with equal probability. More...
 
static Sequence RandomSequence (int length, char[] states)
 Create a random sequence with the specified length containing all states with equal probability. More...
 
static Sequence RandomSequence (int length, IReadOnlyList< char > states, IReadOnlyList< double > stateFrequencies)
 Create a random sequence with the specified length containing each state with probabilities given by stateFrequencies . More...
 
static Sequence RandomSequence (int length, char[] states, double[] stateFrequencies)
 Create a random sequence with the specified length containing each state with probabilities given by stateFrequencies . More...
 

Properties

ImmutableArray< char > States [get]
 The possible states that make up the sequence. Note that some states may not actually be present in the sequence. More...
 
ImmutableArray< double >? Conservation [get]
 The conservation profile of the sequence. If this is null, all positions in the sequence are equally conserved. More...
 
ImmutableArray< double >? IndelProfile [get]
 The indel profile of the sequence. If this is null, all positions in the sequence have equal probability of being affected by an indel event. More...
 
string StringSequence [get]
 Returns the sequence as a string. More...
 
int Length [get]
 The length of the sequence. More...
 
int Count [get]
 
char this[int index] [get]
 

Detailed Description

Represents a sequence of characters.

Definition at line 14 of file Sequence.cs.

Constructor & Destructor Documentation

◆ Sequence() [1/4]

PhyloTree.SequenceSimulation.Sequence.Sequence ( ReadOnlySpan< char >  sequence)

Creates a new Sequence.

Parameters
sequenceThe sequence.

Definition at line 64 of file Sequence.cs.

◆ Sequence() [2/4]

PhyloTree.SequenceSimulation.Sequence.Sequence ( ReadOnlySpan< char >  sequence,
IReadOnlyList< char >  states 
)

Creates a new Sequence.

Parameters
sequenceThe sequence.
statesThe possible states for the sequence.

Definition at line 95 of file Sequence.cs.

◆ Sequence() [3/4]

PhyloTree.SequenceSimulation.Sequence.Sequence ( ReadOnlySpan< char >  sequence,
IReadOnlyList< char >  states,
IReadOnlyList< double >  conservation 
)

Creates a new Sequence.

Parameters
sequenceThe sequence.
statesThe possible states for the sequence.
conservationThe conservation profile for the sequence.

Definition at line 125 of file Sequence.cs.

◆ Sequence() [4/4]

PhyloTree.SequenceSimulation.Sequence.Sequence ( ReadOnlySpan< char >  sequence,
IReadOnlyList< char >  states,
IReadOnlyList< double >  conservation,
IReadOnlyList< double >  indelProfile 
)

Creates a new Sequence.

Parameters
sequenceThe sequence.
statesThe possible states for the sequence.
conservationThe conservation profile for the sequence.
indelProfileThe indel profile for the sequence.

Definition at line 161 of file Sequence.cs.

Member Function Documentation

◆ Evolve() [1/4]

Sequence PhyloTree.SequenceSimulation.Sequence.Evolve ( RateMatrix  rateMatrix,
double  time 
)

Simulates the evolution of the Sequence over the specified amount of time , using the specified rate matrix. No indels are allowed to happen.

Parameters
rateMatrixThe rate matrix to simulate sequence evolution.
timeThe length of time over which the sequence evolves.
Returns
The evolved sequence.

Definition at line 288 of file Sequence.cs.

◆ Evolve() [2/4]

Sequence PhyloTree.SequenceSimulation.Sequence.Evolve ( RateMatrix  rateMatrix,
IndelModel  indelModel,
double  time 
)

Simulates the evolution of the Sequence over the specified amount of time , using the specified rate matrix. Insertions and deletions happen according to the specified indelModel .

Parameters
rateMatrixThe rate matrix to simulate sequence evolution.
indelModelThe insertion/deletion model.
timeThe length of time over which the sequence evolves.
Returns
The evolved sequence.

Definition at line 303 of file Sequence.cs.

◆ Evolve() [3/4]

Sequence PhyloTree.SequenceSimulation.Sequence.Evolve ( RateMatrix  rateMatrix,
IndelModel  indelModel,
double  time,
out Insertion[]  insertions 
)

Simulates the evolution of the Sequence over the specified amount of time , using the specified rate matrix. Insertions and deletions happen according to the specified indelModel .

Parameters
rateMatrixThe rate matrix to simulate sequence evolution.
indelModelThe insertion/deletion model.
timeThe length of time over which the sequence evolves.
insertionsAn array containing all the insertion events that have occurred during the evolution of the sequence (useful to map the evolved sequence back onto the ancestral sequence).
Returns
The evolved sequence and an array containing all the insertion events that happened during its evolution.

Definition at line 320 of file Sequence.cs.

◆ Evolve() [4/4]

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

Simulates the evolution of the 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).
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 351 of file Sequence.cs.

◆ EvolveAll()

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

Simulates the evolution of the 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).
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 367 of file Sequence.cs.

◆ GetEnumerator()

IEnumerator< char > PhyloTree.SequenceSimulation.Sequence.GetEnumerator ( )

Definition at line 228 of file Sequence.cs.

◆ operator string()

static implicit PhyloTree.SequenceSimulation.Sequence.operator string ( Sequence  sequence)
static

Converts a Sequence to a string

Parameters
sequenceThe Sequence to convert.

Definition at line 216 of file Sequence.cs.

◆ RandomSequence() [1/5]

static Sequence PhyloTree.SequenceSimulation.Sequence.RandomSequence ( int  length,
char[]  states 
)
static

Create a random sequence with the specified length containing all states with equal probability.

Parameters
lengthThe length of the sequence.
statesThe character states to use for the sequence.
Returns
A random sequence

◆ RandomSequence() [2/5]

static Sequence PhyloTree.SequenceSimulation.Sequence.RandomSequence ( int  length,
char[]  states,
double[]  stateFrequencies 
)
static

Create a random sequence with the specified length containing each state with probabilities given by stateFrequencies .

Parameters
lengthThe length of the sequence.
statesThe character states to use for the sequence.
stateFrequenciesThe frequency for each state.
Returns
A random sequence

◆ RandomSequence() [3/5]

static Sequence PhyloTree.SequenceSimulation.Sequence.RandomSequence ( int  length,
IReadOnlyList< char >  states 
)
static

Create a random sequence with the specified length containing all states with equal probability.

Parameters
lengthThe length of the sequence.
statesThe character states to use for the sequence.
Returns
A random sequence

◆ RandomSequence() [4/5]

static Sequence PhyloTree.SequenceSimulation.Sequence.RandomSequence ( int  length,
IReadOnlyList< char >  states,
IReadOnlyList< double >  stateFrequencies 
)
static

Create a random sequence with the specified length containing each state with probabilities given by stateFrequencies .

Parameters
lengthThe length of the sequence.
statesThe character states to use for the sequence.
stateFrequenciesThe frequency for each state.
Returns
A random sequence

◆ RandomSequence() [5/5]

static Sequence PhyloTree.SequenceSimulation.Sequence.RandomSequence ( int  length,
RateMatrix  rateMatrix 
)
static

Create a random sequence with the specified length , using the states and equilibrium frequencies from the rateMatrix .

Parameters
lengthThe length of the sequence.
rateMatrixThe rate matrix.
Returns
A random sequence.

◆ ToString()

override string PhyloTree.SequenceSimulation.Sequence.ToString ( )

Definition at line 222 of file Sequence.cs.

Property Documentation

◆ Conservation

ImmutableArray<double>? PhyloTree.SequenceSimulation.Sequence.Conservation
get

The conservation profile of the sequence. If this is null, all positions in the sequence are equally conserved.

Definition at line 27 of file Sequence.cs.

◆ Count

int PhyloTree.SequenceSimulation.Sequence.Count
get

Definition at line 55 of file Sequence.cs.

◆ IndelProfile

ImmutableArray<double>? PhyloTree.SequenceSimulation.Sequence.IndelProfile
get

The indel profile of the sequence. If this is null, all positions in the sequence have equal probability of being affected by an indel event.

Definition at line 33 of file Sequence.cs.

◆ Length

int PhyloTree.SequenceSimulation.Sequence.Length
get

The length of the sequence.

Definition at line 49 of file Sequence.cs.

◆ States

ImmutableArray<char> PhyloTree.SequenceSimulation.Sequence.States
get

The possible states that make up the sequence. Note that some states may not actually be present in the sequence.

Definition at line 22 of file Sequence.cs.

◆ StringSequence

string PhyloTree.SequenceSimulation.Sequence.StringSequence
get

Returns the sequence as a string.

Definition at line 38 of file Sequence.cs.

◆ this[int index]

char PhyloTree.SequenceSimulation.Sequence.this[int index]
get

Definition at line 58 of file Sequence.cs.


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