Search
Question: How can I get all installed Bioconductor packages?
0
gravatar for ishenweiyan
11 weeks ago by
ishenweiyan0 wrote:

In my all R packages, I want to find out which packages are installed by biocLite(), how could I do that ? Thank you.

ADD COMMENTlink modified 11 weeks ago by melissadayhill0 • written 11 weeks ago by ishenweiyan0
0
gravatar for Federico Marini
11 weeks ago by
Germany
Federico Marini110 wrote:

Hi ishenweiyan,

this is part of a script I use to document every now and then the packages I have stored by major R version change

# using package_info for the extra info delivered
### -> you might need to change the lib.loc according to system/version
allpkgs <- (devtools:::package_info(rownames(installed.packages(lib.loc = "/Library/Frameworks/R.framework/Versions/3.5/Resources/library")),include_base = T))
allpkgs[grepl("Bioconductor",allpkgs$source),]

# in a similar fashion, for cran/CRAN packages, and leading edge packages you might have got from Github repos
allpkgs[grepl("cran",allpkgs$source,ignore.case = TRUE),]
allpkgs[grepl("Github",allpkgs$source),]

There might be other ways to do it, but I found this to be relatively robust. If others have alternative solutions, I'd be also happy to check them out ;)

ADD COMMENTlink modified 11 weeks ago • written 11 weeks ago by Federico Marini110
0
gravatar for Mike Smith
11 weeks ago by
Mike Smith2.9k
EMBL Heidelberg / de.NBI
Mike Smith2.9k wrote:

How about this, using the sessioninfo package:

library(sessioninfo)
library(dplyr)

## list all installed packages
pkgs <- installed.packages()[,'Package']

## read description files & parse using sessioninfo
desc <- lapply(pkgs, utils::packageDescription)
source <- vapply(desc, sessioninfo:::pkg_source, character(1))

## combine and filter for BioC only
bioc_pkgs <- data_frame(pkgs, source) %>%
    filter(source == "Bioconductor")

Output looks like:

> bioc_pkgs
# A tibble: 110 x 2
   pkgs             source      
   <chr>            <chr>       
 1 affy             Bioconductor
 2 affyio           Bioconductor
 3 airway           Bioconductor
 4 annotate         Bioconductor
 5 AnnotationDbi    Bioconductor
 6 AnnotationFilter Bioconductor
 7 AnnotationHub    Bioconductor
 8 Biobase          Bioconductor
 9 BiocGenerics     Bioconductor
10 BiocInstaller    Bioconductor
# ... with 100 more rows
ADD COMMENTlink written 11 weeks ago by Mike Smith2.9k

I think I wrote my piece of code before the nice sessioninfo came out, and sticked to that since it was working :D

ADD REPLYlink modified 11 weeks ago • written 11 weeks ago by Federico Marini110
1

I think yours has fewer steps and is easier to understand. This seems a rather neat combination:

installed.packages() %>% 
rownames() %>% 
devtools:::package_info() %>% 
filter(source == "Bioconductor")
ADD REPLYlink modified 11 weeks ago • written 11 weeks ago by Mike Smith2.9k

I think the OP can be quite satisfied with the material over here, the latest one is nice & compact indeed
 

ADD REPLYlink written 11 weeks ago by Federico Marini110
0
gravatar for Martin Morgan
11 weeks ago by
Martin Morgan ♦♦ 22k
United States
Martin Morgan ♦♦ 22k wrote:

A base R solution. These are the repositories that biocLite uses, filtered to exclude the CRAN repository

repos = BiocInstaller::biocinstallRepos()
repos = repos[startsWith(names(repos), "BioC")]

and the packages installed with biocLite

installed_pkgs = rownames(installed.packages())
available_pkgs = rownames(available.packages(repos = repos))
intersect(available_pkgs, installed_pkgs)

 

ADD COMMENTlink written 11 weeks ago by Martin Morgan ♦♦ 22k
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 2.2.0
Traffic: 128 users visited in the last hour