bioin.pattern_count¶
-
bioin.pattern_count(pattern, text)[source]¶ The number of times that a pattern appears as a substring of text.
Parameters: - pattern (str) – the substring pattern to find in the given text.
- text (str) – the string space for looking.
Returns: String, number of substring pattern that appears in text.
Examples
Count the frequency (overlapping occurrences also counts) of a substring, i.e. pattern in the given string, i.e. text.
>>> pattern = "GCG" >>> text = "GCGCG" >>> count = pattern_count(pattern, text) >>> count 2