Return fraction of positions that differ relative to other
Parameters: | other : BiologicalSequence
|
---|---|
Returns: | float
|
Raises: | skbio.core.exception.BiologicalSequenceError
|
See also
distance, fraction_same, scipy.spatial.distance.hamming
Notes
Computed as the Hamming distance between self and other. This is available in addition to distance in case the distance method is updated to use something other than scipy.spatial.distance.hamming as the default distance metric. So, if you specifically want the fraction of positions that differ, you should use this function instead of distance to ensure backward compatibility.
Examples
>>> from skbio.core.sequence import BiologicalSequence
>>> s = BiologicalSequence('GGUC')
>>> t = BiologicalSequence('AGUC')
>>> s.fraction_diff(t)
0.25