plot_enrichments: Enrichment plots

Description Usage Arguments Value Examples

View source: R/plot_enrichments.R

Description

Function to plot enrichments from ChIP-seq/ATAC-seq at genomics regions either as an individual groups or as paired condition e.g untreated-treated

Usage

1
2
3
plot_enrichments(enrichments_df = NULL, log_transform = TRUE,
  plot_type = "separate", sample_metadata, box_alpha = 0.8,
  violin_alpha = 0.8, x_order = NULL, overlap_order = NULL)

Arguments

enrichments_df

enrichments at genomics regions from all samples, as in the format of output from multiBigwig_summary

log_transform

logical. Should the data be log2 transformed? Default is TRUE

plot_type

either separate or overlap

sample_metadata

metadata associated with the columns present in enrichments_df, information in this table will be used depending on the option in plot_type

box_alpha

alpha/transparency to use for box plots, default 0.8

violin_alpha

alpha/transparecny to use for violin plots, default 0.8

x_order

ordering of levels on x-axis in resulting plot, default NULL

overlap_order

ordering of overlaying if plot_type = 'overlap'. E.g. overlaying treatment data on top of untreated data, default NULL

Value

ggplot2 object

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
## load example data
chr21_data_table <- system.file('extdata/bw', 'ALPS_example_datatable.txt', package = 'ALPS', mustWork = TRUE)

## attach path to bw_path and bed_path
d_path <- dirname(chr21_data_table)

chr21_data_table <- read.delim(chr21_data_table, header = TRUE)
chr21_data_table$bw_path <- paste0(d_path, '/', chr21_data_table$bw_path)
chr21_data_table$bed_path <- paste0(d_path, '/', chr21_data_table$bed_path)

enrichments <- multiBigwig_summary(data_table = chr21_data_table,
                                   summary_type = 'mean',
                                   parallel = TRUE)

## plot_type == 'separate'
plot_enrichments(enrichments_df = enrichments, log_transform = TRUE,
plot_type = 'separate', sample_metadata = chr21_data_table)

## plot_type == 'overlap'
enrichemnts_4_overlapviolins <- system.file('extdata/overlap_violins', 'enrichemnts_4_overlapviolins.txt', package = 'ALPS', mustWork = TRUE)
enrichemnts_4_overlapviolins <- read.delim(enrichemnts_4_overlapviolins, header = TRUE)

## metadata associated with above enrichments
data_table_4_overlapviolins <- system.file('extdata/overlap_violins', 'data_table_4_overlapviolins.txt', package = 'ALPS', mustWork = TRUE)
data_table_4_overlapviolins <- read.delim(data_table_4_overlapviolins, header = TRUE)

plot_enrichments(enrichments_df = enrichemnts_4_overlapviolins, log_transform = FALSE,
plot_type = 'overlap', sample_metadata = data_table_4_overlapviolins)

itsvenu/ALPS documentation built on Nov. 4, 2019, 2:13 p.m.