BiocInstaller/DESCRIPTION0000644000126300012640000000063612174134515016405 0ustar00biocbuildphs_compbioPackage: BiocInstaller Title: Install/Update Bioconductor and CRAN Packages Description: Installs/updates Bioconductor and CRAN packages Version: 1.10.3 Author: Dan Tenenbaum and Biocore Team Maintainer: Bioconductor Package Maintainer biocViews: Software Depends: R (>= 2.16.0) Suggests: RUnit, BiocGenerics License: Artistic-2.0 Packaged: 2013-07-25 05:36:13 UTC; biocbuild BiocInstaller/NAMESPACE0000644000126300012640000000022512127131307016102 0ustar00biocbuildphs_compbioimport("utils") export(biocLite, biocVersion, biocinstallRepos, useDevel, biocValid, monograph_group, RBioinf_group, biocases_group, all_group) BiocInstaller/NEWS0000644000126300012640000000065412127131307015370 0ustar00biocbuildphs_compbioCHANGES IN VERSION 1.10.0 ------------------------- NEW FEATURES o biocValid() checks that installed packages are consistent with those available via biocLite(). o biocVersion() returns the version of Bioconductor expected with this version of the BiocInstaller package. USER-VISIBLE CHANGES o biocLite() invoked with no arguments updates currently installed packages to their most-recent version. BiocInstaller/R/0000755000126300012640000000000012154743000015064 5ustar00biocbuildphs_compbioBiocInstaller/R/biocLite.R0000644000126300012640000001641612127131306016751 0ustar00biocbuildphs_compbio## TODO: should probably print out a message about how to use mirrors, ## the way sourcing biocLite.R does now. biocinstallRepos <- function(siteRepos=character()) { ## siteRepos argument is public, but need biocVersion internally .biocinstallRepos(siteRepos=siteRepos, biocVersion()) } .biocinstallRepos <- function(siteRepos=character(), biocVersion) { old.opts <- options("repos") on.exit(options(old.opts)) ## Starting at some point in R-2.14, Omegahat is included in ## the list of available repositories, on windows only, it seems. ## on mac and linux: ## 1: + CRAN ## 2: + CRAN (extras) ## 3: + BioC software ## 4: + BioC annotation ## 5: + BioC experiment ## 6: + BioC extra ## 7: R-Forge ## 8: rforge.net ## on windows: ## 1: + CRAN ## 2: + CRAN (extras) ## 3: Omegahat ## 4: BioC software ## 5: BioC annotation ## 6: BioC experiment ## 7: BioC extra ## 8: R-Forge ## 9: rforge.net ## So it's probably better not to rely on the numbers. setRepositories(ind=1:20) # in case more repos are added repos <- getOption("repos") biocMirror <- getOption("BioC_mirror", "http://bioconductor.org") biocPaths <- c(BioCsoft="bioc", BioCann="data/annotation", BioCexp="data/experiment", BioCextra="extra") biocRepos <- paste(biocMirror, "packages", biocVersion, biocPaths, sep="/") repos[names(biocPaths)] <- biocRepos keepRepos <- if (.Platform$OS.type %in% "windows") { c(names(biocPaths), "CRAN", "CRANextra") } else { c(names(biocPaths), "CRAN") } repos <- repos[keepRepos] ## This needs to be commented out a few months (3? 4?) after the ## next development cycle has started, when we are confident that ## no developper is still using an early R devel with a ## tools:::.BioC_version_associated_with_R_version still pointing ## to the release repository. if (!IS_USER) { ## comment repos here as they become available. inactive <- c( ## "BioCsoft" ## , "BioCextra" ## , "BioCann" ## , "BioCexp" ) ## No need to touch below. tmpRepos <- paste(biocMirror, "packages", DOWNGRADE_VERSION, biocPaths[inactive], sep="/") repos[inactive] <- tmpRepos } repos <- subset(repos, !is.na(repos)) if ("@CRAN@" %in% repos) repos["CRAN"] <- "http://cran.fhcrc.org" if (includeMBNI && (getOption("pkgType") %in% c("source", "win.binary"))) repos[["MBNI"]] <- mbniUrl c(siteRepos=siteRepos, repos) } biocLiteInstall <- function(pkgs, repos, ask, suppressUpdates, siteRepos=character(), lib.loc=.libPaths(), lib=.libPaths()[1], ...) { if (!missing(repos)) .stop("'repos' argument to 'biocLite' not allowed") if (!(is.character(suppressUpdates) || is.logical(suppressUpdates)) || (is.logical(suppressUpdates) && 1L != length(suppressUpdates))) .stop("'suppressUpdates' must be character() or logical(1)") type <- list(...)[["type"]] if (is.null(type)) type <- getOption("pkgType") biocMirror <- getOption("BioC_mirror", "http://bioconductor.org") .message("BioC_mirror: %s", biocMirror) version <- getRversion() thisRVer <- sprintf("%d.%d", version$major, version$minor) .message("Using Bioconductor version %s (BiocInstaller %s), R version %s.", biocVersion(), packageVersion("BiocInstaller"), version) if (!suppressPackageStartupMessages(require("utils", quietly=TRUE))) .stop("failed to load package 'utils'") if (compareVersion(thisRVer, NEXT_R_DEVEL_VERSION) >= 0) .message("Temporarily using Bioconductor version %s", biocVersion()) repos <- biocinstallRepos(siteRepos) if (length(pkgs)) { if ((type %in% c("mac.binary", "mac.binary.leopard")) && ("MBNI" %in% names(repos))) { url <- contrib.url(repos[["MBNI"]]) mbniPkgs <- intersect(pkgs, row.names(available.packages(url))) if (length(mbniPkgs) > 0) .message("MBNI Brain Array packages '%s' are not available as Mac binaries, use biocLite with type='source'", paste(mbniPkgs, collapse="' '")) } .message("Installing package(s) '%s'", paste(pkgs, collapse="' '")) install.packages(pkgs=pkgs, lib=lib, repos=repos, ...) } ## early exit if suppressUpdates if (is.logical(suppressUpdates) && suppressUpdates) return(invisible(pkgs)) pkgsToUpdate <- old.packages(repos=repos, lib.loc=lib.loc) if (is.null(pkgsToUpdate)) return(invisible(pkgs)) if (!is.logical(suppressUpdates)) { pkgsToUpdate <- filterPackagesToUpdate(suppressUpdates, pkgsToUpdate) suppressUpdates <- FALSE } oldPkgs <- getUpdatablePackages(pkgsToUpdate) if (nrow(oldPkgs)) { pkgList <- paste(oldPkgs[,"Package"], collapse="', '") if (ask==TRUE) { .message("Old packages: '%s'", pkgList) answer <- .getAnswer("Update all/some/none? [a/s/n]: ", allowed = c("a", "A", "s", "S", "n", "N")) switch(answer, a = update.packages(repos=repos, oldPkgs=oldPkgs, ask=FALSE), s = update.packages(repos=repos, oldPkgs=oldPkgs, ask=TRUE), n = invisible(pkgs)) } else { .message("Updating packages '%s'", pkgList) update.packages(repos=repos, oldPkgs=oldPkgs, ask=ask) } } invisible(pkgs) } .getAnswer <- function(msg, allowed) { if (interactive()) { repeat { cat(msg) answer <- readLines(n = 1) if (answer %in% allowed) break } tolower(answer) } else { "n" } } biocLite <- function(pkgs=c("Biobase","IRanges","AnnotationDbi"), suppressUpdates=FALSE, suppressAutoUpdate=FALSE, siteRepos=character(), ask=TRUE, ...) { if (missing(pkgs)) # biocLite() update w/out installing defaults pkgs <- pkgs[!pkgs %in% rownames(installed.packages())] if (!suppressAutoUpdate && !bioconductorPackageIsCurrent()) { on.exit(updateBioconductorPackage(pkgs, ask=ask, suppressUpdates=suppressUpdates, siteRepos=siteRepos, ...)) } else if ("BiocUpgrade" %in% pkgs) { if (!IS_UPGRADEABLE) { .warning("Bioconductor version %s is the latest available for R version %s", biocVersion(), R_VERSION) pkgs <- pkgs[!pkgs %in% "BiocUpgrade"] biocLiteInstall(pkgs, ask=ask, siteRepos=siteRepos, suppressUpdates=suppressUpdates, ...) } else { .biocUpgrade() } } else { biocLiteInstall(pkgs, ask=ask, siteRepos=siteRepos, suppressUpdates=suppressUpdates, ...) } } BiocInstaller/R/biocValid.R0000644000126300012640000000524612136612665017126 0ustar00biocbuildphs_compbio.tooNewPkgs <- function(instPkgs, availPkgs) { idx <- rownames(availPkgs) %in% rownames(instPkgs) vers <- availPkgs[idx, "Version"] idx <- package_version(vers) < package_version(instPkgs[names(vers), "Version"]) tooNew <- names(vers)[idx] instPkgs[tooNew, c("Version", "LibPath"), drop=FALSE] } biocValid <- function(pkgs = installed.packages(lib.loc, priority=priority), lib.loc=NULL, priority="NA", type=getOption("pkgType"), filters=NULL, silent=FALSE, ..., fix=FALSE) { if (!is.matrix(pkgs)) { if (is.character(pkgs)) pkgs <- installed.packages(pkgs, lib.loc=lib.loc) else .stop("'pkgs' must be a character vector of package names, or a matrix like that returned by 'installed.packages()'") } repos <- biocinstallRepos() contribUrl <- contrib.url(repos, type=type) availPkgs <- available.packages(contribUrl, type=type, filters=filters) oldPkgs <- old.packages(lib.loc, repos=biocinstallRepos(), instPkgs=pkgs, available=availPkgs, checkBuilt=TRUE, type=type) tooNewPkgs <- .tooNewPkgs(pkgs, availPkgs) valid <- (NROW(oldPkgs) == 0) && (NROW(tooNewPkgs) == 0) if (valid) return(valid) if (!silent) { result <- structure(list(oldPkgs=oldPkgs, tooNewPkgs = tooNewPkgs), class="biocValid") print(result) } if (fix) { pkgs <- c(rownames(oldPkgs), rownames(tooNewPkgs)) biocLite(pkgs, lib.loc=lib.loc, ...) .warning("updated or downgraded package(s) %s", paste(.sQuote(pkgs), collapse=" ")) } else { msg <- character() if (NROW(oldPkgs)) msg <- c(msg, sprintf("%d package(s) out of date", NROW(oldPkgs))) if (NROW(tooNewPkgs)) msg <- c(msg, sprintf("%d package(s) too new", NROW(tooNewPkgs))) .stop(paste(msg, collapse="; ")) } invisible(valid) } print.biocValid <- function(x, ...) { cat("\n* sessionInfo()\n\n") print(sessionInfo()) cat("\n") if (NROW(x$oldPkgs)) { cat("* Out-of-date packages\n") print(x$oldPkgs) cat("\nupdate with biocLite()\n\n") } if (NROW(x$tooNewPkgs)) { cat("* Packages too new for Bioconductor version ", .sQuote(as.character(biocVersion())), "\n\n", sep="") print(x$tooNewPkgs) pkgs <- paste(.dQuote(rownames(x$tooNewPkgs)), collapse=", ") msg <- .msg(ifelse(NROW(x$tooNewPkgs) == 1L, "biocLite(%s)", "biocLite(c(%s))"), pkgs) cat("\ndowngrade with ", msg, "\n\n", sep="") } } BiocInstaller/R/biocVersion.R0000644000126300012640000000004712127131306017472 0ustar00biocbuildphs_compbiobiocVersion <- function() BIOC_VERSION BiocInstaller/R/getUpdateablePackages.R0000644000126300012640000000114012127131306021410 0ustar00biocbuildphs_compbiofilterPackagesToUpdate <- function(regexes, pkgs) { regex = paste(regexes, collapse="|") hits <- grep(regex, pkgs[,"Package"], invert=TRUE) pkgs[hits, , drop=FALSE] } getUpdatablePackages <- function(pkgs) { all <- file.access(pkgs[,"LibPath"], 2) nonUpdateable <- pkgs[all == -1, "Package"] updateable <- pkgs[all == 0, , drop=FALSE] if (length(nonUpdateable)) { pkgList <- paste(nonUpdateable, collapse="', '") fmt <- "installed directory not writable, cannot update packages '%s'" .warning(fmt, pkgList, call.=FALSE) } updateable } BiocInstaller/R/package_groups.R0000644000126300012640000000461212127131306020204 0ustar00biocbuildphs_compbiomonograph_group <- function() { warning("'arrayMagic' package is no longer available") c("affycomp", "affydata", "affypdnn", "affyPLM", "ALL", "ALLMLL", "AmpAffyExample", "annaffy", "AnnBuilder", "annotate", "arrayQuality", "beta7", "Biobase", "bioDist", "Biostrings", "cMAP", "CoCiteStats", "convert", "e1071", "edd", "estrogen", "exactRankTests", "facsDorit", "factDesign", "gbm", "gcrma", "geneplotter", "golubEsets", "GOstats", "gpls", "graph", "hexbin", "hgu133a", "hgu133atagcdf", "hgu133acdf", "hgu133bcdf", "hgu2beta7", "hgu95av2", "hgu95av2cdf", "hgu95av2probe", "hopach", "hsahomology", "hu6800cdf", "hu6800probe", "humanLLMappings", "ipred", "KEGG", "KEGGSOAP", "kidpack", "limma", "locfit", "LogitBoost", "matchprobes", "mclust", "mlbench", "MLInterfaces", "multtest", "pamr", "prada", "PROcess", "ProData", "randomForest", "rat2302", "RbcBook1", "RBGL", "RColorBrewer", "RCurl", "Rgraphviz", "rrcov", "simpleaffy", "sma", "SpikeInSubset", "SSOAP", "statmod", "vsn", "XML", "xtable", "YEAST", "yeastExpData") } lite_group <- function() { c("affy", "affydata", "affyPLM", "annaffy", "annotate", "Biobase", "biomaRt", "Biostrings", "DynDoc", "gcrma", "genefilter", "geneplotter", "hgu95av2.db", "limma", "marray", "multtest", "vsn", "xtable", "affyQCReport") } graph_group <- function() { c("graph", "Rgraphviz", "RBGL") } all_group <- function() { contribUrl <- paste(biocinstallRepos()['BioCsoft'], "src/contrib", sep="/") pkglist = available.packages(contribUrl) pkgs = rownames(pkglist) } RBioinf_group <- function() { c(lite_group(), graph_group(), "RBioinf", "BiocCaseStudies", "XML", "RCurl", "biomaRt", "GEOquery", "KEGG", "KEGGSOAP", "hgu95av2", "hgu95av2probe", "hgu95av2cdf", "human.db0", "BSgenome.Hsapiens.UCSC.hg18") } biocases_group <- function() { c(lite_group(), graph_group(), "ALL", "apComplex", "bioDist", "BiocCaseStudies", "biocGraph", "biomaRt", "CCl4", "CLL", "Category", "class", "convert", "GO.db", "GOstats", "GSEABase", "hgu133a.db", "hgu95av2cdf", "hgu95av2probe", "hopach", "KEGG.db", "kohonen", "lattice", "latticeExtra", "MASS", "matchprobes", "MLInterfaces", "org.Hs.eg.db", "ppiStats", "randomForest", "RColorBrewer", "Rintact", "sma", "weaver", "yeastExpData") } BiocInstaller/R/updateBiocInstallerPackage.R0000644000126300012640000000733212127131306022425 0ustar00biocbuildphs_compbio.getContribUrl <- function(biocVersion) { .contribUrl <- function(repos) { contribUrl <- contrib.url(repos) pkgs <- available.packages(contribUrl) if (!"BiocInstaller" %in% rownames(pkgs)) .stop("'BiocInstaller' package not in repository %s", repos, call.=FALSE) contribUrl } repos <- .biocinstallRepos(biocVersion=biocVersion)["BioCsoft"] suppressWarnings(tryCatch({ .contribUrl(repos) }, error=function(err) { version <- getRversion() currentVersion <- sprintf("%d.%d", version$major, version$minor) lowerVersion <- .lowerRVersionString(version) oldRepos <- sub(currentVersion, lowerVersion, repos) .message("%s, using '%s'", conditionMessage(err), oldRepos) .contribUrl(oldRepos) })) } bioconductorPackageIsCurrent <- function() { installedSentinel <- availableSentinel <- package_version("0.0.0") installedVersion <- tryCatch(packageVersion("BiocInstaller"), error = function(err) installedSentinel) contribUrl <- .getContribUrl(biocVersion()) ap <- available.packages(contribUrl) availableVersion <- if ("BiocInstaller" %in% rownames(ap)) package_version(ap["BiocInstaller", "Version"]) else availableSentinel if ((installedVersion == availableVersion) && (installedVersion == installedSentinel)) .stop("'BiocInstaller' package not installed, and not available") availableVersion <= installedVersion } updateBioconductorPackage <- function(pkgs, ask, suppressUpdates, ...) { .dbg("before, version is %s", packageVersion("BiocInstaller")) bootstrap <- function() { if ("package:BiocInstaller" %in% search()) detach("package:BiocInstaller", unload=TRUE, force=TRUE) ## contribUrl will be in bootstrap's environment suppressWarnings(tryCatch({ update.packages(contriburl=contribUrl, ask=FALSE, checkBuilt=TRUE, oldPkgs="BiocInstaller") }, error=function(err) { assign("failed", TRUE, "biocBootstrapEnv") NULL })) library(BiocInstaller) BiocInstaller:::.updateBioconductorPackageFinish() } biocBootstrapEnv <- new.env() biocBootstrapEnv[["pkgs"]] <- pkgs[pkgs != "BiocInstaller"] biocBootstrapEnv[["ask"]] <- ask biocBootstrapEnv[["suppressUpdates"]] <- suppressUpdates biocBootstrapEnv[["contribUrl"]] <- .getContribUrl(biocVersion()) biocBootstrapEnv[["dotArgs"]] <- list(...) .stepAside(biocBootstrapEnv, bootstrap) } .updateBioconductorPackageFinish <- function() { args <- c(list(pkgs=get("pkgs", "biocBootstrapEnv"), ask=get("ask", "biocBootstrapEnv"), suppressUpdates=get("suppressUpdates", "biocBootstrapEnv")), get("dotArgs", "biocBootstrapEnv")) failed <- exists("failed", "biocBootstrapEnv") detach("biocBootstrapEnv") .dbg("after, version is %s", packageVersion("BiocInstaller")) vers <- packageVersion("BiocInstaller") if (!failed) .message("'BiocInstaller' updated to version %s", vers) else .warning("'BiocInstaller' update failed, using version %s", vers, call.=FALSE) if ("BiocUpgrade" %in% args$pkgs) { if (!IS_UPGRADEABLE) { .warning("Bioconductor version %s is the latest available for R version %s", biocVersion(), R_VERSION) args$pkgs <- args$pkgs[!args$pkgs %in% "BiocUpgrade"] do.call(biocLiteInstall, args) } else { .biocUpgrade() } } else { do.call(biocLiteInstall, args) } } BiocInstaller/R/useDevel.R0000644000126300012640000000462612127131306016773 0ustar00biocbuildphs_compbio.biocUpgrade <- function() { txt <- sprintf("Upgrade all packages to Bioconductor version %s? [y/n]: ", UPGRADE_VERSION) answer <- .getAnswer(txt, allowed = c("y", "Y", "n", "N")) if ("y" == answer) .update(UPGRADE_VERSION, TRUE) } useDevel <- function(devel=TRUE) { if (devel) { if (!IS_USER) .stop("'devel' version already in use") if (IS_END_OF_LIFE) .stop("'devel' version not available") if (!IS_UPGRADEABLE) .stop("'devel' version requires a more recent R") biocVers <- UPGRADE_VERSION } else { if (IS_USER) .stop("'devel' version not in use") if (!IS_DOWNGRADEABLE) .stop("'devel' version cannot be down-graded with this version of R") biocVers <- DOWNGRADE_VERSION } .update(biocVers, FALSE) } .update <- function(biocVersion, biocLiteAfterUpdate = FALSE) { .dbg("before, version is %s", packageVersion("BiocInstaller")) bootstrap <- function() { if (nchar(Sys.getenv("BIOCINSTALLER_TEST_REPOS"))) contribUrl = Sys.getenv("BIOCINSTALLER_TEST_REPOS") if ("package:BiocInstaller" %in% search()) detach("package:BiocInstaller", unload=TRUE, force=TRUE) ## contribUrl will be in bootstrap's environment suppressWarnings(tryCatch({ install.packages("BiocInstaller", contriburl=contribUrl) }, error=function(err) { assign("failed", TRUE, "biocBootstrapEnv") NULL })) library(BiocInstaller) BiocInstaller:::.updateFinish() } biocBootstrapEnv <- new.env() biocBootstrapEnv[["contribUrl"]] <- .getContribUrl(biocVersion) biocBootstrapEnv[["biocLiteAfterUpdate"]] <- biocLiteAfterUpdate .stepAside(biocBootstrapEnv, bootstrap) } .updateFinish <- function() { failed <- exists("failed", "biocBootstrapEnv") biocLiteAfterUpdate <- get("biocLiteAfterUpdate", "biocBootstrapEnv") detach("biocBootstrapEnv") .dbg("after, version is %s", packageVersion("BiocInstaller")) vers <- packageVersion("BiocInstaller") if (!failed) { .message("'BiocInstaller' changed to version %s", vers) if (biocLiteAfterUpdate) biocLite(character(), ask=FALSE) } else .warning("update failed, using BiocInstaller version %s", vers, call.=FALSE) } BiocInstaller/R/utilities.R0000644000126300012640000000277312136612665017247 0ustar00biocbuildphs_compbio.dQuote <- function(x) sprintf('"%s"', as.character(x)) .sQuote <- function(x) sprintf("'%s'", as.character(x)) .msg <- function(fmt, ..., width=getOption("width")) ## Use this helper to format all error / warning / message text { txt <- strwrap(sprintf(fmt, ...), width=width, exdent=2) paste(txt, collapse="\n") } # use as BiocInstaller:::.opts$get() BiocInstaller:::.opts$set(TRUE) .opts = local({ debug <- FALSE list(get=function() debug, set=function(x) { old <- debug debug <<- x old }) }) .dbg <- function(...) { if (.opts$get()) { .msg(...) } } .message <- function(..., appendLF=TRUE) { message(.msg(...), appendLF=appendLF) } .stop <- function(..., call.=FALSE) { stop(.msg(...), call.=call.) } .warning <- function(..., call.=FALSE, immediate.=FALSE) { warning(.msg(...), call.=call., immediate.=immediate.) } .lowerRVersionString <- function(version=getRversion()) { if (0L == version$minor) { major <- version$major - 1L minor <- version$minor } else { major <- version$major minor <- version$minor - 1L } paste(major, minor, sep=".") } # bootstrap() should take care of unloading BiocInstaller # and reloading it. .stepAside <- function(biocBootstrapEnv, bootstrap) { environment(bootstrap) <- biocBootstrapEnv biocBootstrapEnv[["bootstrap"]] <- bootstrap attach(biocBootstrapEnv) on.exit(eval(bootstrap(), biocBootstrapEnv)) } BiocInstaller/R/zzz.R0000644000126300012640000000442512154743000016051 0ustar00biocbuildphs_compbio## The following values are updated with each Bioc release; see .onLoad BIOC_VERSION <- package_version("2.12") # Bioc version for this package R_VERSION <- package_version("3.0.0") # R version for this package IS_END_OF_LIFE <- FALSE # is BIOC_VERSION out-of-date? NEXT_R_DEVEL_VERSION <- "3.1.0" # next (not-yet-supported) version of R ## Change when the status of MBNI changes. ## Make sure this change is propagated to users, even ## if builds have stopped for a particular version of BioC. ## See biocLite.R:.biocinstallRepos to include / exclude package types includeMBNI <- FALSE mbniUrl <- "http://brainarray.mbni.med.umich.edu/bioc" globalVariables("contribUrl") # used in 'bootstrap' functions IS_USER <- IS_UPGRADEABLE <- IS_DOWNGRADEABLE <- UPGRADE_VERSION <- DOWNGRADE_VERSION <- NULL .onLoad <- function(libname, pkgname) { # USER or DEVEL? IS_USER <<- (packageVersion(pkgname)$minor %% 2L) == 0L IS_UPGRADEABLE <<- (## Allowable within-R changes (IS_USER && ((BIOC_VERSION$minor %% 2L) == 0L)) || ## between-R change (getRversion()$minor >= R_VERSION$minor + 1L)) IS_DOWNGRADEABLE <<- !IS_USER && ((BIOC_VERSION$minor %% 2L) != 0L) ## Up- and downgrade versions, whether accessible or not vers <- sprintf("%s.%s", BIOC_VERSION$major, BIOC_VERSION$minor + 1L) UPGRADE_VERSION <<- package_version(vers) vers <- sprintf("%s.%s", BIOC_VERSION$major, BIOC_VERSION$minor - 1L) DOWNGRADE_VERSION <<- package_version(vers) } .onAttach <- function(libname, pkgname) { .message("Bioconductor version %s (BiocInstaller %s), ?biocLite for help", biocVersion(), packageVersion("BiocInstaller")) if (IS_END_OF_LIFE) { if (IS_UPGRADEABLE) .message("A newer version of Bioconductor is available for this version of R, ?BiocUpgrade for help") else .message("A newer version of Bioconductor is available after installing a new version of R, ?BiocUpgrade for help") } if (R.version$major == "3" && R.version$minor == "0.0" && Sys.info()["sysname"] %in% c("Darwin", "Windows")) { .message("Upgrade to R-3.0.1 or some packages may not load properly.") } } BiocInstaller/inst/0000755000126300012640000000000012127131307015641 5ustar00biocbuildphs_compbioBiocInstaller/inst/scripts/0000755000126300012640000000000012127131307017330 5ustar00biocbuildphs_compbioBiocInstaller/inst/scripts/biocLite.R0000644000126300012640000000615212127131307021211 0ustar00biocbuildphs_compbio## Mirrors: uncomment the following and change to your favorite CRAN mirror ## if you don't want to use the default (cran.fhcrc.org, Seattle, USA). ## options("repos" = c(CRAN="http://cran.fhcrc.org")) ## Mirrors: uncomment the following and change to your favorite Bioconductor ## mirror, if you don't want to use the default (www.bioconductor.org, ## Seattle, USA) ## options("BioC_mirror" = "http://www.bioconductor.org") local({ vers <- getRversion() biocVers <- tryCatch(tools:::.BioC_version_associated_with_R_version, error=function(...) numeric_version(0.0)) if (vers > "2.13" && biocVers > "2.8") { if ("biocLite" %in% ls(envir=.GlobalEnv)) { message <- paste("You have an outdated biocLite() function.", "Run 'rm(biocLite)' and try again.") stop(message) } if (!suppressWarnings(require("BiocInstaller", quietly=TRUE))) { a <- NULL p <- file.path(Sys.getenv("HOME"), ".R", "repositories") if (file.exists(p)) { a <- tools:::.read_repositories(p) if (!"BioCsoft" %in% rownames(a)) a <- NULL } if (is.null(a)) { p <- file.path(R.home("etc"), "repositories") a <- tools:::.read_repositories(p) } if (!"package:utils" %in% search()) { url <- "http://bioconductor.org/biocLite.R" txt <- sprintf("use 'source(\"%s\")' to update 'BiocInstaller' after 'utils' package is attached", url) message(paste(strwrap(txt), collapse="\n ")) } else { ## add a conditional for Bioc releases occuring WITHIN ## a single R minor version if (vers >= "2.15" && vers < "2.16") { a["BioCsoft", "URL"] <- sub(as.character(biocVers), "2.11", a["BioCsoft", "URL"]) biocVers <- numeric_version("2.11") } install.packages("BiocInstaller", repos=a["BioCsoft", "URL"]) if (!suppressWarnings(require("BiocInstaller", quietly=TRUE))) { url0 <- "http://www.bioconductor.org/packages" url <- sprintf("%s/%s/bioc", url0, as.character(biocVers)) txt0 <- "'biocLite.R' failed to install 'BiocInstaller', use 'install.packages(\"%s\", repos=\"%s\")'" txt <- sprintf(txt0, "BiocInstaller", url) message(paste(strwrap(txt), collapse="\n ")) } } } } else { source("http://bioconductor.org/getBioC.R") biocLite <<- function(pkgs, groupName="lite", ...) { if (missing(pkgs)) biocinstall(groupName=groupName, ...) else biocinstall(pkgs=pkgs, groupName=groupName, ...) } } }) BiocInstaller/inst/unitTests/0000755000126300012640000000000012127412215017643 5ustar00biocbuildphs_compbioBiocInstaller/inst/unitTests/test_BiocUpgrade.R0000644000126300012640000000156412127412215023217 0ustar00biocbuildphs_compbiotest_useDevel <- function() { if (BiocInstaller:::IS_END_OF_LIFE) { checkException(useDevel(), silent=TRUE) } else if (!BiocInstaller:::IS_DOWNGRADEABLE) { checkException(useDevel(FALSE), silent=TRUE) } if (!BiocInstaller:::IS_UPGRADEABLE) { checkException(useDevel(), silent=TRUE) opts <- options(warn=2); on.exit(options(opts)) checkException(biocLite("BiocUpgrade")) } } test_getContribUrl_exist <- function() { fun <- BiocInstaller:::.getContribUrl vers <- BiocInstaller:::BIOC_VERSION checkTrue(grepl(vers, fun(vers))) if (BiocInstaller:::IS_UPGRADEABLE) { vers <- BiocInstaller:::UPGRADE_VERSION checkTrue(grepl(vers, fun(vers))) } if (BiocInstaller:::IS_DOWNGRADEABLE) { vers <- BiocInstaller:::DOWNGRADE_VERSION checkTrue(grepl(vers, fun(vers))) } } BiocInstaller/inst/unitTests/test_biocinstallRepos.R0000644000126300012640000000112112127131307024334 0ustar00biocbuildphs_compbiorepos <- biocinstallRepos() test_biocinstallRepos_named_repositories <- function() { allOS <- c("BioCsoft", "CRAN", "BioCann", "BioCexp", "BioCextra") windowsOnly <- "CRANextra" checkTrue(all(allOS %in% names(repos))) if (.Platform$OS.type == "windows") { checkTrue(windowsOnly %in% names(repos)) } else { checkTrue(!windowsOnly %in% names(repos)) } } test_biocinstallRepos_noNA_repositories <- function() { checkTrue(!any(is.na(repos))) } test_biocinstallRepos_order <- function() { checkIdentical("BioCsoft", names(repos)[[1]]) } BiocInstaller/man/0000755000126300012640000000000012174065453015451 5ustar00biocbuildphs_compbioBiocInstaller/man/BiocUpgrade.Rd0000644000126300012640000000174712127131307020123 0ustar00biocbuildphs_compbio\name{BiocUpgrade} \alias{BiocUpgrade} \title{ Upgrade Bioconductor to the latest version available for this version of R } \description{ Downloads the latest version of the BiocInstaller package, and upgrades all currently installed packages to the latest repositories for this version of R. To upgrade, use: \preformatted{ source("http://bioconductor.org/biocLite.R") biocLite("BiocUpgrade") } } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{install.packages}} installs the packages themselves. } \examples{ \dontrun{ source("http://bioconductor.org/biocLite.R") biocLite("BiocUpgrade") } } \keyword{environment} BiocInstaller/man/biocLite.Rd0000644000126300012640000001040012127131307017453 0ustar00biocbuildphs_compbio\name{biocLite} \alias{biocLite} \title{ Install or update Bioconductor and CRAN packages } \description{ \code{biocLite} installs or updates Bioconductor and CRAN packages, ensuring that packages from the appropriate version of Bioconductor are installed, and that all packages remain up to date. } \usage{ biocLite (pkgs=c("Biobase", "IRanges", "AnnotationDbi"), suppressUpdates=FALSE, suppressAutoUpdate=FALSE, siteRepos=character(), ask=TRUE, ...) } \arguments{ \item{pkgs}{\code{character()} of package names to install or update. A missing value and \code{suppressUpdates=FALSE} updates installed packages, perhaps also installing \code{Biobase}, \code{IRanges}, and \code{AnnotationDbi} if they are not already installed.} \item{suppressUpdates}{\code{logical(1)} indicating whether to suppress automatic updating of all installed packages, or \code{character()} of regular expressions specifying which packages to NOT automatically update.} \item{suppressAutoUpdate}{\code{logical(1)} indicating whether the \code{BiocInstaller} package updates itself.} \item{siteRepos}{\code{character()} representing an additional repository in which to look for packages to install. This repository will be prepended to the default repositories (which you can see with \code{\link{biocinstallRepos}}).} \item{ask}{\code{logical(1)} indicating whether to prompt user before installed packages are updated, or the character string 'graphics', which brings up a widget for choosing which packages to update. If TRUE, user can choose whether to update all outdated packages without further prompting, to pick and choose packages to update, or to cancel updating (in a non-interactive session, no packages will be updated). Otherwise, the value is passed to \code{\link{update.packages}}.} \item{...}{Additional arguments. \code{lib.loc} is passed to \code{\link{old.packages}} (used to determine the library location of installed packages to be updated). \code{lib} is passed to \code{\link{install.packages}} (used to determine the library location where \code{pkgs} are to be installed).} } \details{ The \code{biocLite()} function is generally used after sourcing the file \code{biocLite.R}. This will install the \code{BiocInstaller} package if it is not already installed. See example section for more information. } \value{ \code{biocLite()} returns the \code{pkgs} argument, invisibly. } \seealso{ \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{install.packages}} installs the packages themselves. \code{\link{update.packages}} updates all installed packages. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. \code{\link{monograph_group}}, \code{\link{RBioinf_group}} and \code{\link{biocases_group}} return package names associated with Bioconductor publications. \code{\link{all_group}} returns the names of all Bioconductor software packages. } \examples{ \dontrun{ ## Change default Bioconductor and CRAN mirrors chooseBioCmirror() chooseCRANmirror() ## If you don't have the BiocInstaller package installed, you can ## quickly install and load it as follows: source("http://bioconductor.org/biocLite.R") ## The most recent version of the BiocInstaller package is now loaded. ## No need to load it with library(). # installs default packages (if not already installed) and updates # previously installed packages biocLite() ## Now install a CRAN package: biocLite("survival") ## install a Bioconductor package, but don't update all installed ## packages as well: biocLite("GenomicRanges", suppressUpdates=TRUE) ## Install default packages, but do not update any package whose name ## starts with "org." or "BSgenome." biocLite(suppressUpdates=c("^org\\.", "^BSgenome\\.")) ## install a package from source: biocLite("IRanges", type="source") ## install all Bioconductor software packages biocLite(all_group()) } ## Show the Bioconductor and CRAN repositories that will be used to ## install/update packages. biocinstallRepos() } \keyword{environment} BiocInstaller/man/biocValid.Rd0000644000126300012640000000520412127131307017623 0ustar00biocbuildphs_compbio\name{biocValid} \alias{biocValid} \title{Validate installed package versions against biocLite versions.} \description{ Check that installed packages are consistent (neither out-of-date nor too new) with the version of R and Bioconductor in use, using \code{biocLite} for validation. } \usage{ biocValid(pkgs = installed.packages(lib.loc, priority = priority), lib.loc = NULL, priority = "NA", type = getOption("pkgType"), filters = NULL, silent = FALSE, ..., fix=FALSE) } \arguments{ \item{pkgs}{A character list of package names for checking, or a matrix as returned by \code{\link{installed.packages}}.} \item{lib.loc}{The library location(s) of packages to be validated; see \code{\link{installed.packages}}.} \item{priority}{check validity of all, \dQuote{base}, or \dQuote{recommended} packages; see \code{\link{installed.packages}}.} \item{type}{The type of available package (e.g., binary, source) to check validity against; see \code{\link{available.packages}}.} \item{filters}{Filter available packages to check validity against; see \code{\link{available.packages}}.} \item{silent}{Report how packages are invalid (\code{silent=FALSE}, default) and abort execution, or return a logical(1) (\code{silent=TRUE}) indicating the overall validity of installed packages.} \item{\dots}{Additional arguments, passed to \code{\link{biocLite}} when \code{fix=TRUE}.} \item{fix}{When \code{TRUE}, invoke \code{biocLite} to reinstall (update or downgrade, as appropriate) invalid packages.} } \details{ This function compares the version of installed packages to the version of packages associated with the version of R and Bioconductor appropriate for the BiocInstaller package currently in use. Packages are reported as \sQuote{out-of-date} if a more recent version is available at the repositories specified by \code{biocinstallRepos()}. Usually, \code{biocLite()} is sufficient to update packages to their most recent version. Packages are reported as \sQuote{too new} if the installed version is more recent than the most recent available in the \code{biocinstallRepos()} repositories. It is possible to down-grade by re-installing a too new package \dQuote{PkgA} with \code{biocLite("PkgA")}. It is important for the user to understand how their installation became too new, and to avoid this in the future. } \value{ \code{logical(1)} indicating overall validity of installed packages. } \author{Martin Morgan \url{mtmorgan@fhcrc.org}} \seealso{\code{\link{biocLite}} to update installed packages.} \examples{try(biocValid())} \keyword{ environment } BiocInstaller/man/biocVersion.Rd0000644000126300012640000000074312127131307020214 0ustar00biocbuildphs_compbio\name{biocVersion} \alias{biocVersion} \title{Bioconductor version} \description{ This function reports the Bioconductor version in use, as determined by the BiocInstaller package. } \usage{ biocVersion() } \value{ \code{package_version} representing the Bioconductor version in use. } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{BiocUpgrade}} Upgrading to new versions. } \examples{ biocVersion() } \keyword{environment} BiocInstaller/man/biocinstallRepos.Rd0000644000126300012640000000203512127131307021242 0ustar00biocbuildphs_compbio\name{biocinstallRepos} \alias{biocinstallRepos} \title{ Display current Bioconductor and CRAN repositories. } \description{ Displays the URLs of the repositories used by \code{\link{biocLite}} to install Bioconductor and CRAN packages. } \usage{ biocinstallRepos(siteRepos=character()) } \arguments{ \item{siteRepos}{\code{character()} representing an additional repository in which to look for packages to install. This repository will be prepended to the default repositories returned by the function.} } \value{ Named \code{character()} of repositories. } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{install.packages}} installs the packages themselves. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. } \examples{ biocinstallRepos() ## Choose mirrors \dontrun{ chooseCRANmirror() chooseBioCmirror() } } \keyword{environment} BiocInstaller/man/packageGroups.Rd0000644000126300012640000000257412127131307020531 0ustar00biocbuildphs_compbio\name{Package Groups} \alias{biocases_group} \alias{RBioinf_group} \alias{monograph_group} \alias{all_group} \title{ Convenience functions to return package names associated with Bioconductor publications. } \description{ Returns character vectors of packages associated with Bioconductor publications, which can then be passed to \code{\link{biocLite}()} } \usage{ monograph_group() RBioinf_group() biocases_group() all_group() } \value{ \code{character()} of package names. } \seealso{ \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{install.packages}} installs the packages themselves. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. } \examples{ ## Get the names of packages used in the book ## "Bioconductor Case Studies": biocases_group() ## Get the names of packages used in the book ## "R Programming for Bioinformatics": RBioinf_group() ## Get the names of packages used in the monograph ## "Bioinformatics and Computational Biology Solutions ## Using R and Bioconductor": monograph_group() ## Get the names of all Bioconductor software packages all_group() } \keyword{environment} BiocInstaller/man/useDevel.Rd0000644000126300012640000001301112174065453017510 0ustar00biocbuildphs_compbio\name{useDevel} \alias{useDevel} \title{ Get the 'devel' version of the BiocInstaller package. } \description{ Downloads the 'devel' version of the BiocInstaller package so that all subsequent invocations of \code{\link{biocLite}} and \code{\link{biocinstallRepos}} use the devel repositories. Displays the URLs of the repositories used by \code{\link{biocLite}} to install Bioconductor and CRAN packages. Should only be used with a release (or patched) version of R, freshly installed. } \usage{ useDevel(devel=TRUE) } \arguments{ \item{devel}{Whether to look in the devel (TRUE) or release (FALSE) repositories in subsequent invocations of \code{\link{biocLite}} and \code{\link{biocinstallRepos}}.} } \details{ With R going to a yearly release schedule and Bioconductor keeping its twice-yearly release schedule, the same version of R (3.0) can be used with two different versions of Bioconductor (2.11, release, and 2.12, devel). The version number of the BiocInstaller package is what is used to determine whether to download packages from the BioC 2.11 or 2.12 repositories. In keeping with Bioconductor versioning conventions, if the middle number (y in x.y.z) is even, the package is part of a release version; if odd, it's part of a devel version. By default, when BiocInstaller is first installed on R-3.0, it will be set up to download BioC 2.11 packages. If you want to change this, you can run the \code{\link{useDevel}} function. With argument \code{TRUE} (the default), it will download the devel version of BiocInstaller and subsequently all packages downloaded with \code{\link{biocLite}} will be from the BioC 2.12 (devel) repository. You should run \code{\link{useDevel}} only once. It is possible to keep BioC 2.11 and 2.12 libraries separate, within the same installation of R. The trick is to use the \code{R_LIBS_USER} environment variable. First, create two separate directories for your BioC release and devel packages. Suggested directory names are as follows: Linux: ~/R/x86_64-unknown-linux-gnu-library/3.0-bioc-release ~/R/x86_64-unknown-linux-gnu-library/3.0-bioc-devel Mac OS: ~/Library/R/3.0-bioc-release/library ~/Library/R/3.0-bioc-devel/library Windows: C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.0-bioc-release C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.0-bioc-devel (change YOUR_USER_NAME to your user name) You can then invoke "R for bioc-devel" or "R for bioc-release" from the command line as follows: Linux: R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.0-bioc-release R R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.0-bioc-devel R Mac OS X: R_LIBS_USER=~~/Library/R/3.0-bioc-release/library R R_LIBS_USER=~~/Library/R/3.0-bioc-devel/library R Windows: cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.0-bioc-release && R" cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.0-bioc-devel && R" (Note: this assumes that R.exe is in your PATH.) If you launch R in this way and then invoke \code{\link{.libPaths}}, you'll see that the first item is your special release or devel directory. Packages will be installed to that directory and that is the first place that \code{\link{library}} will look for them. \code{\link{biocLite}}, \code{\link{install.packages}}, \code{\link{update.packages}} and friends all respect this setting. On Linux and Mac OS X, you can create a bash alias to save typing. Add the following to your ~/bash_profile: Linux alias Rdevel='R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.0-bioc-devel R' alias Rrelease='R_LIBS_USER=~/R/x86_64-unknown-linux-gnu-library/3.0-bioc-release R' Mac OS X alias Rdevel='R_LIBS_USER=~/Library/R/3.0-bioc-devel/library R' alias Rrelease='R_LIBS_USER=~/Library/R/3.0-bioc-release/library R' You can then invoke these from the command line as Rdevel ...and... Rrelease On Windows, you can create two shortcuts, one for devel and one for release. Go to My Computer and navigate to a directory that is in your PATH. Then right-click and choose New->Shortcut. in the "type the location of the item" box, put: cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\\R\\win-library\\3.0-bioc-release && R" ...for release and cmd /C "set R_LIBS_USER=C:\\Users\\YOUR_USER_NAME\\Documents\R\\win-library\\3.0-bioc-devel && R" ...for devel. (again, it's assumed R.exe is in your PATH) Click "Next". In the "Type a name for this shortcut" box, type Rdevel or Rrelease You can invoke these from the command line as Rdevel.lnk ...and... Rrelease.lnk (You must type in the .lnk extension.) Because \code{R_LIBS_USER} is an environment variable, its value should be inherited by any subprocesses started by R, so they should do the right thing as well. } \value{ Invisible NULL. } \seealso{ \code{\link{biocinstallRepos}} returns the Bioconductor and CRAN repositories used by \code{biocLite}. \code{\link{biocLite}} Installs/updates Bioconductor/CRAN packages. \code{\link{install.packages}} installs the packages themselves. \code{\link{chooseBioCmirror}} lets you choose from a list of all public Bioconductor mirror URLs. \code{\link{chooseCRANmirror}} lets you choose from a list of all public CRAN mirror URLs. } \examples{ \dontrun{ useDevel() } } \keyword{environment} BiocInstaller/tests/0000755000126300012640000000000012127131306016025 5ustar00biocbuildphs_compbioBiocInstaller/tests/BiocInstaller_unit_tests.R0000644000126300012640000000005312127131306023161 0ustar00biocbuildphs_compbioBiocGenerics:::testPackage("BiocInstaller")