Sign inSign up

kwellswrasman/r_docker_dropt

By kwellswrasman

•Updated 2 months ago

Single cell RNA seq tools in R + dropt

Image
Data science
0

10K+

kwellswrasman/r_docker_dropt repository overview

⁠scRNA-seq docker image + dropt

This docker image is based around the bioconductor docker image⁠ that allows for using an interactive Rstuido session with local host. I have installed several R packages into this base image using renv for reproducibility.

The full recipe for this image is on github⁠

⁠Version history

Recipes can be found on github (linked to proper commit by the version) with all packages and version information.

  • V1⁠ Uses R 4.5 and includes most packages for single cell analysis with Seurat version 5. In addition, it includes SingleCellExperiment and DropletUtils and scran for improved outlier detection and normalization. muscat is also included for pseudobulk differential expression and djvdj is included for analysis of VDJ data. This has no reliance on anaconda.

⁠Downloading the image

To download, the image, you can simply run

docker pull kwellswrasman/r_docker_dropt:v1

⁠Converting to singularity

To convert this image to singularity, simply run

singularity pull --name scrna_seq_r_v3.sif docker://kwellswrasman/r_docker_dropt:v1

⁠Using R studio

To run Rstudio using this image, in a terminal run

docker run \
	-e PASSWORD=bioc \
	-p 8787:8787 \
	kwellswrasman/r_docker_dropt:v1

If you navagate to http://localhost:8787⁠ on you web browswer, you will be able to log into a Rstudio session using rstudio as your username and whatever you set above as the password, in this case bioc.

With the above command, you won't have access to your system, but adding a mount line will fix it.

docker run \
	-e PASSWORD=bioc \
	-p 8787:8787 \
	--mount type=bind,source="$(pwd)",target=/home/rstudio/rnaseq \
	kwellswrasman/r_docker_dropt:v1

More information on the base container is here⁠

Packages installed in this container can be found in the R_dependencies file. The renv.lock file will provide all packages and versions.

⁠R studio with singularity

To run R studio with singularity on a slurm server, use the helper launch_rstusio.sh script. The log file will include instruction for how to run rstusio from within the singularity image in a running job. This requires ssh access to the server.

⁠Version control with renv

This image was built using version control with renv.

⁠Initial build

To build the container initially, I added any desired packages to R_dependencies and then I followed the following steps

  1. I removed the following lines from the docker file
COPY renv.lock renv.lock
RUN R -e "renv::restore()"
  1. I then built the package without any R packages
docker build r_docker_dropt:v1 ./
  1. I next started an interactive shell
docker run -it --mount type=bind,source="$(pwd)",target=/home/rstudio/r_docker r_docker_dropt:v1 sh
  1. In this I started R and used renv to install packages. Any non-cran packages need to be installed manually using the full github path or bioc:: for bioconductor packages. I then copy the lock file into the r_docker directory.
R

> renv::init()
> renv::hydrate()
> renv::install(c("github_user/github_package", "bioc::bioconductor_package"))
> renv::snapshot
> q()

cp renv.lock r_docker
exit
  1. Now that I have the lock file, I add back in two lines from the docker file
COPY renv.lock renv.lock
RUN R -e "renv::restore()"
  1. Rebuild the image
docker build r_docker_dropt:v1 ./
⁠Adding a package
  1. Add you new package to R_dependencies

  2. Start an interactive shell in the docker container (this assumes it has been downloaded from dockerhub, see above)

docker run -it --mount type=bind,source="$(pwd)",target=/home/rstudio/r_docker r_docker_dropt:v1 sh
  1. Start R and install your new packages with renv. Any non-cran packages need to be installed manually using the full github path or bioc:: for bioconductor packages. I then copy the lock file into the r_docker directory.
R

> renv::init()
> renv::hydrate()
> renv::install(c("github_user/github_package", "bioc::bioconductor_package"))
> renv::snapshot
> q()

cp renv.lock r_docker
exit
  1. Rebuild the image
docker build r_docker_dropt:v1 ./

Tag summary

Content type

Image

Digest

sha256:cb71ed299…

Size

3.4 GB

Last updated

about 1 year ago

docker pull kwellswrasman/r_docker_dropt