skbio.sequence.DNASequence.fraction_same

DNASequence.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.sequence.BiologicalSequenceError

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

Examples

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