Skip to content

About

Snakemake workflow to embed OME-Zarr whole slide images with raw2features.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

raw2features Snakemake workflow

Runs raw2features over a cohort of OME-Zarr whole-slide images. Per slide: raw2features embed → <id>.embeddings.zarr → validate-store, with an optional SpatialData export. Slides are discovered as *.ome.zarr in slide_dir.

This workflow (v1.0.0) pins raw2features 0.2.1. raw2features is MIT-licensed and copyright Craig Myles; see CITATION.cff for how to cite both.

Quick start

pip install snakemake "raw2features[zarr,image,torch,models]==0.2.1"

# smoke test on a generated synthetic slide (CPU)
mkdir -p test_data && raw2features sample test_data/sample.ome.zarr
snakemake --cores 2 --configfile config/test.yaml

# your cohort
snakemake --cores 8 --config slide_dir=/data/slides out_dir=/data/emb qc=grandqc

raw2features must be on the PATH of the shell Snakemake spawns (activate your venv first), or set raw2features_cmd to its full path. A command not found in <out_dir>/logs/<slide>.embed.log means this.

Defaults are in config/config.yaml. Re-running resumes missing slides. For Slurm use snakemake-executor-plugin-slurm (--executor slurm).

Running with Docker

Snakemake itself only supports Apptainer/Singularity containers, so to use Docker, make the command a docker run of the pinned image (tested):

snakemake --cores 2 --configfile config/test.yaml \
  --config raw2features_cmd="docker run --rm -u $(id -u):$(id -g) -e HOME=$PWD/.cache -v $PWD:$PWD -w $PWD ghcr.io/pschrempf/raw2features:0.2.1 raw2features"

Add -v <dir>:<dir> for data outside the working directory and --gpus all for GPUs.

Running with Apptainer/Singularity

container in config/config.yaml points at the same image; Snakemake uses it when container support is switched on:

snakemake --cores 8 --software-deployment-method apptainer   # Snakemake >= 8
snakemake --cores 8 --use-singularity                         # Snakemake 7 (tested)

Building the image

Dockerfile installs a pinned raw2features release. Keep the image tag equal to that version:

docker build --build-arg R2F_VERSION=0.2.1 -t ghcr.io/pschrempf/raw2features:0.2.1 .
docker push ghcr.io/pschrempf/raw2features:0.2.1

About

Snakemake workflow to embed OME-Zarr whole slide images with raw2features.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages