skbio.sequence.GrammaredSequence.__contains__#

GrammaredSequence.__contains__(subsequence)[source]#

Determine if a subsequence is contained in this sequence.

Parameters:
subsequencestr, Sequence, or 1D np.ndarray (np.uint8 or ‘|S1’)

The putative subsequence.

Returns:
bool

Indicates whether subsequence is contained in this sequence.

Raises:
TypeError

If subsequence is a Sequence object with a different type than this sequence.

Examples

>>> from skbio import Sequence
>>> s = Sequence('GGUCGUGAAGGA')
>>> 'GGU' in s
True
>>> 'CCC' in s
False