maskMotif(Biostrings)
maskMotif()所属R语言包:Biostrings
Masking by content (or by position)
内容屏蔽(或位置)
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Functions for masking a sequence by content (or by position).
掩盖内容序列(或位置)的功能。
用法----------Usage----------
maskMotif(x, motif, min.block.width=1, ...)
mask(x, start=NA, end=NA, pattern)
参数----------Arguments----------
参数:x
The sequence to mask.
序列来掩盖。
参数:motif
The motif to mask in the sequence.
掩盖序列中的主题。
参数:min.block.width
The minimum width of the blocks to mask.
块的最小宽度面具。
参数:...
Additional arguments for matchPattern.
matchPattern额外的参数。
参数:start
An integer vector containing the starting positions of the regions to mask.
一个整数向量,包含区域的起始位置,以面具。
参数:end
An integer vector containing the ending positions of the regions to mask.
一个整数向量,包含区域的结束位置来屏蔽。
参数:pattern
The motif to mask in the sequence.
掩盖序列中的主题。
值----------Value----------
A MaskedXString object for maskMotif and an XStringViews object for mask.
一个的maskMotif和maskXStringViews对象MaskedXString对象。
作者(S)----------Author(s)----------
H. Pages
参见----------See Also----------
read.Mask, matchPattern, XString-class, MaskedXString-class, XStringViews-class, MaskCollection-class
read.Mask,matchPattern,MaskedXString级XString级,级XStringViews,MaskCollection级
举例----------Examples----------
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## EXAMPLE 1[#示例1]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
maskMotif(BString("AbcbbcbEEE"), "bcb")
maskMotif(BString("AbcbcbEEE"), "bcb")
## maskMotif() can be used in an incremental way to mask more than 1[的#maskMotif()可以用来在一个渐进的方式来掩盖超过1]
## motif. Note that maskMotif() does not try to mask again what's[#序。请注意,maskMotif()并不试图掩盖什么]
## already masked (i.e. the new mask will never overlaps with the[#已屏蔽(即新的面具永远不会重叠]
## previous masks) so the order in which the motifs are masked actually[#)以前的口罩,以便在该图案是为了掩盖实际上]
## matters as it will affect the total set of masked positions.[#重要的,因为它会影响蒙面职位的总集。]
x0 <- BString("AbcbEEEEEbcbbEEEcbbcbc")
x1 <- maskMotif(x0, "E")
x1
x2 <- maskMotif(x1, "bcb")
x2
x3 <- maskMotif(x2, "b")
x3
## Note that inverting the order in which "b" and "bcb" are masked would[#注意,颠倒顺序在“b”和“BCB”被屏蔽]
## lead to a different final set of masked positions.[#导致不同的蒙面职位的最后一组。]
## Also note that the order doesn't matter if the motifs to mask don't[#另外请注意,顺序并不重要,如果图案来掩盖不]
## overlap (we assume that the motifs are unique) i.e. if the prefix of[#重叠(我们假设是独一无二的图案),即如果前缀]
## each motif is not the suffix of any other motif. This is of course[#每个主题是没有任何其他主题的后缀。当然,这是]
## the case when all the motifs have only 1 letter.[#的情况时,所有的图案都只有1个字母。]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## EXAMPLE 2[#示例2]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
x <- DNAString("ACACAACTAGATAGNACTNNGAGAGACGC")
## Mask the N-blocks[#掩盖了N块。]
x1 <- maskMotif(x, "N")
x1
as(x1, "XStringViews")
gaps(x1)
as(gaps(x1), "XStringViews")
## Mask the AC-blocks [#掩盖交流块。]
x2 <- maskMotif(x1, "AC")
x2
gaps(x2)
## Mask the GA-blocks[#掩盖GA块。]
x3 <- maskMotif(x2, "GA", min.block.width=5)
x3 # masks 2 and 3 overlap[口罩2和3的重叠]
gaps(x3)
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## EXAMPLE 3[#示例3]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
library(BSgenome.Dmelanogaster.UCSC.dm3)
chrU <- Dmelanogaster$chrU
chrU
alphabetFrequency(chrU)
chrU <- maskMotif(chrU, "N")
chrU
alphabetFrequency(chrU)
as(chrU, "XStringViews")
as(gaps(chrU), "XStringViews")
mask2 <- Mask(mask.width=length(chrU), start=c(50000, 350000, 543900), width=25000)
names(mask2) <- "some ugly regions"
masks(chrU) <- append(masks(chrU), mask2)
chrU
as(chrU, "XStringViews")
as(gaps(chrU), "XStringViews")
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## EXAMPLE 4[#示例4]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## Note that unlike maskMotif(), mask() returns an XStringViews object![#注意,,不像maskMotif(),面具()返回一个XStringViews对象!]
## masking "by position"[#掩盖“按位置”]
mask("AxyxyxBC", 2, 6)
## masking "by content"[#掩蔽“内容”]
mask("AxyxyxBC", "xyx")
noN_chrU <- mask(chrU, "N")
noN_chrU
alphabetFrequency(noN_chrU, collapse=TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|