makeMetageneDataFrame: Compute Metagenes for Lists of Samples and Gene Sets

Description Usage Arguments Value See Also Examples

View source: R/makeMetageneDataFrame.R

Description

This function takes a list of data sets stratified by samples and gene sets. It computes the metagene for each gene set in each sample, and returns a data.frame suitable for ggplot2::ggplot().

Usage

1
makeMetageneDataFrame(list, assay.type = "matrix")

Arguments

list

A named list of lists of SummarizedExperiment objects. Each item in the top-most list is a named sample (e.g. "replicate1"). Each item within each sublist is a named gene set (e.g. "upregulated"). Each SummarizedExperiment object stores matrix of histone modification enrichment, with colnames indicating the index or coordinate of bins used to compute enrichment.

assay.type

Name the assay to average between all samples.

Value

A data.frame with columns named:

See Also

importDeeptoolsExperiment

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
# Set the plotting environment ----

library(ggplot2)
library(cowplot)
theme_set(theme_cowplot())

# Prepare example data ----

sample_names <- c("A", "B", "C")

se_list <- generateDeeptoolsExperiments(20, 10, sample_names)
se_list

# Split each sample into gene subsets ----

range_sets <- list(set1=c("GR_1"), set2=c("GR_2", "GR_3"))
se_list_list <- lapply(se_list, splitByGeneSet, range_sets)

# Usage ----

x <- makeMetageneDataFrame(se_list_list)

ggplot(x, aes(position, metagene, color=geneset)) +
    geom_line(aes(group=interaction(geneset, sample))) +
    geom_point() +
    facet_wrap(~sample, ncol=1)

kevinrue/deeperTools documentation built on Feb. 28, 2020, 7:45 p.m.