Package 'BiocArchive'

Title: Access the Bioconductor archives and install packages from previous releases
Description: Install older versions of Bioconductor based on the R version currently installed in the system. The package relies on BiocManager to install packages but makes sure that CRAN package versions are downloaded from P3M snapshots. These snapshots will conincide with the last published built date of the requested Bioconductor version.
Authors: Marcel Ramos [aut, cre]
Maintainer: Marcel Ramos <[email protected]>
License: Artistic-2.0
Version: 1.0.1
Built: 2024-11-20 05:06:00 UTC
Source: https://github.com/Bioconductor/BiocArchive

Help Index


Check whether a Bioconductor mirror is configured

Description

The function checks the PACKAGES file with RCurl::url.exists.

Usage

checkBioCmirror(
  mirror = getOption("BioC_mirror"),
  version = BiocManager::version(),
  repoType = c("BioCsoft", "BioCann", "BioCexp", "BioCworkflows", "BioCbooks"),
  type = getOption("pkgType")
)

Arguments

mirror

character(1) The Bioconductor mirror to be tested resolves from getOption("BioC_mirror"). If one is not selected, chooseBioCmirror() will be run and the user will be able to select a mirror interactively.

version

character(1) The Bioconductor version to be checked.

repoType

character(1) One of the Bioconductor package types, including BioCsoft (default), BioCann, BioCexp, BioCworkflows, and BioCbooks.

type

character(1) The package type whether "source", "binary", "mac.binary", or "win.binary" as given by getOption("pkgType"). See install.packages for details.

Value

A logical value indicating availability of the mirror indicated in the name.

Examples

bioc_url <- "https://bioconductor.org"
bioc_mirror <- c(`0-Bioconductor (World-wide) [https]` = bioc_url)
checkBioCmirror(mirror = bioc_mirror)

Install packages from the CRAN archive

Description

The function looks through the CRAN archive for each package and finds the package versions that are compatible with the archived Bioconductor version using the release date of that Bioconductor version as reported by lastBuilt.

Usage

CRANinstall(
  pkgs,
  version = BiocManager::version(),
  dry.run = FALSE,
  ...,
  last_built = lastBuilt(version = version)
)

Arguments

pkgs

character() A vector of package names whose versions are sought to be compatible with the archived version of Bioconductor.

version

character(1) The desired version to reproduce. This is largely dictated by the current R / Bioconductor version installed and is indicated by BiocManager::version by default.

dry.run

logical(1) Whether to show only the time machine repository and forgo the package installation.

...

Additional parameters for the BiocManager::install() function

last_built

⁠named character(1)⁠ A character scalar of the date of the Bioconductor versions last build. The name corresponds to the Bioconductor version, e.g., c('3.14' = "2022-04-13"). By default, the lastBuilt() function reports the date from the value of the version argument.

Value

Mostly called for its side effect of installing the package from the CRAN archives that corresponds to the given Bioconductor version.

Examples

CRANinstall(c("dplyr", "ggplot2"), version = "3.14", dry.run = TRUE)

Install packages from a previous release of Bioconductor for reproducibility

Description

This function allows users to install packages from a previously released Bioconductor version.

Usage

install(
  pkgs = character(),
  version = BiocManager::version(),
  snapshot = getOption("BiocArchive.snapshot", "P3M"),
  dry.run = FALSE,
  ...,
  last_built = lastBuilt(version = version)
)

Arguments

pkgs

character() vector of package names to install or update. A missing value updates installed packages according to ⁠update =⁠ and ⁠ask =⁠. Package names containing a '/' are treated as GitHub repositories and installed using remotes::install_github().

version

character(1) The desired version to reproduce. This is largely dictated by the current R / Bioconductor version installed and is indicated by BiocManager::version by default.

snapshot

character(1) The snapshot CRAN repository to use for reproducibility. This defaults to the value of getOption("BiocArchive.snapshot", "P3M").

dry.run

logical(1) Whether to show only the time machine repository and forgo the package installation.

...

Additional parameters for the BiocManager::install() function

last_built

⁠named character(1)⁠ A character scalar of the date of the Bioconductor versions last build. The name corresponds to the Bioconductor version, e.g., c('3.14' = "2022-04-13"). By default, the lastBuilt() function reports the date from the value of the version argument.

Details

CRAN packages for out-of-date Bioconductor installations can be installed from historical 'snapshots' consistent with the last date the Bioconductor version was current. This behavior is largely dictated by the actual R/Bioconductor installation, e.g., Bioconductor 3.11. For example, Bioconductor version 3.11 was current until October 28, 2020; CRAN packages are therefore installed from a snapshot created on 2020-10-28. By default, the snapshots are from 'P3M', the Posit Public Package Manager. Use options(BiocArchive.snapshot = "CRAN") to use the current CRAN repository (i.e., disabling the snapshot feature).

Note that the function will temporarily change the getOption('repos') setting for CRAN to allow installation of CRAN packages from either the P3M time machines. The function will also modify the BIOCONDUCTOR_USE_CONTAINER_REPOSITORY environment variable to temporarily disable binary package installations. This is due to the possibility of CRAN packages in the Bioconductor binary repositories that are not fixed to a certain release date. Note that BiocArchive.snapshot has replaced BiocManager.snapshot.

It may be desirable to specify different default repositories, especially CRAN, for intentionally out-of-date Bioconductor releases (e.g., to support reproducible research). Our approach automatically provides an alteration to the repos option , e.g., 'options(repos = c(CRAN = "https://packagemanager.posit.co/cran/2022-04-13/")).

Value

Mostly called for the side-effects of copying and modifying the config.yaml and .Renviron files to reproduce an R / Bioconductor package environment from a previous Bioconductor release.

Examples

install("DESeq2", version = "3.14", snapshot = "P3M", dry.run = TRUE)

Obtain the last build date for a particular Bioconductor version

Description

The function facilitates the discovery of last build dates useful for selecting a fixed date to be used in conjunction with options("BiocArchive.snapshot"). Currently, it looks at https://bioconductor.org/checkResults/ and parses the dates listed.

Usage

lastBuilt(version = "all")

Arguments

version

character(1) Indicates the Bioconductor version for which the last build date is sought. By default, 'all' versions will be returned.

Value

character(1) The last build date for the specified Bioconductor version.

Examples

lastBuilt(version = "3.14")

Display Bioconductor and CRAN snapshot repositories

Description

repositories() reports the URLs from which to install Bioconductor and CRAN packages. There repositories are based on the data of the last build of the archived Bioconductor release.

Usage

repositories(
  site_repository = character(),
  version = BiocManager::version(),
  snapshot = getOption("BiocArchive.snapshot", "P3M"),
  last_built = lastBuilt(version = version)
)

Arguments

site_repository

(Optional) character(1) representing an additional repository (e.g., a URL to an organization's internally maintained repository) in which to look for packages to install. This repository will be prepended to the default repositories returned by the function.

version

(Optional) character(1) or package_version indicating the Bioconductor version (e.g., "3.8") for which repositories are required.

snapshot

character(1) The snapshot CRAN repository to use for reproducibility. This defaults to the value of getOption("BiocArchive.snapshot", "P3M").

last_built

⁠named character(1)⁠ A character scalar of the date of the Bioconductor versions last build. The name corresponds to the Bioconductor version, e.g., c('3.14' = "2022-04-13"). By default, the lastBuilt() function reports the date from the value of the version argument.

Details

The CRAN repository reflects the snapshot arguments, which can be either P3M, or CRAN. The CRAN option will default to the established repository. For installation of archived packages on CRAN, see the CRANinstall function.

When binary installations are enabled via BIOCONDUCTOR_USE_CONTAINER_REPOSITORY, the function will temporarily disable binary installation of packages. Bioconductor binary repositories may include CRAN packages that are not fixed to the release date.

Value

A character vector of Bioconductor and CRAN repositories accounting for previous releases

See Also

CRANinstall

Examples

if (interactive()) {
    # run within the Bioconductor 3.14 Docker container
    repositories(version = "3.14", snapshot = "P3M")
}

Validate installed packages versions against archive constraints

Description

Check that installed packages are consistent (neither out-of-date nor too new) with the verison of R and Bioconductor in use.

Usage

valid(
  pkgs = utils::installed.packages(lib.loc, priority = priority),
  lib.loc = NULL,
  priority = "NA",
  type = getOption("pkgType"),
  filters = NULL,
  ...,
  checkBuilt = FALSE,
  site_repository = character(),
  version = BiocManager::version(),
  last_built = lastBuilt(version = version),
  snapshot = getOption("BiocArchive.snapshot", "P3M")
)

Arguments

pkgs

A character() vector of package names for checking, or a matrix as returned by installed.packages()'.

lib.loc

A character() vector of library location(s) of packages to be validated; see installed.packages().

priority

character(1) Check validity of all, "base", or "recommended" packages; see installed.packages().

type

character(1) The type of available package (e.g., binary, source) to check validity against; see available.packages().

filters

character(1) Filter available packages to check validity against; see available.packages().

...

Additional arguments, passed to BiocManager::install() when fix=TRUE.

checkBuilt

logical(1). If TRUE a package built under an earlier major.minor version of R (e.g., 3.4) is considered to be old.

site_repository

character(1). See ?install.

version

character(1) The desired version to reproduce. This is largely dictated by the current R / Bioconductor version installed and is indicated by BiocManager::version by default.

last_built

⁠named character(1)⁠ A character scalar of the date of the Bioconductor versions last build. The name corresponds to the Bioconductor version, e.g., c('3.14' = "2022-04-13"). By default, the lastBuilt() function reports the date from the value of the version argument.

snapshot

character(1) The snapshot CRAN repository to use for reproducibility. This defaults to the value of getOption("BiocArchive.snapshot", "P3M").

Details

The function mainly works with the CRAN repositories location given by the repositories() function. There is no reliable way to verify CRANinstall installations other than by running the function with the dry.run = TRUE parameter and manually comparing versions.

Value

biocValid list object with elements too_new and out_of_date containing data.frames with packages and their installed locations that are too new or out-of-date for the archived version of Bioconductor. When internet access is unavailable, an empty 'biocValid' list is returned. If all packages ('pkgs') are up to date, then TRUE is returned.

Examples

if (interactive()) {
  valid()
}