Question: BiocUpgrade without being promped to confirm
1
gravatar for Simon Coetzee
5.1 years ago by
USA Cedars-Sinai Medical Center
Simon Coetzee50 wrote:

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

ADD COMMENTlink modified 5.1 years ago by Dan Tenenbaum8.2k • written 5.1 years ago by Simon Coetzee50
Answer: BiocUpgrade without being promped to confirm
3
gravatar for Dan Tenenbaum
5.1 years ago by
Dan Tenenbaum8.2k
United States
Dan Tenenbaum8.2k wrote:

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 COMMENTlink written 5.1 years ago by Dan Tenenbaum8.2k
Answer: BiocUpgrade without being promped to confirm
2
gravatar for James W. MacDonald
5.1 years ago by
United States
James W. MacDonald52k wrote:

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 COMMENTlink written 5.1 years ago by James W. MacDonald52k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 152 users visited in the last hour