| plot_correlation {ALPS} | R Documentation |
Function to calculate correlations of ChIP/ATAC-seq
enrichment among replicates/samples or groups.
The function is compatible with the output of
multiBigwig_summary or any custom data.frame
with the similar format.
plot_correlation(enrichments_df, log_transform = TRUE, method = "pearson", plot_type = "replicate_level", sample_metadata, ...)
enrichments_df |
dataframe of enrichments, usually in the form of the output from function |
log_transform |
logical, whether to log2 transform |
method |
method to calculate correlation coefficient, one of |
plot_type |
whether to plot |
sample_metadata |
a data.frame required if |
... |
additional arguments either to |
corrplot or ggplot2 object
## load example data
## 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)
## replicate_level correlation plot
plot_correlation(enrichments_df = enrichments,
log_transform = TRUE, plot_type = 'replicate_level',
sample_metadata = chr21_data_table)
## group_level correlation plot
plot_correlation(enrichments_df = enrichments,
log_transform = TRUE, plot_type = 'group_level',
sample_metadata = chr21_data_table)