regexCounts: Count occurrences of regular expression

Description Usage Arguments Value Examples

View source: R/sarks.R

Description

Counts how often a regular expression (or vector of regular expressions) occurs in each element of a character vector.

Usage

1
regexCounts(regex, seqs, overlap = FALSE)

Arguments

regex

character vector of regular expressions to search for

seqs

character vector or XStringSet of sequences in which to search for and count occurrences of regex

overlap

logical value: should overlapping occurrences of regex be counted as multiple hits?

Value

if length(regex) is one, returns integer vector of counts; if length(regex) is more than one, returns matrix of counts: one row per sequence in seqs, one column per expression in regex

Examples

1
2
3
data(simulatedSeqs)
reCounts1 <- regexCounts('AAAAA|TTTTT', simulatedSeqs)
reCounts2 <- regexCounts(c('AAAAA|TTTTT', 'CG'), simulatedSeqs)

sarks documentation built on Nov. 8, 2020, 6:54 p.m.