Run labs in container

Instructions on running labs in Docker or Singularity container

Note

Three different toolkits, namely Seurat (R/RStudio), Bioconductor (R/RStudio) and Scanpy (Python/Jupyter) are available to perform the scRNAseq analysis. The labs can be run on Uppmax using Singularity (Apptainer) or on your local machine using Docker. Both options provide the necessary environment to run the analysis.
If you use Uppmax, you do not need any local installation or setup on your system but you need an Uppmax account and become a member of the Uppmax projects. If you use Docker, you will need to set up and run Docker yourself.

2 Option B: Run Docker Locally

Important

The docker containers are not tested on Microsoft Windows OS.

2.1 Local Setup

Create a new directory at a suitable location. Now you can fetch the scripts for the labs. You can either download individual .qmd or .ipynb files from the Contents page or clone the whole repo. If you clone the repo, navigate to compiled/labs to work on labs.

git clone --depth 1 --single-branch --branch master https://github.com/nbisweden/workshop-scRNAseq.git
cd workshop-scRNAseq/compiled/labs

If the git command is not available, you can simply go to https://github.com/NBISweden/workshop-scRNAseq and download the repo as a zip file and unzip it in a suitable location.

2.2 Images

Separate Docker images are made available for Seurat, Bioconductor and Scanpy toolkits. An additional set of images are available for spatial analyses. All images follow the registry/username/image:tag convention. The image is always ghcr.io/nbisweden/workshop-scrnaseq. Add the appropriate tag based on the lab you are running.

An overview of the available docker images. Note the space requirements.

Topic Image Size (GB)
Seurat 2024-seurat-r4.3.0 8.87
Bioconductor 2024-bioconductor-r4.3.0 7.89
Scanpy 2024-scanpy-py3.10 3.68
Optional Topic Image Size (GB)
Seurat spatial 2024-seurat_spatial-r4.3.0 6.85
Bioconductor spatial 2024-bioconductor_spatial-r4.3.0 6.47
Scanpy spatial 2024-scanpy_spatial-py3.10 3.68

2.3 Seurat

Tip

To avoid running out of memory, restart R (Session > Restart R) after each lab.

cd /path/to/labs  # replace this with the full path to the workshop compiled lab folder
docker pull --platform=linux/amd64 ghcr.io/nbisweden/workshop-scrnaseq:2024-seurat-r4.3.0
docker run --platform=linux/amd64 --rm -p 8788:8787 -e PASSWORD=scrnaseq -v ${PWD}:/home/rstudio/workdir ghcr.io/nbisweden/workshop-scrnaseq:2024-seurat-r4.3.0

Do not close the terminal. In the browser, go to localhost:8788.
Use the following credentials to log in to the RStudio Server:

User: rstudio
Password: scrnaseq

Navigate to /home/rstudio/workdir/ and open qmd files

RStudio login screen

RStudio preview

2.4 Bioconductor

Tip

To avoid running out of memory, restart R (Session > Restart R) after each lab.

cd /path/to/labs  # replace this with the full path to the workshop compiled lab folder
docker pull --platform=linux/amd64 ghcr.io/nbisweden/workshop-scrnaseq:2024-bioconductor-r4.3.0
docker run --platform=linux/amd64 --rm -p 8789:8787 -e PASSWORD=scrnaseq -v ${PWD}:/home/rstudio/workdir ghcr.io/nbisweden/workshop-scrnaseq:2024-bioconductor-r4.3.0

Do not close the terminal. In the browser, go to localhost:8789. Use the following credentials to log in to the RStudio Server:

User: rstudio
Password: scrnaseq

Navigate to /home/rstudio/workdir/ and open qmd files

2.5 Scanpy

Tip

To avoid running out of memory, restart the kernel (Kernel > Restart Kernel) after each lab.

cd /path/to/labs  # replace this with the full path to the workshop compiled lab folder
docker pull --platform=linux/amd64 ghcr.io/nbisweden/workshop-scrnaseq:2024-scanpy-py3.10
docker run --platform=linux/amd64 --rm -p 8888:8888 -v ${PWD}:/home/jovyan/workdir ghcr.io/nbisweden/workshop-scrnaseq:2024-scanpy-py3.10

Do not close the terminal. At the end of the prompt, you will see a URL that starts with http://127.0.0.1, similar to the one below:

http://127.0.0.1:8888/lab?token=0a1d9ec51b91528a1d1fe2ad2c74f59ecb94c47070c2911d

Note that your token value will be different. Copy the entire URL (with the token) and paste it in your browser.

JupyterLab home

JupyterLab preview