Skip to contents

This function counts the frequency of a specific character or pattern in a given sequence.

Usage

count_seq_pattern(seq, pattern)

Arguments

seq

A character vector representing the sequence to count the pattern in.

pattern

A character string representing the pattern to count in the sequence.

Value

An integer representing the count of the pattern in the sequence.

Examples

seq <- "ATGGTGCTCCGTGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCGCTACGTAG"
count_seq_pattern(seq, "CG")
#> [1] 31
# [1] 31