Replace matched patterns in bstr sequences by replacements

bstr_replace(bstrobj, pattern, replacement, case_sensitive = FALSE)

Arguments

bstrobj

bstr class object or character vector

pattern

Pattern to look for.

replacement

A character vector of replacements or a function.

case_sensitive

sensitive to case in pattern (default:FALSE)

Examples

bstr_replace("AtGcTaat", "at", "cc")
#> class: bstr,character #> number of sequences: 1 #> [1] no name 1 : ccGcTacc 8
bstr_replace("AtGcTaat", "at", c("cc", "xx"))
#> class: bstr,character #> number of sequences: 2 #> [1] no name 1 : ccGcTacc 8 #> [2] <NA> : xxGcTaxx 8
bstr_replace("AtGcTaat", c("at", "gc"), c("cc", "xx"))
#> class: bstr,character #> number of sequences: 2 #> [1] no name 1 : ccGcTacc 8 #> [2] <NA> : AtxxTaat 8
bstr_replace("AtGcTaat", c("at", "gc"), c("cc", "xx"), TRUE)
#> class: bstr,character #> number of sequences: 2 #> [1] no name 1 : AtGcTacc 8 #> [2] <NA> : AtGcTaat 8
bstr_replace("AtGcTaat", c("at", "gc"), bstr_switch_case)
#> class: bstr,character #> number of sequences: 1 #> [1] no name 1 : aTGcTaAT 8