skbio.core.sequence.ProteinSequence.distance

ProteinSequence.distance(other, distance_fn=None)[source]

Returns the distance to other

Parameters:

other : BiologicalSequence

The BiologicalSequence to compute the distance to.

distance_fn : function, optional

Function used to compute the distance between self and other. If None (the default), scipy.spatial.distance.hamming will be used.

Returns:

float

The distance between self and other.

Raises:

skbio.core.exception.BiologicalSequenceError

If len(self) != len(other).

See also

fraction_diff, fraction_same, skbio.core.distance.DistanceMatrix, scipy.spatial.distance.hamming

Examples

>>> from skbio.core.sequence import BiologicalSequence
>>> s = BiologicalSequence('GGUC')
>>> t = BiologicalSequence('AGUC')
>>> s.distance(t)
0.25
>>> def dumb_dist(s1, s2): return 0.42
>>> s.distance(t, dumb_dist)
0.42