找回密码
 注册
查看: 704|回复: 0

R语言 GenomicRanges包 GRanges-class()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-25 19:29:20 | 显示全部楼层 |阅读模式
GRanges-class(GenomicRanges)
GRanges-class()所属R语言包:GenomicRanges

                                        GRanges objects
                                         格朗对象

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

The GRanges class is a container for the genomic locations and their associated annotations.
农庄类基因的位置和其相关的注释是一个容器。


Details

详情----------Details----------

The GRanges class stores the sequences of genomic locations and associated annotations. Each element in the sequence is comprised of a sequence name, an interval, a strand, and optional element metadata (e.g. score, GC content, etc.). This information is stored in four slots:
农庄类存储序列基因组的位置和相关注释。序列中的每个元素组成的序列名,一个时间间隔,链,和可选元素的元数据(例如得分,GC含量等)。此信息存储在四个插槽:




seqnames a 'factor' Rle object
seqnamesA因素RLE对象




ranges an IRanges object containing
rangesIRanges对象,其中包含




strand a 'factor' Rle object containing
strandA因素RLE对象,其中包含




elementMetadata a DataFrame object containing the annotation columns. Columns cannot be named "seqnames", "ranges", "strand", "seqlevels", "seqlengths", "isCircular", "genome", "start", "end", "width",
elementMetadataDataFrame对象包含注释列。列不能被名为"seqnames","ranges","strand","seqlevels","seqlengths","isCircular","genome","start"的,"end","width"


构造----------Constructor----------

GRanges(seqnames = Rle(), ranges = IRanges(),     strand = Rle("*", length(seqnames)),     ...,     seqlengths =     structure(rep(NA_integer_, length(levels(seqnames))),       names = levels(seqnames))): Creates a GRanges object.
GRanges(seqnames = Rle(), ranges = IRanges(),     strand = Rle("*", length(seqnames)),     ...,     seqlengths =     structure(rep(NA_integer_, length(levels(seqnames))),       names = levels(seqnames))):创建一个农庄的对象。




seqnames Rle object, character vector, or factor
seqnames RLE对象,特征向量,或因素




ranges IRanges object containing the ranges.
rangesIRanges对象,它包含的范围。




strand Rle object, character vector, or factor
strand RLE对象,特征向量,或因素




seqlengths a named integer vector containing the
seqlengths包含一个名为整数向量




... Optional annotation columns for the elementMetadata slot. These columns cannot be named
...elementMetadata插槽的可选注释列。这些列不能被命名为


强迫----------Coercion----------

In the code snippets below, x is a GRanges object.
在下面的代码片段,x是一个农庄的对象。

as(from, "GRanges"): Creates a GRanges object from a RangedData, RangesList or RleList object.
as(from, "GRanges"):从RangedData,RangesList或RleList对象创建一个农庄对象。

as(from, "RangedData"): Creates a RangedData object from a GRanges object. The strand and the values become columns in the result. The seqlengths(from), isCircular(from), and genome(from) vectors are stored in the element metadata of ranges(rd).
as(from, "RangedData"):创建一个从农庄对象RangedData对象。 strand和价值观成为结果中的列。 seqlengths(from),isCircular(from),在genome(from)元素的元数据存储ranges(rd)向量。

as(from, "RangesList"): Creates a RangesList object from a GRanges object. The strand and values become element metadata on the ranges. The seqlengths(from), isCircular(from), and genome(from) vectors are stored in the element metadata.
as(from, "RangesList"):创建一个从农庄对象RangesList对象。 strand和价值观,成为元素范围的元数据。 seqlengths(from),isCircular(from),genome(from)向量元素的元数据存储。

as.data.frame(x, row.names = NULL, optional = FALSE): Creates a data.frame with columns seqnames (factor), start (integer), end (integer), width (integer), strand (factor), as well as the additional columns stored in elementMetadata(x).
as.data.frame(x, row.names = NULL, optional = FALSE):创建列数据框seqnames(因子),start(整数),end(整数),width(整数), strand(因素),以及额外的列存储在elementMetadata(x)。


存取----------Accessors----------

In the following code snippets, x is a GRanges object.
在下面的代码片段,x是一个农庄的对象。

length(x): Gets the number of elements.
length(x):获取元素的数量。

seqnames(x), seqnames(x) <- value: Gets or sets the sequence names. value can be an Rle object, a character vector, or a factor.
seqnames(x),seqnames(x) <- value:获取或设置序列的名称。 value是一个RLE对象,一个字符向量,或一个因素。

ranges(x), ranges(x) <- value: Gets or sets the ranges. value can be a Ranges object.
ranges(x),ranges(x) <- value:获取或设置范围。 value可以是一个范围对象。

names(x), names(x) <- value: Gets or sets the names of the elements.
names(x),names(x) <- value:获取或设置元素的名称。

strand(x), strand(x) <- value: Gets or sets the strand. value can be an Rle object, character vector, or factor.
strand(x),strand(x) <- value:获取或设置链。 value可以一个RLE对象,特征向量或因素。

elementMetadata(x), elementMetadata(x) <- value: Gets or sets the optional data columns. value can be a DataFrame, data.frame object, or NULL.
elementMetadata(x),elementMetadata(x) <- value:获取或设置可选的数据列。 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 GRanges 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)),相当于保证返回一个农庄对象相同的特征向量,这些表达式。 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。


范围的方法----------Ranges methods----------

In the following code snippets, x is a GRanges object.
在下面的代码片段,x是一个农庄的对象。

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))。

flank(x, width, start = TRUE, both = FALSE, use.names = TRUE,   ignore.strand=FALSE): Returns a new GRanges object containing intervals of width width that flank the intervals in x. The start argument takes a logical indicating whether x should be flanked at the "start" (TRUE) or the "end" (FALSE), which for strand(x) != "-" is start(x) and end(x) respectively and for strand(x) == "-" is  codeend(x) and start(x) respectively. The both argument takes a single logical value indicating whether the flanking region width positions extends into the range. If both = TRUE, the resulting range thus straddles the end point, with width positions on either side.
flank(x, width, start = TRUE, both = FALSE, use.names = TRUE,   ignore.strand=FALSE):返回一个新的农庄反对包含间隔的宽度width侧翼x间隔。 start参数需要一个逻辑是否x应两侧的“开始”(TRUE)或“结束”(FALSE), strand(x) != "-"是start(x)和end(x)分别为strand(x) == "-"codeend(x)和start(x)分别。 both参数需要一个单一的逻辑值,该值指示是否width阵地侧翼区范围延伸。如果both = TRUE,因此产生的范围跨越了终点,width两边的位置。

resize(x, width, use.names = TRUE): Returns a new GRanges object containing intervals that have been resized to width width based on the strand(x) values.  Elements where strand(x) == "+" or strand(x) == "*" are anchored at start(x) and elements where strand(x) == "-" are anchored at the end(x). The use.names argument determines whether or not to keep the names on the ranges.
resize(x, width, use.names = TRUE):返回一个新的农庄对象,其中包含已调整到宽间隔width基于strand(x)值。元素strand(x) == "+"或strand(x) == "*"start(x)和strand(x) == "-"end(x)锚元素锚定。 use.names参数决定是否保留范围的名称。

shift(x, shift, use.names = TRUE): Returns a new GRanges 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):返回一个新的农庄对象,其中包含整数向量shift已转移的开始和结束值的时间间隔。 use.names参数决定是否保留范围的名称。

disjoin(x): Returns a new GRanges object containing disjoint ranges for each distinct (seqname, strand) pairing. The names (names(x)) and the columns in x are dropped.
disjoin(x):返回一个新的农庄对象,其中包含不相交的范围内,为每个不同的(seqname,钢绞线)配对。 (names(x))的名称和列x被丢弃。

isDisjoint(x): Return a logical value indicating whether the ranges x are disjoint (i.e. non-overlapping).
isDisjoint(x):返回一个逻辑值范围是否x是不相交的(即非重叠)。

gaps(x, start = 1L, end = seqlengths(x)): Returns a new GRanges object containing complemented ranges for each distinct (seqname, strand) pairing. The names (names(x)) and the columns in x are dropped.  For the start and end arguments of this gaps method, it is expected that the user will supply a named integer vector (where the names correspond to the appropriate seqlevels). See ?gaps for more information about range complements and for a description of the optional arguments.
gaps(x, start = 1L, end = seqlengths(x)):返回一个新的农庄对象,其中包含为每个不同的(seqname,钢绞线)配对补充的范围。 (names(x))的名称和列x被丢弃。对于这种差距的方法的开始和结束的参数,它预计用户将提供一个名为整数向量(名称对应到相应的seqlevels)。看到?gaps有关范围的更多信息补充和可选参数的描述。

range(x, ...): Returns a new GRanges object containing range bounds for each distinct (seqname, strand) pairing. The names (names(x)) and the columns in x are dropped.
range(x, ...):返回一个新的农庄对象,其中包含为每个不同的(seqname,钢绞线)配对的范围界限。 (names(x))的名称和列x被丢弃。

reduce(x, drop.empty.ranges = FALSE, min.gapwidth = 1L): Returns a new GRanges object containing reduced ranges for each distinct (seqname, strand) pairing. The names (names(x)) and the columns in x are dropped. See ?reduce for more information about range reduction and for a description of the optional arguments.
reduce(x, drop.empty.ranges = FALSE, min.gapwidth = 1L):返回一个新的农庄对象,其中包含减少幅度为每个不同的(seqname,钢绞线)配对。 (names(x))的名称和列x被丢弃。看到?reduce减少约范围的详细信息和可选参数的说明。

restrict(x,  start = NA, end = NA, keep.all.ranges = FALSE, use.names = TRUE): Returns a new GRanges object containing restricted ranges for distinct seqnames. The start and end arguments can be a named numeric vector of seqnames for the ranges to be resticted or a numeric vector or length 1 if the restriction operation is to be applied to all the sequences in x. See ?restrict for more information about range restriction and for a description of the optional arguments.
restrict(x,  start = NA, end = NA, keep.all.ranges = FALSE, use.names = TRUE):返回一个新的农庄含有限制不同seqnames范围的对象。 start和end参数可以是一个名为只供范围,或者一个数值向量或长度为1的数字seqnames向量的限制,如果操作是被应用到所有序列<X >看到x范围限制的有关信息和可选参数的说明。

distance(x, y, ignore.strand = FALSE): Calculate the number of positions separating two features. The value is zero if the features overlap and NA if the features are on different sequences, or different strands (if ignore.strand is FALSE).
distance(x, y, ignore.strand = FALSE):计算两个功能分开的职位数量。该值是零,如果功能重叠和NA如果功能不同的序列,或不同股(ignore.strand如果是FALSE)。


分裂和结合----------Splitting and Combining----------

In the code snippets below, x is a GRanges object.
在下面的代码片段,x是一个农庄的对象。

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 GRanges 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和...一起在农庄的对象。任何对象...“必须属于同一类的x,或者其子类之一,或必须是NULL。其结果是为x同一类的对象。

c(x, ..., .ignoreElementMetadata=TRUE) If the GRanges objects have associated elementMetadata (also known as values), each such DataFrame must have the same columns in order to combine successfully. In order to circumvent this restraint, you can pass in an .ignoreElementMetadata=TRUE argument which will combine all the objects into one and drop all of their elementMetadata.
c(x, ..., .ignoreElementMetadata=TRUE)如果GRanges对象有关联的elementMetadata(也称为values),每个这样的DataFrame必须有相同的列,以便成功地结合起来。为了规避这种约束,你可以通过.ignoreElementMetadata=TRUE参数将合并成一个所有对象和删除所有的elementMetadata。

split(x, f = seq_len(length(x)), drop = FALSE): Splits x into a GRangesList, according to f, dropping elements corresponding to unrepresented levels if drop is TRUE. Split factor f defaults to splitting each element of x into a separate element in the resulting GRangesList object.
split(x, f = seq_len(length(x)), drop = FALSE):拆分x成GRangesList,根据f,删除相应的元素没有律师代表的水平drop如果是TRUE。分裂因子f默认分裂x成一个单独的元素产生GRangesList对象的每个元素。


子集----------Subsetting----------

In the code snippets below, x is a GRanges object.
在下面的代码片段,x是一个农庄的对象。

x[i, j], x[i, j] <- value: Gets or sets elements i with optional elementMetadata columns elementMetadata(x)[,j], where i can be missing; an NA-free logical, numeric, or character vector; or a 'logical' Rle object.
x[i, j],x[i, j] <- value:获取或设置元素i带有可选elementMetadata列elementMetadata(x)[,j],其中i可以失踪; NA无逻辑,数字,或特征向量;或“逻辑”RLE对象。

x[i,j] <- value: Replaces elements i and optional elementMetadata columns j with value.
x[i,j] <- value:替换元素i和可选elementMetadata列的jvalue。

head(x, n = 6L): If n is non-negative, returns the first n elements of the GRanges object. If n is negative, returns all but the last abs(n) elements of the GRanges object.
head(x, n = 6L):n如果非负,返回的农庄对象的前n个元素。 n如果是负,返回所有,但最后abs(n)农庄对象的元素。

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 with 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。


作者(S)----------Author(s)----------


P. Aboyoun



参见----------See Also----------

GRangesList-class, seqinfo, Vector-class, Ranges-class, Rle-class, DataFrame-class, coverage-methods, setops-methods, findOverlaps-methods
- 类GRangesList,seqinfo,媒介类,范围类,RLE级级DataFrame,覆盖方法,setops方法,findOverlaps方法


举例----------Examples----------


  gr <-
    GRanges(seqnames =
            Rle(c("chr1", "chr2", "chr1", "chr3"), c(1, 3, 2, 4)),
            ranges =
            IRanges(1:10, width = 10:1, names = head(letters,10)),
            strand =
            Rle(strand(c("-", "+", "*", "+", "-")),
                c(1, 2, 2, 3, 2)),
            score = 1:10,
            GC = seq(1, 0, length=10))
  gr

  # Summarizing elements[总结元素]
  table(seqnames(gr))
  sum(width(gr))
  summary(elementMetadata(gr)[,"score"]) # or values(gr)[或值(GR)]

  # Renaming the underlying sequences[重命名的基本序列]
  seqlevels(gr)
  seqlevels(gr) <- sub("chr", "Chrom", seqlevels(gr))
  gr

  # Intra-interval operations[区间内操作]
  flank(gr, 10)
  resize(gr, 10)
  shift(gr, 1)

  # Inter-interval operations[间区间操作]
  isDisjoint(gr)
  disjoin(gr)
  gaps(gr, start = 1, end = 10)
  range(gr)
  reduce(gr)
  restrict(gr, start =3)
  
  # Combining objects[结合对象]
  gr2 <- GRanges(seqnames=Rle(c('Chrom1', 'Chrom2', 'Chrom3'), c(3, 3, 4)),
                 IRanges(1:10, width=5), strand='-',
                 score=101:110, GC = runif(10))
  gr3 <- GRanges(seqnames=Rle(c('Chrom1', 'Chrom2', 'Chrom3'), c(3, 4, 3)),
                 IRanges(101:110, width=10), strand='-',
                 score=21:30)
  some.gr <- c(gr, gr2)
  
  ## all.gr &lt;- c(gr, gr2, gr3) ## (This would fail)[#all.gr < -  C(GR,GR2,GR3)#(这将失败)]
  all.gr <- c(gr, gr2, gr3, .ignoreElementMetadata=TRUE)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-2-7 12:39 , Processed in 0.051693 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表