skbio.core.sequence.NucleotideSequence.fraction_same

NucleotideSequence.fraction_same(other)[source]

Return fraction of positions that are the same relative to other

Parameters:

other : BiologicalSequence

The BiologicalSequence to compare against.

Returns:

float

The fraction of positions that are the same between self and other.

Raises:

skbio.core.exception.BiologicalSequenceError

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

See also

distance, fraction_diff, scipy.spatial.distance.hamming

Examples

>>> from skbio.core.sequence import BiologicalSequence
>>> s = BiologicalSequence('GGUC')
>>> t = BiologicalSequence('AGUC')
>>> s.fraction_same(t)
0.75