setops-methods(GenomicRanges)
setops-methods()所属R语言包:GenomicRanges
Set operations on GRanges/GRangesList/GappedAlignments objects
设置对农庄/ GRangesList的/ GappedAlignments对象的操作
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Performs set operations on GRanges/GRangesList/GappedAlignments objects.
执行,上农庄/ GRangesList的/ GappedAlignments对象设置操作。
用法----------Usage----------
## Set operations
## S4 method for signature 'GRanges,GRanges'
union(x, y, ignore.strand=FALSE, ...)
## S4 method for signature 'GRanges,GRanges'
intersect(x, y, ignore.strand=FALSE, ...)
## S4 method for signature 'GRanges,GRanges'
setdiff(x, y, ignore.strand=FALSE, ...)
## Parallel set operations
## S4 method for signature 'GRanges,GRanges'
punion(x, y, fill.gap=FALSE, ignore.strand=FALSE, ...)
## S4 method for signature 'GRanges,GRanges'
pintersect(x, y, resolve.empty=c("none", "max.start", "start.x"), ignore.strand=FALSE, ...)
## S4 method for signature 'GappedAlignments,GRanges'
pintersect(x, y, ...)
## S4 method for signature 'GRanges,GRanges'
psetdiff(x, y, ignore.strand=FALSE, ...)
参数----------Arguments----------
参数:x, y
For union, intersect, setdiff, pgap: x and y must both be GRanges objects. For punion: one of x or y must be a GRanges object, the other one can be a GRanges or GRangesList object. For pintersect: one of x or y must be a GRanges object, the other one can be a GRanges, GRangesList or GappedAlignments object. For psetdiff: x and y can be any combination of GRanges and/or GRangesList objects, with the exception that if x is a GRangesList object then y must be a GRangesList too. In addition, for the "parallel" operations, x and y must be of equal length (i.e. length(x) == length(y)).
union,intersect,setdiff,pgap:x和y都必须是农庄的对象。 punion:x或y之一必须是一个农庄对象,其他人可以是一个农庄和GRangesList对象。 pintersect:x或y之一必须是一个农庄对象,其他人可以是一个农庄,GRangesList或GappedAlignments的对象。对于psetdiff:x和y农庄和/或GRangesList的对象可以是任何异常,如果x是GRangesList的对象,那么y结合,必须是一个GRangesList。此外,“水货”的操作,x和y必须是长度相等(即length(x) == length(y))。
参数:fill.gap
Logical indicating whether or not to force a union by using the rule start = min(start(x), start(y)), end = max(end(x), end(y)).
逻辑表示是否强制使用规则start = min(start(x), start(y)), end = max(end(x), end(y))工会。
参数:resolve.empty
One of "none", "max.start", or "start.x" denoting how to handle ambiguous empty ranges formed by intersections. "none" - throw an error if an ambiguous empty range is formed, "max.start" - associate the maximum start value with any ambiguous empty range, and "start.x" - associate the start value of x with any ambiguous empty range. (See pintersect for the definition of an ambiguous range.)
一"none","max.start"或"start.x"表示如何处理模棱两可的路口形成的空范围。 "none" - 抛出一个错误,如果形成一个模糊的范围为空"max.start" - 关联的任何含糊不清的空范围最大的起始值,"start.x" - x关联起始值任何含糊不清的空范围。 (参见pintersect的暧昧范围的定义。)
参数:ignore.strand
For set operations: If set to TRUE, then the strand of x and y is set to "*" prior to any computation. For parallel set operations: If set to TRUE, the strand information is ignored in the computation and the result has the strand information of x.
集合运算:如果设置为TRUE,那么x和y设置为"*"之前任何计算链。对于并行的一套操作:如果设置为TRUE,钢绞线的信息将被忽略在计算结果x链信息。
参数:...
Further arguments to be passed to or from other methods.
进一步的参数被传递或其他方法。
Details
详情----------Details----------
The pintersect methods involving GRanges, GRangesList and/or GappedAlignments objects use the triplet (sequence name, range, strand) to determine the element by element intersection of features, where a strand value of "*" is treated as occurring on both the "+" and "-" strand.
pintersect方法涉及农庄,GRangesList和/或GappedAlignments的对象使用链的价值的"*"被视为元素交汇的特点,来确定该元素的三重(序列的名称,范围,钢绞线) "+"和"-"链发生。
The psetdiff methods involving GRanges and/or GRangesList objects use the triplet (sequence name, range, strand) to determine the element by element set difference of features, where a strand value of "*" is treated as occurring on both the "+" and "-" strand.
psetdiff方法涉及格朗和/或GRangesList的的对象,使用三重(序列的名称,范围,钢绞线)确定元素的元素的功能差集,在股值"*"如发生治疗"+"和"-"链。
值----------Value----------
For union, intersect, setdiff, and pgap: a GRanges.
union,intersect,setdiff,pgap:一个农庄。
For punion and pintersect: when x or y is not a GRanges object, an object of the same class as this non-GRanges object. Otherwise, a GRanges object.
对于punion和pintersect:x或y是不是一个农庄的对象,因为这非农庄对象的相同类的对象。否则,农庄对象。
For psetdiff: either a GRanges object when both x and y are GRanges objects, or a GRangesList object when y is a GRangesList object.
对于psetdiff:要么是农庄的对象,当两个x和y是格朗物体或GRangesList的对象,当y是GRangesList的对象。
作者(S)----------Author(s)----------
P. Aboyoun
参见----------See Also----------
IRanges-setops, GRanges-class, GRangesList-class, GappedAlignments-class, findOverlaps-methods
IRanges-setops,一流的农庄,级GRangesList,GappedAlignments级,findOverlaps方法
举例----------Examples----------
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## A. SET OPERATIONS[答:#设置业务]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
x <- GRanges("chr1", IRanges(c(2, 9) , c(7, 19)), strand=c("+", "-"))
y <- GRanges("chr1", IRanges(5, 10), strand="-")
union(x, y)
union(x, y, ignore.strand=TRUE)
intersect(x, y)
intersect(x, y, ignore.strand=TRUE)
setdiff(x, y)
setdiff(x, y, ignore.strand=TRUE)
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## B. PARALLEL SET OPERATIONS[#二平行SET操作]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## Not run: [#无法运行:]
punion(x, shift(x, 7)) # will fail[将失败]
## End(Not run)[#结束(不运行)]
punion(x, shift(x, 7), fill.gap=TRUE)
pintersect(x, shift(x, 6))
## Not run: [#无法运行:]
pintersect(x, shift(x, 7)) # will fail[将失败]
## End(Not run)[#结束(不运行)]
pintersect(x, shift(x, 7), resolve.empty="max.start")
psetdiff(x, shift(x, 7))
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## C. MORE EXAMPLES[#C。更多的例子]
## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
## GRanges object:[#农庄对象:]
gr <- GRanges(seqnames=c("chr2", "chr1", "chr1"),
ranges=IRanges(1:3, width = 12),
strand=Rle(strand(c("-", "*", "-"))))
## GRangesList object[#GRangesList对象]
gr1 <- GRanges(seqnames="chr2",
ranges=IRanges(3, 6))
gr2 <- GRanges(seqnames=c("chr1", "chr1"),
ranges=IRanges(c(7,13), width = 3),
strand=c("+", "-"))
gr3 <- GRanges(seqnames=c("chr1", "chr2"),
ranges=IRanges(c(1, 4), c(3, 9)),
strand=c("-", "-"))
grlist <- GRangesList(gr1=gr1, gr2=gr2, gr3=gr3)
## Parallel intersection of a GRanges and a GRangesList object[#并行路口1农庄和GRangesList对象]
pintersect(gr, grlist)
pintersect(grlist, gr)
## Parallel intersection of a GappedAlignments and a GRanges object[#并行路口1 GappedAlignments和农庄对象的]
library(Rsamtools) # because file ex1.bam is in this package[因为文件ex1.bam是在这个包]
galn_file <- system.file("extdata", "ex1.bam", package="Rsamtools")
galn <- readGappedAlignments(galn_file)
pintersect(galn, shift(as(galn, "GRanges"), 6L))
## Parallel set difference of a GRanges and a GRangesList object[#并行的差集的农庄和1 GRangesList对象]
psetdiff(gr, grlist)
## Parallel set difference of two GRangesList objects[#并行差集两个GRangesList对象的]
psetdiff(grlist, shift(grlist, 3))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|