RangedData-methods(rtracklayer)
RangedData-methods()所属R语言包:rtracklayer
Data on a Genome
基因组数据
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The rtracklayer package adds convenience methods on top of RangedData and GenomicRanges to manipulate data on genomic ranges. For RangedData the spaces are now called chromosomes (but could still refer to some other type of sequence).
rtracklayer包RangedData和GenomicRanges操纵基因组范围内的数据。上添加方便的方法RangedData的空间现在被称为染色体(但仍然可以参考一些其他类型的序列)。
存取----------Accessors----------
In the code snippets below, x is a RangedData or GenomicRanges object.
在下面的代码片段,x是RangedData或GenomicRanges对象。
chrom(x), chrom(x) <- value: Gets or sets the chromosome names for x. The length of value should equal the length of x. This is an alias for names(x).
chrom(x), chrom(x) <- value:获取或设置为x染色体的名称。 value长度应该等于长度x。这是别名names(x)。
seqinfo(x), seqinfo(x) <- value: Gets or sets the sequence information as a Seqinfo object. This is just a wrapper on top of seqinfo for ranges(x).
seqinfo(x),seqinfo(x) <- value:获取或设置作为Seqinfo对象的序列信息。这仅仅是一个seqinforanges(x)上的包装。
score(x): Gets the “score” column from the element metadata of a GenomicRanges or GRangesList. Many track formats have a score column, so this is often used during export. The IRanges package defines a method for RangedData. The ANY fallback for this method simply returns NULL.
score(x):从GenomicRanges或GRangesList的获取元素的元数据的“得分”栏。许多曲目格式有得分列,因此,这往往是在出口过程中使用。 IRanges包定义为RangedData的方法。 这种方法的后援ANY简单地返回NULL。
构造----------Constructor----------
GenomicData(ranges, ..., strand = NULL, chrom = NULL, genome = NULL, asRangedData = TRUE): If asRangedData is TRUE, constructs a RangedData instance with the given ranges and variables in ... (see the RangedData constructor). If asRangedData is FALSE, constructs a GRanges instance with the given ranges and variables in ....
GenomicData(ranges, ..., strand = NULL, chrom = NULL, genome = NULL, asRangedData = TRUE):asRangedData如果TRUE给定的RangedData和ranges(...变量,构建一个RangedData实例构造)。如果asRangedData是FALSE给定的GRanges和ranges变量,构建一个...实例。
If non-NULL, the strand argument specifies the strand of each range. It should be a character vector or factor of length equal to that of ranges. All values should be either -, +, * or NA. (The NA code for strand is only acceptable when asRangedData is TRUE.) To get the levels for strand, call levels(strand()).
如果非NULL,strand参数指定每个范围链。它应该是一个特征向量或因素的长度等于ranges。所有的值应该要么-,+,*或NA。 (NA是唯一可以接受的strand代码当asRangedData是TRUE)strand,叫levels(strand())的水平。
chrom argument is analogous to space in the RangedData and seqnames in GRanges constructors.
chrom的说法是类似于spaceRangedData和seqnamesGRanges构造。
The genome argument should be a scalar string and is treated as the RangedData universe. See the examples.
genome参数应该是一个标量字符串RangedData宇宙治疗。见的例子。
If ranges is not a Ranges object, this function calls as(ranges, "RangedData") and returns the result if successful. As a special case, the “chrom” column in a data.frame-like object is renamed to “space”, for convenience. Thus, one could pass a data.frame with columns “start”, “end” and, optionally, “chrom”.
ranges如果不Ranges对象,这个函数调用as(ranges, "RangedData")“如果成功,返回结果。作为一个特殊的情况下,列在一个data.frame状物体的“铬”更名为“空间”,为方便。因此,人们可以通过与列的“开始”,“结束”,并选择性地“铬”data.frame。
作者(S)----------Author(s)----------
Michael Lawrence and Patrick Aboyoun
举例----------Examples----------
range1 <- IRanges::IRanges(start=c(1,2,3), end=c(5,2,8))
## just ranges ##[#刚刚范围#]
## RangedData instance[#RangedData实例]
rd <- GenomicData(range1)
## GRanges instance[#农庄实例]
gr <- GenomicData(range1, asRangedData = FALSE)
## with a genome (universe) ##[#基因组(宇宙)##]
## RangedData instance[#RangedData实例]
rd <- GenomicData(range1, genome = "hg18")
genome(rd) ## "hg18"[#“hg18”]
## GRanges instance[#农庄实例]
gr <- GenomicData(range1, genome = "hg18", asRangedData = FALSE)
genome(gr) ## "hg18"[#“hg18”]
## with some data ##[一些数据##]
filter <- c(1L, 0L, 1L)
score <- c(10L, 2L, NA)
strand <- factor(c("+", NA, "-"), levels = levels(strand()))
## RangedData instance[#RangedData实例]
rd <- GenomicData(range1, score, genome = "hg18")
rd[["score"]]
strand(rd) ## all NA[#所有适用]
rd <- GenomicData(range1, score, filt = filter, strand = strand)
rd[["filt"]]
strand(rd) ## equal to 'strand'[#等于“链”]
## GRanges instance[#农庄实例]
gr <- GenomicData(range1, score, genome = "hg18", asRangedData = FALSE)
values(gr)[["score"]]
strand(gr) ## all '*'[#所有的“*”]
gr <- GenomicData(range1, score, filt = filter, strand = strand,
asRangedData = FALSE)
values(gr)[["filt"]]
strand(gr) ## equal to 'strand'[#等于“链”]
## multiple chromosomes ##[##多个染色体]
range2 <- IRanges::IRanges(start=c(15,45,20,1), end=c(15,100,80,5))
ranges <- c(range1, range2)
score <- c(score, c(0L, 3L, NA, 22L))
chrom <- paste("chr", rep(c(1,2), c(length(range1), length(range2))), sep="")
## RangedData instance[#RangedData实例]
rd <- GenomicData(ranges, score, chrom = chrom, genome = "hg18")
chrom(rd) # equal to 'chrom'[等于“CHROM”]
rd[["score"]] # unlists over the chromosomes[unlists以上的染色体]
score(rd)
rd[1][["score"]] # equal to score[1:3][等于得分[1:3]]
## GRanges instance[#农庄实例]
gr <- GenomicData(ranges, score, chrom = chrom, genome = "hg18",
asRangedData = FALSE)
chrom(gr) # equal to 'chrom'[等于“CHROM”]
values(gr)[["score"]]
values(gr[chrom(gr) == "chr1"])[["score"]]
## coercion from data.frame ##[从数据框###胁迫]
df <- as.data.frame(rd)
GenomicData(df)
GenomicData(df, asRangedData = FALSE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|