|
#!/usr/bin/Rscript |
|
|
|
# This option is needed to finish environment isolation from the cache |
|
# when renv::isolate() is run |
|
options(renv.consent = TRUE) |
|
# First, install renv (if it is needed!) |
|
if (!requireNamespace("renv", quietly = TRUE)) { |
|
install.packages("renv") |
|
} |
|
|
|
# We are declaring the directory where to install |
|
# all of these packages. |
|
# If we are already in the project directory, the path is not needed. |
|
# To start from a clean environment, use, bare=TRUE. Otherwise, renv::init |
|
# will scan all the already installed packages, in order to add them to |
|
# the newly created environment |
|
renv::init("~/RATAMAN2",bare=TRUE,restart=TRUE) |
|
|
|
# if the renv project already exists, instead of the initialization |
|
# you activate it with 'activate' |
|
# Remember: if we are already in the project directory, |
|
# the path is not needed |
|
renv::activate("~/RATAMAN2") |
|
|
|
|
|
# A CRAN package is installed |
|
# It can also be installed using traditional method, but it is better |
|
# in this way |
|
renv::install("reshape2") |
|
|
|
# Bioconductor itself must be recorded |
|
if (!requireNamespace("BiocManager", quietly = TRUE)) { |
|
install.packages("BiocManager") |
|
} |
|
|
|
# This line adding the Bioconductor repositories is needed, |
|
# in order to have the URLs to their repos in the |
|
# reproducible snapshot |
|
options(repos=BiocManager::repositories()) |
|
|
|
# You have to uncomment next line if you want packages to be tied to an |
|
# specific Bioconductor release |
|
# BiocManager::install(version = "3.11") |
|
|
|
# Now, installing several packages from Bioconductor |
|
# using renv::install is as easy as giving a prefix |
|
renv::install(c("bioc::GenomicFeatures", "bioc::AnnotationDbi")) |
|
|
|
# At last, the snapshot is generated |
|
renv::snapshot(prompt=FALSE) |