Skip to contents

Visualises the result from get_df_enrichment for a single motif by producing a plotly bar plot with the motif enrichment comparisons for all the comparison dataset pair.

Usage

plot_enrichment_overall(
  enrichment_df,
  motif_i,
  label_colours,
  reference_label,
  html_tags = TRUE
)

Arguments

enrichment_df

A data frame containing the motif enrichment results, produced using get_df_enrichment.

motif_i

The index of the motif to plot.

label_colours

A vector with colours (valid names or hex codes) to use for "No" and "Yes" bar segments.

reference_label

The label of the reference experiment.

html_tags

Logical. If TRUE, returns the plot as a tagList object.

Value

A list of plotly objects with the peak motif enrichment data. If html_tags is TRUE, the function returns a list of tagList objects instead. The two plots in the list are named as follows:

$count_plt

y-axis represents the number of peaks.

$perc_plt

y-axis represents the percentage of peaks.

See also

Examples

data("CTCF_ChIP_peaks", package = "MotifPeeker")
data("CTCF_TIP_peaks", package = "MotifPeeker")
data("motif_MA1102.3", package = "MotifPeeker")
data("motif_MA1930.2", package = "MotifPeeker")
input <- list(
    peaks = list(CTCF_ChIP_peaks, CTCF_TIP_peaks),
    exp_type = c("ChIP", "TIP"),
    exp_labels = c("CTCF_ChIP", "CTCF_TIP"),
    read_count = c(150, 200),
    peak_count = c(100, 120)
)
segregated_input <- segregate_seqs(input$peaks[[1]], input$peaks[[2]])
motifs <- list(
    motifs = list(motif_MA1930.2, motif_MA1102.3),
    motif_labels = list("MA1930.2", "MA1102.3")
)
    
# \donttest{
    if (requireNamespace("BSgenome.Hsapiens.UCSC.hg38")) {
        genome_build <-
            BSgenome.Hsapiens.UCSC.hg38::BSgenome.Hsapiens.UCSC.hg38
        enrichment_df <- get_df_enrichment(
            input, segregated_input, motifs, genome_build,
            reference_index = 1, workers = 1
        )
        label_colours <- c("red", "cyan")
    
        plt <- plot_enrichment_overall(
        enrichment_df, motif_i = 1, label_colours = label_colours,
        reference_label = "CTCF_ChIP", html_tags = FALSE
        )
        print(plt$count_plot)
        print(plt$perc_plot)
    }
#> NULL
#> NULL
# }