mask {Biostrings} | R Documentation |
Use this function to mask some portions of a sequence. The portions to mask can either be specified "by position" (start/end) or "by content" (they match a given pattern).
mask(x, ...)
x |
The single string or BString (or derived) object to mask. This can also be a BStringViews object. |
... |
Additional arguments to be passed to or from methods. |
For BString (or derived) objects, mask()
can be used in two
different ways: by specifying the starts/ends of the portions to mask
(masking "by position") or by specifying a pattern (masking "by content").
For BStringViews objects, no extra argument is needed: y <- mask(x)
is the shortest (in term of number of views) BStringViews object such that:
(a) subject(y) == subject(x),
(b) y views cover the portions of the subject that are not covered by x
views,
(c) y views are sorted from left to right,
(d) y views are not "out of limits".
A BStringViews object containing the set of "unmasked" portions.
H. Pages
BStringViews, BString, DNAString, RNAString
## masking "by position" mask("AxyxyxBC", 2, 6) ## masking "by content" mask("AxyxyxBC", "xyx") ## masking the N's in a chromosome sequence library(BSgenome.Dmelanogaster.FlyBase.r51) chrU <- Dmelanogaster[["U"]] alphabetFrequency(chrU) noN_chrU <- mask(chrU, "N") alphabetFrequency(noN_chrU) ## masking a BStringViews object mask(noN_chrU) v <- views("AxyxyxBC", c(6, 4,-1, NA), c(7, 6, 1, 1)) mask(v) ## note that applying mask() again returns a BStringViews object ## where the original views on v have been merged, sorted from left to right ## and cleaned from their "out of limits" portions mask(mask(v)) ## finally, note that mask(mask(mask(v))) is _always_ the same as mask(v) mask(mask(mask(v)))