XGR_enrichment_plot: Plot enrichment results

View source: R/XGR_enrichment_plot.R

XGR_enrichment_plotR Documentation

Plot enrichment results

Description

Plot enrichment results from XGR annotations.

Usage

XGR_enrichment_plot(
  enrich_res,
  title = NULL,
  subtitle = NULL,
  facet_formula = NULL,
  line_formula = "y ~ x",
  line_method = "lm",
  line_span = 1,
  FDR_thresh = 1,
  plot_type = "bar",
  shape_var = "Cell_type",
  facet_scales = "free",
  show_plot = TRUE,
  save_plot = FALSE,
  height = 5,
  width = 5,
  dpi = 300
)

Arguments

dpi

Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types.

See Also

Other XGR: XGR_enrichment_bootstrap(), XGR_enrichment(), XGR_filter_assays(), XGR_filter_sources(), XGR_import_annotations(), XGR_iterate_enrichment(), XGR_iterate_overlap(), XGR_merge_and_process(), XGR_parse_metadata(), XGR_plot_enrichment(), XGR_prepare_foreground_background(), XGR_query(), XGR_sep_handler(), xgr_example

Examples

## Not run: 
root <- file.path(
    "/sc/arion/projects/pd-omics/brian",
    "Fine_Mapping/Data/GWAS/Nalls23andMe_2019/_genome_wide"
)
### merged enrichment results
enrich_res <- data.table::fread(
    file.path(
        root,
        "XGR/celltypespecific_epigenomics.SNP_groups.csv.gz"
    )
)
enrich_res <- data.table::fread(
    file.path(
        root,
        "XGR/celltypespecific_epigenomics.snp_groups.csv.gz"
    )
)
enrich_boot <- data.table::fread(
    file.path(
        root,
        "XGR/celltypespecific_epigenomics.snp_groups.permute.csv.gz"
    )
)
enrich_assay <- data.table::fread(
    file.path(
        root,
        "XGR/celltypespecific_epigenomics.snp_groups.assay.csv.gz"
    )
)

# Merged volcano plot
enrich_res <- subset(enrich_res, SNP_Group != "Consensus (-PolyFun)") |>
    dplyr::rename(SNP_group = SNP_Group)
gp <- XGR_enrichment_plot(
    enrich_res = subset(enrich_res, !Assay %in% c("HiChIP_FitHiChIP", "PLAC")),
    title = "Enrichment: Cell-type-specific epigenomics",
    plot_type = "point",
    save_plot = file.path(
        root, "XGR/celltypespecific_epigenomics.enrich_volcano.png"
    ),
    height = 6, width = 8, shape_var = "Assay"
)
## Merged bar plot
gp <- XGR_enrichment_plot(
    enrich_res = enrich_res,
    plot_type = "bar",
    facet_formula = ".~Assay",
    FDR_thresh = .05
)
# Merged volcano plot (permuted)
gp <- XGR_enrichment_plot(
    enrich_res = enrich.scATAC.permute,
    title = "Permuted enrichment: Cell-type-specific peaks and elements",
    plot_type = "point"
)

## End(Not run)

RajLabMSSM/echoannot documentation built on Oct. 26, 2023, 2:41 p.m.