skbio.sequence.SubstitutionMatrix.identity#

classmethod SubstitutionMatrix.identity(alphabet, match, mismatch, dtype='float32')[source]#

Create an identity substitution matrix.

All matches and mismatches will have the identical scores, respectively, regardless of the character.

Parameters:
alphabetiterable

Characters that constitute the alphabet.

matchint or float

Score assigned to all matches.

mismatchint or float

Score assigned to all mismatches.

dtype{“float32”, “float64”}, optional

Floating-point data type of the matrix. Default is “float32”.

Returns:
SubstitutionMatrix

Substitution matrix constructed from the alphabet and scores.

Examples

>>> from skbio import SubstitutionMatrix
>>> mat = SubstitutionMatrix.identity('ACGT', 1, -2)
>>> mat.alphabet
('A', 'C', 'G', 'T')
>>> mat.scores
array([[ 1., -2., -2., -2.],
       [-2.,  1., -2., -2.],
       [-2., -2.,  1., -2.],
       [-2., -2., -2.,  1.]], dtype=float32)