Remove all matched patterns in bstr sequences

bstr_remove(bstrobj, pattern, case_sensitive = FALSE)

bstr_remove_num(bstrobj)

bstr_remove_notalpha(bstrobj)

bstr_remove_gap(bstrobj, gap_chr = "-")

Arguments

bstrobj

bstr class object or character vector

pattern

regex pattern

case_sensitive

sensitive to case in pattern (default:FALSE)

gap_chr

a gap character

Value

A bstr object.

Examples

temp <- bstr(c("ATGCCCTAG", "aTGCcCtAg")) c(temp, remove = bstr_remove(temp, "[aT]"))
#> class: bstr,character #> number of sequences: 4 #> [1] no name 1 : ATGCCCTAG 9 #> [2] no name 2 : aTGCcCtAg 9 #> [3] remove.no name 1 : GCCCG 5 #> [4] remove.no name 2 : GCcCg 5
c(temp, remove = bstr_remove(temp, "aT"))
#> class: bstr,character #> number of sequences: 4 #> [1] no name 1 : ATGCCCTAG 9 #> [2] no name 2 : aTGCcCtAg 9 #> [3] remove.no name 1 : GCCCTAG 7 #> [4] remove.no name 2 : GCcCtAg 7
c(temp, remove = bstr_remove(temp, "aT", TRUE))
#> class: bstr,character #> number of sequences: 4 #> [1] no name 1 : ATGCCCTAG 9 #> [2] no name 2 : aTGCcCtAg 9 #> [3] remove.no name 1 : ATGCCCTAG 9 #> [4] remove.no name 2 : GCcCtAg 7
bstr_remove_num(bstr("ac12 -xe gg. "))
#> class: bstr,character #> number of sequences: 1 #> [1] no name 1 : ac -xe gg. 11
bstr_remove_notalpha(bstr("ac12 -xe gg. "))
#> class: bstr,character #> number of sequences: 1 #> [1] no name 1 : acxegg 6
bstr_remove_gap(bstr("ac12 -xe gg. "))
#> class: bstr,character #> number of sequences: 1 #> [1] no name 1 : ac12 xe gg. 12