Run labs in container

Instructions on running the spatial labs in Docker

1 Run Docker Locally

Important

The docker containers are not tested on Microsoft Windows OS.

1.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.

1.2 Spatial images

Separate Docker images to run the spatial analysis are made available for Seurat, Bioconductor and Scanpy toolkits. 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 Tag 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

1.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_spatial-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_spatial-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

1.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_spatial-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_spatial-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

1.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_spatial-py3.10
docker run --platform=linux/amd64 --rm -p 8888:8888 -v ${PWD}:/home/jovyan/workdir ghcr.io/nbisweden/workshop-scrnaseq:2024-scanpy_spatial-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