├── tests └── tinytest.R ├── inst ├── tinytest │ ├── test_internals.R │ ├── test_assertions.R │ ├── test_checkInstalled.R │ ├── test_showUtils.R │ └── test_lifeCycle.R └── scripts │ └── README.Rmd ├── NAMESPACE ├── R ├── BiocDeveloper-package.R ├── askUserYesNo.R ├── internals.R ├── checkInstalled.R ├── showUtils.R ├── lifecycle.R └── assertions.R ├── NEWS.md ├── .gitignore ├── man ├── askUserYesNo.Rd ├── checkInstalled.Rd ├── setSlots.Rd ├── BiocBaseUtils-package.Rd ├── selectSome.Rd ├── lifeCycle.Rd └── Assertions.Rd ├── DESCRIPTION ├── .github └── workflows │ └── readme.yaml ├── vignettes └── BiocBaseUtils.Rmd └── README.md /tests/tinytest.R: -------------------------------------------------------------------------------- 1 | if (requireNamespace("tinytest", quietly = TRUE)) 2 | tinytest::test_package("BiocBaseUtils") 3 | -------------------------------------------------------------------------------- /inst/tinytest/test_internals.R: -------------------------------------------------------------------------------- 1 | setClass("A", representation = representation(slotA = "character")) 2 | aclass <- new("A", slotA = "A") 3 | aclass <- setSlots(aclass, slotA = "B") 4 | expect_identical(aclass@slotA, "B") 5 | 6 | invObj <- BiocBaseUtils:::unsafe_replaceSlots(aclass, slotA = 42) 7 | expect_error( 8 | methods::validObject(invObj) 9 | ) 10 | expect_error( 11 | setSlots(aclass, slotA = 42) 12 | ) 13 | -------------------------------------------------------------------------------- /inst/scripts/README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | knit: (function(inputFile, encoding) { 4 | rmarkdown::render(inputFile, encoding = encoding, output_dir = "../../") }) 5 | --- 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | cache = TRUE, 12 | out.width = "100%" 13 | ) 14 | ``` 15 | 16 | ```{r, child="../../vignettes/BiocBaseUtils.Rmd"} 17 | 18 | ``` 19 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(askUserYesNo) 4 | export(checkInstalled) 5 | export(isCharacter) 6 | export(isScalarCharacter) 7 | export(isScalarInteger) 8 | export(isScalarLogical) 9 | export(isScalarNumber) 10 | export(isTRUEorFALSE) 11 | export(isZeroOneCharacter) 12 | export(lifeCycle) 13 | export(selectSome) 14 | export(setSlots) 15 | importFrom(methods,"slot<-") 16 | importFrom(methods,validObject) 17 | importFrom(utils,head) 18 | importFrom(utils,tail) 19 | -------------------------------------------------------------------------------- /R/BiocDeveloper-package.R: -------------------------------------------------------------------------------- 1 | #' BiocBaseUtils: Utility and Internal functions for Bioconductor packages 2 | #' 3 | #' BiocBaseUtils is a package aimed at helping the typical Bioconductor developer 4 | #' formalize often written functions that can be seen scattered throughout the 5 | #' Bioconductor ecosystem. Some of these functions include the ability to 6 | #' replace slots in an object. Other functions work to create a nice show method 7 | #' output by selecting some observations. 8 | #' 9 | #' @aliases NULL 10 | "_PACKAGE" 11 | -------------------------------------------------------------------------------- /inst/tinytest/test_assertions.R: -------------------------------------------------------------------------------- 1 | expect_true(isTRUEorFALSE(TRUE)) 2 | expect_true(isTRUEorFALSE(FALSE)) 3 | expect_true(isTRUEorFALSE(NA, na.ok = TRUE)) 4 | expect_false(isScalarCharacter(LETTERS)) 5 | 6 | expect_true(isScalarCharacter("L")) 7 | expect_true(isCharacter(LETTERS)) 8 | expect_true(isCharacter(NA_character_, na.ok = TRUE)) 9 | expect_false(isZeroOneCharacter("")) 10 | expect_true(isZeroOneCharacter("", zchar = TRUE)) 11 | 12 | expect_true(isScalarInteger(1L)) 13 | expect_false(isScalarInteger(1)) 14 | 15 | expect_true(isScalarNumber(1)) 16 | expect_false(isScalarNumber(1:2)) 17 | -------------------------------------------------------------------------------- /inst/tinytest/test_checkInstalled.R: -------------------------------------------------------------------------------- 1 | expect_error( 2 | checkInstalled("abc123xyzjfk"), 3 | paste0( 4 | "The calling function requires missing package dependencies:", 5 | "\n \"abc123xyzjfk\"" 6 | ) 7 | ) 8 | 9 | tinytest::expect_match( 10 | trimws( 11 | capture.output( 12 | tryCatch({ 13 | checkInstalled("abc123xyzjfk") 14 | }, error = function(e) { 15 | invisible() 16 | }) 17 | )[3] 18 | ), 19 | "BiocManager::install\\(\\\"abc123xyzjfk\\\"\\)" 20 | ) 21 | 22 | expect_true( 23 | checkInstalled(c("base", "datasets")) 24 | ) 25 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # Changes in version 1.12.0 2 | 3 | ## Bug fixes and minor improvements 4 | 5 | * The error message from `checkInstalled` now reports required packages 6 | in addition to the installation text. 7 | 8 | # Changes in version 1.6.0 9 | 10 | ## New features 11 | 12 | * `checkInstalled` allows to check if a package is installed and produces 13 | copy-and-paste text for installation. 14 | 15 | # Changes in version 1.4.0 16 | 17 | ## New features 18 | 19 | * Added `isScalarLogical` for completeness; identical to `isTRUEorFALSE`. 20 | 21 | # Changes in version 1.0.0 22 | 23 | ## New features 24 | 25 | * Added a `NEWS.md` file to track changes to the package. 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # User-specific files 9 | .Ruserdata 10 | 11 | # Example code in package build process 12 | *-Ex.R 13 | 14 | # Output files from R CMD build 15 | /*.tar.gz 16 | 17 | # Output files from R CMD check 18 | /*.Rcheck/ 19 | 20 | # RStudio files 21 | *.Rproj 22 | .Rproj.user/ 23 | 24 | # produced vignettes 25 | vignettes/*.html 26 | vignettes/*.pdf 27 | 28 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 29 | .httr-oauth 30 | 31 | # knitr and R markdown default cache directories 32 | *_cache/ 33 | /cache/ 34 | 35 | # Temporary files created by R markdown 36 | *.utf8.md 37 | *.knit.md 38 | 39 | # R Environment Variables 40 | .Renviron 41 | inst/doc 42 | -------------------------------------------------------------------------------- /inst/tinytest/test_showUtils.R: -------------------------------------------------------------------------------- 1 | expect_identical( 2 | length(selectSome(letters, maxToShow = 5)), 5L 3 | ) 4 | 5 | expect_identical( 6 | length(selectSome(letters, maxToShow = 3)), 3L 7 | ) 8 | 9 | expect_true( 10 | "??" %in% selectSome(letters, ellipsis = "??", maxToShow = 5) 11 | ) 12 | 13 | expect_identical( 14 | match("??", selectSome(letters, ellipsis = "??")), 3L 15 | ) 16 | 17 | expect_identical( 18 | match("??", 19 | selectSome( 20 | letters, ellipsis = "??", ellipsisPos = "start", maxToShow = 3 21 | ) 22 | ), 23 | 1L 24 | ) 25 | 26 | expect_identical( 27 | match("??", 28 | selectSome( 29 | letters, ellipsis = "??", ellipsisPos = "end", maxToShow = 5L 30 | ) 31 | ), 32 | 5L 33 | ) 34 | -------------------------------------------------------------------------------- /inst/tinytest/test_lifeCycle.R: -------------------------------------------------------------------------------- 1 | test_fun <- function() { 2 | lifeCycle(newfun = "new_test", package = "BiocBaseUtils") 3 | } 4 | 5 | expect_warning( 6 | test_fun(), 7 | "'test_fun' is deprecated\\." 8 | ) 9 | 10 | expect_warning( 11 | test_fun(), 12 | "Use 'new_test' instead\\." 13 | ) 14 | 15 | expect_warning( 16 | test_fun(), 17 | "See help\\('BiocBaseUtils-deprecated'\\)\\." 18 | ) 19 | 20 | test_fun <- function() { 21 | lifeCycle( 22 | newfun = "new_test", package = "BiocBaseUtils", cycle = "defunct" 23 | ) 24 | } 25 | 26 | expect_error( 27 | test_fun(), 28 | "'test_fun' is defunct\\." 29 | ) 30 | 31 | expect_error( 32 | test_fun(), 33 | "Use 'new_test' instead\\." 34 | ) 35 | 36 | expect_error( 37 | test_fun(), 38 | "See help\\('BiocBaseUtils-defunct'\\)\\." 39 | ) 40 | -------------------------------------------------------------------------------- /man/askUserYesNo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/askUserYesNo.R 3 | \name{askUserYesNo} 4 | \alias{askUserYesNo} 5 | \title{Ask user for a yes/no response} 6 | \usage{ 7 | askUserYesNo(prompt, interactive.only = TRUE) 8 | } 9 | \arguments{ 10 | \item{prompt}{\code{character()} Question form prompt to display to the user 11 | without a question mark} 12 | 13 | \item{interactive.only}{\code{logical(1)} If \code{TRUE}, the function will only 14 | prompt the user when the R session is interactive. If \code{FALSE}, the 15 | function will always prompt the user.} 16 | } 17 | \value{ 18 | TRUE when user replies with 'yes' to prompt, FALSE when 'no' 19 | } 20 | \description{ 21 | Ask user for a yes/no response 22 | } 23 | \examples{ 24 | 25 | askUserYesNo("Do you want to continue") 26 | 27 | } 28 | \author{ 29 | Martin M. 30 | } 31 | -------------------------------------------------------------------------------- /man/checkInstalled.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checkInstalled.R 3 | \name{checkInstalled} 4 | \alias{checkInstalled} 5 | \title{Check packages are installed otherwise suggest} 6 | \usage{ 7 | checkInstalled(pkgs) 8 | } 9 | \arguments{ 10 | \item{pkgs}{\code{character()} package names required for a function} 11 | } 12 | \value{ 13 | \code{TRUE} if all packages are installed, otherwise stops with a message 14 | and suggests installation of missing packages 15 | } 16 | \description{ 17 | \code{checkInstalled} allows to check if a package is installed. If the package is 18 | not available, a convenient copy-and-paste message is provided for package 19 | installation with \code{BiocManager}. The function is typically used within 20 | functions that check for package availability from the \code{Suggests} field. 21 | } 22 | \examples{ 23 | if (interactive()) { 24 | checkInstalled( 25 | c("BiocParallel", "SummarizedExperiment") 26 | ) 27 | } 28 | } 29 | \author{ 30 | M. Morgan, M. Ramos 31 | } 32 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: BiocBaseUtils 2 | Title: General utility functions for developing Bioconductor packages 3 | Version: 1.13.0 4 | Authors@R: c( 5 | person("Marcel", "Ramos", , "marcel.ramos@sph.cuny.edu", 6 | c("aut", "cre"), c(ORCID = "0000-0002-3242-0582") 7 | ), 8 | person("Martin", "Morgan", , "martin.morgan@roswellpark.org", "ctb" 9 | ), 10 | person("Hervé", "Pagès", , "hpages.on.github@gmail.com", "ctb") 11 | ) 12 | Description: The package provides utility functions related to package 13 | development. These include functions that replace slots, and selectors 14 | for show methods. It aims to coalesce the various helper functions 15 | often re-used throughout the Bioconductor ecosystem. 16 | Imports: methods, utils 17 | Depends: R (>= 4.2.0) 18 | Suggests: 19 | knitr, 20 | rmarkdown, 21 | BiocStyle, 22 | tinytest 23 | License: Artistic-2.0 24 | Encoding: UTF-8 25 | biocViews: Software, Infrastructure 26 | BugReports: https://www.github.com/Bioconductor/BiocBaseUtils/issues 27 | Roxygen: list(markdown = TRUE) 28 | RoxygenNote: 7.3.2 29 | VignetteBuilder: knitr 30 | Date: 2025-07-14 31 | -------------------------------------------------------------------------------- /man/setSlots.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/internals.R 3 | \name{setSlots} 4 | \alias{setSlots} 5 | \alias{replaceSlots} 6 | \title{Convenience function to set slot values} 7 | \usage{ 8 | setSlots(object, ..., check = TRUE) 9 | } 10 | \arguments{ 11 | \item{object}{An S4 object with slots to replace} 12 | 13 | \item{...}{Slot name and value pairs either as named arguments 14 | or a named list, e.g., \code{slotName = value}.} 15 | 16 | \item{check}{logical(1L) Whether to run validObject after the slot 17 | replacement} 18 | } 19 | \value{ 20 | The object input with updated slot data 21 | } 22 | \description{ 23 | Given the current object, the function \code{setSlots} will take name-value 24 | pair inputs either as named arguments or a \code{list} and replace the values of 25 | the specified slots. This is a convenient function for updating slots in 26 | an S4 class object. 27 | } 28 | \examples{ 29 | 30 | setClass("A", representation = representation(slotA = "character")) 31 | 32 | aclass <- new("A", slotA = "A") 33 | 34 | setSlots(aclass, slotA = "B") 35 | 36 | } 37 | \author{ 38 | H. Pagès 39 | } 40 | -------------------------------------------------------------------------------- /R/askUserYesNo.R: -------------------------------------------------------------------------------- 1 | #' Ask user for a yes/no response 2 | #' 3 | #' @param prompt `character()` Question form prompt to display to the user 4 | #' without a question mark 5 | #' 6 | #' @param interactive.only `logical(1)` If `TRUE`, the function will only 7 | #' prompt the user when the R session is interactive. If `FALSE`, the 8 | #' function will always prompt the user. 9 | #' 10 | #' @return TRUE when user replies with 'yes' to prompt, FALSE when 'no' 11 | #' 12 | #' @author Martin M. 13 | #' 14 | #' @examples 15 | #' 16 | #' askUserYesNo("Do you want to continue") 17 | #' 18 | #' @export 19 | askUserYesNo <- 20 | function(prompt, interactive.only = TRUE) 21 | { 22 | if (interactive.only && !interactive()) 23 | return(FALSE) 24 | responses <- c("yes", "no") 25 | msg1 <- paste0(prompt, " [", paste(responses, collapse = ", "), "]? ") 26 | msg2 <- paste0("reply with '", paste(responses, collapse = "' or '"), "'") 27 | repeat { 28 | userResponse <- trimws(tolower(readline(msg1))) 29 | if (userResponse %in% responses) 30 | break 31 | message(msg2) 32 | } 33 | identical(userResponse, responses[1L]) 34 | } 35 | -------------------------------------------------------------------------------- /man/BiocBaseUtils-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/BiocDeveloper-package.R 3 | \docType{package} 4 | \name{BiocBaseUtils-package} 5 | \alias{BiocBaseUtils} 6 | \alias{BiocBaseUtils-package} 7 | \title{BiocBaseUtils: Utility and Internal functions for Bioconductor packages} 8 | \description{ 9 | BiocBaseUtils is a package aimed at helping the typical Bioconductor developer 10 | formalize often written functions that can be seen scattered throughout the 11 | Bioconductor ecosystem. Some of these functions include the ability to 12 | replace slots in an object. Other functions work to create a nice show method 13 | output by selecting some observations. 14 | } 15 | \seealso{ 16 | Useful links: 17 | \itemize{ 18 | \item Report bugs at \url{https://www.github.com/Bioconductor/BiocBaseUtils/issues} 19 | } 20 | 21 | } 22 | \author{ 23 | \strong{Maintainer}: Marcel Ramos \email{marcel.ramos@sph.cuny.edu} (\href{https://orcid.org/0000-0002-3242-0582}{ORCID}) 24 | 25 | Other contributors: 26 | \itemize{ 27 | \item Martin Morgan \email{martin.morgan@roswellpark.org} [contributor] 28 | \item Hervé Pagès \email{hpages.on.github@gmail.com} [contributor] 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/selectSome.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/showUtils.R 3 | \name{selectSome} 4 | \alias{selectSome} 5 | \title{Select and return only some entries from a vector} 6 | \usage{ 7 | selectSome( 8 | obj, 9 | maxToShow = 5, 10 | ellipsis = "...", 11 | ellipsisPos = c("middle", "end", "start"), 12 | quote = FALSE 13 | ) 14 | } 15 | \arguments{ 16 | \item{obj}{character() A vector to be abbreviated for display purposes} 17 | 18 | \item{maxToShow}{numeric(1) The maximum number of values to show in the 19 | output (default: 5)} 20 | 21 | \item{ellipsis}{character(1) The symbol used to abbreviate values in the 22 | vector (default: "...")} 23 | 24 | \item{ellipsisPos}{character(1) The location for the ellipsis in the output, 25 | by default in the \code{"middle"} but can be moved to either the \code{"end"} or 26 | the \code{"start"}.} 27 | 28 | \item{quote}{logical(1) Whether or not to add a single quote around the \code{obj} 29 | input. This only works for character type inputs.} 30 | } 31 | \value{ 32 | An abbreviated output of \code{obj} 33 | } 34 | \description{ 35 | \code{selectSome} works well in \code{show} methods. It abbreviates a vector input 36 | depending on the \code{maxToShow} argument. 37 | } 38 | \examples{ 39 | 40 | letters 41 | 42 | selectSome(letters) 43 | 44 | } 45 | \author{ 46 | M. Morgan, H. Pagès 47 | } 48 | -------------------------------------------------------------------------------- /.github/workflows/readme.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | paths: ['vignettes/**.Rmd'] 4 | 5 | name: render-rmarkdown 6 | 7 | jobs: 8 | render-rmarkdown: 9 | runs-on: ubuntu-latest 10 | 11 | env: 12 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 13 | 14 | steps: 15 | - name: Checkout repo 16 | uses: actions/checkout@v3 17 | with: 18 | fetch-depth: 0 19 | 20 | - uses: r-lib/actions/setup-pandoc@v1 21 | 22 | - uses: r-lib/actions/setup-r@v1 23 | 24 | - uses: r-lib/actions/setup-renv@v1 25 | 26 | - name: Query dependencies 27 | run: | 28 | install.packages(c("remotes", "rmarkdown", "BiocManager")) 29 | shell: Rscript {0} 30 | 31 | - name: Install Dependencies 32 | run: | 33 | options(repos = c(CRAN = "https://packagemanager.rstudio.com/cran/__linux__/focal/latest")) 34 | BiocManager::install(version = "devel", ask = FALSE) 35 | remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories()) 36 | remotes::install_local(repos = BiocManager::repositories()) 37 | shell: Rscript {0} 38 | 39 | - name: Render README 40 | run: | 41 | Rscript -e 'rmarkdown::render(input = "inst/scripts/README.Rmd", output_dir = ".")' 42 | 43 | - name: Commit results 44 | run: | 45 | git config --local user.name "$GITHUB_ACTOR" 46 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" 47 | git add README.md 48 | git commit -m 'Re-build README.md file' 49 | git push origin 50 | -------------------------------------------------------------------------------- /R/internals.R: -------------------------------------------------------------------------------- 1 | #' Convenience function to set slot values 2 | #' 3 | #' @aliases replaceSlots 4 | #' 5 | #' @description 6 | #' Given the current object, the function `setSlots` will take name-value 7 | #' pair inputs either as named arguments or a `list` and replace the values of 8 | #' the specified slots. This is a convenient function for updating slots in 9 | #' an S4 class object. 10 | #' 11 | #' @param object An S4 object with slots to replace 12 | #' 13 | #' @param ... Slot name and value pairs either as named arguments 14 | #' or a named list, e.g., `slotName = value`. 15 | #' 16 | #' @param check logical(1L) Whether to run validObject after the slot 17 | #' replacement 18 | #' 19 | #' @return The object input with updated slot data 20 | #' 21 | #' @importFrom methods slot<- validObject 22 | #' 23 | #' @author H. Pagès 24 | #' 25 | #' @examples 26 | #' 27 | #' setClass("A", representation = representation(slotA = "character")) 28 | #' 29 | #' aclass <- new("A", slotA = "A") 30 | #' 31 | #' setSlots(aclass, slotA = "B") 32 | #' 33 | #' @export 34 | setSlots <- function (object, ..., check = TRUE) 35 | { 36 | if (!isTRUEorFALSE(check)) 37 | stop("'check' must be TRUE or FALSE") 38 | object <- unsafe_replaceSlots(object, ...) 39 | if (check) 40 | validObject(object) 41 | object 42 | } 43 | 44 | unsafe_replaceSlots <- function (object, ..., .slotList = list()) 45 | { 46 | slots <- c(list(...), .slotList) 47 | slots_names <- names(slots) 48 | for (i in seq_along(slots)) { 49 | slot_name <- slots_names[[i]] 50 | if (identical(slot_name, "mcols")) 51 | slot_name <- "elementMetadata" 52 | slot_val <- slots[[i]] 53 | slot(object, slot_name, check = FALSE) <- slot_val 54 | } 55 | object 56 | } 57 | 58 | -------------------------------------------------------------------------------- /R/checkInstalled.R: -------------------------------------------------------------------------------- 1 | #' Check packages are installed otherwise suggest 2 | #' 3 | #' `checkInstalled` allows to check if a package is installed. If the package is 4 | #' not available, a convenient copy-and-paste message is provided for package 5 | #' installation with `BiocManager`. The function is typically used within 6 | #' functions that check for package availability from the `Suggests` field. 7 | #' 8 | #' @param pkgs `character()` package names required for a function 9 | #' 10 | #' @return `TRUE` if all packages are installed, otherwise stops with a message 11 | #' and suggests installation of missing packages 12 | #' 13 | #' @author M. Morgan, M. Ramos 14 | #' 15 | #' @examples 16 | #' if (interactive()) { 17 | #' checkInstalled( 18 | #' c("BiocParallel", "SummarizedExperiment") 19 | #' ) 20 | #' } 21 | #' @export 22 | checkInstalled <- function(pkgs) { 23 | inst <- vapply(pkgs, FUN = function(pkg) { 24 | !nzchar(system.file(package = pkg)) 25 | }, logical(1L)) 26 | toinst <- pkgs[inst] 27 | if (length(toinst)) 28 | .install_suggestion(toinst) 29 | else 30 | TRUE 31 | } 32 | 33 | .install_suggestion <- function(pkgs) { 34 | n <- length(pkgs) 35 | txt <- if (identical(n, 1L)) '"%s"' else 'c(\n "%s"\n )' 36 | fmt <- ' BiocManager::install(%s)' 37 | fmt <- sprintf(fmt, txt) 38 | pkgs <- paste(strwrap( 39 | paste(pkgs, collapse='", "'), 40 | width = getOption("width") - 4L 41 | ), collapse="\n ") 42 | cat( 43 | "Install the required package(s) with:", 44 | "\n\n", sprintf(fmt, pkgs), "\n\n", sep = "" 45 | ) 46 | stop( 47 | "The calling function requires missing package dependencies:\n ", 48 | sprintf("\"%s\"", pkgs), 49 | call. = FALSE 50 | ) 51 | } 52 | -------------------------------------------------------------------------------- /R/showUtils.R: -------------------------------------------------------------------------------- 1 | #' Select and return only some entries from a vector 2 | #' 3 | #' `selectSome` works well in `show` methods. It abbreviates a vector input 4 | #' depending on the `maxToShow` argument. 5 | #' 6 | #' @param obj character() A vector to be abbreviated for display purposes 7 | #' 8 | #' @param maxToShow numeric(1) The maximum number of values to show in the 9 | #' output (default: 5) 10 | #' 11 | #' @param ellipsis character(1) The symbol used to abbreviate values in the 12 | #' vector (default: "...") 13 | #' 14 | #' @param ellipsisPos character(1) The location for the ellipsis in the output, 15 | #' by default in the `"middle"` but can be moved to either the `"end"` or 16 | #' the `"start"`. 17 | #' 18 | #' @param quote logical(1) Whether or not to add a single quote around the `obj` 19 | #' input. This only works for character type inputs. 20 | #' 21 | #' @return An abbreviated output of `obj` 22 | #' 23 | #' @importFrom utils head tail 24 | #' 25 | #' @author M. Morgan, H. Pagès 26 | #' 27 | #' @examples 28 | #' 29 | #' letters 30 | #' 31 | #' selectSome(letters) 32 | #' 33 | #' @export 34 | selectSome <- function(obj, maxToShow = 5, ellipsis = "...", 35 | ellipsisPos = c("middle", "end", "start"), quote = FALSE) 36 | { 37 | if (is.character(obj) && quote) 38 | obj <- sQuote(obj) 39 | ellipsisPos <- match.arg(ellipsisPos) 40 | len <- length(obj) 41 | if (maxToShow < 3) 42 | maxToShow <- 3 43 | if (len > maxToShow) { 44 | maxToShow <- maxToShow - 1 45 | if (ellipsisPos == "end") { 46 | c(head(obj, maxToShow), ellipsis) 47 | } else if (ellipsisPos == "start") { 48 | c(ellipsis, tail(obj, maxToShow)) 49 | } else { 50 | bot <- ceiling(maxToShow/2) 51 | top <- len - (maxToShow - bot - 1) 52 | sbot <- seq_len(bot) 53 | nms <- obj[c(sbot, top:len)] 54 | c(as.character(nms[sbot]), ellipsis, as.character(nms[-sbot])) 55 | } 56 | } else { 57 | obj 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /man/lifeCycle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lifecycle.R 3 | \name{lifeCycle} 4 | \alias{lifeCycle} 5 | \title{Set the life cycle stage of a function} 6 | \usage{ 7 | lifeCycle( 8 | newfun = oldfun, 9 | newpackage, 10 | package, 11 | cycle = c("deprecated", "defunct"), 12 | title = package 13 | ) 14 | } 15 | \arguments{ 16 | \item{newfun}{\code{character(1)} The name of the function to use instead. It can 17 | be a specific function within another package (e.g., \verb{package::function}) 18 | or a function in the current package (e.g., \code{function}). If \code{newfun} is not 19 | specified, the calling function \code{oldfun} is assumed to be the replacement.} 20 | 21 | \item{newpackage}{\code{character(1)} If a function is moved to a new package, the 22 | name of the new package can be specified here. This is equivalent to 23 | specifying \code{newfun = paste0(newpackage, "::", newfun)}.} 24 | 25 | \item{package}{\code{character(1)} The name of the package where the deprecated 26 | or defunct function resides. It corresponds to the package from where the 27 | \code{lifeCycle} function is called.} 28 | 29 | \item{cycle}{\code{character(1)} The life cycle stage of the function. This can be 30 | either \code{"deprecated"} or \code{"defunct"}.} 31 | 32 | \item{title}{\code{character(1)} The Rd name prefix of the documentation page 33 | where deprecated or defunct functions are documented (e.g., "summary" for 34 | "summary-deprecated"). By default, the package name is used.} 35 | } 36 | \description{ 37 | The \code{lifeCycle} function is used to set the life cycle stage of 38 | a function. It is to be used within the body of the function that is being 39 | deprecated or defunct. It is a wrapper around both \code{.Deprecated} and 40 | \code{.Defunct} base R functions. 41 | } 42 | \examples{ 43 | test_fun <- function() { 44 | lifeCycle(newfun = "new_test", package = "BiocBaseUtils") 45 | } 46 | ## catch warning and convert to message 47 | tryCatch(test_fun(), warning = function(w) message(w)) 48 | 49 | test_fun <- function() { 50 | lifeCycle( 51 | newfun = "new_test", package = "BiocBaseUtils", cycle = "defunct" 52 | ) 53 | } 54 | ## catch error and convert to message 55 | tryCatch(test_fun(), error = function(e) message(e)) 56 | } 57 | -------------------------------------------------------------------------------- /R/lifecycle.R: -------------------------------------------------------------------------------- 1 | #' Set the life cycle stage of a function 2 | #' 3 | #' @description The `lifeCycle` function is used to set the life cycle stage of 4 | #' a function. It is to be used within the body of the function that is being 5 | #' deprecated or defunct. It is a wrapper around both `.Deprecated` and 6 | #' `.Defunct` base R functions. 7 | #' 8 | #' @param newfun `character(1)` The name of the function to use instead. It can 9 | #' be a specific function within another package (e.g., `package::function`) 10 | #' or a function in the current package (e.g., `function`). If `newfun` is not 11 | #' specified, the calling function `oldfun` is assumed to be the replacement. 12 | #' 13 | #' @param newpackage `character(1)` If a function is moved to a new package, the 14 | #' name of the new package can be specified here. This is equivalent to 15 | #' specifying `newfun = paste0(newpackage, "::", newfun)`. 16 | #' 17 | #' @param package `character(1)` The name of the package where the deprecated 18 | #' or defunct function resides. It corresponds to the package from where the 19 | #' `lifeCycle` function is called. 20 | #' 21 | #' @param cycle `character(1)` The life cycle stage of the function. This can be 22 | #' either `"deprecated"` or `"defunct"`. 23 | #' 24 | #' @param title `character(1)` The Rd name prefix of the documentation page 25 | #' where deprecated or defunct functions are documented (e.g., "summary" for 26 | #' "summary-deprecated"). By default, the package name is used. 27 | #' 28 | #' @examples 29 | #' test_fun <- function() { 30 | #' lifeCycle(newfun = "new_test", package = "BiocBaseUtils") 31 | #' } 32 | #' ## catch warning and convert to message 33 | #' tryCatch(test_fun(), warning = function(w) message(w)) 34 | #' 35 | #' test_fun <- function() { 36 | #' lifeCycle( 37 | #' newfun = "new_test", package = "BiocBaseUtils", cycle = "defunct" 38 | #' ) 39 | #' } 40 | #' ## catch error and convert to message 41 | #' tryCatch(test_fun(), error = function(e) message(e)) 42 | #' @export 43 | lifeCycle <- function( 44 | newfun = oldfun, newpackage, package, 45 | cycle = c("deprecated", "defunct"), title = package 46 | ) { 47 | removal <- missing(newfun) && missing(newpackage) 48 | oldfun <- as.character(sys.call(sys.parent())[1L]) 49 | cycle <- match.arg(cycle) 50 | 51 | if (!missing(newpackage)) 52 | newfun <- paste0(newpackage, "::", gsub("^.*::", "", newfun)) 53 | 54 | msg <- c( 55 | gettextf("'%s' is %s.\n ", oldfun, cycle), 56 | if (!removal) gettextf("Use '%s' instead.\n ", newfun), 57 | gettextf("See help('%s').", paste0(title, "-", cycle)) 58 | ) 59 | cycle_fun <- switch(cycle, deprecated = .Deprecated, defunct = .Defunct) 60 | arglist <- list(new = newfun, msg = msg, package = package) 61 | do.call(cycle_fun, arglist) 62 | } 63 | -------------------------------------------------------------------------------- /man/Assertions.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/assertions.R 3 | \name{Assertions} 4 | \alias{Assertions} 5 | \alias{isTRUEorFALSE} 6 | \alias{isScalarCharacter} 7 | \alias{isScalarInteger} 8 | \alias{isScalarNumber} 9 | \alias{isScalarLogical} 10 | \alias{isCharacter} 11 | \alias{isZeroOneCharacter} 12 | \title{Suite of helper functions to test for types} 13 | \usage{ 14 | isTRUEorFALSE(x, na.ok = FALSE) 15 | 16 | isScalarCharacter(x, na.ok = FALSE, zchar = FALSE) 17 | 18 | isScalarInteger(x, na.ok = FALSE) 19 | 20 | isScalarNumber(x, na.ok = FALSE, infinite.ok = FALSE) 21 | 22 | isScalarLogical(x, na.ok = FALSE) 23 | 24 | isCharacter(x, na.ok = FALSE, zchar = FALSE) 25 | 26 | isZeroOneCharacter(x, na.ok = FALSE, zchar = FALSE) 27 | } 28 | \arguments{ 29 | \item{x}{The input vector whose type is to be checked} 30 | 31 | \item{na.ok}{logical(1L) Whether it is acceptable to consider \code{NA} type 32 | inputs (default: \code{FALSE}).} 33 | 34 | \item{zchar}{logical(1L) Whether is is acceptable to consider 'zero' 35 | characters as defined by \code{nchar}, e.g., \code{nchar("")} (default: \code{FALSE}).} 36 | 37 | \item{infinite.ok}{logical(1L) Whether it is acceptable to consider infinite 38 | values as identified by \code{is.finite} (default: \code{FALSE}).} 39 | } 40 | \value{ 41 | Either \code{TRUE} or \code{FALSE} 42 | } 43 | \description{ 44 | These are a group of helper functions that allow the developer 45 | to easily check for common data types in Bioconductor. These include 46 | logical, character, and numeric (& integer). 47 | } 48 | \details{ 49 | Some functions such as \code{isScalarCharacter} allow exceptions to the type 50 | checks via the \code{na.ok} and \code{zchar} arguments. Others, for example 51 | \code{isScalarNumber} can permit \code{Inf} with the \code{infinite.ok} argument. 52 | } 53 | \section{Functions}{ 54 | \itemize{ 55 | \item \code{isTRUEorFALSE()}: Is the input a single logical vector? 56 | 57 | \item \code{isScalarCharacter()}: Is the input a single character vector? 58 | 59 | \item \code{isScalarInteger()}: Is the input a single integer vector? 60 | 61 | \item \code{isScalarNumber()}: Is the input a single numeric vector? 62 | 63 | \item \code{isScalarLogical()}: Is the input a single logical vector? 64 | 65 | \item \code{isCharacter()}: Is the input a character vector? 66 | 67 | \item \code{isZeroOneCharacter()}: Is the input a character vector of zero or one length? 68 | 69 | }} 70 | \examples{ 71 | 72 | isTRUEorFALSE(TRUE) 73 | isTRUEorFALSE(FALSE) 74 | isTRUEorFALSE(NA, na.ok = TRUE) 75 | 76 | isScalarCharacter(LETTERS) 77 | isScalarCharacter("L") 78 | isCharacter(LETTERS) 79 | isCharacter(NA_character_, na.ok = TRUE) 80 | isZeroOneCharacter("") 81 | isZeroOneCharacter("", zchar = TRUE) 82 | 83 | isScalarInteger(1L) 84 | isScalarInteger(1) 85 | 86 | isScalarNumber(1) 87 | isScalarNumber(1:2) 88 | 89 | } 90 | \author{ 91 | M. Morgan, H. Pagès 92 | } 93 | -------------------------------------------------------------------------------- /R/assertions.R: -------------------------------------------------------------------------------- 1 | # adapted from S4Vectors 2 | .isSingle <- function(x, na.ok, FUN) 3 | { 4 | FUN(x) && identical(length(x), 1L) && (na.ok || !is.na(x)) 5 | } 6 | 7 | #' @name Assertions 8 | #' 9 | #' @title Suite of helper functions to test for types 10 | #' 11 | #' @description 12 | #' These are a group of helper functions that allow the developer 13 | #' to easily check for common data types in Bioconductor. These include 14 | #' logical, character, and numeric (& integer). 15 | #' 16 | #' @details 17 | #' Some functions such as `isScalarCharacter` allow exceptions to the type 18 | #' checks via the `na.ok` and `zchar` arguments. Others, for example 19 | #' `isScalarNumber` can permit `Inf` with the `infinite.ok` argument. 20 | #' 21 | #' @param x The input vector whose type is to be checked 22 | #' 23 | #' @param na.ok logical(1L) Whether it is acceptable to consider `NA` type 24 | #' inputs (default: `FALSE`). 25 | #' 26 | #' @param zchar logical(1L) Whether is is acceptable to consider 'zero' 27 | #' characters as defined by `nchar`, e.g., `nchar("")` (default: `FALSE`). 28 | #' 29 | #' @param infinite.ok logical(1L) Whether it is acceptable to consider infinite 30 | #' values as identified by `is.finite` (default: `FALSE`). 31 | #' 32 | #' @author M. Morgan, H. Pagès 33 | #' 34 | #' @return Either `TRUE` or `FALSE` 35 | #' 36 | #' @md 37 | #' 38 | #' @examples 39 | #' 40 | #' isTRUEorFALSE(TRUE) 41 | #' isTRUEorFALSE(FALSE) 42 | #' isTRUEorFALSE(NA, na.ok = TRUE) 43 | #' 44 | #' isScalarCharacter(LETTERS) 45 | #' isScalarCharacter("L") 46 | #' isCharacter(LETTERS) 47 | #' isCharacter(NA_character_, na.ok = TRUE) 48 | #' isZeroOneCharacter("") 49 | #' isZeroOneCharacter("", zchar = TRUE) 50 | #' 51 | #' isScalarInteger(1L) 52 | #' isScalarInteger(1) 53 | #' 54 | #' isScalarNumber(1) 55 | #' isScalarNumber(1:2) 56 | #' 57 | NULL 58 | 59 | 60 | #' @describeIn Assertions Is the input a single logical vector? 61 | #' 62 | #' @export 63 | isTRUEorFALSE <- function(x, na.ok = FALSE) 64 | { 65 | .isSingle(x, na.ok, is.logical) 66 | } 67 | 68 | #' @describeIn Assertions Is the input a single character vector? 69 | #' 70 | #' @export 71 | isScalarCharacter <- function(x, na.ok = FALSE, zchar = FALSE) 72 | { 73 | identical(length(x), 1L) && isCharacter(x, na.ok, zchar) 74 | } 75 | 76 | #' @describeIn Assertions Is the input a single integer vector? 77 | #' 78 | #' @export 79 | isScalarInteger <- function(x, na.ok = FALSE) 80 | { 81 | .isSingle(x, na.ok, is.integer) 82 | } 83 | 84 | #' @describeIn Assertions Is the input a single numeric vector? 85 | #' 86 | #' @export 87 | isScalarNumber <- function(x, na.ok = FALSE, infinite.ok = FALSE) 88 | { 89 | .isSingle(x, na.ok, is.numeric) && (infinite.ok || is.finite(x)) 90 | } 91 | 92 | #' @describeIn Assertions Is the input a single logical vector? 93 | #' 94 | #' @export 95 | isScalarLogical <- function(x, na.ok = FALSE) 96 | { 97 | .isSingle(x, na.ok, is.logical) 98 | } 99 | 100 | #' @describeIn Assertions Is the input a character vector? 101 | #' 102 | #' @export 103 | isCharacter <- function(x, na.ok = FALSE, zchar = FALSE) 104 | { 105 | is.character(x) && (na.ok || all(!is.na(x))) && (zchar || all(nzchar(x))) 106 | } 107 | 108 | #' @describeIn Assertions Is the input a character vector of zero or one length? 109 | #' 110 | #' @export 111 | isZeroOneCharacter <- function(x, na.ok = FALSE, zchar = FALSE) 112 | { 113 | (length(x) == 0L || length(x) == 1L) && 114 | isCharacter(x, na.ok, zchar) 115 | } 116 | -------------------------------------------------------------------------------- /vignettes/BiocBaseUtils.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "BiocBaseUtils Quick Start" 3 | author: "Bioconductor Core Team" 4 | date: "`r format(Sys.time(), '%B %d, %Y')`" 5 | output: 6 | BiocStyle::html_document: 7 | number_sections: yes 8 | toc: true 9 | vignette: > 10 | %\VignetteIndexEntry{BiocBaseUtils Quick Start} 11 | %\VignetteEngine{knitr::rmarkdown} 12 | %\VignetteEncoding{UTF-8} 13 | --- 14 | 15 | ```{r, include = FALSE} 16 | knitr::opts_chunk$set( 17 | collapse = TRUE, 18 | comment = "#>" 19 | ) 20 | ``` 21 | 22 | # BiocBaseUtils 23 | 24 | The `BiocBaseUtils` package provides a suite of helper functions designed to 25 | help developers. Currently, it covers three topics often encountered during 26 | the development process. 27 | 28 | 1. Assertions - Type checks for logical, character, and numeric inputs 29 | 2. Slot replacement - Replacing the value of object slots 30 | 3. `show` method - Limiting the output of internal components of a class 31 | 32 | # Installation 33 | 34 | Install the package directly from Bioconductor: 35 | 36 | ```{r,eval=FALSE} 37 | if (!requireNamespace("BiocManager", quietly = TRUE)) 38 | install.packages("BiocManager") 39 | BiocManager::install("BiocBaseUtils") 40 | ``` 41 | 42 | # Load Package 43 | 44 | ```{r,include=TRUE,results="hide",message=FALSE,warning=FALSE} 45 | library(BiocBaseUtils) 46 | ``` 47 | 48 | # Assertions 49 | 50 | We provide a number of functions that helps the developer establish the 51 | type of class of a particular object. These include `integer`, `numeric`, 52 | `character`, and `logical`; types often used in R / Bioconductor. 53 | 54 | ## Logical 55 | 56 | ```{r} 57 | isTRUEorFALSE(TRUE) 58 | isTRUEorFALSE(FALSE) 59 | isTRUEorFALSE(NA, na.ok = TRUE) 60 | ``` 61 | 62 | ## Character 63 | 64 | ```{r} 65 | isScalarCharacter(LETTERS) 66 | isScalarCharacter("L") 67 | isCharacter(LETTERS) 68 | isCharacter(NA_character_, na.ok = TRUE) 69 | isZeroOneCharacter("") 70 | isZeroOneCharacter("", zchar = TRUE) 71 | ``` 72 | 73 | ## Numeric 74 | 75 | ```{r} 76 | isScalarInteger(1L) 77 | isScalarInteger(1) 78 | 79 | isScalarNumber(1) 80 | isScalarNumber(1:2) 81 | ``` 82 | 83 | # Slot replacement 84 | 85 | This function is often used in packages that establish formal S4 classes. 86 | When updating the value of a slot, one often uses the `setSlots` function. 87 | 88 | ```{r} 89 | setClass("A", representation = representation(slot1 = "numeric")) 90 | aclass <- new("A", slot1 = 1:10) 91 | aclass 92 | ``` 93 | 94 | Now we use the `setSlots` function to update the values in the object. 95 | 96 | ```{r} 97 | aclass <- setSlots(aclass, slot1 = 11:20) 98 | aclass 99 | ``` 100 | 101 | Note that `setSlots` provides the same functionality as 102 | `BiocGenerics:::replaceSlots` but is more consistent with Bioconductor the 103 | setter and getter language. 104 | 105 | # `show` method 106 | 107 | The `selectSome` function allows the developer to display a limited amount of 108 | information from a developed class. Note that the use of the `@` here is due 109 | to the minimal implementation in the examples provided. The developer should 110 | always provide an interface to access the internal components of the class 111 | via an 'accessor' function. 112 | 113 | ```{r} 114 | setMethod("show", signature = "A", function(object) { 115 | s1info <- getElement(object, "slot1") 116 | cat("A sequence:", selectSome(s1info)) 117 | }) 118 | aclass 119 | ``` 120 | 121 | # Contributing 122 | 123 | `BiocBaseUtils` is a work in progress and we welcome contributions. There 124 | are quite a few often-used utility functions that are yet to be included in the 125 | package. We would like to keep the dependencies in this package minimal; 126 | therefore, contributions should mostly use base R. 127 | 128 | # Session Info 129 | 130 | ```{r} 131 | sessionInfo() 132 | ``` 133 | 134 | Please report minimally reproducible bugs at our [github issue page][]. 135 | 136 | [github issue page]: https://github.com/Bioconductor/BiocBaseUtils/issues 137 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # BiocBaseUtils 3 | 4 | The `BiocBaseUtils` package provides a suite of helper functions 5 | designed to help developers. Currently, it covers three topics often 6 | encountered during the development process. 7 | 8 | 1. Assertions - Type checks for logical, character, and numeric inputs 9 | 2. Slot replacement - Replacing the value of object slots 10 | 3. `show` method - Limiting the output of internal components of a 11 | class 12 | 13 | # Installation 14 | 15 | Install the package directly from Bioconductor: 16 | 17 | ``` r 18 | if (!requireNamespace("BiocManager", quietly = TRUE)) 19 | install.packages("BiocManager") 20 | BiocManager::install("BiocBaseUtils") 21 | ``` 22 | 23 | # Load Package 24 | 25 | ``` r 26 | library(BiocBaseUtils) 27 | ``` 28 | 29 | # Assertions 30 | 31 | We provide a number of functions that helps the developer establish the 32 | type of class of a particular object. These include `integer`, 33 | `numeric`, `character`, and `logical`; types often used in R / 34 | Bioconductor. 35 | 36 | ## Logical 37 | 38 | ``` r 39 | isTRUEorFALSE(TRUE) 40 | #> [1] TRUE 41 | isTRUEorFALSE(FALSE) 42 | #> [1] TRUE 43 | isTRUEorFALSE(NA, na.ok = TRUE) 44 | #> [1] TRUE 45 | ``` 46 | 47 | ## Character 48 | 49 | ``` r 50 | isScalarCharacter(LETTERS) 51 | #> [1] FALSE 52 | isScalarCharacter("L") 53 | #> [1] TRUE 54 | isCharacter(LETTERS) 55 | #> [1] TRUE 56 | isCharacter(NA_character_, na.ok = TRUE) 57 | #> [1] TRUE 58 | isZeroOneCharacter("") 59 | #> [1] FALSE 60 | isZeroOneCharacter("", zchar = TRUE) 61 | #> [1] TRUE 62 | ``` 63 | 64 | ## Numeric 65 | 66 | ``` r 67 | isScalarInteger(1L) 68 | #> [1] TRUE 69 | isScalarInteger(1) 70 | #> [1] FALSE 71 | 72 | isScalarNumber(1) 73 | #> [1] TRUE 74 | isScalarNumber(1:2) 75 | #> [1] FALSE 76 | ``` 77 | 78 | # Slot replacement 79 | 80 | This function is often used in packages that establish formal S4 81 | classes. When updating the value of a slot, one often uses the 82 | `setSlots` function. 83 | 84 | ``` r 85 | setClass("A", representation = representation(slot1 = "numeric")) 86 | aclass <- new("A", slot1 = 1:10) 87 | aclass 88 | #> An object of class "A" 89 | #> Slot "slot1": 90 | #> [1] 1 2 3 4 5 6 7 8 9 10 91 | ``` 92 | 93 | Now we use the `setSlots` function to update the values in the object. 94 | 95 | ``` r 96 | aclass <- setSlots(aclass, slot1 = 11:20) 97 | aclass 98 | #> An object of class "A" 99 | #> Slot "slot1": 100 | #> [1] 11 12 13 14 15 16 17 18 19 20 101 | ``` 102 | 103 | Note that `setSlots` provides the same functionality as 104 | `BiocGenerics:::replaceSlots` but is more consistent with Bioconductor 105 | the setter and getter language. 106 | 107 | # `show` method 108 | 109 | The `selectSome` function allows the developer to display a limited 110 | amount of information from a developed class. Note that the use of the 111 | `@` here is due to the minimal implementation in the examples provided. 112 | The developer should always provide an interface to access the internal 113 | components of the class via an ‘accessor’ function. 114 | 115 | ``` r 116 | setMethod("show", signature = "A", function(object) { 117 | s1info <- getElement(object, "slot1") 118 | cat("A sequence:", selectSome(s1info)) 119 | }) 120 | aclass 121 | #> A sequence: 11 12 ... 19 20 122 | ``` 123 | 124 | # Contributing 125 | 126 | `BiocBaseUtils` is a work in progress and we welcome contributions. 127 | There are quite a few often-used utility functions that are yet to be 128 | included in the package. We would like to keep the dependencies in this 129 | package minimal; therefore, contributions should mostly use base R. 130 | 131 | # Session Info 132 | 133 | ``` r 134 | sessionInfo() 135 | #> R version 4.2.1 (2022-06-23) 136 | #> Platform: x86_64-pc-linux-gnu (64-bit) 137 | #> Running under: Ubuntu 20.04.4 LTS 138 | #> 139 | #> Matrix products: default 140 | #> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 141 | #> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0 142 | #> 143 | #> locale: 144 | #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 145 | #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 146 | #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C 147 | #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C 148 | #> 149 | #> attached base packages: 150 | #> [1] stats graphics grDevices datasets utils methods base 151 | #> 152 | #> other attached packages: 153 | #> [1] BiocBaseUtils_0.99.10 154 | #> 155 | #> loaded via a namespace (and not attached): 156 | #> [1] compiler_4.2.1 magrittr_2.0.3 fastmap_1.1.0 htmltools_0.5.3 157 | #> [5] tools_4.2.1 yaml_2.3.5 codetools_0.2-18 stringi_1.7.8 158 | #> [9] rmarkdown_2.15 knitr_1.39 stringr_1.4.0 xfun_0.32 159 | #> [13] digest_0.6.29 rlang_1.0.4 renv_0.15.5 evaluate_0.16 160 | ``` 161 | 162 | Please report minimally reproducible bugs at our [github issue 163 | page](https://github.com/Bioconductor/BiocBaseUtils/issues). 164 | --------------------------------------------------------------------------------