diff --git a/DESCRIPTION b/DESCRIPTION index a8fe1ab..164035d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ALPS Title: AnaLysis routines for ePigenomicS data -Version: 0.99.9 +Version: 0.100.1 Author: Venu Thatikonda, Natalie Jäger Maintainer: Venu Thatikonda Description: The package provides analysis and publication quality visualization routines for genome-wide @@ -12,7 +12,7 @@ Description: The package provides analysis and publication quality visualization License: MIT + file LICENSE Encoding: UTF-8 LazyData: false -RoxygenNote: 6.1.1 +RoxygenNote: 7.2.3 Depends: R (>= 3.6) Imports: assertthat, @@ -39,6 +39,7 @@ Imports: tidyr, TxDb.Hsapiens.UCSC.hg19.knownGene, TxDb.Hsapiens.UCSC.hg38.knownGene, + TxDb.Mmusculus.UCSC.mm10.knownGene, utils URL: https://github.com/itsvenu/ALPS BugReports: https://github.com/itsvenu/ALPS/issues diff --git a/NAMESPACE b/NAMESPACE index d493029..d4d37f7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,6 +18,7 @@ export(process_transfac) import(corrplot) import(ggplot2) import(org.Hs.eg.db) +importFrom(AnnotationDbi,mapIds) importFrom(BiocParallel,bplapply) importFrom(ChIPseeker,annotatePeak) importFrom(GGally,ggpairs) @@ -26,8 +27,10 @@ importFrom(GenomicRanges,reduce) importFrom(Gviz,DataTrack) importFrom(Gviz,GeneRegionTrack) importFrom(Gviz,plotTracks) +importFrom(IRanges,ranges) importFrom(TxDb.Hsapiens.UCSC.hg19.knownGene,TxDb.Hsapiens.UCSC.hg19.knownGene) importFrom(TxDb.Hsapiens.UCSC.hg38.knownGene,TxDb.Hsapiens.UCSC.hg38.knownGene) +importFrom(TxDb.Mmusculus.UCSC.mm10.knownGene,TxDb.Mmusculus.UCSC.mm10.knownGene) importFrom(data.table,dcast) importFrom(data.table,fread) importFrom(dplyr,filter) @@ -42,6 +45,8 @@ importFrom(genefilter,rowVars) importFrom(gghalves,geom_half_violin) importFrom(ggseqlogo,ggseqlogo) importFrom(magrittr,"%>%") +importFrom(org.Hs.eg.db,org.Hs.eg.db) +importFrom(org.Mm.eg.db,org.Mm.eg.db) importFrom(reshape2,melt) importFrom(rtracklayer,BigWigFileList) importFrom(rtracklayer,summary) diff --git a/NEWS b/NEWS index 2d9234e..f279909 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +VERSION 0.100.0 +-------------- + * Added support for mm10 + VERSION 0.99.8 -------------- * Bioc review fixes @@ -9,4 +13,3 @@ VERSION 0.99.7 VERSION 0.99.0 -------------- * FIRST RELEASE - diff --git a/R/get_genomic_annotations.R b/R/get_genomic_annotations.R index 29199a8..26be8b9 100644 --- a/R/get_genomic_annotations.R +++ b/R/get_genomic_annotations.R @@ -59,7 +59,7 @@ merge_GR <- function(x) { #' #' @param data_table a data.frame of sample table, as is for #' \code{multiBigwig_summary} input table, default NULL -#' @param ref_gen reference genome, either \code{hg38 or hg19}, +#' @param ref_gen reference genome, either \code{hg38, mm10 or hg19}, #' default \code{hg38} #' @param tss_region bp ± TSS to define promoter regions #' @param merge_level either \code{all, group_level} or \code{none}. @@ -71,6 +71,7 @@ merge_GR <- function(x) { #' #' @importFrom TxDb.Hsapiens.UCSC.hg38.knownGene TxDb.Hsapiens.UCSC.hg38.knownGene #' @importFrom TxDb.Hsapiens.UCSC.hg19.knownGene TxDb.Hsapiens.UCSC.hg19.knownGene +#' @importFrom TxDb.Mmusculus.UCSC.mm10.knownGene TxDb.Mmusculus.UCSC.mm10.knownGene #' @importFrom dplyr filter pull #' @importFrom ChIPseeker annotatePeak #' @importFrom data.table dcast @@ -100,10 +101,10 @@ get_genomic_annotations <- function(data_table, ## check ref_gen if (ref_gen == "hg38") { - txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene::TxDb.Hsapiens.UCSC.hg38.knownGene + } else if (ref_gen == "mm10") { + txdb <- TxDb.Mmusculus.UCSC.mm10.knownGene::TxDb.Mmusculus.UCSC.mm10.knownGene } else { - txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene::TxDb.Hsapiens.UCSC.hg19.knownGene } diff --git a/R/plot_browser_tracks.R b/R/plot_browser_tracks.R index 174fb15..0dfbd50 100644 --- a/R/plot_browser_tracks.R +++ b/R/plot_browser_tracks.R @@ -1,15 +1,15 @@ getChrStartEnd <- function(x) { - - x_chr <- gsub(":.*", "", x) %>% as.character() - x_start <- gsub(".*:", "", x) %>% gsub("-.*", - "", .) %>% as.numeric() - x_end <- gsub(".*:", "", x) %>% gsub(".*-", - "", .) %>% as.numeric() - - x_res <- list(chr = x_chr, from = x_start, - to = x_end) - - return(x_res) + + x_chr <- gsub(":.*", "", x) %>% as.character() + x_start <- gsub(".*:", "", x) %>% gsub("-.*", + "", .) %>% as.numeric() + x_end <- gsub(".*:", "", x) %>% gsub(".*-", + "", .) %>% as.numeric() + + x_res <- list(chr = x_chr, from = x_start, + to = x_end) + + return(x_res) } #' UCSC Genome browser like plots @@ -21,15 +21,20 @@ getChrStartEnd <- function(x) { #' #' @param data_table a dataframe that contains \code{bw_path}, \code{sample_id} and \code{color_code}. Tracks are colored according to \code{color_code}. Default \code{NULL} #' @param gene_range genomic region for which browser-like plots needed in format \code{chr:start-end}. Default \code{NULL} -#' @param ref_gen reference genome, to get gene annotations, currently supports \code{hg19} and \code{hg38}. Default, \code{hg38} +#' @param ref_gen reference genome, to get gene annotations, currently supports \code{hg19} \code{mm10} and \code{hg38}. Default, \code{hg38} #' @param cex.axis axis label size, default \code{0.5} #' @param cex.title axis title size, default \code{0.8} #' @param ... additional arguments to change the appearence of a plot. All arguments that can be passed to base R graphics are supported #' #' @importFrom TxDb.Hsapiens.UCSC.hg38.knownGene TxDb.Hsapiens.UCSC.hg38.knownGene #' @importFrom TxDb.Hsapiens.UCSC.hg19.knownGene TxDb.Hsapiens.UCSC.hg19.knownGene +#' @importFrom TxDb.Mmusculus.UCSC.mm10.knownGene TxDb.Mmusculus.UCSC.mm10.knownGene #' @importFrom dplyr filter pull #' @importFrom Gviz GeneRegionTrack DataTrack plotTracks +#' @importFrom org.Mm.eg.db org.Mm.eg.db +#' @importFrom org.Hs.eg.db org.Hs.eg.db +#' @importFrom IRanges ranges +#' @importFrom AnnotationDbi mapIds #' #' @return plot of genome browser tracks #' @@ -58,67 +63,80 @@ plot_browser_tracks <- function(data_table, ref_gen = "hg38", cex.axis = 0.5, cex.title = 0.8, ...) { - - assertthat::assert_that(is.data.frame(data_table), msg = "Please provide `data_table`") - assertthat::assert_that(assertthat::has_name(data_table, "bw_path")) - assertthat::assert_that(assertthat::has_name(data_table, "sample_id")) - assertthat::assert_that(assertthat::has_name(data_table, "color_code")) - - assertthat::assert_that(!is.null(gene_range), msg = "Please provide `gene_range` in format; chr:start-end") - - gene_range_split <- getChrStartEnd(x = gene_range) - - ## build genetrack - if (ref_gen == "hg38") { - - txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene::TxDb.Hsapiens.UCSC.hg38.knownGene - - } else { - - txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene::TxDb.Hsapiens.UCSC.hg19.knownGene - } - - ## - grtrack <- Gviz::GeneRegionTrack(txdb, - genome = ref_gen, - chromosome = gene_range_split$chr, - window = -1, name = NULL, background.title = "white", - col.frame = "white", col.axis = "black", - col = "black", col.title = "black", - geneSymbol = TRUE, showId = TRUE, - from = gene_range_split$from, to = gene_range_split$to) - - ## build enrichment tracks - dt_list <- list() - all_sample_ids <- data_table$sample_id %>% - as.character() - - for (i in seq_along(all_sample_ids)) { - - x_id <- all_sample_ids[i] - x_dat <- data_table %>% dplyr::filter(sample_id == get("x_id")) - - x_bw <- x_dat %>% dplyr::pull(bw_path) %>% as.character() - x_col <- x_dat %>% dplyr::pull(color_code) %>% as.character() - - x_dt <- Gviz::DataTrack(range = x_bw, - genome = ref_gen, - chromosome = gene_range_split$chr, - name = x_id, type = "hist", window = -1, - fill.histogram = x_col, col.histogram = "NA", - background.title = "white", col.frame = "white", - col.axis = "black", col = "black", - col.title = "black") - - dt_list[[i]] <- x_dt - - } - - gtrack_pos <- length(dt_list) + 1 - dt_list[[gtrack_pos]] <- grtrack - - Gviz::plotTracks(dt_list, from = gene_range_split$from, - to = gene_range_split$to, cex.axis = cex.axis, - cex.title = cex.title, ...) - + + assertthat::assert_that(is.data.frame(data_table), msg = "Please provide `data_table`") + assertthat::assert_that(assertthat::has_name(data_table, "bw_path")) + assertthat::assert_that(assertthat::has_name(data_table, "sample_id")) + assertthat::assert_that(assertthat::has_name(data_table, "color_code")) + + assertthat::assert_that(!is.null(gene_range), msg = "Please provide `gene_range` in format; chr:start-end") + + gene_range_split <- getChrStartEnd(x = gene_range) + + ## build genetrack + if (ref_gen == "hg38") { + txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene::TxDb.Hsapiens.UCSC.hg38.knownGene + symbol_db <- org.Hs.eg.db::org.Hs.eg.db + } else if (ref_gen == "mm10") { + txdb <- TxDb.Mmusculus.UCSC.mm10.knownGene::TxDb.Mmusculus.UCSC.mm10.knownGene + symbol_db <- org.Mm.eg.db::org.Mm.eg.db + } else { + txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene::TxDb.Hsapiens.UCSC.hg19.knownGene + symbol_db <- org.Hs.eg.db::org.Hs.eg.db + } + + ## + grtrack <- Gviz::GeneRegionTrack(txdb, + genome = ref_gen, + chromosome = gene_range_split$chr, + window = -1, name = NULL, background.title = "white", + col.frame = "white", col.axis = "black", + col = "black", col.title = "black", + geneSymbol = TRUE, showId = TRUE, + from = gene_range_split$from, to = gene_range_split$to, + collapseTranscripts="longest", shape="arrow", transcriptAnnotation = "symbol") + + # map gene symbol + gene_ids = IRanges::ranges(grtrack) + gene_symbols <- AnnotationDbi::mapIds(symbol_db, keys=gene_ids$gene, column = "SYMBOL", keytype = "ENTREZID", multiVals = "first") + gene_symbols[is.na(names(gene_symbols))] <- gene_ids$transcript[is.na(names(gene_symbols))] + gene_ids$symbol <- gene_symbols + IRanges::ranges(grtrack) <- gene_ids + + ## build enrichment tracks + dt_list <- list() + all_sample_ids <- data_table$sample_id %>% + as.character() + + axisTrack <- Gviz::GenomeAxisTrack() + atrack <- length(dt_list)+1 + dt_list[[atrack]] <- axisTrack + + for (i in seq_along(all_sample_ids)) { + + x_id <- all_sample_ids[i] + x_dat <- data_table %>% dplyr::filter(sample_id == get("x_id")) + + x_bw <- x_dat %>% dplyr::pull(bw_path) %>% as.character() + x_col <- x_dat %>% dplyr::pull(color_code) %>% as.character() + + x_dt <- Gviz::DataTrack(range = x_bw, + genome = ref_gen, + chromosome = gene_range_split$chr, + name = gsub("_", " ", x_id), type = "hist", window = -1, + fill.histogram = x_col, col.histogram = "NA", + background.title = "white", col.frame = "white", + col.axis = "black", col = "black", + col.title = "black") + + dt_list[[i+1]] <- x_dt + + } + + gtrack_pos <- length(dt_list) + 1 + dt_list[[gtrack_pos]] <- grtrack + + Gviz::plotTracks(dt_list, from = gene_range_split$from, + to = gene_range_split$to, cex.axis = cex.axis, + cex.title = cex.title, ...) } diff --git a/R/plot_correlation.R b/R/plot_correlation.R index 2e7eb8e..8f9f0ce 100644 --- a/R/plot_correlation.R +++ b/R/plot_correlation.R @@ -10,6 +10,9 @@ #' @param log_transform logical, whether to log2 transform \code{enrichments_df} #' @param method method to calculate correlation coefficient, one of \code{'pearson'} (default), \code{'spearman'} or \code{'kendall'} #' @param plot_type whether to plot \code{replicate_level} correlations or \code{group_level} correlations. \code{replicate_level} plot represents the pairwise correlation values among all the samples/columns, where as the \code{group_level} plot is a paired plot of genomic regions after averaging of all samples in a group. Default \code{replicate_level} +#' @param select_var logical, whether to plot only a subset of columns from \code{enrichments_df}, if TRUE then colvar and rowvar must also be specified. Can also be used to change order of plotted variables. +#' @param colvar When \code{select_var} = TRUE, define the columns from \code{enrichments_df} that should be used as column variables in the correlation plot. Enter a single number, a range (e.g. 1:3), or selected columns (e.g. c(3,1,5)) +#' @param rowvar When \code{select_var} = TRUE, define the columns from \code{enrichments_df} that should be used as row variables in the correlation plot. Enter a single number, a range (e.g. 1:3), or selected columns (e.g. c(3,1,5)) #' @param sample_metadata a data.frame required if \code{plot_type = 'group_level'}. The data.frame must contain columns \code{sample_id} and \code{group} #' @param ... additional arguments either to \code{corrplot::corrplot} or \code{GGally::ggpairs} depending on arg \code{plot_type} #' @@ -55,79 +58,89 @@ plot_correlation <- function(enrichments_df, log_transform = TRUE, method = "pearson", plot_type = "replicate_level", + select_var=FALSE, + colvar, + rowvar, sample_metadata, ...) { - - assertthat::assert_that(length(colnames(enrichments_df)[-1:-3]) == length(sample_metadata$sample_id), - msg = "colnames in `enrichments_df` & sample_id in `sample_metadata` are not matching!") - - assertthat::assert_that(assertthat::has_name(enrichments_df, "chr")) - assertthat::assert_that(assertthat::has_name(enrichments_df, "start")) - assertthat::assert_that(assertthat::has_name(enrichments_df, "end")) - - enrichments_df <- enrichments_df %>% - dplyr::mutate(region = paste(chr, start, end, sep = "_")) %>% - dplyr::select(-c(chr, start, end)) %>% - tibble::column_to_rownames(var = "region") - - ## sanity check - length(colnames(enrichments_df)) == length(sample_metadata$sample_id) - - if (plot_type == "replicate_level") { - - if (log_transform) { - - enrichments_mat <- log2(enrichments_df + 1) - - } else { - - enrichments_mat <- enrichments_df - - } - - enrichments_cor <- cor(enrichments_mat, method = method) - - corrplot::corrplot(enrichments_cor, ...) - + + assertthat::assert_that(length(colnames(enrichments_df)[-1:-3]) == length(sample_metadata$sample_id), + msg = "colnames in `enrichments_df` & sample_id in `sample_metadata` are not matching!") + + assertthat::assert_that(assertthat::has_name(enrichments_df, "chr")) + assertthat::assert_that(assertthat::has_name(enrichments_df, "start")) + assertthat::assert_that(assertthat::has_name(enrichments_df, "end")) + + enrichments_df <- enrichments_df %>% + dplyr::mutate(region = paste(chr, start, end, sep = "_")) %>% + dplyr::select(-c(chr, start, end)) %>% + tibble::column_to_rownames(var = "region") + + ## sanity check + length(colnames(enrichments_df)) == length(sample_metadata$sample_id) + + if (plot_type == "replicate_level") { + + if (log_transform) { + + enrichments_mat <- log2(enrichments_df + 1) + } else { - - assertthat::assert_that(assertthat::has_name(sample_metadata, "sample_id")) - assertthat::assert_that(assertthat::has_name(sample_metadata, "group")) - - all_groups <- sample_metadata$group %>% - as.character %>% unique() - - .mean_fun <- function(x) { - - x_sampleids <- sample_metadata %>% - dplyr::filter(group == get("x")) %>% - dplyr::pull(sample_id) %>% - as.character() - - x_res <- enrichments_df %>% - dplyr::select(dplyr::one_of(x_sampleids)) %>% - rowMeans() %>% as.data.frame() %>% - dplyr::rename(`:=`(!!x, ".")) - - return(x_res) - } - - group_df <- lapply(all_groups, .mean_fun) %>% - as.data.frame() - - if (log_transform) { - - group_mat <- log2(group_df + 1) - } else { - - group_mat <- group_df - } - - ## paired plot - GGally::ggpairs(group_mat, ...) + - theme_minimal(base_size = 12) + - theme(axis.text = element_text(color = "black"), - strip.text = element_text(color = "black", size = 13), - panel.grid.minor = element_blank()) + + enrichments_mat <- enrichments_df + } - + + if (select_var) { + + enrichments_cor <- cor(enrichments_mat[rowvar], enrichments_mat[colvar], method = method) + + } else {enrichments_cor <- cor(enrichments_mat, enrichments_mat, method = method) + + } + + corrplot::corrplot(enrichments_cor, tl.col="black", tl.srt=45, + cl.pos="b", addrect=2, ...) + + } else { + + assertthat::assert_that(assertthat::has_name(sample_metadata, "sample_id")) + assertthat::assert_that(assertthat::has_name(sample_metadata, "group")) + + all_groups <- sample_metadata$group %>% + as.character %>% unique() + + .mean_fun <- function(x) { + + x_sampleids <- sample_metadata %>% + dplyr::filter(group == get("x")) %>% + dplyr::pull(sample_id) %>% + as.character() + + x_res <- enrichments_df %>% + dplyr::select(dplyr::one_of(x_sampleids)) %>% + rowMeans() %>% as.data.frame() %>% + dplyr::rename(`:=`(!!x, ".")) + + return(x_res) + } + + group_df <- lapply(all_groups, .mean_fun) %>% + as.data.frame() + + if (log_transform) { + + group_mat <- log2(group_df + 1) + } else { + + group_mat <- group_df + } + + ## paired plot + GGally::ggpairs(group_mat, upper=list(continuous=GGally::wrap("cor", size=7)), ...) + + theme_bw(base_size = 12) + + theme(strip.background=element_rect(colour="white", fill="white"), + strip.text = element_text(color="black", size=14), + panel.grid.minor = element_blank()) + } + } diff --git a/README.md b/README.md index 3c67fbb..b8c80a5 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,20 @@ -## ALPS - AnaLysis routines for ePigenomicS data +# ALPS - AnaLysis routines for ePigenomicS data -ALPS R/Bioconductor package provides tools for analysis of genome-wide epigenomics data. Please check Bioconductor webpage for manual. +ALPS R/Bioconductor package provides tools for analysis of genome-wide +epigenomics data. Please check Bioconductor webpage for manual. -#### Installation +## Installation -``` +```R if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("ALPS") ``` -#### ALPS workflow - -![](inst/figures/README-ALPS-overview.png) - -For questions, suggestions, please contact thatikonda92 [at] gmail [dot] com or [@nerd_yie](https://twitter.com/nerd_yie) - +## ALPS workflow +![ALPS workflow](inst/figures/README-ALPS-overview.png) +For questions, suggestions, please contact thatikonda92 [at] gmail [dot] com or +[@nerd_yie](https://twitter.com/nerd_yie). diff --git a/man/ALPS-package.Rd b/man/ALPS-package.Rd index 6d0be4a..d9f2b83 100644 --- a/man/ALPS-package.Rd +++ b/man/ALPS-package.Rd @@ -6,12 +6,7 @@ \alias{ALPS-package} \title{ALPS: AnaLysis routines for ePigenomicS data} \description{ -The package provides analysis and publication quality visualization routines for genome-wide - epigenomics data such as histone modification or transcription factor ChIP-seq, ATAC-seq, DNase-seq etc. - The functions in the package can be used with any type of data that can be represented with bigwig files - at any resolution. The goal of the ALPS is to provide analysis tools for most downstream analysis without - leaving the R environment and most tools in the package require a minimal input that can be prepared with - basic R, unix or excel skills. +The package provides analysis and publication quality visualization routines for genome-wide epigenomics data such as histone modification or transcription factor ChIP-seq, ATAC-seq, DNase-seq etc. The functions in the package can be used with any type of data that can be represented with bigwig files at any resolution. The goal of the ALPS is to provide analysis tools for most downstream analysis without leaving the R environment and most tools in the package require a minimal input that can be prepared with basic R, unix or excel skills. } \seealso{ Useful links: diff --git a/man/get_genomic_annotations.Rd b/man/get_genomic_annotations.Rd index b3c2422..125cb76 100644 --- a/man/get_genomic_annotations.Rd +++ b/man/get_genomic_annotations.Rd @@ -4,14 +4,18 @@ \alias{get_genomic_annotations} \title{Annotate genomic regions} \usage{ -get_genomic_annotations(data_table, ref_gen = "hg38", - tss_region = c(-1000, 1000), merge_level = "all") +get_genomic_annotations( + data_table, + ref_gen = "hg38", + tss_region = c(-1000, 1000), + merge_level = "all" +) } \arguments{ \item{data_table}{a data.frame of sample table, as is for \code{multiBigwig_summary} input table, default NULL} -\item{ref_gen}{reference genome, either \code{hg38 or hg19}, +\item{ref_gen}{reference genome, either \code{hg38, mm10 or hg19}, default \code{hg38}} \item{tss_region}{bp ± TSS to define promoter regions} diff --git a/man/get_variable_regions.Rd b/man/get_variable_regions.Rd index 108ba81..fbf2497 100644 --- a/man/get_variable_regions.Rd +++ b/man/get_variable_regions.Rd @@ -4,8 +4,12 @@ \alias{get_variable_regions} \title{Get variable regions} \usage{ -get_variable_regions(enrichments_df, log_transform = TRUE, - scale = TRUE, num_regions = 500) +get_variable_regions( + enrichments_df, + log_transform = TRUE, + scale = TRUE, + num_regions = 500 +) } \arguments{ \item{enrichments_df}{a data.frame o enrichments at genomic regions. Output of diff --git a/man/plot_browser_tracks.Rd b/man/plot_browser_tracks.Rd index 300f4d0..f91af7e 100644 --- a/man/plot_browser_tracks.Rd +++ b/man/plot_browser_tracks.Rd @@ -4,15 +4,21 @@ \alias{plot_browser_tracks} \title{UCSC Genome browser like plots} \usage{ -plot_browser_tracks(data_table, gene_range = NULL, ref_gen = "hg38", - cex.axis = 0.5, cex.title = 0.8, ...) +plot_browser_tracks( + data_table, + gene_range = NULL, + ref_gen = "hg38", + cex.axis = 0.5, + cex.title = 0.8, + ... +) } \arguments{ \item{data_table}{a dataframe that contains \code{bw_path}, \code{sample_id} and \code{color_code}. Tracks are colored according to \code{color_code}. Default \code{NULL}} \item{gene_range}{genomic region for which browser-like plots needed in format \code{chr:start-end}. Default \code{NULL}} -\item{ref_gen}{reference genome, to get gene annotations, currently supports \code{hg19} and \code{hg38}. Default, \code{hg38}} +\item{ref_gen}{reference genome, to get gene annotations, currently supports \code{hg19} \code{mm10} and \code{hg38}. Default, \code{hg38}} \item{cex.axis}{axis label size, default \code{0.5}} diff --git a/man/plot_correlation.Rd b/man/plot_correlation.Rd index 843d934..8157cab 100644 --- a/man/plot_correlation.Rd +++ b/man/plot_correlation.Rd @@ -4,9 +4,17 @@ \alias{plot_correlation} \title{Correlations among replicates/groups} \usage{ -plot_correlation(enrichments_df, log_transform = TRUE, - method = "pearson", plot_type = "replicate_level", sample_metadata, - ...) +plot_correlation( + enrichments_df, + log_transform = TRUE, + method = "pearson", + plot_type = "replicate_level", + select_var = FALSE, + colvar, + rowvar, + sample_metadata, + ... +) } \arguments{ \item{enrichments_df}{dataframe of enrichments, usually in the form of the output from function \code{\link{multiBigwig_summary}}, default \code{NULL}} @@ -17,6 +25,12 @@ plot_correlation(enrichments_df, log_transform = TRUE, \item{plot_type}{whether to plot \code{replicate_level} correlations or \code{group_level} correlations. \code{replicate_level} plot represents the pairwise correlation values among all the samples/columns, where as the \code{group_level} plot is a paired plot of genomic regions after averaging of all samples in a group. Default \code{replicate_level}} +\item{select_var}{logical, whether to plot only a subset of columns from \code{enrichments_df}, if TRUE then colvar and rowvar must also be specified. Can also be used to change order of plotted variables.} + +\item{colvar}{When \code{select_var} = TRUE, define the columns from \code{enrichments_df} that should be used as column variables in the correlation plot. Enter a single number, a range (e.g. 1:3), or selected columns (e.g. c(3,1,5))} + +\item{rowvar}{When \code{select_var} = TRUE, define the columns from \code{enrichments_df} that should be used as row variables in the correlation plot. Enter a single number, a range (e.g. 1:3), or selected columns (e.g. c(3,1,5))} + \item{sample_metadata}{a data.frame required if \code{plot_type = 'group_level'}. The data.frame must contain columns \code{sample_id} and \code{group}} \item{...}{additional arguments either to \code{corrplot::corrplot} or \code{GGally::ggpairs} depending on arg \code{plot_type}} diff --git a/man/plot_enrichments.Rd b/man/plot_enrichments.Rd index 1059151..21c3b89 100644 --- a/man/plot_enrichments.Rd +++ b/man/plot_enrichments.Rd @@ -4,9 +4,16 @@ \alias{plot_enrichments} \title{Enrichment plots} \usage{ -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) +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{ \item{enrichments_df}{enrichments at genomics regions from all samples, as in the format of output from \code{\link{multiBigwig_summary}}}