RaggedExperiment-class: RaggedExperiment objects

Description Usage Arguments Value Methods (by generic) Constructors Subsetting Coercion Examples

Description

The RaggedExperiment class is a container for storing range-based data, including but not limited to copy number data, and mutation data. It can store a collection of GRanges objects, as it is derived from the GenomicRangesList.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
RaggedExperiment(..., colData = DataFrame())

## S4 method for signature 'RaggedExperiment'
rowRanges(x, ...)

## S4 method for signature 'RaggedExperiment'
dim(x)

## S4 method for signature 'RaggedExperiment'
dimnames(x)

## S4 replacement method for signature 'RaggedExperiment,list'
dimnames(x) <- value

## S4 method for signature 'RaggedExperiment'
colData(x, ...)

## S4 method for signature 'RaggedExperiment,missing'
assay(x, i, ...)

## S4 method for signature 'RaggedExperiment,ANY'
assay(x, i, ..., withDimnames = TRUE)

## S4 method for signature 'RaggedExperiment'
assays(x, ..., withDimnames = TRUE)

## S4 method for signature 'RaggedExperiment'
assayNames(x, ...)

## S4 method for signature 'RaggedExperiment'
show(object)

## S4 method for signature 'RaggedExperiment,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'RaggedExperiment,Vector'
overlapsAny(query, subject, maxgap = 0L,
  minoverlap = 1L, type = c("any", "start", "end", "within", "equal"), ...)

## S4 method for signature 'RaggedExperiment,Vector'
subsetByOverlaps(query, subject,
  maxgap = 0L, minoverlap = 1L, type = c("any", "start", "end", "within",
  "equal"), invert = FALSE, ...)

Arguments

...

Constructor: GRanges, list of GRanges, or GRangesList OR assay: Additional arguments for assay. See details for more information.

colData

A DataFrame describing samples. Length of rowRanges must equal the number of rows in colData

x

A RaggedExperiment object.

value

A list of dimension names

i

logical(1), integer(1), or character(1) indicating the assay to be reported. For [, i can be any supported Vector object, e.g., GRanges.

withDimnames

logical (default TRUE) whether to use dimension names in the resulting object

object

A RaggedExperiment object.

j

integer(), character(), or logical() index selecting columns from RaggedExperiment

drop

logical (default TRUE) whether to drop empty samples

query

A RaggedExperiment instance.

subject

Each of them can be a Ranges, Views, RangesList, ViewsList, or RangedData object. In addition, if subject is a Ranges object, query can be an integer vector to be converted to length-one ranges.

If query is a RangesList or RangedData, subject must be a RangesList or RangedData. If both lists have names, each element from the subject is paired with the element from the query with the matching name, if any. Otherwise, elements are paired by position. The overlap is then computed between the pairs as described below.

If subject is omitted, query is queried against itself. In this case, and only this case, the drop.self and drop.redundant arguments are allowed. By default, the result will contain hits for each range against itself, and if there is a hit from A to B, there is also a hit for B to A. If drop.self is TRUE, all self matches are dropped. If drop.redundant is TRUE, only one of A->B and B->A is returned.

maxgap

Intervals with a separation of maxgap or less and a minimum of minoverlap overlapping positions, allowing for maxgap, are considered to be overlapping. maxgap should be a scalar, non-negative, integer. minoverlap should be a scalar, positive integer.

minoverlap

Intervals with a separation of maxgap or less and a minimum of minoverlap overlapping positions, allowing for maxgap, are considered to be overlapping. maxgap should be a scalar, non-negative, integer. minoverlap should be a scalar, positive integer.

type

By default, any overlap is accepted. By specifying the type parameter, one can select for specific types of overlap. The types correspond to operations in Allen's Interval Algebra (see references). If type is start or end, the intervals are required to have matching starts or ends, respectively. While this operation seems trivial, the naive implementation using outer would be much less efficient. Specifying equal as the type returns the intersection of the start and end matches. If type is within, the query interval must be wholly contained within the subject interval. Note that all matches must additionally satisfy the minoverlap constraint described above.

The maxgap parameter has special meaning with the special overlap types. For start, end, and equal, it specifies the maximum difference in the starts, ends or both, respectively. For within, it is the maximum amount by which the subject may be wider than the query.

invert

If TRUE, keep only the query ranges that do not overlap the subject.

Value

constructor returns a RaggedExperiment object

'rowRanges' returns a GRanges object summarizing ranges corresponding to assay() rows.

'assays' returns a SimpleList

overlapsAny returns a logical vector of length equal to the number of rows in the query; TRUE when the copy number region overlaps the subject.

subsetByOverlaps returns a RaggedExperiment containing only copy number regions overlapping subject.

Methods (by generic)

Constructors

RaggedExperiment(..., colData=DataFrame()): Creates a RaggedExperiment object using multiple GRanges objects or a list of GRanges objects. Additional column data may be provided as a DataFrame object.

Subsetting

In the following, 'x' represents a RaggedExperiment object:

x[i, j]: Get ranges or elements (i and j, respectively) with optional metadata columns where i or j can be missing, an NA-free logical, numeric, or character vector.

Coercion

Coercion possible from RangedRaggedAssay to RaggedExperiment. Here object represents a RangedRaggedAssay: as(object, "RaggedExperiment")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Create an empty RaggedExperiment instance
re0 <- RaggedExperiment()
re0

## Create a couple of GRanges objects with row ranges names
sample1 <- GRanges(
    c(a = "chr1:1-10:-", b = "chr1:11-18:+"),
    score = 1:2)
sample2 <- GRanges(
    c(c = "chr2:1-10:-", d = "chr2:11-18:+"),
    score = 3:4)

## Include column data
colDat <- DataFrame(id = 1:2)

## Create a RaggedExperiment object from a couple of GRanges
re1 <- RaggedExperiment(sample1=sample1, sample2=sample2, colData = colDat)
re1

## With list of GRanges
lgr <- list(sample1 = sample1, sample2 = sample2)

## Create a RaggedExperiment from a list of GRanges
re2 <- RaggedExperiment(lgr, colData = colDat)

grl <- GRangesList(sample1 = sample1, sample2 = sample2)

## Create a RaggedExperiment from a GRangesList
re3 <- RaggedExperiment(grl, colData = colDat)

## Subset a RaggedExperiment
assay(re3[c(1, 3),])
subsetByOverlaps(re3, GRanges("chr1:1-5"))  # by ranges

Bioconductor-mirror/RaggedExperiment documentation built on Aug. 10, 2017, 10:44 a.m.