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

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

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

                                        Applying over spaces
                                         申请了空间

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

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

The rdapply function applies a user function over the spaces of a RangedData. The parameters to rdapply are collected into an instance of RDApplyParams,
rdapply功能适用超过用户RangedData的空间函数。参数rdapply到实例RDApplyParams收集,


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


rdapply(x, ...)



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

参数:x
The RDApplyParams instance, see below for how to make one.
RDApplyParams实例,见下文如何使一个。


参数:...
Additional arguments for methods
附加参数的方法


Details

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

The rdapply function is an attempt to facilitate the common operation of performing the same operation over each space (e.g. chromosome) in a RangedData. To facilitate a wide array of such tasks, the function takes a large number of options. The RDApplyParams class is meant to help manage this complexity. In particular, it facilitates experimentation through its support for incremental changes to parameter settings.
rdapply功能是为了促进共同执行相同的操作在每个空间(如染色体)RangedData操作。 ,以方便这些任务的一系列功能需要大量的选项。 RDApplyParams类是为了帮助管理这种复杂性。特别是,它有利于通过其支持参数设置的增量变化的实验。

There are two RangedData settings that are required: the user function object and the RangedData over which it is applied. The rest of the settings determine what is actually passed to the user function and how the return value is processed before relaying it to the user. The following is the description and rationale for each setting.
有两个RangedData设置所需的用户function对象和超过它应用于RangedData。其余的设置确定什么是真正传递给用户的功能和返回值如何处理前传达给用户。以下是每个设置的说明和理由。




rangedData <STRONG>REQUIRED</STRONG>. The RangedData instance over which applyFun is applied.
rangedData<STRONG>要求</强>。 RangedData实例哪些applyFun应用。




applyFun <STRONG>REQUIRED</STRONG>. The user function to be applied to each space in the RangedData. The function must expect the RangedData as its first parameter and also accept the parameters specified in applyParams.
applyFun<STRONG>要求</强>。用户function被应用到每一个空间RangedData。该函数必须预期作为其第一个参数RangedData也接受applyParams指定的参数。

The list of additional parameters to pass to applyFun. Usually empty.
附加参数的list传递applyFun的。通常是空的。

The instance of FilterRules that is used to filter each subset of the RangedData passed to the user function. This is an efficient and convenient means for performing the same operation over different subsets of the data on a space-by-space basis. In particular, this avoids the need to store subsets of the entire RangedData. A common workflow is to invoke rdapply with one set of active filters, enable different filters, reinvoke rdapply, and compare the results.
FilterRules,用于过滤的每个子集RangedData传递给用户的功能。实例这是执行相同的操作空间空间基础数据的不同子集,一个高效,便捷的手段。特别是,这避免了需要存储整个RangedData的子集。一个共同的工作流程是调用rdapply与一套有源滤波器,使不同的过滤器,重新调用rdapply,并比较结果。

A scalar logical (TRUE or FALSE) indicating whether the list to be returned from rdapply should be simplified as by sapply. Defaults to FALSE.
标量逻辑(TRUE或FALSE)指示是否的listrdapply的返回应简化为sapply。 FALSE默认。

The function that is used to convert the list that would otherwise be returned from rdapply to something more convenient. The function should take the list as its first parameter and also accept the parameters specified in reducerParams. This is an alternative to the primitive behavior of the simplify option (so simplify must be FALSE if this option is set). The aim is to orthogonalize the applyFun operation (i.e. the statistics) from the data structure of the result.
这是用来转换从function,否则将返回到更方便的东西list rdapply。该功能应作为其第一个参数列表中也接受reducerParams指定的参数。这是一个替代的simplify选项(simplify必须FALSE如果此选项设置)的原始行为。目的是正交化applyFun操作(即统计),从数据结构的结果。

A list of additional parameters to pass to reducerFun. Can only be set if reducerFun is set. Usually empty.
一个额外的参数list通过reducerFun,。如果reducerFun设置,只能设置。通常是空的。

The function used for applying over the RangedData. By default, this is lapply, but it could also be a specialized function, like mclapply.
申请超过RangedData使用的功能。默认情况下,这是lapply,但它也可能是一个专门的功能,像mclapply。


值----------Value----------

By default a list holding the result of each invocation of the user function, but see details.
默认情况下list每次调用用户函数的结果,但看到的细节。


建设的RDApplyParams对象----------Constructing an RDApplyParams object----------




RDApplyParams(rangedData, applyFun, applyParams, filterRules, simplify, reducerFun, reducerParams): Constructs a RDApplyParams object with each setting specified by the argument of the same name. See the Details section for more information.
RDApplyParams(rangedData, applyFun, applyParams, filterRules, simplify, reducerFun, reducerParams):构造一个RDApplyParams由同名的参数指定的每个设置的对象。更多信息,请参阅详细资料“节。


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

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




rangedData(x), rangedData(x) <- value: Get or set the RangedData instance over which applyFun is applied.
rangedData(x),rangedData(x) <- value:获取或设置RangedData实例指applyFun的应用。




applyFun(x), applyFun(x) <- value: Get or set the user function to be applied to each space in the RangedData.
applyFun(x),applyFun(x) <- value:获取或设置用户function被应用在RangedData每一个空间。




applyParams(x), applyParams(x) <- value: Get or set the list of additional parameters to pass to applyFun.
applyParams(x),applyParams(x) <- value:获取或设置list额外的参数传递到applyFun。




filterRules(x), filterRules(x) <- value: Get or set the instance of FilterRules that is used to filter each subset of the RangedData passed to the user function.
filterRules(x),filterRules(x) <- value:获取或设置的实例FilterRules,用于过滤的每个子集的RangedData传递给用户的功能。




simplify(x), simplify(x) <- value: Get or set a a scalar logical (TRUE or FALSE) indicating whether the list to be returned from rdapply should be simplified as by sapply.
simplify(x),simplify(x) <- value:获取或设置AA标逻辑(TRUE或FALSE)指示是否listrdapply应该返回简化为sapply。




reducerFun(x), reducerFun(x) <- value: Get or set the function that is used to convert the list that would otherwise be returned from rdapply to something more convenient.
reducerFun(x),reducerFun(x) <- value:获取或设置这是用来转换从function,否则将返回到更方便的东西list rdapply。




reducerParams(x), reducerParams(x) <- value: Get or set a list of additional parameters to pass to reducerFun.
reducerParams(x),reducerParams(x) <- value:获取或设置一个额外的参数list的传递reducerFun的。




iteratorFun(x), iteratorFun(x) <- value: Get or set the function used for applying over the RangedData.
iteratorFun(x),iteratorFun(x) <- value:获取或设置了申请RangedData的使用功能。


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


Michael Lawrence



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

RangedData, FilterRules
RangedData,FilterRules


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


  ranges <- IRanges(c(1,2,3),c(4,5,6))
  score <- c(2L, 0L, 1L)
  rd <- RangedData(ranges, score, space = c("chr1","chr2","chr1"))
  
  ## a single function[#单一功能]
  countrows <- function(rd) nrow(rd)
  params <- RDApplyParams(rd, countrows)
  rdapply(params) # list(chr1 = 2L, chr2 = 1L)[列表(chr1 = 2L,chr2 = 1L)]

  ## with a parameter[#参数]
  params <- RDApplyParams(rd, function(rd, x) nrow(rd)*x, list(x = 2))
  rdapply(params) # list(chr1 = 4L, chr2 = 2L)[列表(chr1 = 4L,chr2 = 2L)]

  ## add a filter[#添加一个过滤器]
  cutoff <- 0
  rules <- FilterRules(filter = score > cutoff)
  params <- RDApplyParams(rd, countrows, filterRules = rules)
  rdapply(params) # list(chr1 = 2L, chr2 = 0L)[列表(chr1 = 2L,chr2 = 0L)]
  rules <- FilterRules(list(fun = function(rd) rd[["score"]] < 2),
                       filter = score > cutoff)
  params <- RDApplyParams(rd, countrows, filterRules = rules)
  rdapply(params) # list(chr1 = 1L, chr2 = 0L)[列表(chr1 = 1L,chr2 = 0L)]
  active(filterRules(params))["filter"] <- FALSE
  rdapply(params) # list(chr1 = 1L, chr2 = 1L)[列表(chr1 = 1L,chr2 = 1L)]

  ## simplify[#简化]
  params <- RDApplyParams(rd, countrows, simplify = TRUE)
  rdapply(params) # c(chr1 = 2L, chr2 = 1L)[C(chr1 = 2L,chr2 = 1L)]

  ## reducing[#减少]
  params <- RDApplyParams(rd, countrows, reducerFun = unlist,
                          reducerParams = list(use.names = FALSE))
  rdapply(params) ## c(2L, 1L)[#C(2L,1L)]

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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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