biopython v1.71.0 Bio.Phylo.TreeConstruction.DistanceCalculator

Class to calculate the distance matrix from a DNA or Protein

Multiple Sequence Alignment(MSA) and the given name of the substitution model.

Currently only scoring matrices are used.

:Parameters:

model : str
    Name of the model matrix to be used to calculate distance.
    The attribute `dna_matrices` contains the available model
    names for DNA sequences and `protein_matrices` for protein
    sequences.

Example


 >>> from Bio.Phylo.TreeConstruction import DistanceCalculator
 >>> from Bio import AlignIO
 >>> aln = AlignIO.read(open('Tests/TreeConstruction/msa.phy'), 'phylip')
 >>> print aln
 SingleLetterAlphabet() alignment with 5 rows and 13 columns
 AACGTGGCCACAT Alpha
 AAGGTCGCCACAC Beta
 GAGATTTCCGCCT Delta
 GAGATCTCCGCCC Epsilon
 CAGTTCGCCACAA Gamma

DNA calculator with ‘identity’ model::

     >>> calculator = DistanceCalculator('identity')
     >>> dm = calculator.get_distance(aln)
     >>> print dm
     Alpha   0
     Beta    0.230769230769  0
     Gamma   0.384615384615  0.230769230769  0
     Delta   0.538461538462  0.538461538462  0.538461538462  0
     Epsilon 0.615384615385  0.384615384615  0.461538461538  0.153846153846  0
             Alpha           Beta            Gamma           Delta           Epsilon

Protein calculator with ‘blosum62’ model::

     >>> calculator = DistanceCalculator('blosum62')
     >>> dm = calculator.get_distance(aln)
     >>> print dm
     Alpha   0
     Beta    0.369047619048  0
     Gamma   0.493975903614  0.25            0
     Delta   0.585365853659  0.547619047619  0.566265060241  0
     Epsilon 0.7             0.355555555556  0.488888888889  0.222222222222  0
             Alpha           Beta            Gamma           Delta           Epsilon

Link to this section Summary

Functions

Initialize with a distance model

Convert matrix from SubsMat format to _Matrix object

Calculate pairwise distance from two sequences

Return a DistanceMatrix for MSA object

Link to this section Functions

Initialize with a distance model.

Link to this function _build_protein_matrix()

Convert matrix from SubsMat format to _Matrix object

Calculate pairwise distance from two sequences.

Returns a value between 0 (identical sequences) and 1 (completely different, or seq1 is an empty string.)

Return a DistanceMatrix for MSA object

:Parameters:

msa : MultipleSeqAlignment
    DNA or Protein multiple sequence alignment.