BiocUpgrade without being promped to confirm
2
1
Entering edit mode
@simon-coetzee-5051
Last seen 22 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.8k views
ADD COMMENT
3
Entering edit mode
Dan Tenenbaum ★ 8.2k
@dan-tenenbaum-4256
Last seen 3.2 years 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

 

 

ADD COMMENT
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()
{
    if (!IS_UPGRADEABLE) {
        .stop("Bioconductor version %s cannot be upgraded with
               R version %s", biocVersion(), R_VERSION)
    }
    if (IS_UPGRADEABLE && UPGRADE_IS_DEVEL)
        .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]: ",
                   UPGRADE_VERSION)
    answer <- .getAnswer(txt, allowed = c("y", "Y", "n", "N"))
    if ("y" == answer)
        .update(UPGRADE_VERSION, TRUE)
}

 

Updated:

.biocUpgrade <-
    function(ask = TRUE)
{
    if (!IS_UPGRADEABLE) {
        .stop("Bioconductor version %s cannot be upgraded with
               R version %s", biocVersion(), R_VERSION)
    }
    if (IS_UPGRADEABLE && UPGRADE_IS_DEVEL)
        .stop("Bioconductor version %s can be upgraded, but only to 'devel';
               see ?useDevel. Use biocLite() without any arguments to update
               installed packages", biocVersion())
    if(ask){
      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)
    } else {
       .update(UPGRADE_VERSION, TRUE)
    }
}

You will also have to change biocLite:

From

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) {
        .biocUpgrade()
    } else {
        biocLiteInstall(pkgs, ask=ask, siteRepos=siteRepos,
                        suppressUpdates=suppressUpdates, ...)
    }
}

To:

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) {
        .biocUpgrade(ask = ask)
    } else {
        biocLiteInstall(pkgs, ask=ask, siteRepos=siteRepos,
                        suppressUpdates=suppressUpdates, ...)
    }
}

Then build and install.

ADD COMMENT

Login before adding your answer.

Traffic: 508 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6