1 ## Mirrors: uncomment the following and change to your favorite CRAN mirror
2 ## if you don't want to use the default (cran.fhcrc.org, Seattle, USA).
3 ## options("repos" = c(CRAN="http://cran.fhcrc.org"))
5 ## Mirrors: uncomment the following and change to your favorite Bioconductor
6 ## mirror, if you don't want to use the default (www.bioconductor.org,
8 ## options("BioC_mirror" = "http://www.bioconductor.org")
12 package_version(readLines("http://bioconductor.org/bioc-version",
15 biocVers <- tryCatch({
16 BiocInstaller::biocVersion() # recent BiocInstaller
17 }, error=function(...) { # no / older BiocInstaller
18 tools:::.BioC_version_associated_with_R_version
21 if (biocVers < currBiocVers) {
22 txt <- strwrap(sprintf("Your Bioconductor is out-of-date, upgrade
23 to version %s by following instructions at
24 http://bioconductor.org/install.", currBiocVers))
25 message(paste(txt, collapse="\n"))
28 if (vers > "2.13" && biocVers > "2.8") {
30 if (exists("biocLite", .GlobalEnv, inherits=FALSE)) {
31 txt <- strwrap("There is an outdated biocLite() function in the
32 global environment; run 'rm(biocLite)' and try again.")
33 stop("\n", paste(txt, collapse="\n"))
36 if (!suppressWarnings(require("BiocInstaller", quietly=TRUE))) {
38 p <- file.path(Sys.getenv("HOME"), ".R", "repositories")
40 a <- tools:::.read_repositories(p)
41 if (!"BioCsoft" %in% rownames(a))
45 p <- file.path(R.home("etc"), "repositories")
46 a <- tools:::.read_repositories(p)
48 if (!"package:utils" %in% search()) {
49 url <- "http://bioconductor.org/biocLite.R"
50 txt <- sprintf("use 'source(\"%s\")' to update 'BiocInstaller'
51 after 'utils' package is attached",
53 message(paste(strwrap(txt), collapse="\n "))
55 ## add a conditional for Bioc releases occuring WITHIN
56 ## a single R minor version
57 if (vers >= "2.15" && vers < "2.16") {
58 a["BioCsoft", "URL"] <- sub(as.character(biocVers), "2.11",
60 biocVers <- numeric_version("2.11")
62 install.packages("BiocInstaller", repos=a["BioCsoft", "URL"])
63 if (!suppressWarnings(require("BiocInstaller",
65 url0 <- "http://www.bioconductor.org/packages"
66 url <- sprintf("%s/%s/bioc",
67 url0, as.character(biocVers))
68 txt0 <- "'biocLite.R' failed to install 'BiocInstaller',
69 use 'install.packages(\"%s\", repos=\"%s\")'"
70 txt <- sprintf(txt0, "BiocInstaller", url)
71 message(paste(strwrap(txt), collapse="\n "))
76 source("http://bioconductor.org/getBioC.R")
78 function(pkgs, groupName="lite", ...)
81 biocinstall(groupName=groupName, ...)
83 biocinstall(pkgs=pkgs, groupName=groupName, ...)