sourceBiocinstallScript <- function() { thisRVer <- paste(R.Version()[c("major", "minor")], collapse=".") ## Verify we're running a recent enough version of R. requiredRVer <- "2.1.0" stopifnot(require("utils")) if (compareVersion(thisRVer, requiredRVer) < 0) { ## R versions less than 2.1.0 need to use the old (BioC 1.5) version of getBioC.R stop(paste("\nYou are currently running R version ", thisRVer, ",\n", "however an R version greater than ", requiredRVer, " is required.\n", "To obtain the latest version of R, please see:\n", " http://www.r-project.org/\n", sep="")) } if (compareVersion(thisRVer, "2.10.0") >= 0) choppedRVer <- "2.10" else choppedRVer <- gsub("(\\w+).(\\w+).(\\w+)", "\\1.\\2", thisRVer) scriptUrl <- paste("http://bioconductor.org", "installScripts", choppedRVer, "biocinstall.R", sep="/") #cat("Sourcing ", scriptUrl, " ... ", sep="") ## Don't add any arg to the safeSource() function and don't define any local ## variable in it. This is the only way to make sure the call to ls() only ## returns the list of symbols that result from the call to source(). safeSource <- function() { source(scriptUrl, local=TRUE) for (objname in ls(all.names=TRUE)) { if (exists(objname, envir=.GlobalEnv, inherits=FALSE)) warning("Redefining ", sQuote(objname)) .GlobalEnv[[objname]] <- get(objname, inherits=FALSE) } } safeSource() #cat("OK\n") } sourceBiocinstallScript() ### Install Bioconductor packages using CRAN-style repositories. ### ...: arguments passed to install.packages. getBioC <- function(...) { biocinstall(...) }