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

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

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

                                        The IRanges constructor and supporting functions
                                         IRanges构造和配套功能

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

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

The IRanges function is a constructor that can be used to create IRanges instances.
IRanges函数是一个可以用来创建IRanges实例的构造。

solveUserSEW0 and solveUserSEW are utility functions that solve a set of user-supplied start/end/width values.
solveUserSEW0和solveUserSEW实用功能,解决了一套用户提供的开始/结束/宽度值。


用法----------Usage----------


## IRanges constructor:
IRanges(start=NULL, end=NULL, width=NULL, names=NULL)

## Supporting functions (not for the end user):
solveUserSEW0(start=NULL, end=NULL, width=NULL)
solveUserSEW(refwidths, start=NA, end=NA, width=NA,
             rep.refwidths=FALSE,
             translate.negative.coord=TRUE,
             allow.nonnarrowing=FALSE)



参数----------Arguments----------

参数:start, end, width
For IRanges and solveUserSEW0: NULL, or vector of integers (eventually with NAs).  For solveUserSEW: vector of integers (eventually with NAs).  
IRanges和solveUserSEW0:NULL,或向量整数(最终NAS)。 solveUserSEW:整数向量(最终NAS)。


参数:names
A character vector or NULL.  
字符向量或NULL。


参数:refwidths
Vector of non-NA non-negative integers containing the reference widths.  
矢量非NA的非负含有参照宽度的整数。


参数:rep.refwidths
TRUE or FALSE. Use of rep.refwidths=TRUE is supported only when refwidths is of length 1.  
TRUE或FALSE。使用rep.refwidths=TRUE支持,只有当refwidths长度为1。


参数:translate.negative.coord, allow.nonnarrowing
TRUE or FALSE.  
TRUE或FALSE。


IRanges构造----------IRanges constructor----------

Return the IRanges object containing the ranges specified by start, end and width. Input falls into one of two categories:
返回IRanges对象,其中包含start,end和width指定的范围。输入分为两类:

start, end and width are numeric vectors (or NULLs). If necessary they are recycled to the length of the longest (NULL arguments are filled with NAs). After this recycling, each row in the 3-column matrix obtained by binding those 3 vectors together is "solved" i.e. NAs are treated as unknown in the equation end = start + width - 1. Finally, the solved matrix is returned as an IRanges instance.
start,end和width数字矢量(或null)。如果有必要,他们回收到的长度最长(NULL参数与NAS填写)。这回收后,每行3列的矩阵,这3个向量结合在一起得到的是“解决”,即定居未知方程end = start + width - 1治疗。最后,解决矩阵返回作为IRanges实例。

The start argument is a logical vector or logical Rle object and IRanges(start) produces the same result as as(start, "IRanges"). Note that, in that case, the returned IRanges instance is guaranteed to be normal.
start参数是一个逻辑向量或逻辑的的RLE对象和IRanges(start)生产as(start, "IRanges")相同的结果。请注意,在这种情况下,的返回IRanges实例保证是正常的。

Note that the names argument is never recycled (to remain consistent with what `names<-` does on standard vectors).
请注意,names参数是从来没有回收(什么names<-标准的向量保持一致)。


支持功能----------Supporting functions----------

solveUserSEW0(start=NULL, end=NULL, width=NULL):
solveUserSEW0(start=NULL, end=NULL, width=NULL):

solveUserSEW(refwidths, start=NA, end=NA, width=NA,        rep.refwidths=FALSE,        translate.negative.coord=TRUE,        allow.nonnarrowing=FALSE): Use of rep.refwidths=TRUE is supported only when refwidths is of length 1. If rep.refwidths=FALSE (the default) then start, end and width are recycled to the length of refwidths (it's an error if one of them is longer than refwidths, or is of zero length while refwidths is not). If rep.refwidths=TRUE then refwidths is first replicated L times where L is the length of the longest of start, end and width. After this replication, start, end and width are recycled to the new length of refwidths (L) (it's an error if one of them is of zero length while L is != 0).
solveUserSEW(refwidths, start=NA, end=NA, width=NA,        rep.refwidths=FALSE,        translate.negative.coord=TRUE,        allow.nonnarrowing=FALSE):rep.refwidths=TRUE使用的支持,只有当refwidths长度为1。如果rep.refwidths=FALSE(默认),然后start,end和width被回收到的长度refwidths(这是一个错误,如果其中一人是长于refwidths,或长度为零的同时refwidths是不是)。如果rep.refwidths=TRUE然后refwidths首先复制l次,其中L是长度最长的start,end和width。这个复制后,start,end和widthrefwidths(L),(这是一个错误,如果其中一个是长度为零,而L的新长度回收的= 0)。

From now, refwidths, start, end and width are integer vectors of equal lengths. Each row in the 3-column matrix obtained by binding those 3 vectors together must contain at least one NA (otherwise an error is returned). Then each row is "solved" i.e. the 2 following transformations are performed (i is the indice of the row): (1) if translate.negative.coord is TRUE then a negative value of start[i] or end[i] is considered to be a -refwidths[i]-based coordinate so refwidths[i]+1 is added to it to make it 1-based; (2) the NAs in the row are treated as unknowns which values are deduced from the known values in the row and from refwidths[i].
从现在开始,refwidths,start,end和width是相同长度的整数向量。获得这3个向量结合在一起,每行3列的矩阵必须至少包含一个NA(否则将返回一个错误)。然后每一行是“解决”,即在2以下转换(i行证指数):(1)如果translate.negative.coord是真,那么的start[i]负值或end[i]被认为是一个-refwidths[i]基于坐标的所以refwidths[i]+1添加到它的1(2)在该行的NAS作为未知数治疗价值从该行中的已知值从refwidths[i]推导。

The exact rules for (2) are the following. Rule (2a): if the row contains at least 2 NAs, then width[i] must be one of them (otherwise an error is returned), and if start[i] is one of them it is replaced by 1, and if end[i] is one of them it is replaced by refwidths[i], and finally width[i] is replaced by end[i] - start[i] + 1. Rule (2b): if the row contains only 1 NA, then it is replaced by the solution of the width[i] == end[i] - start[i] + 1 equation.
确切的规则(2)有以下几种。规则(2A):如果该行包含至少2定居,然后width[i]必须是其中之一(否则将返回一个错误),start[i]如果就是其中之一,它是由1所取代,如果end[i]就是其中之一,它被替换refwidths[i],终于width[i]end[i] - start[i] + 1的更换。规则(2B):如果该行包含只有1不适用,那么它的width[i] == end[i] - start[i] + 1方程的解决方案取代。

Finally, the set of solved rows is returned as an IRanges object of the same length as refwidths (after replication if rep.refwidths=TRUE).
最后,解决行集返回相同长度的refwidthsIRanges对象(复制后,如果rep.refwidths=TRUE)。

Note that an error is raised if either (1) the set of user-supplied start/end/width values is invalid or (2) allow.nonnarrowing is FALSE and the ranges represented by the solved start/end/width values are not narrowing the ranges represented by the user-supplied start/end/width values.
注意:如果任一(1)用户提供的开始/结束/宽度值的设置是无效或(2)allow.nonnarrowing的是假的,解决的开始/结束/宽度值所代表的范围,就会引发错误不缩小由用户提供的开始/结束/宽度值所代表的范围。


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


H. Pages



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

IRanges-class, narrow
IRanges级,narrow


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


  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## A. USING THE IRanges() CONSTRUCTOR[#答:使用的IRanges()构造]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  IRanges(start=11, end=rep.int(20, 5))
  IRanges(start=11, width=rep.int(20, 5))
  IRanges(-2, 20)  # only one range[只有一个范围]
  IRanges(start=c(2, 0, NA), end=c(NA, NA, 14), width=11:0)
  IRanges()  # IRanges instance of length zero[IRanges实例的长度为零]
  IRanges(names=character())

  ## With logical input:[#逻辑输入:]
  x &lt;- IRanges(c(FALSE, TRUE, TRUE, FALSE, TRUE))  # logical vector input[逻辑向量输入]
  isNormal(x)  # TRUE[真]
  x &lt;- IRanges(Rle(1:30) %% 5 &lt;= 2)  # logical Rle input[逻辑RLE输入]
  isNormal(x)  # TRUE[真]

  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  ## B. USING solveUserSEW()[#乙使用solveUserSEW()]
  ## ---------------------------------------------------------------------[#------------------------------------------------- --------------------]
  refwidths <- c(5:3, 6:7)
  refwidths

  solveUserSEW(refwidths)
  solveUserSEW(refwidths, start=4)
  solveUserSEW(refwidths, end=3, width=2)
  solveUserSEW(refwidths, start=-3)
  solveUserSEW(refwidths, start=-3, width=2)
  solveUserSEW(refwidths, end=-4)

  ## The start/end/width arguments are recycled:[#开始/结束/宽度参数回收:]
  solveUserSEW(refwidths, start=c(3, -4, NA), end=c(-2, NA))

  ## Using 'rep.refwidths=TRUE':[#使用rep.refwidths = TRUE“:]
  solveUserSEW(10, start=-(1:6), rep.refwidths=TRUE)
  solveUserSEW(10, end=-(1:6), width=3, rep.refwidths=TRUE)

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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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