Last data update: 2014.03.03

R: Coverage of a RangedSummarizedExperiment object
coverage-methodsR Documentation

Coverage of a RangedSummarizedExperiment object

Description

This man page documents the coverage method for RangedSummarizedExperiment objects.

Usage

## S4 method for signature 'RangedSummarizedExperiment'
coverage(x, shift=0L, width=NULL, weight=1L,
            method=c("auto", "sort", "hash"))

Arguments

x

A RangedSummarizedExperiment object.

shift, width, weight, method

See ?coverage in the GenomicRanges package.

Details

This method operates on the rowRanges component of the RangedSummarizedExperiment object, which can be a GenomicRanges or GRangesList object.

More precisely, on RangedSummarizedExperiment object x, coverage(x, ...) is equivalent to coverage(rowRanges(x), ...).

See ?coverage in the GenomicRanges package for the details of how coverage operates on a GenomicRanges or GRangesList object.

Value

See ?coverage in the GenomicRanges package.

See Also

  • RangedSummarizedExperiment objects.

  • The coverage man page in the GenomicRanges package where the coverage methods for GenomicRanges and GRangesList objects are documented.

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)),
                     seqlengths=c(chr1=1800, chr2=1300))
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
                     row.names=LETTERS[1:6])
rse <- SummarizedExperiment(assays=SimpleList(counts=counts),
                            rowRanges=rowRanges, colData=colData)

cvg <- coverage(rse)
cvg
stopifnot(identical(cvg, coverage(rowRanges(rse))))

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/coverage-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: coverage-methods
> ### Title: Coverage of a RangedSummarizedExperiment object
> ### Aliases: coverage-methods coverage
> ###   coverage,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)),
+                      seqlengths=c(chr1=1800, chr2=1300))
> colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
+                      row.names=LETTERS[1:6])
> rse <- SummarizedExperiment(assays=SimpleList(counts=counts),
+                             rowRanges=rowRanges, colData=colData)
> 
> cvg <- coverage(rse)
> cvg
RleList of length 2
$chr1
integer-Rle of length 1800 with 11 runs
  Lengths: 464 100 181  46  54  46  14  64  36  64 731
  Values :   0   1   0   1   2   1   0   1   2   1   0

$chr2
integer-Rle of length 1300 with 31 runs
  Lengths:  19  53  47  36  17  11  72  20 ...  38   9   5  11  37  47  16 226
  Values :   0   1   2   1   2   1   2   1 ...   3   2   3   2   3   2   1   0

> stopifnot(identical(cvg, coverage(rowRanges(rse))))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>