Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Usage guide

Everything about launching a run: the command, the profiles, the cluster, resuming and GPUs. For a first run, read the step-by-step guide instead. What goes into the sheets and settings is under Inputs.

The command

nextflow run CosciaLab/histo -r v3.2.0 \
    -profile singularity,size_small,slurm \
    -params-file params.yml

Settings: file, not command line

Put pipeline settings in the -params-file. A setting can also go on the command line as --name value, but two rules make that error-prone:

To start a settings file with every option listed, copy params_template_compact.yml to params.yml and remove the # in front of what you change. null there means off or unset.

Profiles

Give one profile of each kind, separated by commas: -profile singularity,size_small,slurm.

How the software runs. singularity on the cluster (apptainer works too); docker on a laptop. The images must be in place before the run; the pipeline downloads nothing while it runs. How maintainers stage them: Fetching images.

Resources. Pick by the size of the stitched image. Only size_tiny is measured; the others are estimates and will change.

ProfileStitched image
size_tinyunder ~1 GB, test data
size_smallup to ~50 GB
size_medium~50–200 GB
size_huge~200 GB and up

A 16-bit image takes 2 bytes per pixel per channel: 30 000 × 20 000 px with 8 channels is about 10 GB.

Where the steps run. slurm sends each step to the cluster’s queue as its own job. Without it, everything runs on the machine you launched from.

At the MDC. Add mdc after slurm. It asks for nodes with the Ceph storage, and GPU nodes when you use a GPU. See At the MDC.

Running on the cluster

Launch from a working folder of your own, not from inside a copy of the pipeline. Nextflow submits the cluster jobs itself; you never write a job script. Run it inside tmux, so it keeps going when you log out.

mkdir -p ~/runs/myrun && cd ~/runs/myrun
tmux new -s myrun

# Keep temporary files off the shared /tmp, which is small. Without this a run can die
# with "No space left on device", which looks like a quota problem and is not one.
export TMPDIR=/fast/AG_Coscia/$USER/tmp
export NXF_TEMP="$TMPDIR"
export NXF_OPTS="-Djava.io.tmpdir=$TMPDIR"
mkdir -p "$TMPDIR"

# Stops a download at launch of a config this pipeline does not use.
export NXF_OFFLINE=true

nextflow run CosciaLab/histo -r v3.2.0 \
    -profile singularity,size_small,slurm \
    -params-file params.yml

Replace the TMPDIR path with a folder of yours on a large disk. All three temp settings are needed: they serve the tools, Nextflow and Java respectively.

Example

A whole slide, about 30 000 × 20 000 px, segmented with Cellpose on many markers, cells and nuclei:

input: /data/myproject/sheets/samplesheet.csv
outdir: /data/myproject/results

use_cellpose: true
use_projection: true

segment_nuclei: true
patch_width_pixel: 3000

Why each line: Parameters. More complete runs: Tutorials.

Resume a run

Add -resume to the same command, from the same working folder, and Nextflow reuses every step whose inputs and settings have not changed. Use it after a failure, or after changing a setting that only affects later steps: changing a segmentation setting does not redo the stitching.

Keep work/ and the hidden .nextflow/ folder in the working folder; -resume needs both. Results that are links into work/ (with publish_dir_mode: symlink) break when it is deleted.

One exception: the store. Several steps change a sample’s .zarr store in place. If a later run changed the store, -resume back to earlier settings reuses those steps and does not bring the earlier store back. A Cellpose step may also fail with “projection removed by an earlier run”. Rerun those samples without -resume.

To find which steps failed in a past run:

nextflow log                                        # list the runs
nextflow log <run_name> -f name,status,exit,workdir -F 'status == "FAILED"'

GPU

use_gpu: true gives each Cellpose and InstanSeg patch one GPU. Run it with slurm; with mdc too, each patch gets an A40 in the gpu partition.

On another cluster whose GPUs sit in their own partition, name it in a config file given with -c; replace gpu with your partition. Not needed with mdc:

process {
    withName: 'SEGMENT_PATCH_(CELLPOSE|INSTANSEG)' {
        queue = 'gpu'
    }
}

To check a patch used the GPU, open its work folder’s .command.out: the [segment_patch] line ends with device cuda.