skbio.sequence.GrammaredSequence.count¶

GrammaredSequence.
count
(subsequence, start=None, end=None)[source]¶ Count occurrences of a subsequence in this sequence.
State: Stable as of 0.4.0.
 Parameters
 Returns
Number of occurrences of subsequence in this sequence.
 Return type
 Raises
ValueError – If subsequence is of length 0.
TypeError – If subsequence is a
Sequence
object with a different type than this sequence.
Examples
>>> from skbio import Sequence >>> s = Sequence('GGUCG') >>> s.count('G') 3 >>> s.count('GG') 1 >>> s.count('T') 0 >>> s.count('G', 2, 5) 1