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

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

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

                                        XVector objects
                                         XVector对象

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

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

The XVector virtual class is a general container for storing an "external vector". It inherits from the Vector, which has a very rich interface.
XVector虚拟类是一个用于存储“外部向量”的一般容器。它继承了从向量,有着非常丰富的接口。

The following classes derive directly from the XVector class:
下面的类派生直接从XVector类:

The XRaw class is a container for storing an "external raw vector" i.e. an external sequence of bytes (stored as char values at the C level).
XRaw类是用于存储“外部的原始向量”,即一个字节的外部序列(存储在C级的char值)的容器。

The XInteger class is a container for storing an "external integer vector" i.e. an external sequence of integer values (stored as int values at the C level).
XInteger类是一个用于存储“外部整数向量”,即整数值的外部序列(存储为int值在C级)的容器。

The XDouble class is a container for storing an "external double vector" i.e. an external sequence of numeric values (stored as double values at the C level).
XDouble类是用于存储“外部的双重向量,即一个数值(存储在C级的双值)的外部序列”的容器。

Also the XString class from the Biostrings package.
也从Biostrings包XString类。

The purpose of the X* containers is to provide a "pass by address" semantic and also to avoid the overhead of copying the sequence data when a linear subsequence needs to be extracted.
在X *容器的目的是提供“按地址传递”语义,并避免复制的序列数据,当一个线性序列,需要提取的开销。


额外的子集操作XVector对象----------Additional Subsetting operations on XVector objects----------

In the code snippets below, x is an XVector object.
在下面的代码片段,x是XVector的对象。

subseq(x, start=NA, end=NA, width=NA): Extract the subsequence from x specified by start, end and width. The supplied start/end/width values are solved by a call to solveUserSEW(length(x), start=start, end=end, width=width) and therefore must be compliant with the rules of the SEW (Start/End/Width) interface (see ?solveUserSEW for the details).
subseq(x, start=NA, end=NA, width=NA):提取的序列从x指定由start,end和width的。提供的开始/结束/宽度值都解决了由solveUserSEW(length(x), start=start, end=end, width=width)调用,因此必须符合规则的SEW(开始/结束/宽)接口(见?solveUserSEW细节)。

A note about performance: subseq does NOT copy the sequence data of an XVector object. Hence it's very efficient and is therefore the recommended way to extract a linear subsequence (i.e. a set of consecutive elements) from an XVector object. For example, extracting a 100Mb subsequence from Human chromosome 1 (a 250Mb DNAString object) with subseq is (almost) instantaneous and has (almost) no memory footprint (the cost in time and memory does not depend on the length of the original sequence or on the length of the subsequence to extract).
注:关于性能subseq不会复制一个XVector对象的序列数据。因此它是非常有效的,因此,推荐的方法来提取一个线性序列(即一组连续的元素)从XVector对象。例如,提取从100MB人类1号染色体(一个250MB DNAString对象)序列subseq(几乎)瞬(几乎)没有内存占用(长度不依赖于时间和内存的成本提取原始序列或序列的长度)。

subseq(x, start=NA, end=NA, width=NA) <- value: Replace the subsequence specified on the left (i.e. the subsequence in x specified by start, end and width) by value. value must belong to the same class as x, or to one of its subclasses, or must be NULL. This replacement method can modify the length of x, depending on how the length of the left subsequence compares to the length of value. It can be used for inserting elements in x (specify an empty left subsequence for this) or deleting elements from x (use a NULL right value for this). Unlike the extraction method above, this replacement method always copies the sequence data of x (even for XVector objects). NOTE: Only works for XRaw (and derived) objects for now.
subseq(x, start=NA, end=NA, width=NA) <- value:更换左侧指定的序列(即序列x指定由start,end和width)value。 value必须属于到x,或它的一个子类的同一类,或者必须是NULL。此替代方法可以修改的长度x,取决于如何左边序列的长度比较长value。它可以用于插入x(指定这左一个空序列)的元素或删去x(使用NULL这个权值)的元素。上面的提取方法不同,这种替代方法始终x(甚至为XVector对象)序列数据复制。注:的只有XRaw作品(以及派生)现在的对象。


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


H. Pages



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

Vector-class, DNAString-class, XVectorList-class, Views-class, solveUserSEW, compact
一流的向量,DNAString级XVectorList级,点击类,solveUserSEW,compact


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


  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## A. XRaw OBJECTS[#答XRaw对象]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]

  x1 &lt;- XRaw(4)  # values are not initialized[未初始化值]
  x1
  x2 <- as(c(255, 255, 199), "XRaw")
  x2
  y &lt;- c(x1, x2, NULL, x1)  # NULLs are ignored[忽略空值]
  y
  subseq(y, start=-4)
  subseq(y, start=-4) <- x2
  y

  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## B. XInteger OBJECTS[#乙XInteger对象]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]

  x3 <- XInteger(12, val=c(-1:10))
  x3
  length(x3)

  ## Subsetting[#子集]
  x4 <- XInteger(99999, val=sample(99, 99999, replace=TRUE) - 50)
  x4
  subseq(x4, start=10)
  subseq(x4, start=-10)
  subseq(x4, start=-20, end=-10)
  subseq(x4, start=10, width=5)
  subseq(x4, end=10, width=5)
  subseq(x4, end=10, width=0)

  x3[length(x3):1]
  x3[length(x3):1, drop=FALSE]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-5 10:51 , Processed in 0.026636 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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