skbio.sequence.SubstitutionMatrix.identity#

classmethod SubstitutionMatrix.identity(alphabet, match, mismatch)[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.

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.]])