--- title: "5. MiR-Score" author: "Zhesi Zhang, Xin Lai" date: "`r Sys.Date()`" package: miREA output: BiocStyle::html_document: toc: true toc_float: true vignette: > %\VignetteIndexEntry{5. MiR-Score} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>") ``` # Overview `MiR_Score()` performs miRNA enrichment analysis by testing whether a pathway's miRNAs are located unexpectedly toward one end of a ranked miRNA list. The ranked list covers every miRNA in `mir_DEdata`, ranked by each miRNA's own differential expression statistic. This is a GSEA style test, built on `r BiocStyle::Biocpkg("clusterProfiler")`'s `GSEA()`. Note that unlike `TG_Score()`, the ranked list here is not restricted through `background_MGI`, only the pathway side is. 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`. * `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`). This is used to derive the pathway miRNA set `MiR_Score()` tests against, since pathway definitions only specify genes. * `pvalueType` for `MiR_Score()` itself, one of `"pos"`, `"neg"`, or `"std"`, selecting a one sided or two sided test. ```{r load-data} library(miREA) data(toy_pathway) data(toy_mir_DEdata) data(toy_gene_DEdata) data(background_MGI) ``` # Run MiR-Score ```{r prepare-input} input_data <- getAllInputData( methods = "MiR_Score", pathway = toy_pathway, mir_DEdata = toy_mir_DEdata, gene_DEdata = toy_gene_DEdata, background_MGI = background_MGI ) ``` `input_data$data$MiR_Score` holds the ranked miRNA list, covering every miRNA in `toy_mir_DEdata`, ranked by its own differential expression statistic. `input_data$pathway$MiR` holds the pathway miRNA sets, derived from `toy_pathway`'s genes through `background_MGI`. ```{r run-mir-score} res <- MiR_Score( miRList = input_data$data$MiR_Score, pathway = input_data$pathway$MiR, pvalueType = "std", pvalueCutoff = 1 ) head(res) ``` # Run through miREA() `MiR_Score()` 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). `MiR_Score()` itself has no `background` argument, but `miREA()` still requires one for the `MiR` target, since `MiR_ORA()` shares that target and does use it. For a single target, `background` can be a plain character vector instead of a named list. ```{r run-through-miREA} result <- miREA( methods = "MiR_Score", input_data = input_data, background = unique(input_data$pathway$MiR$miRNA), pvalueCutoff = 1 ) head(result$result$MiR_Score) ``` # Supplying your own ranked miRNA list If you already have a ranked miRNA list from an external analysis instead of letting `getAllInputData()` derive one from `mir_DEdata`, call `MiR_Score()` directly with that list and `input_data$pathway$MiR`. `miRList` must be a named numeric vector, sorted from the highest to the lowest score. ```{r custom-list, eval=FALSE} my_miRList <- sort( c(`hsa-miR-21-5p` = 2.3, `hsa-miR-155-5p` = -1.1), decreasing = TRUE ) res_custom <- MiR_Score( miRList = my_miRList, pathway = input_data$pathway$MiR, pvalueType = "std", pvalueCutoff = 1 ) ``` # Session info ```{r session-info} sessionInfo() ```