Skip to main content
`Ctrl`+`K`

# skbio.sequence.SubstitutionMatrix.rename

SubstitutionMatrix.rename(mapper, strict=True)

  Rename IDs in the dissimilarity matrix.

  Parameters:
    mapper dict or callable

      A dictionary or function that maps current IDs to new IDs.

    strict bool, optional

      If `True` (default), every ID in the matrix must be included in `mapper`. If `False`, only the specified IDs will be renamed.

  Raises:
    ValueError

      If `mapper` does not contain all of the same IDs in the matrix whereas in strict mode.

  Examples

      >>> from skbio import DistanceMatrix
      >>> dm = DistanceMatrix([[0, 1], [1, 0]], ids=['a', 'b'])
      >>> dm.rename({'a': 'x', 'b': 'y'})
      >>> print(dm.ids)
      ('x', 'y')