skbio.core.sequence.RNASequence.k_word_counts

RNASequence.k_word_counts(k, overlapping=True, constructor=<type 'str'>)[source]

Get the counts of words of length k

Parameters:

k : int

The word length.

overlapping : bool, optional

Defines whether the k-words should be overlapping or not overlapping.

constructor : type, optional

The constructor for the returned k-words.

Returns:

collections.Counter

The counts of words of length k contained in the BiologicalSequence.

Examples

>>> from skbio.core.sequence import BiologicalSequence
>>> s = BiologicalSequence('ACACAT')
>>> s.k_word_counts(3, overlapping=True)
Counter({'ACA': 2, 'CAC': 1, 'CAT': 1})