Last data update: 2014.03.03
|
R: Intra range transformations of a RangedSummarizedExperiment...
intra-range-methods | R Documentation |
Intra range transformations of a RangedSummarizedExperiment object
Description
This man page documents the intra range transformations that are
supported on RangedSummarizedExperiment objects.
Usage
## S4 method for signature 'RangedSummarizedExperiment'
shift(x, shift=0L, use.names=TRUE)
## S4 method for signature 'RangedSummarizedExperiment'
narrow(x, start=NA, end=NA, width=NA, use.names=TRUE)
## S4 method for signature 'RangedSummarizedExperiment'
resize(x, width, fix="start", use.names=TRUE,
ignore.strand=FALSE)
## S4 method for signature 'RangedSummarizedExperiment'
flank(x, width, start=TRUE, both=FALSE,
use.names=TRUE, ignore.strand=FALSE)
## S4 method for signature 'RangedSummarizedExperiment'
promoters(x, upstream=2000, downstream=200)
## S4 method for signature 'RangedSummarizedExperiment'
restrict(x, start=NA, end=NA, keep.all.ranges=FALSE,
use.names=TRUE)
## S4 method for signature 'RangedSummarizedExperiment'
trim(x, use.names=TRUE)
Arguments
x |
A RangedSummarizedExperiment object.
|
shift, use.names |
See ?shift in the GenomicRanges
package.
|
start, end, width, fix |
See ?shift in the GenomicRanges
package.
|
ignore.strand, both |
See ?shift in the GenomicRanges
package.
|
upstream, downstream |
See ?shift in the GenomicRanges
package.
|
keep.all.ranges |
See ?shift in the GenomicRanges
package.
|
Details
These transformations operate on the rowRanges component of the
RangedSummarizedExperiment object, which can be a
GenomicRanges or GRangesList
object.
More precisely, any of the above functions performs the following
transformation on RangedSummarizedExperiment object x :
rowRanges(x) <- f(rowRanges(x), ...)
where f is the name of the function and ... any additional
arguments passed to it.
See ?shift in the GenomicRanges
package for the details of how these transformations operate on a
GenomicRanges or GRangesList
object.
See Also
Examples
nrows <- 20; ncols <- 6
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
rowRanges <- GRanges(rep(c("chr1", "chr2"), c(5, 15)),
IRanges(sample(1000L, 20), width=100),
strand=Rle(c("+", "-"), c(12, 8)))
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
row.names=LETTERS[1:6])
rse0 <- SummarizedExperiment(assays=SimpleList(counts=counts),
rowRanges=rowRanges, colData=colData)
rse1 <- shift(rse0, 1)
stopifnot(identical(
rowRanges(rse1),
shift(rowRanges(rse0), 1)
))
se2 <- narrow(rse0, start=10, end=-15)
stopifnot(identical(
rowRanges(se2),
narrow(rowRanges(rse0), start=10, end=-15)
))
se3 <- resize(rse0, width=75)
stopifnot(identical(
rowRanges(se3),
resize(rowRanges(rse0), width=75)
))
se4 <- flank(rse0, width=20)
stopifnot(identical(
rowRanges(se4),
flank(rowRanges(rse0), width=20)
))
se5 <- restrict(rse0, start=200, end=700, keep.all.ranges=TRUE)
stopifnot(identical(
rowRanges(se5),
restrict(rowRanges(rse0), start=200, end=700, keep.all.ranges=TRUE)
))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SummarizedExperiment)
Loading required package: GenomicRanges
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: S4Vectors
Loading required package: stats4
Attaching package: 'S4Vectors'
The following objects are masked from 'package:base':
colMeans, colSums, expand.grid, rowMeans, rowSums
Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/SummarizedExperiment/intra-range-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: intra-range-methods
> ### Title: Intra range transformations of a RangedSummarizedExperiment
> ### object
> ### Aliases: intra-range-methods shift
> ### shift,RangedSummarizedExperiment-method narrow
> ### narrow,RangedSummarizedExperiment-method resize
> ### resize,RangedSummarizedExperiment-method flank
> ### flank,RangedSummarizedExperiment-method promoters
> ### promoters,RangedSummarizedExperiment-method restrict
> ### restrict,RangedSummarizedExperiment-method
> ### trim,RangedSummarizedExperiment-method
> ### Keywords: methods utilities
>
> ### ** Examples
>
> nrows <- 20; ncols <- 6
> counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
> rowRanges <- GRanges(rep(c("chr1", "chr2"), c(5, 15)),
+ IRanges(sample(1000L, 20), width=100),
+ strand=Rle(c("+", "-"), c(12, 8)))
> colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
+ row.names=LETTERS[1:6])
> rse0 <- SummarizedExperiment(assays=SimpleList(counts=counts),
+ rowRanges=rowRanges, colData=colData)
>
> rse1 <- shift(rse0, 1)
> stopifnot(identical(
+ rowRanges(rse1),
+ shift(rowRanges(rse0), 1)
+ ))
>
> se2 <- narrow(rse0, start=10, end=-15)
> stopifnot(identical(
+ rowRanges(se2),
+ narrow(rowRanges(rse0), start=10, end=-15)
+ ))
>
> se3 <- resize(rse0, width=75)
> stopifnot(identical(
+ rowRanges(se3),
+ resize(rowRanges(rse0), width=75)
+ ))
>
> se4 <- flank(rse0, width=20)
> stopifnot(identical(
+ rowRanges(se4),
+ flank(rowRanges(rse0), width=20)
+ ))
>
> se5 <- restrict(rse0, start=200, end=700, keep.all.ranges=TRUE)
> stopifnot(identical(
+ rowRanges(se5),
+ restrict(rowRanges(rse0), start=200, end=700, keep.all.ranges=TRUE)
+ ))
>
>
>
>
>
> dev.off()
null device
1
>
|