diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 277bc96..f86688f 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,4 +1,5 @@ # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Additional formatting taken from: https://github.com/r-lib/actions/blob/v2-branch/check-r-package/action.yaml on: push: @@ -25,23 +26,56 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-pandoc@v2 + - name: Checkout repo + uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v2 + - name: Setup Pandoc + uses: r-lib/actions/setup-pandoc@v2 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Setup dependencies + uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck needs: check - - uses: r-lib/actions/check-r-package@v2 + - name: Check + id: rcmdcheck + run: | + ## -------------------------------------------------------------------- + options(crayon.enabled = TRUE) + cat("check-dir-path=", file.path(getwd(), "check"), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) + check_results <- rcmdcheck::rcmdcheck(args = c("--no-vignettes", "--no-manual", "--as-cran"), build_args = c("--no-build-vignettes", "--no-manual"), check_dir = "check", error_on = "error") + shell: Rscript {0} + working-directory: '.' + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + echo ::group::Show testthat output + find check -name 'testthat.Rout*' -exec cat '{}' \; || true + echo ::endgroup:: + shell: bash + working-directory: '.' + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: ${{ steps.rcmdcheck.outputs.check-dir-path }} + + - name: Upload snapshots + uses: actions/upload-artifact@v3 with: - upload-snapshots: true - args: 'c("--ignore-vignettes", "--no-manual")' - build_args: 'c("--no-build-vignettes")' + name: ${{ runner.os }}-r${{ matrix.config.r }}-testthat-snapshots + path: ${{ steps.rcmdcheck.outputs.check-dir-path }}/**/tests*/testthat/_snaps + if-no-files-found: ignore diff --git a/.github/workflows/bioc-check.yaml b/.github/workflows/bioc-check.yaml index c555a30..8744697 100644 --- a/.github/workflows/bioc-check.yaml +++ b/.github/workflows/bioc-check.yaml @@ -5,12 +5,12 @@ on: push: branches: main -name: bioc-check +name: Bioc-check jobs: bioc-check: runs-on: macos-latest - name: BiocCheck + name: Bioc-check steps: - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 8917e9c..97037a5 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -8,7 +8,7 @@ name: test-coverage jobs: test-coverage: - runs-on: ubuntu-latest + runs-on: macos-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} diff --git a/R/GetResultsDE.R b/R/GetResultsDE.R index 22c0c41..40f10cd 100644 --- a/R/GetResultsDE.R +++ b/R/GetResultsDE.R @@ -2,16 +2,16 @@ #' #' @name getResultsDE #' @author Jack Leary -#' @description This function turns the nested list differential expression results of \code{\link{testDynamic}} and turns them into a tidy \code{data.frame}. +#' @description This function turns the nested list differential expression results of \code{\link{testDynamic}} and turns them into a tidy data.frame. #' @import magrittr #' @importFrom purrr map_dfr #' @importFrom dplyr arrange desc mutate across if_else with_groups relocate #' @importFrom tidyselect everything #' @importFrom stats p.adjust p.adjust.methods #' @param test.dyn.res The nested list returned by \code{\link{testDynamic}}. Defaults to NULL. -#' @param p.adj.method (Optional) The method used to adjust \emph{p}-values for multiple hypothesis testing. Defaults to "holm". -#' @param fdr.cutoff (Optional) The FDR threshold for determining statistical significance. Defaults to 0.01. -#' @return A data.frame containing differential expression results & modeling statistics for each gene. +#' @param p.adj.method The method used to adjust \emph{p}-values for multiple hypothesis testing. Defaults to "holm". +#' @param fdr.cutoff The FDR threshold for determining statistical significance. Defaults to 0.01. +#' @return A data.frame containing differential expression results & test statistics for each gene. #' @export #' @seealso \code{\link{testDynamic}} #' @seealso \code{\link[stats]{p.adjust}} @@ -34,7 +34,7 @@ getResultsDE <- function(test.dyn.res = NULL, dplyr::mutate(dplyr::across(tidyselect::everything(), \(z) unname(unlist(z)))) }) }) %>% - dplyr::arrange(P_Val, dplyr::desc(Test_Stat)) %>% + dplyr::arrange(dplyr::desc(Test_Stat)) %>% dplyr::mutate(P_Val_Adj = stats::p.adjust(P_Val, method = p.adj.method), Gene_Dynamic_Lineage = dplyr::if_else(P_Val_Adj < fdr.cutoff, 1, 0, missing = 0)) %>% dplyr::with_groups(Gene, diff --git a/R/testSlope.R b/R/testSlope.R index c155157..70c555e 100644 --- a/R/testSlope.R +++ b/R/testSlope.R @@ -8,9 +8,9 @@ #' @importFrom dplyr arrange desc mutate if_else with_groups #' @importFrom stats p.adjust #' @param test.dyn.res The list returned by \code{\link{testDynamic}} - no extra processing required. Defaults to NULL. -#' @param p.adj.method The method used to adjust the \emph{p}-values for each slope. Defaults to "holm". +#' @param p.adj.method The method used to adjust the \emph{p}-values for each coefficient. Defaults to "holm". #' @param fdr.cutoff The FDR threshold for determining statistical significance. Defaults to 0.01. -#' @return A dataframe containing the genes, breakpoints, and slope \emph{p}-values from each model. +#' @return A dataframe containing the genes, breakpoints, and coefficient \emph{p}-values from each model. #' @seealso \code{\link{testDynamic}} #' @seealso \code{\link[stats]{p.adjust}} #' @export @@ -25,7 +25,7 @@ testSlope <- function(test.dyn.res = NULL, if (is.null(test.dyn.res)) { stop("You forgot to provide results from testDynamic() to testSlope().") } # create table of results slope_df <- purrr::map_dfr(test.dyn.res, \(x) purrr::map_dfr(x, \(y) data.frame(y["MARGE_Slope_Data"][[1]]))) %>% - dplyr::arrange(P_Val, dplyr::desc(abs(Test_Stat))) %>% + dplyr::arrange(dplyr::desc(abs(Test_Stat))) %>% dplyr::mutate(P_Val_Adj = stats::p.adjust(P_Val, method = p.adj.method)) %>% dplyr::arrange(Gene, Breakpoint) %>% dplyr::mutate(Gene_Dynamic_Lineage_Slope = dplyr::if_else(P_Val_Adj < fdr.cutoff, 1, 0, missing = 0)) %>% diff --git a/README.Rmd b/README.Rmd index 28f9b7a..a47a037 100644 --- a/README.Rmd +++ b/README.Rmd @@ -24,6 +24,7 @@ knitr::opts_chunk$set(warning = FALSE, [![R-CMD-check](https://github.com/jr-leary7/scLANE/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jr-leary7/scLANE/actions/workflows/R-CMD-check.yaml) +[![Bioc-check](https://github.com/jr-leary7/scLANE/actions/workflows/bioc-check.yaml/badge.svg)](https://github.com/jr-leary7/scLANE/actions/workflows/bioc-check.yaml) ![release](https://img.shields.io/github/v/release/jr-leary7/scLANE?color=purple) ![last commit](https://img.shields.io/github/last-commit/jr-leary7/scLANE/main?color=darkgreen) [![codecov](https://codecov.io/gh/jr-leary7/scLANE/branch/main/graph/badge.svg?token=U2U5RTF2VW)](https://codecov.io/gh/jr-leary7/scLANE) diff --git a/man/getResultsDE.Rd b/man/getResultsDE.Rd index 0d1278c..14e949e 100644 --- a/man/getResultsDE.Rd +++ b/man/getResultsDE.Rd @@ -9,15 +9,15 @@ getResultsDE(test.dyn.res = NULL, p.adj.method = "holm", fdr.cutoff = 0.01) \arguments{ \item{test.dyn.res}{The nested list returned by \code{\link{testDynamic}}. Defaults to NULL.} -\item{p.adj.method}{(Optional) The method used to adjust \emph{p}-values for multiple hypothesis testing. Defaults to "holm".} +\item{p.adj.method}{The method used to adjust \emph{p}-values for multiple hypothesis testing. Defaults to "holm".} -\item{fdr.cutoff}{(Optional) The FDR threshold for determining statistical significance. Defaults to 0.01.} +\item{fdr.cutoff}{The FDR threshold for determining statistical significance. Defaults to 0.01.} } \value{ -A data.frame containing differential expression results & modeling statistics for each gene. +A data.frame containing differential expression results & test statistics for each gene. } \description{ -This function turns the nested list differential expression results of \code{\link{testDynamic}} and turns them into a tidy \code{data.frame}. +This function turns the nested list differential expression results of \code{\link{testDynamic}} and turns them into a tidy data.frame. } \examples{ data(scLANE_models) diff --git a/man/testSlope.Rd b/man/testSlope.Rd index 624ffd3..ea892ae 100644 --- a/man/testSlope.Rd +++ b/man/testSlope.Rd @@ -9,12 +9,12 @@ testSlope(test.dyn.res = NULL, p.adj.method = "holm", fdr.cutoff = 0.01) \arguments{ \item{test.dyn.res}{The list returned by \code{\link{testDynamic}} - no extra processing required. Defaults to NULL.} -\item{p.adj.method}{The method used to adjust the \emph{p}-values for each slope. Defaults to "holm".} +\item{p.adj.method}{The method used to adjust the \emph{p}-values for each coefficient. Defaults to "holm".} \item{fdr.cutoff}{The FDR threshold for determining statistical significance. Defaults to 0.01.} } \value{ -A dataframe containing the genes, breakpoints, and slope \emph{p}-values from each model. +A dataframe containing the genes, breakpoints, and coefficient \emph{p}-values from each model. } \description{ This function tests whether each gene's estimated \eqn{\beta} for pseudotime differs significantly from 0 over each empirically estimated sets of knots / pseudotime interval using a Wald test.