From 574c105dc8020c8279cd2c12e8f0a26640794ef0 Mon Sep 17 00:00:00 2001 From: Drew Behrens Date: Sun, 11 Feb 2024 19:22:30 +0100 Subject: [PATCH] Fixed drop parameter in generic "[" function and other small bug fixes (#62) Fixes in this commit: * Set default for `drop` to `FALSE` in `[` generic function and ignore this argument * Extended testing to test for the `drop` argument. * fix GitHub Action again * update and align FRASER documentation * Update RoxyGen documentation to 7.3.1 * Add ORCID ids to DESCRIPTION * fixed BugReports in DESCRIPTION * remove CCX11 flags from Makevars --------- Co-authored-by: Christian Mertes Co-authored-by: Drew Behrens --- .github/helperScripts/setupEnv.R | 45 ---- .github/workflows/check-bioc.yml | 333 ++++++++++++++++++++++++++++ .github/workflows/r.yml | 120 ---------- DESCRIPTION | 23 +- R/AllGenerics.R | 17 +- man/FRASER.Rd | 10 +- man/countRNA.Rd | 16 +- man/fds-methods.Rd | 16 +- man/filtering.Rd | 8 +- man/getter_setter_functions.Rd | 36 +-- man/subset.Rd | 11 +- src/Makevars | 2 - src/Makevars.win | 2 - tests/testthat/test_getter_setter.R | 9 + vignettes/FRASER.Rnw | 2 +- 15 files changed, 411 insertions(+), 239 deletions(-) delete mode 100644 .github/helperScripts/setupEnv.R create mode 100644 .github/workflows/check-bioc.yml delete mode 100644 .github/workflows/r.yml diff --git a/.github/helperScripts/setupEnv.R b/.github/helperScripts/setupEnv.R deleted file mode 100644 index 9702e9b5..00000000 --- a/.github/helperScripts/setupEnv.R +++ /dev/null @@ -1,45 +0,0 @@ -NCPUS <- 3 -Sys.setenv(MAKEFLAGS = "-j3") -BIOC_VERSION <- Sys.getenv("BIOC_VERSION") -START_TIME <- Sys.time() - -print_log <- function(...){ - hash_line <- paste0(rep("#", 10), collapse="") - message(paste0("\n", hash_line, "\n### ", date(), ": ", ..., "\n", hash_line, "\n")) -} - -installIfReq <- function(p, Ncpus=NCPUS, ...){ - for(j in p) - if(!requireNamespace(j, quietly=TRUE)) - BiocManager::install(j, Ncpus=Ncpus, ...) -} - -# install Bioconductor -if(!requireNamespace("BiocManager", quietly=TRUE)) - install.packages("BiocManager", Ncpus=NCPUS) -BiocManager::install("BiocVersion", version=BIOC_VERSION,ask = FALSE) - - -# install needed packages -# add testthat to pre installation dependencies due to: https://github.com/r-lib/pkgload/issues/89 -for(p in c("getopt", "testthat", "devtools", "covr", "roxygen2", "BiocCheck", - "R.utils", "rtracklayer")){ - installIfReq(p=p, Ncpus=NCPUS) -} - -# because of https://github.com/r-windows/rtools-installer/issues/3 -if("windows" == .Platform$OS.type){ - print_log("Install source packages only for windows ...") - BiocManager::install(c("GenomeInfoDbData", "org.Hs.eg.db", "TxDb.Hsapiens.UCSC.hg19.knownGene"), - type="both", version=BIOC_VERSION) -} - -print_log("Update Packages") -BiocManager::install(ask=FALSE, Ncpus=NCPUS, version=BIOC_VERSION) - -print_log("Install dev package") -devtools::install(".", dependencies=TRUE) - -# to get FRASER session info -try({ library(FRASER) }) -print(BiocManager::valid()) diff --git a/.github/workflows/check-bioc.yml b/.github/workflows/check-bioc.yml new file mode 100644 index 00000000..bab071e0 --- /dev/null +++ b/.github/workflows/check-bioc.yml @@ -0,0 +1,333 @@ +## Read more about GitHub actions the features of this GitHub Actions workflow +## at https://lcolladotor.github.io/biocthis/articles/biocthis.html#use_bioc_github_action +## +## For more details, check the biocthis developer notes vignette at +## https://lcolladotor.github.io/biocthis/articles/biocthis_dev_notes.html +## +## You can add this workflow to other packages using: +## > biocthis::use_bioc_github_action() +## +## Using GitHub Actions exposes you to many details about how R packages are +## compiled and installed in several operating system.s +### If you need help, please follow the steps listed at +## https://github.com/r-lib/actions#where-to-find-help +## +## If you found an issue specific to biocthis's GHA workflow, please report it +## with the information that will make it easier for others to help you. +## Thank you! + +## Acronyms: +## * GHA: GitHub Action +## * OS: operating system + +on: + push: + pull_request: + +name: R-CMD-check-bioc + +## These environment variables control whether to run GHA code later on that is +## specific to testthat, covr, and pkgdown. +## +## If you need to clear the cache of packages, update the number inside +## cache-version as discussed at https://github.com/r-lib/actions/issues/86. +## Note that you can always run a GHA test without the cache by using the word +## "/nocache" in the commit message. +env: + has_testthat: 'true' + run_covr: 'true' + run_pkgdown: 'false' + has_RUnit: 'false' + cache-version: 'cache-v1' + run_docker: 'false' + +jobs: + build-check: + runs-on: ${{ matrix.config.os }} + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + container: ${{ matrix.config.cont }} + ## Environment variables unique to this job. + + strategy: + fail-fast: false + matrix: + config: + - { os: ubuntu-latest, r: '4.3', bioc: '3.18', cont: "bioconductor/bioconductor_docker:RELEASE_3_18", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } + - { os: ubuntu-latest, r: 'next', bioc: '3.18', cont: "bioconductor/bioconductor_docker:RELEASE_3_18", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" } + - { os: macOS-latest, r: '4.3', bioc: '3.18'} + - { os: windows-latest, r: '4.3', bioc: '3.18'} + ## Check https://github.com/r-lib/actions/tree/master/examples + ## for examples using the http-user-agent + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} + NOT_CRAN: true + TZ: UTC + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + + ## Set the R library to the directory matching the + ## R packages cache step further below when running on Docker (Linux). + - name: Set R Library home on Linux + if: runner.os == 'Linux' + run: | + mkdir /__w/_temp/Library + echo ".libPaths('/__w/_temp/Library')" > ~/.Rprofile + + ## Most of these steps are the same as the ones in + ## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml + ## If they update their steps, we will also need to update ours. + - name: Checkout Repository + uses: actions/checkout@v3 + + ## R is already included in the Bioconductor docker images + - name: Setup R from r-lib + if: runner.os != 'Linux' + uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + + ## pandoc is already included in the Bioconductor docker images + - name: Setup pandoc from r-lib + if: runner.os != 'Linux' + uses: r-lib/actions/setup-pandoc@v2 + + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + shell: Rscript {0} + + - name: Restore R package cache + if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'" + uses: actions/cache@v3 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2- + + - name: Cache R packages on Linux + if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' " + uses: actions/cache@v3 + with: + path: /home/runner/work/_temp/Library + key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2- + + - name: Install Linux system dependencies + if: runner.os == 'Linux' + run: | + sysreqs=$(Rscript -e 'cat("apt-get update -y && apt-get install -y", paste(gsub("apt-get install -y ", "", remotes::system_requirements("ubuntu", "20.04")), collapse = " "))') + echo $sysreqs + sudo -s eval "$sysreqs" + + - name: Install macOS system dependencies + if: matrix.config.os == 'macOS-latest' + run: | + ## Enable installing XML from source if needed + brew install libxml2 + echo "XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config" >> $GITHUB_ENV + + ## Required to install magick as noted at + ## https://github.com/r-lib/usethis/commit/f1f1e0d10c1ebc75fd4c18fa7e2de4551fd9978f#diff-9bfee71065492f63457918efcd912cf2 + brew install imagemagick@6 + + ## For textshaping, required by ragg, and required by pkgdown + brew install harfbuzz fribidi + + ## For installing usethis's dependency gert + brew install libgit2 + + ## Required for tcltk + brew install xquartz --cask + + - name: Install Windows system dependencies + if: runner.os == 'Windows' + run: | + ## Edit below if you have any Windows system dependencies + shell: Rscript {0} + + - name: Init tinytex + uses: r-lib/actions/setup-tinytex@v2 + + - name: Install tinytex packages + run: | + system("tlmgr --version") + install.packages("tinytex") + tinytex::tlmgr_install(pkgs = c("bera", "caption", "changepage", "enumitem", "everysel", "fancyhdr", "footmisc", "grfext", "index", "marginfix", "mathtools", + "ms", "nowidow", "parnotes", "parskip", "placeins", "preprint", "ragged2e", "side", "soul", "titlesec", "tocbibind", "xstring")) + shell: Rscript {0} + + - name: Install BiocManager + run: | + message(paste('****', Sys.time(), 'installing BiocManager ****')) + remotes::install_cran("BiocManager") + shell: Rscript {0} + + - name: Set BiocVersion + run: | + BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE, force = TRUE) + shell: Rscript {0} + + - name: Install dependencies pass 1 + run: | + ## Try installing the package dependencies in steps. First the local + ## dependencies, then any remaining dependencies to avoid the + ## issues described at + ## https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016675.html + ## https://github.com/r-lib/remotes/issues/296 + ## Ideally, all dependencies should get installed in the first pass. + + ## Set the repos source depending on the OS + ## Alternatively use https://storage.googleapis.com/bioconductor_docker/packages/ + ## though based on https://bit.ly/bioc2021-package-binaries + ## the Azure link will be the main one going forward. + gha_repos <- if( + .Platform$OS.type == "unix" && Sys.info()["sysname"] != "Darwin" + ) c( + "AnVIL" = "https://bioconductordocker.blob.core.windows.net/packages/3.16/bioc", + BiocManager::repositories() + ) else BiocManager::repositories() + + ## For running the checks + message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****')) + install.packages(c("rcmdcheck", "BiocCheck"), repos = gha_repos) + + ## Pass #1 at installing dependencies + ## This pass uses AnVIL-powered fast binaries + ## details at https://github.com/nturaga/bioc2021-bioconductor-binaries + ## The speed gains only apply to the docker builds. + message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****')) + remotes::install_local(dependencies = TRUE, repos = gha_repos, build_vignettes = FALSE, upgrade = TRUE) + continue-on-error: true + shell: Rscript {0} + + - name: Install dependencies pass 2 + run: | + ## Pass #2 at installing dependencies + ## This pass does not use AnVIL and will thus update any packages + ## that have seen been updated in Bioconductor + message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****')) + remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE, force = TRUE) + shell: Rscript {0} + + - name: Install BiocGenerics + if: env.has_RUnit == 'true' + run: | + ## Install BiocGenerics + BiocManager::install("BiocGenerics") + shell: Rscript {0} + + - name: Install covr + if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux' + run: | + remotes::install_cran("covr") + shell: Rscript {0} + + - name: Install pkgdown + if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux' + run: | + remotes::install_cran("pkgdown") + shell: Rscript {0} + + - name: Session info + run: | + options(width = 100) + pkgs <- installed.packages()[, "Package"] + sessioninfo::session_info(pkgs, include_base = TRUE) + shell: Rscript {0} + + - name: Run CMD check + env: + _R_CHECK_CRAN_INCOMING_: false + DISPLAY: 99.0 + run: | + options(crayon.enabled = TRUE) + rcmdcheck::rcmdcheck( + args = c("--no-manual", "--no-vignettes", "--timings"), + build_args = c("--no-manual", "--keep-empty-dirs", "--no-resave-data"), + error_on = "warning", + check_dir = "check" + ) + shell: Rscript {0} + + ## Might need an to add this to the if: && runner.os == 'Linux' + - name: Reveal testthat details + if: env.has_testthat == 'true' + run: find . -name testthat.Rout -exec cat '{}' ';' + + - name: Run RUnit tests + if: env.has_RUnit == 'true' + run: | + BiocGenerics:::testPackage() + shell: Rscript {0} + + - name: Run BiocCheck + env: + DISPLAY: 99.0 + run: | + BiocCheck::BiocCheck( + dir('check', 'tar.gz$', full.names = TRUE), + `quit-with-status` = TRUE, + `no-check-R-ver` = TRUE, + `no-check-bioc-help` = TRUE + ) + shell: Rscript {0} + + - name: Test coverage + if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux' + run: | + covr::codecov() + shell: Rscript {0} + + - name: Install package + if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux' + run: R CMD INSTALL . + + - name: Build pkgdown site + if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux' + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + ## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE) + ## at least one locally before this will work. This creates the gh-pages + ## branch (erasing anything you haven't version controlled!) and + ## makes the git history recognizable by pkgdown. + + - name: Install deploy dependencies + if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux' + run: | + apt-get update && apt-get -y install rsync + + - name: Deploy pkgdown site to GitHub pages 🚀 + if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux' + uses: JamesIves/github-pages-deploy-action@releases/v4 + with: + clean: false + branch: gh-pages + folder: docs + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@master + with: + name: ${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-results + path: check + + ## Note that DOCKER_PASSWORD is really a token for your dockerhub + ## account, not your actual dockerhub account password. + ## This comes from + ## https://seandavi.github.io/BuildABiocWorkshop/articles/HOWTO_BUILD_WORKSHOP.html#6-add-secrets-to-github-repo + ## Check https://github.com/docker/build-push-action/tree/releases/v1 + ## for more details. + - uses: docker/build-push-action@v1 + if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && runner.os == 'Linux' " + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: gagneurlab/fraser + tag_with_ref: true + tag_with_sha: true + tags: latest diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml deleted file mode 100644 index 29c5d9a3..00000000 --- a/.github/workflows/r.yml +++ /dev/null @@ -1,120 +0,0 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions -on: - push: - pull_request: - -name: Build - -jobs: - Build: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - {os: windows-latest, r: '4.2', bioc: '3.15'} - - {os: macOS-latest, r: '4.2', bioc: '3.15'} - - {os: ubuntu-20.04, r: '4.2', bioc: '3.15', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'next', bioc: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - BIOC_VERSION: ${{ matrix.config.bioc }} - - steps: - - uses: actions/checkout@v2 - - - uses: r-lib/actions/setup-r@v1 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v2 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies (Linux) - if: runner.os == 'Linux' - run: | - sudo apt-get install libgit2-dev - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install system dependencies (macOS) - if: runner.os == 'macos' - run: | - brew install libgit2 - brew install --force --overwrite gcc - - - uses: r-lib/actions/setup-tinytex@v1 - - name: Init and install packages for tex - run: | - system("tlmgr --version") - install.packages("tinytex") - tinytex::tlmgr_install(pkgs = c("bera", "caption", "changepage", "enumitem", "everysel", "fancyhdr", "footmisc", "grfext", "index", "marginfix", "mathtools", "ms", "nowidow", "parnotes", "parskip", "placeins", "preprint", "ragged2e", "side", "soul", "titlesec", "tocbibind", "xstring")) - shell: Rscript {0} - - - name: Install dependencies - run: | - source(".github/helperScripts/setupEnv.R") - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check build - run: | - devtools::build(vignettes = FALSE) - shell: Rscript {0} - - - name: Check BiocCheck - run: | - BiocCheck::BiocCheck('.', `quit-with-status`=TRUE) - shell: Rscript {0} - - - name: Check R check - run: | - devtools::check(vignettes = FALSE, args = '--timings') - shell: Rscript {0} - - - name: Check Examples - run: | - devtools::run_examples() - shell: Rscript {0} - - - name: Check tests - run: | - devtools::test() - shell: Rscript {0} - - - name: Check vignette - run: | - devtools::build_vignettes() - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check - - - uses: codecov/codecov-action@v1 diff --git a/DESCRIPTION b/DESCRIPTION index 61c41d47..aa4debec 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,14 +1,18 @@ Package: FRASER Type: Package Title: Find RAre Splicing Events in RNA-Seq Data -Version: 1.15.0 -Date: 2021-04-05 +Version: 1.15.1 +Date: 2024-02-11 Authors@R: c( person("Christian", "Mertes", role=c("aut", "cre"), - email="mertes@in.tum.de"), - person("Ines", "Scheller", role=c("aut"), email="scheller@in.tum.de"), - person("Vicente", "Yepez", role=c("ctb"), email="yepez@in.tum.de"), - person("Julien", "Gagneur", role=c("aut"), email="gagneur@in.tum.de")) + email="mertes@in.tum.de", comment=c(ORCID="0000-0002-1091-205X")), + person("Ines", "Scheller", role=c("aut"), email="scheller@in.tum.de", + comment=c(ORCID="0000-0003-4533-7857")), + person("Karoline", "Lutz", role=c("ctb"), email="lutzk@in.tum.de"), + person("Vicente", "Yepez", role=c("aut"), email="yepez@in.tum.de", + comment=c(ORCID="0000-0001-7916-3643")), + person("Julien", "Gagneur", role=c("aut"), email="gagneur@in.tum.de", + comment=c(ORCID="0000-0002-8924-8365"))) Description: Detection of rare aberrant splicing events in transcriptome profiles. Read count ratio expectations are modeled by an autoencoder to control for confounding factors in the data. Given these expectations, @@ -27,8 +31,8 @@ biocViews: Coverage License: MIT + file LICENSE URL: https://github.com/gagneurlab/FRASER -BugRepots: https://github.com/gagneurlab/FRASER/issues -RoxygenNote: 7.1.2 +BugReports: https://github.com/gagneurlab/FRASER/issues +RoxygenNote: 7.3.1 Encoding: UTF-8 VignetteBuilder: knitr Depends: @@ -74,7 +78,8 @@ Imports: tools, utils, VGAM -Suggests: +Suggests: + magick, BiocStyle, knitr, rmarkdown, diff --git a/R/AllGenerics.R b/R/AllGenerics.R index cfb73078..5c6258d6 100644 --- a/R/AllGenerics.R +++ b/R/AllGenerics.R @@ -11,8 +11,8 @@ asFDS <- function(x){ #' #' @title Getter/Setter methods for the FraserDataSet -#' -#' The following methods are getter and setter methods to extract or set +#' +#' @description The following methods are getter and setter methods to extract or set #' certain values of a FraserDataSet object. #' #' \code{samples} sets or gets the sample IDs; \code{condition} ; @@ -230,8 +230,11 @@ setReplaceMethod("nonSplicedReads", "FraserDataSet", function(object, value){ #' @param x A \code{FraserDataSet} object #' @param i A integer vector to subset the rows/ranges #' @param j A integer vector to subset the columns/samples -#' @param by a character (j or ss) definig if we subset by +#' @param by a character (j or ss) defining if we subset by #' junctions or splice sites +#' @param ... Parameters currently not used or passed on +#' @param drop No dimension reduction is done. And the \code{drop} +#' parameter is currently not used at all. #' @return A subsetted \code{FraserDataSet} object #' @examples #' fds <- createTestFraserDataSet() @@ -240,7 +243,7 @@ setReplaceMethod("nonSplicedReads", "FraserDataSet", function(object, value){ #' fds[1:10,by="ss"] #' #' @rdname subset -subset.FRASER <- function(x, i, j, by=c("j", "ss")){ +subset.FRASER <- function(x, i, j, by=c("j", "ss"), ..., drop=FALSE){ if(length(by) == 1){ by <- whichReadType(x, by) } @@ -288,14 +291,14 @@ subset.FRASER <- function(x, i, j, by=c("j", "ss")){ idxNSR <- rowData(x, type="ss")[['spliceSiteID']] %in% ssIdx # subset it - nsrObj <- nsrObj[idxNSR,j] + nsrObj <- nsrObj[idxNSR,j,drop=FALSE] } # subset the inheritate SE object if(length(x) == 0){ i <- NULL } - subX <- as(as(x, "RangedSummarizedExperiment")[i,j], "FraserDataSet") + subX <- as(as(x, "RangedSummarizedExperiment")[i,j,drop=FALSE], "FraserDataSet") # create new FraserDataSet object newx <- new("FraserDataSet", @@ -311,7 +314,7 @@ subset.FRASER <- function(x, i, j, by=c("j", "ss")){ } #' @rdname subset #' @export -setMethod("[", c("FraserDataSet", "ANY", "ANY"), subset.FRASER) +setMethod("[", c("FraserDataSet", "ANY", "ANY", drop="ANY"), subset.FRASER) #' diff --git a/man/FRASER.Rd b/man/FRASER.Rd index 22f3fff5..8ae94611 100644 --- a/man/FRASER.Rd +++ b/man/FRASER.Rd @@ -94,23 +94,23 @@ raw counts ("BB"). } \section{Functions}{ \itemize{ -\item \code{FRASER}: This function runs the default FRASER pipeline combining +\item \code{FRASER()}: This function runs the default FRASER pipeline combining the beta-binomial fit, the computation of Z scores and p values as well as the computation of delta-PSI values. -\item \code{calculateZscore}: This function calculates z-scores based on the +\item \code{calculateZscore()}: This function calculates z-scores based on the observed and expected logit psi. -\item \code{calculatePvalues}: This function calculates two-sided p-values based on +\item \code{calculatePvalues()}: This function calculates two-sided p-values based on the beta-binomial distribution (or binomial or normal if desired). The returned p values are already adjusted with Holm's method per donor or acceptor site, respectively. -\item \code{calculatePadjValues}: This function adjusts the previously calculated +\item \code{calculatePadjValues()}: This function adjusts the previously calculated p-values per sample for multiple testing. -}} +}} \examples{ # set default parallel backend register(SerialParam()) diff --git a/man/countRNA.Rd b/man/countRNA.Rd index 7940b91b..440231fe 100644 --- a/man/countRNA.Rd +++ b/man/countRNA.Rd @@ -245,32 +245,32 @@ a sample are set to zero. } \section{Functions}{ \itemize{ -\item \code{countRNAData}: This method extracts and counts the split reads and +\item \code{countRNAData()}: This method extracts and counts the split reads and non spliced reads from RNA bam files. -\item \code{getSplitReadCountsForAllSamples}: This method creates a GRanges +\item \code{getSplitReadCountsForAllSamples()}: This method creates a GRanges object containing the split read counts from all specified samples. -\item \code{getNonSplitReadCountsForAllSamples}: This method creates a GRanges +\item \code{getNonSplitReadCountsForAllSamples()}: This method creates a GRanges object containing the non split read counts at the exon-intron boundaries inferred from the GRanges object containing the positions of all the introns in this dataset. -\item \code{addCountsToFraserDataSet}: This method adds the split read and +\item \code{addCountsToFraserDataSet()}: This method adds the split read and non split read counts to a existing FraserDataSet containing the settings. -\item \code{countSplitReads}: This method counts all split reads in a +\item \code{countSplitReads()}: This method counts all split reads in a bam file for a single sample. -\item \code{mergeCounts}: This method merges counts for multiple +\item \code{mergeCounts()}: This method merges counts for multiple samples into one SummarizedExperiment object. -\item \code{countNonSplicedReads}: This method counts non spliced reads based +\item \code{countNonSplicedReads()}: This method counts non spliced reads based on the given target (acceptor/donor) regions for a single sample. -}} +}} \examples{ # On Windows SNOW is the default for the parallele backend, which can be # very slow for many but small tasks. Therefore, we will use diff --git a/man/fds-methods.Rd b/man/fds-methods.Rd index 3e11e4e4..32ebf323 100644 --- a/man/fds-methods.Rd +++ b/man/fds-methods.Rd @@ -41,17 +41,7 @@ \alias{FRASER.mcols.get} \alias{FRASER.rowRanges.get} \alias{mapSeqlevels} -\title{Getter/Setter methods for the FraserDataSet - -The following methods are getter and setter methods to extract or set -certain values of a FraserDataSet object. - -\code{samples} sets or gets the sample IDs; \code{condition} ; -\code{} -\code{nonSplicedReads} return a RangedSummarizedExperiment object -containing the counts for the non spliced reads overlapping splice -sites in the fds. -\code{}} +\title{Getter/Setter methods for the FraserDataSet} \usage{ samples(object) @@ -151,8 +141,6 @@ passed to GenomeInfoDb::mapSeqlevels().} Getter method return the respective current value. } \description{ -Getter/Setter methods for the FraserDataSet - The following methods are getter and setter methods to extract or set certain values of a FraserDataSet object. @@ -162,8 +150,6 @@ certain values of a FraserDataSet object. containing the counts for the non spliced reads overlapping splice sites in the fds. \code{} - -Mapping of chromosome names } \examples{ fds <- createTestFraserDataSet() diff --git a/man/filtering.Rd b/man/filtering.Rd index b40ad786..361dde7e 100644 --- a/man/filtering.Rd +++ b/man/filtering.Rd @@ -72,16 +72,16 @@ reliably detected and to remove introns with no variablity between samples. } \section{Functions}{ \itemize{ -\item \code{filterExpressionAndVariability}: This functions filters out both introns with low +\item \code{filterExpressionAndVariability()}: This functions filters out both introns with low read support and introns that are not variable across samples. -\item \code{filterExpression,FraserDataSet-method}: This function filters out introns and corresponding +\item \code{filterExpression(FraserDataSet)}: This function filters out introns and corresponding splice sites that have low read support in all samples. -\item \code{filterVariability}: This function filters out introns and corresponding +\item \code{filterVariability()}: This function filters out introns and corresponding splice sites which do not show variablity across samples. -}} +}} \examples{ fds <- createTestFraserDataSet() fds <- filterExpressionAndVariability(fds, minDeltaPsi=0.1, filter=FALSE) diff --git a/man/getter_setter_functions.Rd b/man/getter_setter_functions.Rd index bf56e32c..4dad7b0d 100644 --- a/man/getter_setter_functions.Rd +++ b/man/getter_setter_functions.Rd @@ -91,63 +91,63 @@ the values within the FRASER model. } \section{Functions}{ \itemize{ -\item \code{featureExclusionMask}: Retrieves a logical vector indicating +\item \code{featureExclusionMask()}: Retrieves a logical vector indicating for each junction whether it is included or excluded during the fitting procedure. -\item \code{featureExclusionMask<-}: To remove certain junctions from +\item \code{featureExclusionMask(fds, type = currentType(fds)) <- value}: To remove certain junctions from being used in the train step of the encoding dimension we can set the \code{featureExclusion} vector to \code{FALSE}. This can be helpfull if we have local linkage between features which we do not want to model by the autoencoder. -\item \code{rho}: Returns the fitted rho values for the +\item \code{rho()}: Returns the fitted rho values for the beta-binomial distribution -\item \code{zScores}: This returns the calculated z-scores. +\item \code{zScores()}: This returns the calculated z-scores. -\item \code{pVals}: This returns the calculated p-values. +\item \code{pVals()}: This returns the calculated p-values. -\item \code{padjVals}: This returns the adjusted p-values. +\item \code{padjVals()}: This returns the adjusted p-values. -\item \code{predictedMeans}: This returns the fitted mu (i.e. psi) +\item \code{predictedMeans()}: This returns the fitted mu (i.e. psi) values. -\item \code{deltaPsiValue}: Returns the difference between the +\item \code{deltaPsiValue()}: Returns the difference between the observed and the fitted psi values. -\item \code{currentType}: Returns the psi type that is used +\item \code{currentType()}: Returns the psi type that is used within several methods in the FRASER package. -\item \code{currentType<-}: Sets the psi type that is to be used +\item \code{currentType(fds) <- value}: Sets the psi type that is to be used within several methods in the FRASER package. -\item \code{pseudocount}: Sets and returns the pseudo count used +\item \code{pseudocount()}: Sets and returns the pseudo count used within the FRASER fitting procedure. -\item \code{hyperParams}: This returns the results of the +\item \code{hyperParams()}: This returns the results of the hyperparameter optimization NULL if the hyperparameter opimization was not run yet. -\item \code{bestQ}: This returns the optimal size of the +\item \code{bestQ()}: This returns the optimal size of the latent space according to the hyperparameter optimization or a simple estimate of about a tenth of the number of samples if the hyperparameter opimization was not run yet. -\item \code{dontWriteHDF5}: Gets the current value of whether the +\item \code{dontWriteHDF5()}: Gets the current value of whether the assays should be stored as hdf5 files. -\item \code{dontWriteHDF5<-}: Sets whether the assays should be stored +\item \code{dontWriteHDF5(fds) <- value}: Sets whether the assays should be stored as hdf5 files. -\item \code{verbose}: Dependend on the level of verbosity +\item \code{verbose()}: Dependend on the level of verbosity the algorithm reports more or less to the user. 0 means being quiet and 10 means everything. -\item \code{verbose<-}: Sets the verbosity level to a value +\item \code{verbose(fds) <- value}: Sets the verbosity level to a value between 0 and 10. 0 means being quiet and 10 means reporting everything. -}} +}} \examples{ fds <- createTestFraserDataSet() diff --git a/man/subset.Rd b/man/subset.Rd index 034e934b..f034f714 100644 --- a/man/subset.Rd +++ b/man/subset.Rd @@ -5,9 +5,9 @@ \alias{[,FraserDataSet,ANY,ANY,ANY-method} \title{Subsetting by indices for junctions} \usage{ -\method{subset}{FRASER}(x, i, j, by = c("j", "ss")) +\method{subset}{FRASER}(x, i, j, by = c("j", "ss"), ..., drop = FALSE) -\S4method{[}{FraserDataSet,ANY,ANY,ANY}(x, i, j, by = c("j", "ss")) +\S4method{[}{FraserDataSet,ANY,ANY,ANY}(x, i, j, by = c("j", "ss"), ..., drop = FALSE) } \arguments{ \item{x}{A \code{FraserDataSet} object} @@ -16,8 +16,13 @@ \item{j}{A integer vector to subset the columns/samples} -\item{by}{a character (j or ss) definig if we subset by +\item{by}{a character (j or ss) defining if we subset by junctions or splice sites} + +\item{...}{Parameters currently not used or passed on} + +\item{drop}{No dimension reduction is done. And the \code{drop} +parameter is currently not used at all.} } \value{ A subsetted \code{FraserDataSet} object diff --git a/src/Makevars b/src/Makevars index 74e22156..7fb56432 100644 --- a/src/Makevars +++ b/src/Makevars @@ -1,4 +1,2 @@ -CXX_STD = CXX11 - PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_DONT_USE_OPENMP PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/Makevars.win b/src/Makevars.win index 74e22156..7fb56432 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,4 +1,2 @@ -CXX_STD = CXX11 - PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_DONT_USE_OPENMP PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/tests/testthat/test_getter_setter.R b/tests/testthat/test_getter_setter.R index 5db58672..36304edd 100644 --- a/tests/testthat/test_getter_setter.R +++ b/tests/testthat/test_getter_setter.R @@ -12,3 +12,12 @@ test_that("counts", { expect_equal(counts(fds, type="theta", side='other'), N(fds, "theta") - K(fds, "theta")) }) + +test_that("generic functions", { + # test that the correct functions are selected and called + methDef <- selectMethod("[", c("FraserDataSet", "ANY", "ANY", drop="ANY")) + expect_equal(slot(methDef, "defined")[["x"]], "FraserDataSet") + methDef <- selectMethod("[", + c("FraserDataSet", "ANY", "ANY", drop="missing")) + expect_equal(slot(methDef, "defined")[["x"]], "FraserDataSet") +}) diff --git a/vignettes/FRASER.Rnw b/vignettes/FRASER.Rnw index 11a7a599..82e9b56c 100644 --- a/vignettes/FRASER.Rnw +++ b/vignettes/FRASER.Rnw @@ -420,7 +420,7 @@ After looking at the expression distribution between filtered and unfiltered junctions, we can now subset the dataset: <>= -fds_filtered <- fds[mcols(fds, type="j")[,"passed"],] +fds_filtered <- fds[mcols(fds, type="j")[,"passed"]] fds_filtered # filtered_fds not further used for this tutorial because the example dataset # is otherwise too small