BiocUpgrade without being promped to confirm
2
1
Entering edit mode
@simon-coetzee-5051
Last seen 6 months ago
USA Cedars-Sinai Medical Center

How would one go about automating updating to the newest bioconductor install.  I have many machines that I have to update to 3.0, and the command:

biocLite("BiocUpgrade", ask=FALSE)

still requires intervention with the following:

Upgrade all packages to Bioconductor version 3.0? [y/n]:

Is there any way to bypass this?

Thanks

bioclite biocinstaller biocupgrade • 1.6k views
3
Entering edit mode
Dan Tenenbaum ★ 8.2k
@dan-tenenbaum-4256
Last seen 23 months ago
United States

It's a bit tricky to edit these functions because running biocLite("BiocUpgrade") will actually upgrade the BiocInstaller package and overwrite the features you have just added. Maybe that's ok because by the time that happens, you will have accomplished your goal, which is getting the latest version of Bioconductor running. But then you'll have to revisit the same thing after the next Bioconductor release.

Probably we should take a look at this and see if we can implement what you suggest or something similar. Another tricky thing is that the BiocUpgrade process has some interesting design constraints; in fact, the reason it has odd syntax (biocLite("BiocUpgrade") where BiocUpgrade is not an actual package) is because what actually happens when you run that code is, a new package is installed, replacing the one that existed when you ran the command, and then a function is called in the new package. You have to be really careful to invoke the command in a way that won't break either package.

In the meantime, another way to do this might be:

library(BiocInstaller)
repos <- gsub("2.14", "3.0", biocinstallRepos())
install.packages("BiocInstaller", repos=repos)
# You might want to restart R here, to make sure you're talking to the new BiocInstaller before the next commands.
library(BiocInstaller)
biocLite(ask=FALSE)

This will reinstall BiocInstaller from the 3.0 (current release) repository, so when you then run biocLite() with no package arguments, it will update all your packages to the version appropriate for Bioconductor 3.0.

Stay tuned for a possible longer-term fix.

Dan

2
Entering edit mode
@james-w-macdonald-5106
Last seen 8 hours ago
United States

I don't know why there is no 'ask' argument for BiocInstaller:::.biocUpgrade() (perhaps somebody from Seattle will comment). But note that you can always get BiocInstaller from svn (or the tarball), and then change BiocInstaller:::.biocUpgrade() to have an 'ask' argument (in useDevel.R, it currently has no arguments):

Existing:

.biocUpgrade <-
function()
{
.stop("Bioconductor version %s cannot be upgraded with
R version %s", biocVersion(), R_VERSION)
}
.stop("Bioconductor version %s can be upgraded, but only to 'devel';
see ?useDevel. Use biocLite() without any arguments to update
installed packages", biocVersion())

txt <- sprintf("Upgrade all packages to Bioconductor version %s? [y/n]: ",
}

Updated:

.biocUpgrade <-
{
.stop("Bioconductor version %s cannot be upgraded with
R version %s", biocVersion(), R_VERSION)
}
.stop("Bioconductor version %s can be upgraded, but only to 'devel';
see ?useDevel. Use biocLite() without any arguments to update
installed packages", biocVersion())
txt <- sprintf("Upgrade all packages to Bioconductor version %s? [y/n]: ",
} else {
}
}

You will also have to change biocLite:

From

biocLite <-
function(pkgs=c("Biobase","IRanges","AnnotationDbi"),
suppressAutoUpdate=FALSE,
{
if (missing(pkgs))   # biocLite() update w/out installing defaults
pkgs <- pkgs[!pkgs %in% rownames(installed.packages())]
if (!suppressAutoUpdate && !bioconductorPackageIsCurrent()) {
siteRepos=siteRepos, ...))
} else if ("BiocUpgrade" %in% pkgs) {
} else {
}
}

To:

biocLite <-
function(pkgs=c("Biobase","IRanges","AnnotationDbi"),
suppressAutoUpdate=FALSE,
{
if (missing(pkgs))   # biocLite() update w/out installing defaults
pkgs <- pkgs[!pkgs %in% rownames(installed.packages())]
if (!suppressAutoUpdate && !bioconductorPackageIsCurrent()) {
siteRepos=siteRepos, ...))
} else if ("BiocUpgrade" %in% pkgs) {
} else {
}
}

Then build and install.