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

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

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

                                        Collection of Filter Rules
                                         收集筛选规则

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

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

A FilterRules object is a collection of filter rules, which can be either expression or function objects. Rules can be disabled/enabled individually, facilitating
一个FilterRules对象是一个过滤规则,可以是expression或function对象的集合。规则可以禁用/启用独立,促进


Details

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

It is common to split a dataset into subsets during data analysis. When data is large, however, representing subsets (e.g. by logical vectors) and storing them as copies might become too costly in terms of space. The FilterRules class represents subsets as lightweight expression and/or function objects. Subsets can then be calculated when needed (on the fly). This avoids copying and storing a large number of subsets. Although it might take longer to frequently recalculate a subset, it often is a relatively fast operation and the space savings tend to be more than worth it when data is large.
分裂成子集的数据集的数据分析过程中是很常见的。当数据量很大,但是,代表子集(例如逻辑向量),并把它们存储为副本可能会变得过于昂贵的空间。 FilterRules类代表轻量级expression和/或function对象的子集。亚群然后可以在需要时(飞)计算。这样可以避免复制和存储大量的子集。虽然它可能需要更长的时间经常重新计算的一个子集,它往往是一个比较快的操作和节省空间,往往是值得时的数据是大。

Rules may be either expressions or functions. Evaluating an expression or invoking a function should result in a logical vector. Expressions are often more convenient, but functions (i.e. closures) are generally safer and more powerful, because the user can specify the enclosing environment. If a rule is an expression, it is evaluated inside the envir argument to the eval method (see below). If a function, it is invoked with envir as its only argument. See examples.
规则可能是表达式或函数。评价一个表达式或调用一个函数,导致逻辑的向量。表达往往更方便,但功能(即封)一般都更安全和更强大的,因为用户可以指定封闭的环境。如果规则是一个表达式,它被评为envir方法(见下文)内eval参数。如果一个函数,它是用envir作为其唯一参数调用。看到的例子。


存取方法----------Accessor methods----------

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




active(x): Get the logical vector of length length(x), where TRUE for an element indicates that the corresponding rule in x is active (and inactive otherwise). Note that names(active(x)) is equal to
active(x):获取长度的逻辑向量length(x),其中TRUE元素表示相应的规则x是积极的(否则无效)。请注意,names(active(x))等于




active(x) <- value: Replace the active state of the filter rules. If value is a logical vector, it should be of length length(x) and indicate which rules are active. Otherwise, it can be either numeric or character vector, in which case it sets the indicated rules (after dropping NA's) to active and
active(x) <- value:更换过滤规则的活跃状态。如果value是一个逻辑的向量,它应该是长length(x),并指出哪些规则是积极的。否则,它可以是数字或字符的向量,在这种情况下,它设置指定的规则(NA的下跌后)为主动


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

FilterRules(exprs = list(), ..., active = TRUE): Constructs a FilterRules with the rules given in the list exprs or in .... The initial active state of the rules is given by active, which is recycled as necessary. Elements in exprs may be either character (parsed into an expression), a language object (coerced to an expression), an expression, or a function that takes at least one argument. <STRONG>IMPORTANTLY</STRONG>, all arguments in ... are <STRONG>quote()</STRONG>'d and then coerced to an expression. So, for example, character data is only parsed if it is a literal. The names of the filters are taken from the names of exprs and ..., if given. Otherwise, the character vectors take themselves as their name and the others are deparsed (before any coercion). Thus, it is recommended to always specify meaningful names. In any case, the names are made valid and unique.
FilterRules(exprs = list(), ..., active = TRUE):构造一个规则FilterRules在列表exprs或...的。 active,这是必要的回收规则的初始激活状态。 exprs元素可能是字符(解析成一个表达式),一种语言对象(强迫表达式),表达式或一个函数,它至少有一个参数。 <STRONG>重要</ strong>中,所有参数...是<STRONG>quote()</强>“,然后强迫表达式。因此,例如,字符数据只解析,如果它是文字。过滤器的名称取自名exprs和...,如果给定的。否则以他们的名字,特征向量自己和别人都deparsed(任何胁迫前)。因此,建议始终指定一个有意义的名字。在任何情况下,名称是有效的和独特的。


子集和更换----------Subsetting and Replacement----------

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

x[i]: Subsets the filter rules using the same interface as for Vector.
x[i]:子集使用相同的接口Vector过滤规则。

x[[i]]: Extracts an expression or function via the same interface as for List.
x[[i]]:通过相同的接口中提取的表达或功能List。

x[[i]] <- value: The same interface as for List. The default active state for new rules is TRUE.
x[[i]] <- value:List相同的接口。新规则的默认激活状态是TRUE。


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

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




append(x, values, after = length(x)): Appends the values FilterRules instance onto x at the index given by after.
append(x, values, after = length(x)):追加valuesFilterRules实例上x在after给定的索引。




c(x, ..., recursive = FALSE): Concatenates the FilterRule instances in ... onto the end of x.
c(x, ..., recursive = FALSE):串连FilterRule实例...到x年底。


评价----------Evaluating----------

eval(expr, envir = parent.frame(), enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv()):  Evaluates a FilterRules instance (passed as the expr argument). Expression rules are evaluated in envir, while function rules are invoked with envir as their only argument. The evaluation of a rule should yield a logical vector. The results from the rule evaluations are combined via the AND operation (i.e. &amp;) so that a single logical vector is returned from eval.
eval(expr, envir = parent.frame(), enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv()):评估FilterRules实例(作为expr参数传递)。表达规则评估envir,envir作为其唯一的参数调用函数规则。评价规则应该产生一个逻辑的向量。从规则的评价结果相结合,通过与操作(即&amp;),因此,从eval返回一个单一的逻辑向量。

evalSeparately(expr, envir = parent.frame(), enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv()): Evaluates separately each rule in a FilterRules instance (passed as the expr argument). Expression rules are evaluated in envir, while function rules are invoked with envir as their only argument. The evaluation of a rule should yield a logical vector. The results from the rule evaluations are combined into a logical matrix, with a column for each rule. This is essentially the parallel evaluator, while eval is the serial evaluator.
evalSeparately(expr, envir = parent.frame(), enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv()):计算每条规则分别在FilterRules实例(如expr参数传递)。表达规则评估envir,envir作为其唯一的参数调用函数规则。评价规则应该产生一个逻辑的向量。从规则的评价结果组合成一个逻辑矩阵,为每个规则的列。这基本上是平行的评估,而eval是串行的评估。

subsetByFilter(x, filter): Evaluates filter on x and uses the result to subset x. The result contains only the elements in x for which filter evaluates to TRUE.
subsetByFilter(x, filter):计算filter上x和使用结果的子集x。结果包含在唯一的元素xfilter值TRUE。




summary(object, subject): Returns an integer vector with the number of elements in subject that pass each rule in object, along with a count of the elements that pass all filters.
summary(object, subject):返回一个整数向量元素的数量subject通过在object每个规则,以及通过所有过滤器的元素的计数。


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


Michael Lawrence



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

rdapply, which accepts a FilterRules instance to filter each space before invoking the user function.
rdapply,接受FilterRules的实例前调用用户函数过滤每一个空间。


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


  ## constructing a FilterRules instance[#建设FilterRules实例,]

  ## an empty set of filters[#空集过滤器]
  filters <- FilterRules()
  
  ## as a simple character vector[#作为一个简单的特征向量]
  filts <- c("peaks", "promoters")
  filters <- FilterRules(filts)
  active(filters) # all TRUE[所有真正的]

  ## with functions and expressions[#函数和表达式]
  filts <- list(peaks = expression(peaks), promoters = expression(promoters),
                find_eboxes = function(rd) rep(FALSE, nrow(rd)))
  filters <- FilterRules(filts, active = FALSE)
  active(filters) # all FALSE[全是假的]

  ## direct, quoted args (character literal parsed)[#直接引述ARGS(字符文字解析)]
  filters <- FilterRules(under_peaks = peaks, in_promoters = "promoters")
  filts <- list(under_peaks = expression(peaks),
                in_promoters = expression(promoters))

  ## specify both exprs and additional args[#指定两个exprs,和额外的参数]
  filters <- FilterRules(filts, diffexp = de)

  filts <- c("peaks", "promoters", "introns")
  filters <- FilterRules(filts)

  ## set the active state directly[#设置的活跃状态,直接]
  
  active(filters) &lt;- FALSE # all FALSE[全是假的]
  active(filters) &lt;- TRUE # all TRUE[所有真正的]
  active(filters) <- c(FALSE, FALSE, TRUE)
  active(filters)["promoters"] &lt;- TRUE # use a filter name[使用过滤器的名称]
  
  ## toggle the active state by name or index[#激活状态的切换通过名称或索引]
  
  active(filters) &lt;- c(NA, 2) # NA's are dropped[NA的下降]
  active(filters) <- c("peaks", NA)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-5 13:49 , Processed in 0.021627 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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