subsetBy: Subsetting a MultiAssayExperiment object

Description Usage Arguments Details Examples

Description

A set of functions for extracting and dividing a MultiAssayExperiment

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
44
45
46
47
48
49
50
51
52
53
54
55
subsetByRow(x, y, ...)

subsetByColData(x, y)

subsetByColumn(x, y)

subsetByAssay(x, y)

## S4 method for signature 'ExperimentList,ANY'
subsetByRow(x, y, ...)

## S4 method for signature 'ExperimentList,list'
subsetByRow(x, y)

## S4 method for signature 'ExperimentList,List'
subsetByRow(x, y)

## S4 method for signature 'ExperimentList,logical'
subsetByRow(x, y)

## S4 method for signature 'ExperimentList,list'
subsetByColumn(x, y)

## S4 method for signature 'ExperimentList,List'
subsetByColumn(x, y)

## S4 method for signature 'ExperimentList,logical'
subsetByColumn(x, y)

## S4 method for signature 'ExperimentList'
subsetByAssay(x, y)

## S4 method for signature 'MultiAssayExperiment,ANY'
subsetByColData(x, y)

## S4 method for signature 'MultiAssayExperiment,character'
subsetByColData(x, y)

## S4 method for signature 'MultiAssayExperiment,ANY'
subsetByRow(x, y, ...)

## S4 method for signature 'MultiAssayExperiment,ANY'
subsetByColumn(x, y)

## S4 method for signature 'MultiAssayExperiment'
subsetByAssay(x, y)

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

## S4 method for signature 'MultiAssayExperiment,ANY,ANY'
x[[i, j, ...]]

## S4 replacement method for signature 'MultiAssayExperiment,ANY,ANY'
x[[i, j, ...]] <- value

Arguments

x

A MultiAssayExperiment or ExperimentList

y

Any argument used for subsetting, can be a character, logical, integer, list or List vector

...

Additional arguments passed on to lower level functions.

i

Either a character, integer, logical or GRanges object for subsetting by rows

j

Either a character, logical, or numeric vector for subsetting by colData rows. See details for more information.

k

Either a character, logical, or numeric vector for subsetting by assays

drop

logical (default TRUE) whether to drop empty assay elements in the ExperimentList

value

An assay compatible with the MultiAssayExperiment API

Details

Subsetting a MultiAssayExperiment by the j index can yield a call to either subsetByColData or subsetByColumn. For vector inputs, the subset will be applied to the colData rows. For List-type inputs, the List will be applied to each of the elements in the ExperimentList. The order of the subsetting elements in the List must match that of the ExperimentList in the MultiAssayExperiment.

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
34
35
36
37
38
## Load the example MultiAssayExperiment
example("MultiAssayExperiment")

## Using experiment names
subsetByAssay(myMultiAssayExperiment, "Affy")

## Using numeric indices
subsetByAssay(myMultiAssayExperiment, 1:2)

## Using a logical vector
subsetByAssay(myMultiAssayExperiment, c(TRUE, FALSE, TRUE))

## Subset by character vector (Jack)
subsetByColData(myMultiAssayExperiment, "Jack")

## Subset by numeric index of colData rows (Jack and Bob)
subsetByColData(myMultiAssayExperiment, c(1, 3))

## Subset by logical indicator of colData rows (Jack and Jill)
subsetByColData(myMultiAssayExperiment, c(TRUE, TRUE, FALSE, FALSE))

subsetByColumn(myMultiAssayExperiment, list(Affy = 1:2,
    Methyl450k = c(3,5,2), RNASeqGene = 2:4, GISTIC = 1))

subsetWith <- S4Vectors::mendoapply(`[`, colnames(myMultiAssayExperiment),
    MoreArgs = list(1:2))
subsetByColumn(myMultiAssayExperiment, subsetWith)

## Use a GRanges object to subset rows where ranged data present
egr <- GenomicRanges::GRanges(seqnames = "chr2",
    IRanges::IRanges(start = 11, end = 13), strand = "-")
subsetByRow(myMultiAssayExperiment, egr)

## Use a logical vector (recycling used)
subsetByRow(myMultiAssayExperiment, c(TRUE, FALSE))

## Use a character vector
subsetByRow(myMultiAssayExperiment, "ENST00000355076")

vjcitn/MultiAssayExperiment documentation built on Dec. 30, 2017, 4:33 a.m.