GRangesList-class(GenomicRanges)
GRangesList-class()所属R语言包:GenomicRanges
GRangesList objects
GRangesList对象
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The GRangesList class is a container for storing a collection of GRanges objects. It is derived from GenomicRangesList.
GRangesList类是一个容器,用于存储一个农庄对象集合。这是来自GenomicRangesList。
构造----------Constructors----------
GRangesList(...): Creates a GRangesList object using GRanges objects supplied in ....
GRangesList(...):创建GRangesList的对象使用...提供的农庄对象。
makeGRangesListFromFeatureFragments(seqnames=Rle(factor()), fragmentStarts=list(), fragmentEnds=list(), fragmentWidths=list(), strand=character(0), sep=","): Constructs a GRangesList object from a list of fragmented features. See the Examples section below.
makeGRangesListFromFeatureFragments(seqnames=Rle(factor()), fragmentStarts=list(), fragmentEnds=list(), fragmentWidths=list(), strand=character(0), sep=","):构造一个GRangesList一个支离破碎功能列表对象。见下面的示例部分。
强迫----------Coercion----------
In the code snippets below, x is a GRangesList object.
在下面的代码片段,x是GRangesList的对象。
as.data.frame(x, row.names = NULL, optional = FALSE): Creates a data.frame with columns element (character), seqnames (factor), start (integer), end (integer), width (integer), strand (factor), as well as the additional columns stored in elementMetadata(unlist(x)).
as.data.frame(x, row.names = NULL, optional = FALSE):创建列数据框element(字符),seqnames(因素),start(整数),end(整数), width(整数),strand(因素),以及其他列存储在elementMetadata(unlist(x))。
as.list(x, use.names = TRUE): Creates a list containing the elements of x.
as.list(x, use.names = TRUE):包含x元素创建一个列表。
as(x, "IRangesList"): Turns x into an IRangesList object.
as(x, "IRangesList"):打开x到IRangesList对象。
as(from, "GRangesList"): Creates a GRangesList object from a RangedDataList object.
as(from, "GRangesList"):创建从RangedDataList对象GRangesList的对象。
存取----------Accessors----------
In the following code snippets, x is a GRanges object.
在下面的代码片段,x是一个农庄的对象。
seqnames(x), seqnames(x) <- value: Gets or sets the sequence names in the form of an RleList. value can be an RleList or CharacterList.
seqnames(x),seqnames(x) <- value:获取或设置在形式的RleList的序列名称。 value可以成为RleList,或CharacterList。
ranges(x), ranges(x) <- value: Gets or sets the ranges in the form of a CompressedIRangesList. value can be a RangesList object.
ranges(x),ranges(x) <- value:获取或设置在形式的CompressedIRangesList的范围。 value,可以成为RangesList的对象。
strand(x), strand(x) <- value: Gets or sets the strand in the form of an RleList. value can be an RleList or CharacterList object.
strand(x),strand(x) <- value:获取或设置在一个RleList形式钢绞线。 value可以一个RleList或CharacterList对象的。
elementMetadata(x), elementMetadata(x) <- value: Gets or sets the optional data columns for the GRangesList elements. value can be a DataFrame, data.frame object, or NULL.
elementMetadata(x),elementMetadata(x) <- value:获取或设置可选的数据列为GRangesList元素。 value可以成为DataFrame的数据框对象,或NULL。
values(x), values(x) <- value: Alternative to elementMetadata functions.
values(x), values(x) <- value:替代elementMetadata功能。
seqinfo(x), seqinfo(x) <- value: Gets or sets the information about the underlying sequences. value must be a Seqinfo object.
seqinfo(x),seqinfo(x) <- value:获取或设置有关的基本序列的信息。 value,必须成为Seqinfo的对象。
seqlevels(x), seqlevels(x, force=FALSE) <- value: Gets or sets the sequence levels. seqlevels(x) is equivalent to seqlevels(seqinfo(x)) or to levels(seqnames(x)), those 2 expressions being guaranteed to return identical character vectors on a GRangesList object. value must be a character vector with no NAs. See ?seqlevels for more information.
seqlevels(x),seqlevels(x, force=FALSE) <- value:获取或设置序列水平。 seqlevels(x)seqlevels(seqinfo(x))levels(seqnames(x)),相当于,这些表达式保证返回上GRangesList对象的相同的特征向量。 value必须是没有NAS的特征向量。看到?seqlevels更多信息。
seqlengths(x), seqlengths(x) <- value: Gets or sets the sequence lengths. seqlengths(x) is equivalent to seqlengths(seqinfo(x)). value can be a named non-negative integer or numeric vector eventually with NAs.
seqlengths(x),seqlengths(x) <- value:获取或设置序列的长度。 seqlengths(x)相当于seqlengths(seqinfo(x))的。 value可以是命名的非负整数或最终与NAS的数字向量。
isCircular(x), isCircular(x) <- value: Gets or sets the circularity flags. isCircular(x) is equivalent to isCircular(seqinfo(x)). value must be a named logical vector eventually with NAs.
isCircular(x),isCircular(x) <- value:获取或设置的圆形标志。 isCircular(x)相当于isCircular(seqinfo(x))的。 value必须是一个命名的逻辑向量最终与NAS。
genome(x), genome(x) <- value: Gets or sets the genome identifier or assembly name for each sequence. genome(x) is equivalent to genome(seqinfo(x)). value must be a named character vector eventually with NAs.
genome(x),genome(x) <- value:获取或设置每个序列的基因组标识符或程序集名称。 genome(x)相当于genome(seqinfo(x))的。 value必须是一个命名的特征向量最终与NAS。
列表方法----------List methods----------
In the following code snippets, x is a GRangesList object.
在下面的代码片段,x是GRangesList的对象。
length(x): Gets the number of elements.
length(x):获取元素的数量。
names(x), names(x) <- value: Gets or sets the names of the elements.
names(x),names(x) <- value:获取或设置元素的名称。
elementLengths(x): Gets the length of each of the elements.
elementLengths(x):获取length中的每个元素。
isEmpty(x): Returns a logical indicating either if the GRangesList has no elements or if all its elements are empty.
isEmpty(x):返回一个逻辑表示,如果GRangesList有没有元素或它的所有元素,如果是空的。
RangesList方法----------RangesList methods----------
In the following code snippets, x is a GRangesList object.
在下面的代码片段,x是GRangesList的对象。
start(x), start(x) <- value: Gets or sets start(ranges(x)).
start(x),start(x) <- value:获取或设置start(ranges(x))。
end(x), end(x) <- value: Gets or sets end(ranges(x)).
end(x),end(x) <- value:获取或设置end(ranges(x))。
width(x), width(x) <- value: Gets or sets width(ranges(x)).
width(x),width(x) <- value:获取或设置width(ranges(x))。
shift(x, shift, use.names=TRUE): Returns a new GRangesList object containing intervals with start and end values that have been shifted by integer vector shift. The use.names argument determines whether or not to keep the names on the ranges.
shift(x, shift, use.names=TRUE):返回一个新的GRangesList对象包含整数向量shift已转移的开始和结束值的时间间隔。 use.names参数决定是否保留范围的名称。
isDisjoint(x) Return a vector of logical values indicating whether the ranges of each element of x are disjoint (i.e. non-overlapping).
isDisjoint(x)返回一个表示逻辑值的向量是否x是不相交的(即非重叠)的每个元素的范围。
结合----------Combining----------
In the code snippets below, x is a GRangesList object.
在下面的代码片段,x是GRangesList的对象。
append(x, values, after = length(x)): Inserts the values into x at the position given by after, where x and values are of the same class.
append(x, values, after = length(x)):插入valuesx位置after,其中x和values是同一类的。
c(x, ...): Combines x and the GRangesList objects in ... together. Any object in ... must belong to the same class as x, or to one of its subclasses, or must be NULL. The result is an object of the same class as x.
c(x, ...):结合x...一起GRangesList的对象。任何对象...“必须属于同一类的x,或者其子类之一,或必须是NULL。其结果是为x同一类的对象。
unlist(x, recursive = TRUE, use.names = TRUE): Concatenates the elements of x into a single GRanges object.
unlist(x, recursive = TRUE, use.names = TRUE):串连的元素x成一个单一的农庄对象。
子集----------Subsetting----------
In the following code snippets, x is a GRangesList object.
在下面的代码片段,x是GRangesList的对象。
x[i, j], x[i, j] <- value: Gets or sets elements i with optional values columns values(x)[,j], where i can be missing; an NA-free logical, numeric, or character vector; a 'logical' Rle object, or an AtomicList object.
x[i, j],x[i, j] <- value:获取或设置元素i可选值列values(x)[,j],其中i可以丢失; NA无逻辑,数字,或特征向量;一个“逻辑”的RLE对象,或AtomicList对象。
x[[i]], x[[i]] <- value: Gets or sets element i, where i is a numeric or character vector of length 1.
x[[i]],x[[i]] <- value:获取或设置元素i,其中i是一个长度为1的数字或字符的向量。
x$name, x$name <- value: Gets or sets element name, where name is a name or character vector of length 1.
x$name,x$name <- value:获取或设置元素name,其中name是一个名称或特征向量的长度为1。
head(x, n = 6L): If n is non-negative, returns the first n elements of the GRangesList object. If n is negative, returns all but the last abs(n) elements of the GRangesList object.
如果head(x, n = 6L):n非负,返回第n个元素的GRangesList对象。如果n是负数,返回所有,但最后abs(n)的GRangesList对象的元素。
rep(x, times, length.out, each): Repeats the values in x through one of the following conventions:
rep(x, times, length.out, each):重复值x通过以下约定:
times Vector giving the number of times to repeat each element if of length length(x), or to repeat the whole vector
times向量的次数重复每个元素如果长length(x),或重复整个向量
length.out Non-negative integer. The desired length of
length.out非负整数。所需的长度
each Non-negative integer. Each element of x is
each非负整数。每个x元素
seqselect(x, start=NULL, end=NULL, width=NULL): Similar to window, except that multiple consecutive subsequences can be requested for concatenation. As such two of the three start, end, and width arguments can be used to specify the consecutive subsequences. Alternatively, start can take a Ranges object or something that can be converted to a Ranges object like an integer vector, logical vector or logical Rle. If the concatenation of the consecutive subsequences is undesirable, consider using Views.
seqselect(x, start=NULL, end=NULL, width=NULL):window,除了多个连续子序列的相似,可串联的要求。作为这样两个三个start,end,width参数可以用来指定连续子序列。另外,start可以采取范围对象或东西可以转化为像一个整数向量,向量逻辑或逻辑RLE的范围对象。如果连续子序列的串联是不可取的,可以考虑使用Views。
seqselect(x, start=NULL, end=NULL, width=NULL) <- value: Similar to window<-, except that multiple consecutive subsequences can be replaced by a value whose length is a divisor of the number of elements it is replacing. As such two of the three start, end, and width arguments can be used to specify the consecutive subsequences. Alternatively, start can take a Ranges object or something that can be converted to a Ranges object like an integer vector, logical vector or logical Rle.
seqselect(x, start=NULL, end=NULL, width=NULL) <- value:类似window<-,value,其长度是它被替换的元素的数量除数除多个连续子序列可以取代。作为这样两个三个start,end,width参数可以用来指定连续子序列。另外,start可以采取范围对象或东西可以转化为像一个整数向量,向量逻辑或逻辑RLE的范围对象。
subset(x, subset): Returns a new object of the same class as x made of the subset using logical vector subset, where missing values are taken as FALSE.
subset(x, subset):返回一个新的同一类对象x使用逻辑向量的子集subset,遗漏值FALSE。
tail(x, n = 6L): If n is non-negative, returns the last n elements of the GRanges object. If n is negative, returns all but the first abs(n) elements of the GRanges object.
tail(x, n = 6L):n如果非负,返回的农庄对象的最后一个n个元素。 n如果是负,返回所有,但第一个abs(n)农庄对象的元素。
window(x, start = NA, end = NA, width = NA, frequency = NULL, delta = NULL, ...): Extracts the subsequence window from the GRanges object using:
window(x, start = NA, end = NA, width = NA, frequency = NULL, delta = NULL, ...):提取从格朗使用对象的序列窗口:
start, end, width The start, end, or width
start,end,width开始,结束或宽度
frequency, delta Optional arguments that specify
frequency,delta可选参数指定
In general, this is more efficient than using "[" operator.
在一般情况下,这是多使用"["运营商的有效。
window(x, start = NA, end = NA, width = NA, keepLength = TRUE) <- value: Replaces the subsequence window specified on the left (i.e. the subsequence in x specified by start, end and width) by value. value must either be of class class(x), belong to a subclass of class(x), be coercible to class(x), or be NULL. If keepLength is TRUE, the elements of value are repeated to create a GRanges object with the same number of elements as the width of the subsequence window it is replacing. If keepLength is FALSE, this replacement method can modify the length of x, depending on how the length of the left subsequence window compares to the length of value.
window(x, start = NA, end = NA, width = NA, keepLength = TRUE) <- value:替换指定序列窗口左侧(即序列在xstart中指定,end和width)value的 。 value必须是类的class(x),属于一个子类的class(x),class(x),是强制转换或NULL。如果keepLength是TRUE元素value重复与相同数量的元素被更换的序列窗口的宽度,以创建一个农庄对象。如果keepLength是FALSE,此替代方法可以修改的长度x,取决于左序列窗口的长度如何比较长的value。
循环----------Looping----------
In the code snippets below, x is a GRangesList object.
在下面的代码片段,x是GRangesList的对象。
endoapply(X, FUN, ...): Similar to lapply, but performs an endomorphism, i.e. returns an object of class(X).
endoapply(X, FUN, ...):lapply类似,但执行一个自同态,即返回对象class(X)。
lapply(X, FUN, ...): Like the standard lapply function defined in the base package, the lapply method for GRangesList objects returns a list of the same length as X, with each element being the result of applying FUN to the corresponding element of X.
lapply(X, FUN, ...):一样的标准lapply函数定义在基础包,lapply为GRangesList对象方法返回每个元素的列表相同长度为X,是结果申请FUNX相应的元素。
Map(f, ...): Applies a function to the corresponding elements of given GRangesList objects.
Map(f, ...):应用相应的元素给予GRangesList对象的功能。
mapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE): Like the standard mapply function defined in the base package, the mapply method for GRangesList objects is a multivariate version of sapply.
mapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE):像标准的mapply函数的基础包中定义的mapply为GRangesList对象的方法是多元版本的sapply。
mendoapply(FUN, ..., MoreArgs = NULL): Similar to mapply, but performs an endomorphism across multiple objects, i.e. returns an object of class(list(...)[[1]]).
mendoapply(FUN, ..., MoreArgs = NULL):mapply类似,但执行多个对象的自同态,即返回对象class(list(...)[[1]])。
Reduce(f, x, init, right = FALSE, accumulate = FALSE): Uses a binary function to successively combine the elements of x and a possibly given initial value.
Reduce(f, x, init, right = FALSE, accumulate = FALSE):使用二进制功能先后x和可能给定的初始值的元素结合起来,。
f A binary argument function.
F A二进制参数的函数。
init An R object of the same kind as the elements of x.
init的同类作为x元素的R对象。
right A logical indicating whether to proceed from left to right
正确的逻辑表示是否继续从左至右右
nomatch The value to be returned in the case when "no match" (no
nomatch的情况下返回值,当“不匹配”(无
sapply(X, FUN, ..., simplify=TRUE, USE.NAMES=TRUE): Like the standard sapply function defined in the base package, the sapply method for GRangesList objects is a user-friendly version of lapply by default returning a vector or matrix if appropriate.
sapply(X, FUN, ..., simplify=TRUE, USE.NAMES=TRUE):像标准的sapply函数定义在基础包的sapply为GRangesList对象的方法是一个用户友好的lapply版本默认情况下返回一个向量或矩阵如果合适。
“范围”,“减少”和“限制”的方法----------The "range", "reduce" and "restrict" methods----------
In the code snippets below, x is a GRangesList object. The methods in this section are isomorphisms, that is, they are endomorphisms (i.e. they preserve the class of x) who also preserve the length & names & elementMetadata of x. In addition, the seqinfo is preserved too.
在下面的代码片段,x是GRangesList的对象。本节中的方法是同构,也就是说,它们是自同态(即它们保存类的x)谁也保持长度x的名称及elementMetadata。此外,seqinfo被保留。
range(x): Applies range to each element in x. More precisely, it is equivalent to endoapply(x, range).
range(x):适用于range在x每个元素。更确切地说,它是相当于endoapply(x, range)。
reduce(x, drop.empty.ranges=FALSE, min.gapwidth=1L): Applies reduce to each element in x. More precisely, it is equivalent to endoapply(x, reduce, drop.empty.ranges=drop.empty.ranges, min.gapwidth=min.gapwidth).
reduce(x, drop.empty.ranges=FALSE, min.gapwidth=1L):适用于reduce在x每个元素。更确切地说,它是相当于endoapply(x, reduce, drop.empty.ranges=drop.empty.ranges, min.gapwidth=min.gapwidth)。
restrict(x, start = NA, end = NA, keep.all.ranges = FALSE, use.names = TRUE): Applies restrict to each element in x.
restrict(x, start = NA, end = NA, keep.all.ranges = FALSE, use.names = TRUE):适用于restrict在x每个元素。
flank(x, width, start = TRUE, end = NA, keep.all.ranges = FALSE, use.names = TRUE, ignore.strand = FALSE): Applies flank to each element in x.
flank(x, width, start = TRUE, end = NA, keep.all.ranges = FALSE, use.names = TRUE, ignore.strand = FALSE):适用于flank在x每个元素。
作者(S)----------Author(s)----------
P. Aboyoun & H. Pages
参见----------See Also----------
GRanges-class, seqinfo, Vector-class, RangesList-class, RleList-class, DataFrameList-class, coverage-methods, setops-methods, findOverlaps-methods
农庄的类,seqinfo,媒介类,RangesList级,RleList级,DataFrameList级,覆盖方法,setops方法,findOverlaps方法
举例----------Examples----------
## Construction with GRangesList():[#建设与GRangesList():]
gr1 <-
GRanges(seqnames = "chr2", ranges = IRanges(3, 6),
strand = "+", score = 5L, GC = 0.45)
gr2 <-
GRanges(seqnames = c("chr1", "chr1"),
ranges = IRanges(c(7,13), width = 3),
strand = c("+", "-"), score = 3:4, GC = c(0.3, 0.5))
gr3 <-
GRanges(seqnames = c("chr1", "chr2"),
ranges = IRanges(c(1, 4), c(3, 9)),
strand = c("-", "-"), score = c(6L, 2L), GC = c(0.4, 0.1))
grl <- GRangesList("gr1" = gr1, "gr2" = gr2, "gr3" = gr3)
grl
## Summarizing elements:[#总结元素:]
elementLengths(grl)
table(seqnames(grl))
## Extracting subsets:[#提取的子集:]
grl[seqnames(grl) == "chr1", ]
grl[seqnames(grl) == "chr1" & strand(grl) == "+", ]
## Renaming the underlying sequences:[#重命名的基本序列:]
seqlevels(grl)
seqlevels(grl) <- sub("chr", "Chrom", seqlevels(grl))
grl
## range() and reduce():[#范围()和减少():]
range(grl)
reduce(grl) # Doesn't really reduce anything but note the reordering[并没有真正减少任何东西,但要注意的重新排序]
# of the inner elements in the 3rd top-level element: the[对在第三顶层元素的内在因素:]
# ranges are reordered by sequence name first (the order of[范围重新排序第一序列的名称(订单]
# the sequence names is dictated by the sequence levels),[序列名称序列水平决定),]
# and then by strand.[然后通过链。]
restrict(grl, start=3)
### flank[##侧翼]
flank(grl, width =20)
## Coerce to IRangesList (seqnames and strand information is lost):[#强迫IRangesList(seqnames链信息丢失):]
as(grl, "IRangesList")
## isDisjoint():[,#isDisjoint():]
isDisjoint(grl)
## Construction with makeGRangesListFromFeatureFragments():[#建设与makeGRangesListFromFeatureFragments():]
filepath <- system.file("extdata", "feature_frags.txt",
package="GenomicRanges")
featfrags <- read.table(filepath, header=TRUE, stringsAsFactors=FALSE)
grl2 <- with(featfrags,
makeGRangesListFromFeatureFragments(seqnames=targetName,
fragmentStarts=targetStart,
fragmentWidths=blockSizes,
strand=strand))
names(grl2) <- featfrags$RefSeqID
grl2
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|