prepareSummarizedExperiment: Prepare Summarized Experiment

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/prepareSummarizedExperiment.R

Description

This is a utility wrapper for SummarizedExperiment::SummarizedExperiment() that provides automatic subsetting for row and column data. It also provides automatic handling of FASTA spike-ins.

Usage

1
2
prepareSummarizedExperiment(assays, rowRanges = NULL, colData = NULL,
  metadata = NULL, transgeneNames = NULL, spikeNames = NULL)

Arguments

assays

Required. List containing RNA-seq count matrices with matching dimensions. Counts can be passed in either dense (matrix) or sparse (dgCMatrix, dgTMatrix) format.

rowRanges

Optional. GRanges describing assay rows. Must contain genomic ranges. Can be left NULL if the genome is poorly annotated and/or ranges aren't available from AnnotationHub.

colData

Optional. DataFrame data.frame, or matrix describing assay columns.

metadata

Optional. Metadata list.

transgeneNames

character vector indicating which assay() rows denote transgenes (e.g. EGFP, TDTOMATO).

spikeNames

character vector indicating which assay() rows denote spike-in sequences (e.g. ERCCs).

Details

This function also provides automatic metadata slotting of multiple useful environment parameters:

Value

RangedSummarizedExperiment.

Author(s)

Michael Steinbaugh

See Also

Other Prepare Functions: prepareTemplate

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
39
40
41
42
43
44
45
46
47
48
49
50
51
genes <- c(
    "EGFP",  # transgene
    "gene1",
    "gene2",
    "gene3"
)
samples <- c(
    "sample1",
    "sample2",
    "sample3",
    "sample4"
)

# Example matrix
mat <- matrix(
    seq(1L:16L),
    nrow = 4L,
    ncol = 4L,
    dimnames = list(genes, samples)
)

# Primary assay must be named "counts"
assays = list("counts" = mat)

# rowRanges won't contain transgenes or spike-ins
rowRanges <- GRanges(
    seqnames = c("1", "1", "1"),
    ranges = IRanges(
        start = c(1L, 101L, 201L),
        end = c(100L, 200L, 300L)
    )
)
names(rowRanges) <- c("gene1", "gene2", "gene3")

colData <- data.frame(
    "genotype" = c(
        "wildtype",
        "wildtype",
        "knockout",
        "knockout"
    ),
    "age" = c(3L, 6L, 3L, 6L),
    row.names = samples
)

prepareSummarizedExperiment(
    assays = assays,
    rowRanges = rowRanges,
    colData = colData,
    transgeneNames = "EGFP"
)

hbc/bcbioBase documentation built on July 10, 2018, 3:50 p.m.