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.
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=grandqcraw2features 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).
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.
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)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