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

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

[复制链接]
发表于 2012-2-25 19:29:38 | 显示全部楼层 |阅读模式
Seqinfo-class(GenomicRanges)
Seqinfo-class()所属R语言包:GenomicRanges

                                        Seqinfo objects
                                         seqinfo对象

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

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

A Seqinfo object is a table-like object that contains basic information about a set of genomic sequences. The table has 1 row per sequence and 1 column per sequence attribute.  Currently the only attributes are the length, circularity flagi, and genome provenance (e.g. hg19) of the sequence, but more attributes might be added in the future as the need arises.
一个Seqinfo对象是表像的对象,其中包含大约一组基因组序列的基本信息。每个序列表中有1行和1%的序列属性列。目前唯一的属性的长度,圆flagi,源基因组序列(如hg19),但在有需要时,更多的属性,可能会在未来加入。


Details

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

Typically Seqinfo objects are not used directly but are part of higher level objects. Those higher level objects will generally provide a seqinfo accessor for getting/setting their Seqinfo component.
,通常Seqinfo对象不能直接使用,但更高级别的对象的一部分。这些更高级别的对象一般会提供一个获取/设置其Seqinfo组件seqinfo存取。


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

Seqinfo(seqnames, seqlengths=NA, isCircular=NA, genome=NA): Creates a Seqinfo object.
Seqinfo(seqnames, seqlengths=NA, isCircular=NA, genome=NA):创建Seqinfo的对象。


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

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

length(x): Gets the number of sequences in x.
length(x):获取序列x的数量。

seqnames(x), seqnames(x) <- value: Gets/sets the names of the sequences in x. Those names must be non-NA, non-empty and unique. They are also called the sequence levels or the keys of the Seqinfo object.
seqnames(x),seqnames(x) <- value:获取/设置x序列的名称。这些名称必须非NA,非空和独特的。他们也被称为该序列水平或的Seqinfo对象的键。

Note that, in general, the end-user should not try to alter the sequence levels with seqnames(x) <- value. The recommended way to do this is with seqlevels(x) <- value as described below.
请注意,在一般情况下,最终用户不应该尝试改变与seqnames(x) <- value序列水平。推荐的方法做,这是与seqlevels(x) <- value如下所述。

names(x), names(x) <- value: Same as seqnames(x) and seqnames(x) <- value.
names(x),names(x) <- value:相同seqnames(x)和seqnames(x) <- value。

seqlevels(x): Same as seqnames(x).
seqlevels(x):同为seqnames(x)。

seqlevels(x) <- value: Can be used to rename, drop, add and/or reorder the sequence levels. value must be either a named or unnamed character vector. When value has names, the names only serve the purpose of mapping the new sequence levels to the old ones. Otherwise (i.e. when value is unnamed) this mapping is implicitly inferred from the following rules:
seqlevels(x) <- value:可用于重命名,删除,添加和/或重新排列顺序水平。 value必须是一个有名或无名的特征向量。当value的名称,名称只为旧映射新的序列水平的目的。否则(即当value是无名)此映射隐含推断以下规则:

(1) If the number of new and old levels are the same, and if the positional mapping between the new and old levels shows that some or all of the levels are being renamed, and if the levels that are being renamed are renamed with levels that didn't exist before (i.e. are not present in the old levels), then seqlevels(x) <- value will just rename the sequence levels. Note that in that case the result is the same as with seqnames(x) <- value but it's still recommended to use seqlevels(x) <- value as it is safer.
(1)如果新老各级数目是相同的,如果新老各级之间的位置映射显示水平的部分或全部被重新命名,并正在改名的水平,如果水平改名不存在(即是在旧的水平不存在),那么seqlevels(x) <- value只是重命名序列水平。注意,在这种情况下,其结果是作为seqnames(x) <- value相同,但它仍然建议使用seqlevels(x) <- value“,因为它是更安全。

(2) Otherwise (i.e. if the conditions for (1) are not satisfied) seqlevels(x) <- value will consider that the sequence levels are not being renamed and will just perform x <- x[value].
(2)否则(即如果条件(1)不满意)seqlevels(x) <- value会考虑序列水平没有被改名,将只执行x <- x[value]。

See below for some examples.
看到下面的一些例子。

seqlengths(x), seqlengths(x) <- value: Gets/sets the length for each sequence in x.
seqlengths(x),seqlengths(x) <- value:x获取/设置每个序列的长度。

isCircular(x), isCircular(x) <- value: Gets/sets the circularity flag for each sequence in x.
isCircular(x),isCircular(x) <- value:x获取/设置每个序列的圆形标志。

isCircularWithKnownLength(x): Formally defined as (isCircular(x) %in% TRUE) &amp; !is.na(seqlengths(x)).
isCircularWithKnownLength(x):(isCircular(x) %in% TRUE) &amp; !is.na(seqlengths(x))正式定义。

genome(x), genome(x) <- value: Gets/sets the genome identifier or assembly name for each sequence in x.
genome(x),genome(x) <- value:获取/设置每个序列的基因组标识符或程序集名称x。


子集----------Subsetting----------

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

x[i]: A Seqinfo object can be subsetted only by name i.e. i must be a character vector. This is a convenient way to drop/add/reorder the rows (aka the sequence levels) of a Seqinfo object.
x[i]:只能由一个Seqinfo对象名称子集,即i必须是一个字符向量。这是一个方便的方法来删除/添加/重新排序一个Seqinfo对象的行(又名序列水平)。

See below for some examples.
看到下面的一些例子。


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

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

as.data.frame(x): Turns x into a data frame.
as.data.frame(x):打开x到一个数据框。

as(x, "GenomicRanges"), as(x, "RangesList"): Turns x (with no NA lengths) into a GRanges or RangesList.
as(x, "GenomicRanges"),as(x, "RangesList"):打开x没有NA长度到一个农庄或RangesList。


结合Seqinfo对象----------Combining Seqinfo objects----------

There are no c or rbind method for Seqinfo objects. Both would be expected to just append the rows in y to the rows in x resulting in an object of length length(x) + length(y). But that would tend to break the constraint that the seqnames of a Seqinfo object must be unique keys.
有没有c或rbind为Seqinfo对象方法。预计都将只是追加y行的行x长度length(x) + length(y)对象。但往往会打破约束,seqnames一个Seqinfo对象必须是唯一的键。

So instead, a merge method is provided.
因此,而不是一个merge方法提供。

In the code snippet below, x and y are Seqinfo objects.
在下面的代码片段,x和y是Seqinfo的对象。

merge(x, y): Merge x and y into a single Seqinfo object where the keys (aka the seqnames) are union(seqnames(x), seqnames(y)). If a row in y has the same key as a row in x, and if the 2 rows contain compatible information (NA values are compatible with anything), then they are merged into a single row in the result. If they cannot be merged (because they contain different seqlengths, and/or circularity flags, and/or genome identifiers), then an error is raised. In addition to check for incompatible sequence information, merge(x, y) also compares seqnames(x) with seqnames(y) and issues a warning if each of them has names not in the other. The purpose of these checks is to try to detect situations where the user might be combining or comparing objects based on different reference genomes.
merge(x, y):合并x和y键(又名seqnames)union(seqnames(x), seqnames(y))成一个单一的Seqinfo对象。如果在y行作为排在x,如果2行包含兼容的信息(不适用的值是与任何兼容),那么它们合并成单排在同一个密钥结果。如果他们不能被合并(因为它们含有不同seqlengths,和/或圆形标志,和/或基因组标识符),那么就会引发错误。除了检查不兼容的序列信息,merge(x, y)也比较seqnames(x)seqnames(y)和问题的一个警告,如果他们每个人有没有在其他的名称。这些检查的目的是试图检测用户可能会被合并或比较的对象,根据不同的参考基因组的情况。


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


H. Pages



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

seqinfo
seqinfo


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


  ## Note that all the arguments (except 'genome') must have the[#请注意,所有参数(除“基因组”),必须有]
  ## same length. 'genome' can be of length 1, whatever the lengths[#相同的长度。 “基因”可以是长度为1,无论长度]
  ## of the other arguments are.[其他参数#。]
  x <- Seqinfo(seqnames=c("chr1", "chr2", "chr3", "chrM"),
               seqlengths=c(100, 200, NA, 15),
               isCircular=c(NA, FALSE, FALSE, TRUE),
               genome="toy")
  x

  x[c("chrY", "chr3", "chr1")]  # subset by names[按名称子集]

  ## Rename, drop, add and/or reorder the sequence levels:[#重命名,删除,添加和/或重新排列顺序水平:]
  xx <- x
  seqlevels(xx) &lt;- sub("chr", "ch", seqlevels(xx))  # rename[重命名]
  xx
  seqlevels(xx) &lt;- rev(seqlevels(xx))  # reorder[重新排序]
  xx
  seqlevels(xx) &lt;- c("ch1", "ch2", "chY")  # drop/add/reorder[删除/添加/重新排序]
  xx
  seqlevels(xx) &lt;- c(chY="Y", ch1="1", "22")  # rename/reorder/drop/add[重命名/重新安排/删除/添加]
  xx

  y <- Seqinfo(seqnames=c("chr3", "chr4", "chrM"),
               seqlengths=c(300, NA, 15))
  y
  merge(x, y)  # rows for chr3 and chrM are merged[行合并为chr3和特征剩磁]
  suppressWarnings(merge(x, y))

  ## Note that, strictly speaking, merging 2 Seqinfo objects is not[#注意,严格地说,合并2 Seqinfo的对象是不]
  ## a commutative operation, i.e., in general 'z1 &lt;- merge(x, y)'[#交换操作,也就是说,在一般的Z1 < - 合并(X,Y)“]
  ## is not identical to 'z2 &lt;- merge(y, x)'. However 'z1' and 'z2'[#Z2 < - 合并(Y,X)是不完全相同。然而“Z1”和“Z2”]
  ## are guaranteed to contain the same information (i.e. the same[#保证包含相同的信息(即同一]
  ## rows, but typically not in the same order):[#行,但通常不会以相同的顺序):]
  suppressWarnings(merge(y, x))

  ## This contradicts what 'x' says about circularity of chr3 and chrM:[#这违背X的chr3和磁场方向的圆说:]
  isCircular(y)[c("chr3", "chrM")] <- c(TRUE, FALSE)
  y
  if (interactive()) {
    merge(x, y)  # raises an error[提出了一个错误]
  }

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-7 12:54 , Processed in 0.022526 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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