highlightString: Find pattern in strings and flip case

View source: R/dna.R

highlightStringR Documentation

Find pattern in strings and flip case

Description

Use the case of a string to highlight a pattern. For example, highlighting AC in TTTTGTACAAATC as TTTTGTacAAATC. Note that it will not find overlapping patterns e.g. looking for AGA in AGAGA will only find the first AGA. Non-letter characters can be included in the pattern but their case will remain unchanged.

Usage

highlightString(pattern, strings)

Arguments

pattern

Pattern to look for in strings

strings

Strings in which to look for pattern

Value

Strings with case of any occurences of pattern swapped

Examples

highlightString('AGA',c('TTAGATTAGA','AGAGA'))
highlightString('aga',tolower(c('TTAGATTAGA','AGAGA')))

sherrillmix/dnar documentation built on July 18, 2022, 10:07 p.m.