Jrocker - Rstudio and Biocondutor docker
Chun-Jie Liu · 2019-08-14
Reproducibility
Reproducibilities are the main issues in research. For wet biological experiments, though following the protocols of paper provided, sometimes, it’s hard to reproduce the same results. Data engineering paper provides code to reproduce the figures and tables, but as the working environment differences, often get unexpected results. Providing Docker image can partly solve the reproducible issues as Guinney states.
Intention
I manage several old Ubuntu server before 12.04 with codename precise which many resources don’t support the ‘precise’. For some reasons, I can not upgrade the OS. R
and Rstudio server
that I used in my daily life can not upgrade to 3.4.0
from system command as I wrote a blog before to install R
from source. The most painful thing is not upgrading R
each time, it is the packages that takes long time to install. The intetion was wrote in the README in Jrocker
GitHub
repo.
Jrocker
Jrocker is the combination of Rstudio server
, tidyverse suites
, bioconducter
and the packages I used in my project.
Reviewed the Biocondutor release core Dockerfile
code, I plan to build personal running environment for myself Jrocker.
-
No more using bioc base2 docker as base image to construct Jrocker. Now using
rocker/rstudio
as base image. -
Outside packages are provided in the install-pkgs.R.
-
For machine learning and deep learning project, it’s hard to integrating the keras into the Jrocker. Even though JJ Allaire provided a machine learning docker image based on
rocker/rstudio
, I cant reproduce the basic keras example on the keras tutorial. Now I build aTensorFlow
andKeras
jupyter notebook basd onjupyter/scipy-notebook
, and name it asJukeras
. it works fine now.
Run jrocker
docker pull chunjiesamliu/jrocker:latest
docker run -it --rm chunjiesamliu/jrocker /usr/local/bin/R
docker run -it --rm chunjiesamliu/jrocker /bin/bash
Run rstudio server
docker run -d -p 8686:8787 \
-v /home/liucj/:/home/liucj/ \
-e USER=liucj -e PASSWORD=<password> \
-e USERID=$EUID -e ROOT=TRUE \
--name Jrocker chunjiesamliu/jrocker
Run R scripts
docker run -i --rm --user $EUID \
--entrypoint /usr/local/bin/Rscript \
-v /your/path/:/docker/path/ \
chunjiesamliu/jrocker /docker/path/product.R
Run Jrocker for multiple sessions with no conflict
Rstudio server can run only one session, when you run one command with long time wait, you don’t want to wait to run other command. So using jrocker to open other several sessions with no conflict, then save the data as dat.rds.gz
to load into your main rstudio session.
Rprofile
# Blogdown options --------------------------------------------------------
options(blogdown.author = "Chun-Jie Liu")
options(servr.daemon = FALSE)
options(blogdown.ext = ".Rmd")
options(blogdown.subdir = "post")
options(blogdown.yaml.empty = TRUE)
# General options ---------------------------------------------------------
options(repos = c(CRAN = "https://cloud.r-project.org"))
options(prompt = "Jrocker>", digits = 4, show.signif.stars = FALSE)
options(stringsAsFactors = FALSE)
# ggplot2 v3 options ------------------------------------------------------
options(
ggplot2.continuous.color = "viridis",
ggplot2.continuous.fill = "viridis"
)
# First -------------------------------------------------------------------
.First <- function(){
library(magrittr)
}
# Last --------------------------------------------------------------------
.Last <- function(){}