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

Contains methods to compute distance matrices. More...

Static Public Member Functions

static float[][] BuildFromAlignment (IReadOnlyList< byte[]> sequences, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=-1, Action< double > progressCallback=null)
 Build a distance matrix from aligned DNA sequences stored as a T:byte[] array where each byte corresponds to three positions. More...
 
static float[][] BuildFromAlignment (IReadOnlyList< ushort[]> sequences, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=-1, Action< double > progressCallback=null)
 Build a distance matrix from aligned protein sequences stored as a T:ushort[] array where each ushort corresponds to two positions. More...
 
static void BuildFromAlignment (float[][] allocatedMatrix, IReadOnlyList< byte[]> sequences, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=-1, Action< double > progressCallback=null)
 Build a distance matrix from aligned DNA sequences stored as a T:byte[] array where each byte corresponds to three positions. More...
 
static void BuildFromAlignment (float[][] allocatedMatrix, IReadOnlyList< ushort[]> sequences, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a distance matrix from aligned protein sequences stored as a T:ushort[] array where each ushort corresponds to two positions. More...
 
static void BuildFromAlignment (float[][] allocatedMatrix, IReadOnlyList< string > sequences, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a distance matrix from aligned DNA or protein sequences. More...
 
static float[][] BuildFromAlignment (IReadOnlyList< string > sequences, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a distance matrix from aligned DNA or protein sequences. More...
 
static void BootstrapReplicateFromAlignment (float[][] allocatedMatrix, IReadOnlyList< string > sequences, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences. More...
 
static float[][] BootstrapReplicateFromAlignment (IReadOnlyList< string > sequences, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences. More...
 
static float[][] BuildFromAlignment (Dictionary< string, string > alignment, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a distance matrix from aligned DNA or protein sequences. More...
 
static void BuildFromAlignment (float[][] allocatedMatrix, Dictionary< string, string > alignment, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a distance matrix from aligned DNA or protein sequences. More...
 
static float[][] BootstrapReplicateFromAlignment (Dictionary< string, string > alignment, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences. More...
 
static void BootstrapReplicateFromAlignment (float[][] allocatedMatrix, Dictionary< string, string > alignment, AlignmentType alignmentType=AlignmentType.Autodetect, EvolutionModel evolutionModel=EvolutionModel.Kimura, int numCores=0, Action< double > progressCallback=null)
 Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences. More...
 
static IEnumerable< byte[]> ConvertDNASequences (IEnumerable< string > sequences)
 Convert DNA sequences into T:byte[] arrays in which each byte corresponds to 3 positions. More...
 
static List< byte[]> ConvertDNASequences (IReadOnlyList< string > sequences)
 Convert DNA sequences into T:byte[] arrays in which each byte corresponds to 3 positions. More...
 
static IEnumerable< byte[]> BootstrapDNASequences (IEnumerable< string > sequences)
 Computes a bootstrap replicate of a DNA sequence alignment. More...
 
static List< byte[]> BootstrapDNASequences (IReadOnlyList< string > sequences)
 Computes a bootstrap replicate of a DNA sequence alignment. More...
 
static IEnumerable< ushort[]> ConvertProteinSequences (IEnumerable< string > sequences)
 Convert protein sequences into T:ushort[] arrays in which each ushort corresponds to 2 positions. More...
 
static List< ushort[]> ConvertProteinSequences (IReadOnlyList< string > sequences)
 Convert protein sequences into T:ushort[] arrays in which each ushort corresponds to 2 positions. More...
 
static IEnumerable< ushort[]> BootstrapProteinSequences (IEnumerable< string > sequences)
 Computes a bootstrap replicate of a protein sequence alignment. More...
 
static List< ushort[]> BootstrapProteinSequences (IReadOnlyList< string > sequences)
 Computes a bootstrap replicate of a protein sequence alignment. More...
 
static ushort[] ConvertProteinSequence (string sequence)
 Converts a protein sequence stored as a string into a T:ushort[] array. Each ushort contains 2 amino acid positions. The allowed symbols are the usual 20 1-letter amino acid abbreviations, plus U for Sec, O for Pyl, B for Asn or Asp, Z for Gln or Glu, J for Ile or Leu, X for any amino acid, * for stop codons and - for gaps (uppercase and lowercase). All other characters are treated as gaps. If the sequence length is not a multiple of 2, it is padded with gaps. More...
 
static float CompareProteinSequencesBLOSUM62 (ushort[] sequence1, ushort[] sequence2, int selfScore1, int selfScore2)
 Compares two protein sequences using the Scoredist correction with the BLOSUM62 matrix. More...
 

Detailed Description

Contains methods to compute distance matrices.

Definition at line 66 of file DistanceMatrix.cs.

Member Function Documentation

◆ BootstrapDNASequences() [1/2]

static IEnumerable< byte[]> PhyloTree.TreeBuilding.DistanceMatrix.BootstrapDNASequences ( IEnumerable< string >  sequences)
static

Computes a bootstrap replicate of a DNA sequence alignment.

Parameters
sequencesThe aligned DNA sequences.
Returns
An T:IEnumerable<byte[]> that, when enumerated, will contain the bootstrapped sequences, converted into T:byte[] arrays where each byte corresponds to 3 positions.
Exceptions
ArgumentOutOfRangeExceptionThrown if not all of the sequences have the same length.

Definition at line 533 of file DistanceMatrix.cs.

◆ BootstrapDNASequences() [2/2]

static List< byte[]> PhyloTree.TreeBuilding.DistanceMatrix.BootstrapDNASequences ( IReadOnlyList< string >  sequences)
static

Computes a bootstrap replicate of a DNA sequence alignment.

Parameters
sequencesThe aligned DNA sequences.
Returns
An T:List<byte[]> that contains the bootstrapped sequences, converted into T:byte[] arrays where each byte corresponds to 3 positions.
Exceptions
ArgumentOutOfRangeExceptionThrown if not all of the sequences have the same length.

Definition at line 562 of file DistanceMatrix.cs.

◆ BootstrapProteinSequences() [1/2]

static IEnumerable< ushort[]> PhyloTree.TreeBuilding.DistanceMatrix.BootstrapProteinSequences ( IEnumerable< string >  sequences)
static

Computes a bootstrap replicate of a protein sequence alignment.

Parameters
sequencesThe aligned protein sequences.
Returns
An T:IEnumerable<ushort[]> that, when enumerated, will contain the bootstrapped sequences, converted into T:ushort[] arrays where each ushort corresponds to 2 positions.
Exceptions
ArgumentOutOfRangeExceptionThrown if not all of the sequences have the same length.

Definition at line 596 of file DistanceMatrix.cs.

◆ BootstrapProteinSequences() [2/2]

static List< ushort[]> PhyloTree.TreeBuilding.DistanceMatrix.BootstrapProteinSequences ( IReadOnlyList< string >  sequences)
static

Computes a bootstrap replicate of a protein sequence alignment.

Parameters
sequencesThe aligned protein sequences.
Returns
A T:List<ushort[]> that contains the bootstrapped sequences, converted into T:ushort[] arrays where each ushort corresponds to 2 positions.
Exceptions
ArgumentOutOfRangeExceptionThrown if not all of the sequences have the same length.

Definition at line 625 of file DistanceMatrix.cs.

◆ BootstrapReplicateFromAlignment() [1/4]

static float[][] PhyloTree.TreeBuilding.DistanceMatrix.BootstrapReplicateFromAlignment ( Dictionary< string, string >  alignment,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences.

Parameters
alignmentThe aligned sequences. These will be resampled randomly.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.
Returns
A T:float[][] jagged array containing the lower-triangular distance matrix.

Definition at line 462 of file DistanceMatrix.cs.

◆ BootstrapReplicateFromAlignment() [2/4]

static void PhyloTree.TreeBuilding.DistanceMatrix.BootstrapReplicateFromAlignment ( float  allocatedMatrix[][],
Dictionary< string, string >  alignment,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences.

Parameters
allocatedMatrixA pre-allocated T:float[][] jagged array that will contain the lower-triangular distance matrix.
alignmentThe aligned sequences. These will be resampled randomly.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.

Definition at line 476 of file DistanceMatrix.cs.

◆ BootstrapReplicateFromAlignment() [3/4]

static void PhyloTree.TreeBuilding.DistanceMatrix.BootstrapReplicateFromAlignment ( float  allocatedMatrix[][],
IReadOnlyList< string >  sequences,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences.

Parameters
allocatedMatrixA pre-allocated T:float[][] jagged array that will contain the lower-triangular distance matrix.
sequencesThe aligned sequences. These will be resampled randomly.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.

Definition at line 355 of file DistanceMatrix.cs.

◆ BootstrapReplicateFromAlignment() [4/4]

static float[][] PhyloTree.TreeBuilding.DistanceMatrix.BootstrapReplicateFromAlignment ( IReadOnlyList< string >  sequences,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a bootstrap replicate of a distance matrix from aligned DNA or protein sequences.

Parameters
sequencesThe aligned sequences. These will be resampled randomly.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.
Returns
A T:float[][] jagged array containing the lower-triangular distance matrix.

Definition at line 411 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [1/8]

static float[][] PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( Dictionary< string, string >  alignment,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned DNA or protein sequences.

Parameters
alignmentThe aligned sequences.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.
Returns
A T:float[][] jagged array containing the lower-triangular distance matrix.

Definition at line 434 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [2/8]

static void PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( float  allocatedMatrix[][],
Dictionary< string, string >  alignment,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned DNA or protein sequences.

Parameters
allocatedMatrixA pre-allocated T:float[][] jagged array that will contain the lower-triangular distance matrix.
alignmentThe aligned sequences.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.

Definition at line 448 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [3/8]

static void PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( float  allocatedMatrix[][],
IReadOnlyList< byte[]>  sequences,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = -1,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned DNA sequences stored as a T:byte[] array where each byte corresponds to three positions.

Parameters
allocatedMatrixA pre-allocated T:float[][] jagged array that will contain the lower-triangular distance matrix.
sequencesThe aligned sequences.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.

Definition at line 171 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [4/8]

static void PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( float  allocatedMatrix[][],
IReadOnlyList< string >  sequences,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned DNA or protein sequences.

Parameters
allocatedMatrixA pre-allocated T:float[][] jagged array that will contain the lower-triangular distance matrix.
sequencesThe aligned sequences.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.

Definition at line 252 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [5/8]

static void PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( float  allocatedMatrix[][],
IReadOnlyList< ushort[]>  sequences,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned protein sequences stored as a T:ushort[] array where each ushort corresponds to two positions.

Parameters
allocatedMatrixA pre-allocated T:float[][] jagged array that will contain the lower-triangular distance matrix.
sequencesThe aligned sequences.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.

Definition at line 211 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [6/8]

static float[][] PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( IReadOnlyList< byte[]>  sequences,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = -1,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned DNA sequences stored as a T:byte[] array where each byte corresponds to three positions.

Parameters
sequencesThe aligned sequences.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.
Returns
A T:float[][] jagged array containing the lower-triangular distance matrix.

Definition at line 127 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [7/8]

static float[][] PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( IReadOnlyList< string >  sequences,
AlignmentType  alignmentType = AlignmentType.Autodetect,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = 0,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned DNA or protein sequences.

Parameters
sequencesThe aligned sequences.
alignmentTypeThe type of sequences in the alignment.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.
Returns
A T:float[][] jagged array containing the lower-triangular distance matrix.

Definition at line 332 of file DistanceMatrix.cs.

◆ BuildFromAlignment() [8/8]

static float[][] PhyloTree.TreeBuilding.DistanceMatrix.BuildFromAlignment ( IReadOnlyList< ushort[]>  sequences,
EvolutionModel  evolutionModel = EvolutionModel.Kimura,
int  numCores = -1,
Action< double >  progressCallback = null 
)
static

Build a distance matrix from aligned protein sequences stored as a T:ushort[] array where each ushort corresponds to two positions.

Parameters
sequencesThe aligned sequences.
evolutionModelThe evolutionary model to use to compute the distance matrix.
numCoresThe maximum number of threads to use, or -1 to let the runtime decide.
progressCallbackA method used to report progress.
Returns
A T:float[][] jagged array containing the lower-triangular distance matrix.

Definition at line 149 of file DistanceMatrix.cs.

◆ CompareProteinSequencesBLOSUM62()

static float PhyloTree.TreeBuilding.DistanceMatrix.CompareProteinSequencesBLOSUM62 ( ushort[]  sequence1,
ushort[]  sequence2,
int  selfScore1,
int  selfScore2 
)
static

Compares two protein sequences using the Scoredist correction with the BLOSUM62 matrix.

Parameters
sequence1The first sequence.
sequence2The second sequence.
selfScore1The score obtained by comparing sequence1 with itself.
selfScore2The score obtained by comparing sequence2 with itself.
Returns
The distance between the two sequences.

Definition at line 779 of file DistanceMatrix.Protein.cs.

◆ ConvertDNASequences() [1/2]

static IEnumerable< byte[]> PhyloTree.TreeBuilding.DistanceMatrix.ConvertDNASequences ( IEnumerable< string >  sequences)
static

Convert DNA sequences into T:byte[] arrays in which each byte corresponds to 3 positions.

Parameters
sequencesThe sequences to convert.
Returns
An T:IEnumerable<byte[]> that, when enumerated, will contain the converted sequences.

Definition at line 486 of file DistanceMatrix.cs.

◆ ConvertDNASequences() [2/2]

static List< byte[]> PhyloTree.TreeBuilding.DistanceMatrix.ConvertDNASequences ( IReadOnlyList< string >  sequences)
static

Convert DNA sequences into T:byte[] arrays in which each byte corresponds to 3 positions.

Parameters
sequencesThe sequences to convert.
Returns
A T:List<byte[]> that contains the converted sequences.

Definition at line 499 of file DistanceMatrix.cs.

◆ ConvertProteinSequence()

static ushort[] PhyloTree.TreeBuilding.DistanceMatrix.ConvertProteinSequence ( string  sequence)
static

Converts a protein sequence stored as a string into a T:ushort[] array. Each ushort contains 2 amino acid positions. The allowed symbols are the usual 20 1-letter amino acid abbreviations, plus U for Sec, O for Pyl, B for Asn or Asp, Z for Gln or Glu, J for Ile or Leu, X for any amino acid, * for stop codons and - for gaps (uppercase and lowercase). All other characters are treated as gaps. If the sequence length is not a multiple of 2, it is padded with gaps.

Parameters
sequenceThe sequence to convert.
Returns
A T:ushort[] array representing the sequence.

Definition at line 53 of file DistanceMatrix.Protein.cs.

◆ ConvertProteinSequences() [1/2]

static IEnumerable< ushort[]> PhyloTree.TreeBuilding.DistanceMatrix.ConvertProteinSequences ( IEnumerable< string >  sequences)
static

Convert protein sequences into T:ushort[] arrays in which each ushort corresponds to 2 positions.

Parameters
sequencesThe sequences to convert.
Returns
An T:IEnumerable<ushort[]> that, when enumerated, will contain the converted sequences.

Definition at line 572 of file DistanceMatrix.cs.

◆ ConvertProteinSequences() [2/2]

static List< ushort[]> PhyloTree.TreeBuilding.DistanceMatrix.ConvertProteinSequences ( IReadOnlyList< string >  sequences)
static

Convert protein sequences into T:ushort[] arrays in which each ushort corresponds to 2 positions.

Parameters
sequencesThe sequences to convert.
Returns
A T:List<ushort[]> that contains the converted sequences.

Definition at line 585 of file DistanceMatrix.cs.


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