--- title: "7. Edge-Score1D" author: "Zhesi Zhang, Xin Lai" date: "`r Sys.Date()`" package: miREA output: BiocStyle::html_document: toc: true toc_float: true vignette: > %\VignetteIndexEntry{7. Edge-Score1D} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>") ``` # Overview `Edge_Score1D()` performs miRNA gene interaction (MGI) enrichment analysis by testing whether a pathway's MGIs are located unexpectedly toward one end of a ranked MGI list. Unlike `Edge_Score2D()`, `Edge_Topology()`, and `Edge_Network()`, `Edge_Score1D()` does not implement its own permutation loop and has no `iter` or `seed` argument. It is a GSEA style test, delegated entirely to `r BiocStyle::Biocpkg("clusterProfiler")`'s `GSEA()`, which performs its own permutation based significance testing internally. 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 three column data frame with columns `pathway`, `miRNA`, 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 score each MGI. * `scoreFun`, the transform applied to the correlation and differential expression values when building the ranked MGI score, for example `"rank"`. * `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`). ```{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-Score1D ```{r prepare-input} input_data <- getAllInputData( methods = "Edge_Score1D", 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, scoreFun = "rank" ) ``` `input_data$data$Edge_Score1D` holds the ranked MGI list, built by `getAllInputData()` from correlating `toy_gene_mat` and `toy_mir_mat` expression and transforming the result with `scoreFun`. `input_data$pathway$Edge` holds the pathway MGI sets, derived from `toy_pathway`'s genes through `background_MGI`. ```{r run-edge-score1d} res <- Edge_Score1D( MGIList = input_data$data$Edge_Score1D, pathway = input_data$pathway$Edge, pvalueType = "neg", pvalueCutoff = 1, minSize = 2, maxSize = 5000 ) head(res) ``` # Run through miREA() `Edge_Score1D()` 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). `Edge_Score1D()` itself has no `background` argument, but `miREA()` still requires one for the `Edge` target, since `Edge_ORA()`/`Edge_Score2D()`/`Edge_Topology()` share that target and do use it. For a single target, `background` can be a plain character vector instead of a named list. ```{r run-through-miREA} background <- unique(paste0(background_MGI$miRNA, ":", background_MGI$gene)) result <- miREA( methods = "Edge_Score1D", input_data = input_data, background = background, pvalueCutoff = 1, minSize = 2, maxSize = 5000 ) head(result$result$Edge_Score1D) ``` # Session info ```{r session-info} sessionInfo() ```