regexLocate {sarks}R Documentation

Locate occurrences of regular expression

Description

Find locations of matches of a regular expression (or vector of regular expressions) in each element of a named character vector. Not case sensitive.

Usage

regexLocate(regex, seqs, showMatch = FALSE)

Arguments

regex

character vector or XStringSet of regular expressions to search for

seqs

named character vector or XStringSet of sequences in which to locate regex

showMatch

logical value; if true add additional column to output indicating what the exact regex match for each occurrence (can be slow)

Value

If only a single regex is searched for: data.frame with two columns: ‘seqid’ containing the name of the sequence from seqs in which the regex was found and ‘location’ giving the 1-based position at which the regex was found. If length(regex) greater than one, adds additional column ‘regex’ indicating the name of the regex located.

Examples

data(simulatedSeqs)
reLoci <- regexLocate('AAAAA|TTTTT', simulatedSeqs)


[Package sarks version 1.4.0 Index]