skbio.sequence.RNA.match_frequency#
- RNA.match_frequency(other, relative=False)[source]#
Return count of positions that are the same between two sequences.
- Parameters:
- otherstr, Sequence, or 1D np.ndarray (np.uint8 or ‘|S1’)
Sequence to compare to.
- relativebool, optional
If
True
, return the relative frequency of matches instead of the count.
- Returns:
- int or float
Number of positions that are the same between the sequences. This will be an
int
if relative isFalse
and afloat
if relative isTrue
.
- 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
Examples
>>> from skbio import Sequence >>> s = Sequence('GGUC') >>> t = Sequence('AGUC') >>> s.match_frequency(t) 3 >>> s.match_frequency(t, relative=True) 0.75