--- title: "6. Edge-ORA" author: "Zhesi Zhang, Xin Lai" date: "`r Sys.Date()`" package: miREA output: BiocStyle::html_document: toc: true toc_float: true vignette: > %\VignetteIndexEntry{6. Edge-ORA} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>") ``` # Overview `Edge_ORA()` performs miRNA gene interaction (MGI) enrichment analysis by testing the overlap between a set of differentially expressed MGIs and each pathway's MGI set. The pathway MGI set is generated by linking the pathway gene set to `background_MGI`. This is an edge based method, and unlike the `TG_` and `MiR_` methods it operates on miRNA to gene pairs rather than miRNAs or genes alone. This is a standard over-representation analysis, built on `r BiocStyle::Biocpkg("clusterProfiler")`'s `enricher()`. This vignette uses the same toy BLCA example data as the package's main Quick Start vignette. See `vignette("miREA")` for a description of that data and for running all nine methods together through `miREA()`. # Required inputs * `pathway`, a two column data frame with columns `pathway` and `gene`. * `mir_DEdata`, a four column data frame with columns `miRNA`, `log2FoldChange`, `stat`, and `padj`. * `gene_DEdata`, a four column data frame with columns `gene`, `log2FoldChange`, `stat`, and `padj`. * `mir_mat` and `gene_mat`, raw expression matrices with samples as columns, used to correlate miRNA and gene expression within the tumor samples and flag DEMGI pairs. * `background_MGI`, a two column data frame with columns `miRNA` and `gene`, or `NULL` to use the bundled default (see `vignette("miREA")`, Step 1, for details on `background_MGI`). * `background` for `Edge_ORA()` itself, a character vector of background MGIs formatted as `[miRNA]:[gene]`. ```{r load-data} library(miREA) data(toy_pathway) data(toy_mir_DEdata) data(toy_gene_DEdata) data(toy_gene_mat) data(toy_mir_mat) data(background_MGI) ``` # Run Edge-ORA ```{r prepare-input} input_data <- getAllInputData( methods = "Edge_ORA", pathway = toy_pathway, mir_DEdata = toy_mir_DEdata, gene_DEdata = toy_gene_DEdata, background_MGI = background_MGI, gene_mat = toy_gene_mat, mir_mat = toy_mir_mat ) ``` `input_data$data$Edge_ORA` holds the differentially expressed MGIs, built by `getAllInputData()` from correlating `toy_gene_mat` and `toy_mir_mat` expression within the tumor samples. `input_data$pathway$Edge` holds the pathway MGI sets, derived from `toy_pathway`'s genes through `background_MGI`. ```{r run-edge-ora} background <- unique(paste0(background_MGI$miRNA, ":", background_MGI$gene)) res <- Edge_ORA( DEMGI = input_data$data$Edge_ORA, background = background, pathway = input_data$pathway$Edge, pvalueCutoff = 1 ) head(res) ``` # Run through miREA() `Edge_ORA()` can also be run through the `miREA()` wrapper, which is useful when you want its result alongside other methods' results in a single `miREAResult` object (see `vignette("miREA")`, Step 2, for the multi-method case). For a single target, `background` can be a plain character vector instead of a named list. ```{r run-through-miREA} result <- miREA( methods = "Edge_ORA", input_data = input_data, background = background, pvalueCutoff = 1 ) head(result$result$Edge_ORA) ``` # Supplying your own MGI list If you already have a list of differentially expressed MGIs from an external analysis instead of letting `getAllInputData()` derive one from expression and differential expression data, call `Edge_ORA()` directly with that list and `input_data$pathway$Edge`. `DEMGI` must be a character vector formatted as `[miRNA]:[gene]`. ```{r custom-list, eval=FALSE} # replace with your own MGI list my_DEMGI <- c("hsa-miR-21-5p:TP53", "hsa-miR-155-5p:MYC") res_custom <- Edge_ORA( DEMGI = my_DEMGI, background = background, pathway = input_data$pathway$Edge, pvalueCutoff = 1 ) ``` # Session info ```{r session-info} sessionInfo() ```