diff --git a/.Rbuildignore b/.Rbuildignore index 9ad5db4..0e5321c 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,3 +5,6 @@ ^.*\.gitignore ^LICENSE\.md$ ^.git*$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index bfc9f4d..cea5906 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -2,7 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master] + branches: main pull_request: release: types: [published] diff --git a/.gitignore b/.gitignore index a1046bb..4c37638 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ doc Meta inst/doc +docs diff --git a/DESCRIPTION b/DESCRIPTION index 4a6edcd..410a79b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: leapR Title: Layered enrichment analysis of pathways R -Version: 0.99.7 +Version: 0.99.8 Authors@R: c( person("Sara", "Gosline", email = "sara.gosline@pnnl.gov", role = c('aut',"cre"), comment = c(ORCID = "0000-0002-6534-4774")), person("Jason", "McDermott", email = "jason.mcdermott@pnnl.gov", role = "aut"), diff --git a/README.md b/README.md index 75b98b4..c2973f6 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,11 @@ Layered Enrichment Analysis of Pathways in R (leapR) a tool that carries out sta ## Install leapR is available through Bioconductor repository here -```{r install} - +``` if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install(version = "3.21") - BiocManager::install('BiocStyle') - BiocManager::install('leapR') ``` diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..69b0979 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://pnnl-github.io/leapR +template: + bootstrap: 5 + diff --git a/catalog-info.yaml b/catalog-info.yaml new file mode 100644 index 0000000..a545fac --- /dev/null +++ b/catalog-info.yaml @@ -0,0 +1,28 @@ +apiVersion: backstage.io/v1alpha1 +kind: Component +metadata: + name: leap-r + title: Leap R + description: Layered Enrichment Analysis of Pathways in R (leapR) a tool that carries out statistical enrichment analysis on single- or multi-omics data. + annotations: + # Conditional host-specific annotations rendered to avoid empty-string values that fail catalog validation. + github.com/project-slug: pnnl/leapR + links: + - title: Leap R Repository + url: https://github.com/pnnl/leapR + - title: Leap R Publication + url: https://pubs.acs.org/doi/full/10.1021/acs.jproteome.0c00963 + tags: + - R +spec: + type: api + owner: user:default/sara.gosline_pnnl.gov # Sara Gosline project lead + visibility: private # to expose this item in the catalog to others at PNNL, change the visibility to 'public' + # system: + lifecycle: production + + # TODO: does leap-r depend on another resource or component? + # dependsOn: + + # TODO: does another resource depend on leap-r? + # dependencyOf: \ No newline at end of file diff --git a/vignettes/order-enrichment.Rmd b/vignettes/order-enrichment.Rmd new file mode 100644 index 0000000..336e161 --- /dev/null +++ b/vignettes/order-enrichment.Rmd @@ -0,0 +1,127 @@ +--- +title: "leapR Order Enrichment Tests" +output: + BiocStyle::html_document: + toc: true + toc_depth: 2 +vignette: | + %\VignetteIndexEntry{leapR} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r knitr, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + cache = FALSE +) +``` + + +# Load libraries needed + +```{r libraries, message=FALSE, warning = FALSE} +# load the core libraries +library(leapR) +library(gplots) +library(rmarkdown) +# plotting helpers used in this vignette +library(ggplot2) +library(dplyr) +library(tibble) +library(stringr) +``` + + +# Load our test proteomics dataset +```{r load data} +url <- "https://api.figshare.com/v2/file/download/56536217" +pdata <- download.file(url, method = "libcurl", destfile = "protData.rda") +# as.matrix() +load("protData.rda") + +p <- file.remove("protData.rda") + +data(shortlist) +data(longlist) + +## columns that we want to use for results + +cols_to_display <- c("ingroup_n", "outgroup_n", "background_n", + "pvalue", "BH_pvalue") +``` + +# Compare enrichment methods +We want to evaluate how various samples compare in enrichmnet + +```{r compare} + +i = 8 +data("ncipid") + +cor.res <- do.call(rbind,lapply(1:length(shortlist), function (i) { + protdata.enrichment.ks <- leapR::leapR( + geneset = ncipid, "enrichment_in_order", + eset = pset, + minsize = 5, + assay_name = "proteomics", + primary_columns = shortlist[i] + ) + + colnames(protdata.enrichment.ks) <- paste('ks',colnames(protdata.enrichment.ks),sep='.') + + + protdata.enrichment.cs <- leapR::leapR( + geneset = ncipid, "enrichment_in_order", + method = 'chisq', + eset = pset, minsize = 5, + assay_name = "proteomics", + primary_columns = shortlist[i] + ) + colnames(protdata.enrichment.cs) <- paste('chisq',colnames(protdata.enrichment.cs),sep='.') + + protdata.enrichment.zt <- leapR::leapR( + geneset = ncipid, "enrichment_in_order", + eset = pset, minsize = 5, + method = 'ztest', + assay_name = "proteomics", + primary_columns = shortlist[i] + ) + + colnames(protdata.enrichment.zt) <- paste('ztest',colnames(protdata.enrichment.zt),sep='.') + + paths <- rownames(protdata.enrichment.ks) + allvals <- cbind(protdata.enrichment.cs[paths,], + protdata.enrichment.ks[paths,], + protdata.enrichment.zt[paths,]) + + kz <- cor(allvals$ks.BH_pvalue, allvals$ztest.BH_pvalue, use = 'p') + + kc <- cor(allvals$ks.BH_pvalue, allvals$chisq.BH_pvalue, use = 'p') + + cz <- cor(allvals$chisq.BH_pvalue, allvals$ztest.BH_pvalue, use = 'p') + + kz <- cor(allvals$ks.pvalue, allvals$ztest.pvalue, use = 'p') + + kc <- cor(allvals$ks.pvalue, allvals$chisq.pvalue, use = 'p') + + cz <- cor(allvals$chisq.pvalue, allvals$ztest.pvalue, use = 'p') + + return(c(kz = kc, kc=kc, cz = cz)) +})) + +``` + +We can compare the corrected p-values + +```{r compare pvals} +library(ggplot2) + +cor.res |> as.data.frame() |> + tidyr::pivot_longer(c(1:3),names_to='test_comparison',values_to='p cor') |> + ggplot(aes(x=test_comparison, y= `p cor`)) + geom_jitter() + + + +``` \ No newline at end of file