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

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

[复制链接]
发表于 2012-2-25 22:28:07 | 显示全部楼层 |阅读模式
IRanges-class(IRanges)
IRanges-class()所属R语言包:IRanges

                                        IRanges and NormalIRanges objects
                                         IRanges和NormalIRanges对象

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

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

The IRanges class is a simple implementation of the Ranges container where 2 integer vectors of the same length are used to store the start and width values. See the Ranges virtual class for a formal definition of Ranges objects and for their methods (all of them should work for IRanges objects).
IRanges类是一个简单的容器,其中2个相同长度的整数向量用来存储启动和宽度值的范围实施。正式定义的范围对象和方法(他们都应该工作IRanges对象)的虚拟类的范围。

Some subclasses of the IRanges class are: NormalIRanges, Views, etc...
一些的IRanges类的子类:NormalIRanges,意见等..

A NormalIRanges object is just an IRanges object that is guaranteed to be "normal". See the Normality section in the man page for Ranges objects for the definition and properties of "normal" Ranges objects.
一个NormalIRanges对象仅仅是一个IRanges对象,保证是“正常”。为“正常”范围对象的属性的定义和范围对象,请参阅手册页中的常态节。


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

See ?`IRanges-constructor`.
看到?IRanges-constructor。


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

as(from, "IRanges"): Creates an IRanges instance from a Ranges object, logical vector, or integer vector. When from is a logical vector, the resulting IRanges object contains the indices for the runs of TRUE values. When from is an integer vector, the elements are either singletons or "increase by 1" sequences.
as(from, "IRanges"):创建一个范围对象,逻辑向量,或整数向量IRanges实例。当from是一个逻辑的向量,由此产生的IRanges对象包含指数TRUE值的运行。当from是一个整数向量,这些元素是单身或1序列“增加”。

as(from, "NormalIRanges"): Creates a NormalIRanges instance from a logical or integer vector. When from is an integer vector, the elements must be strictly increasing.
as(from, "NormalIRanges"):创建一个从逻辑或整数向量NormalIRanges实例。当from是一个整数向量,这些元素必须是严格递增。


结合----------Combining----------

c(x, ..., .ignoreElementMetadata=TRUE) Combining IRanges objects is straightforward when they do not have any elementMetadata set. If only one of the IRanges object has its elementMetadata set, this is also trivial: the resulting (combined) IRanges object will take the single elementMetadata as the default, and set the corresponding elementMetadata for the other IRanges object to NA. When multiple IRanges object have their own elementMetadata, the user must ensure that each such linkS4class{DataFrame} have identical layouts to each other (same columns defined), in order for the combination to be successful, otherwise an error will be thrown. The user can call c(x, ..., .ignoreElementMetadata=TRUE) in order to combine IRanges objects with differing elementMetadata, which will result in the combined object having NO elementMetadata defined.
c(x, ..., .ignoreElementMetadata=TRUE)结合IRanges对象是简单的,当他们没有任何elementMetadata集。如果只是IRanges对象之一,有其elementMetadata集,这也是微不足道:(合并)IRanges对象将采取单elementMetadata作为默认,设置相应的elementMetadata等IRanges对象NA的。当多个IRanges对象有自己的elementMetadata,用户必须确保每个这样的linkS4class{DataFrame}彼此有相同的布局(相同的列定义),在结合才能取得成功,否则将抛出一个错误。用户可以调用c(x, ..., .ignoreElementMetadata=TRUE)以IRanges对象结合不同elementMetadata,这将导致在合并对象没有elementMetadata定义的。


NormalIRanges对象的方法----------Methods for NormalIRanges objects----------

max(x): The maximum value in the finite set of integers represented by x.
max(x):在有限集的整数代表x的最大值。

min(x): The minimum value in the finite set of integers represented by x.
min(x):在有限集的整数代表x的最低值。


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


H. Pages



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

Ranges-class, Ranges-utils, IRanges-constructor, IRanges-utils, IRanges-setops.
范围级,范围-utils的,IRanges构造,IRanges-utils的,IRanges setops。

Some direct subclasses of the IRanges class (other than NormalIRanges): Views-class.
一些直接的IRanges类的子类(比NormalIRanges其他):视图 - 级。


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


  showClass("IRanges")  # shows (some of) the known subclasses[表演(部分)已知的子类]

  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## A. MANIPULATING IRanges OBJECTS[#答:操纵IRanges对象]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## All the methods defined for Ranges objects work on IRanges objects.[#所有的方法定义的范围对象IRanges对象的工作。]
  ## See ?Ranges for some examples.[#见一些例子吗?范围。]
  ## Also see ?`IRanges-utils` and ?`IRanges-setops` for additional[#也看到了什么?IRanges-utils的和IRanges setops额外的]
  ## operations on IRanges objects.[#操作IRanges对象。]
  
  ## Combining IRanges objects[#结合IRanges对象,]
  ir1 <- IRanges(c(1, 10, 20), width=5)
  elementMetadata(ir1) <- DataFrame(score=runif(3))
  ir2 <- IRanges(c(101, 110, 120), width=10)
  elementMetadata(ir2) <- DataFrame(score=runif(3))
  ir3 <- IRanges(c(1001, 1010, 1020), width=20)
  elementMetadata(ir3) <- DataFrame(value=runif(3))
  some.iranges <- c(ir1, ir2)
  ## all.iranges &lt;- c(ir1, ir2, ir3) ## This will raise an error[#all.iranges < -  C(IR1,IR2,IR3)#这将引发一个错误]
  all.iranges <- c(ir1, ir2, ir3, .ignoreElementMetadata=TRUE)
  stopifnot(is.null(elementMetadata(all.iranges)))

  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## B. A NOTE ABOUT PERFORMANCE[#B.关于性能的注意事项]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## Using an IRanges object for storing a big set of ranges is more[#使用IRanges对象存储大范围的更]
  ## efficient than using a standard R data frame:[#效率比使用标准的R数据框:]
  N &lt;- 2000000L  # nb of ranges[NB的范围]
  W &lt;- 180L      # width of each range[每个范围的宽度]
  start <- 1L
  end <- 50000000L
  set.seed(777)
  range_starts <- sort(sample(end-W+1L, N))
  range_widths <- rep.int(W, N)
  ## Instantiation is faster[#实例是快]
  system.time(x <- IRanges(start=range_starts, width=range_widths))
  system.time(y <- data.frame(start=range_starts, width=range_widths))
  ## Subsetting is faster[#子集速度更快]
  system.time(x16 <- x[c(TRUE, rep.int(FALSE, 15))])
  system.time(y16 <- y[c(TRUE, rep.int(FALSE, 15)), ])
  ## Internal representation is more compact[#内部表示更加紧凑]
  object.size(x16)
  object.size(y16)
  

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-5 14:01 , Processed in 0.020874 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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