Skip to main content
`Ctrl`+`K`

# skbio.sequence.Protein.mismatch_frequency

Protein.mismatch_frequency(other, relative=False)

  Return count of positions that differ between two sequences.

  Parameters:
    other str, Sequence, or 1D np.ndarray (np.uint8 or ‘|S1’)

      Sequence to compare to.

    relative bool, optional

      If `True`, return the relative frequency of mismatches instead of the count.

  Returns:
    int or float

      Number of positions that differ between the sequences. This will be an `int` if relative is `False` and a `float` if relative is `True`.

  Raises:
    ValueError

      If the sequences are not the same length.

    TypeError

      If other is a `Sequence` object with a different type than this sequence.

  See also

  `match_frequency`
  `matches`
  `mismatches`
  `distance`

  Examples

      >>> from skbio import Sequence
      >>> s = Sequence('GGUC')
      >>> t = Sequence('AGUC')
      >>> s.mismatch_frequency(t)
      1
      >>> s.mismatch_frequency(t, relative=True)
      0.25