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.

Tutorial 1: Your first run

What you will do

Run the whole pipeline once on a small public dataset, with no optional steps: illumination correction, stitching, one segmentation method, quantification and the QC report.

The data is MCMICRO’s exemplar-001: three cycles of cyclic immunofluorescence, four channels each, on a small piece of tissue, about the size of one TMA core. Stitched, it is about 3500 × 2600 pixels. It is the same data the pipeline is tested on before every release.

Get the data

The images are three OME-TIFF files, 191 MB in total, from MCMICRO’s public storage. The full dataset has ten cycles; this tutorial uses cycles 6, 7 and 8. Download them into a folder of your own:

mkdir -p /path/to/exemplars/exemplar-001 && cd /path/to/exemplars/exemplar-001
for c in 06 07 08; do
    curl -fLO "https://mcmicro.s3.amazonaws.com/exemplars/001/exemplar-001/raw/exemplar-001-cycle-$c.ome.tiff"
done

Each file holds all the tiles of one cycle, as the microscope wrote them.

The samplesheet

One row per cycle. The pipeline needs cycles numbered 1, 2, 3 without gaps, so the downloaded cycles 6, 7 and 8 become 1, 2 and 3 here.

samplecycle_numberimage_tilesmarker_sheet
exemplar-0011/path/to/exemplars/exemplar-001/exemplar-001-cycle-06.ome.tiff/path/to/exemplars/markers_exemplar001.csv
exemplar-0012/path/to/exemplars/exemplar-001/exemplar-001-cycle-07.ome.tiff/path/to/exemplars/markers_exemplar001.csv
exemplar-0013/path/to/exemplars/exemplar-001/exemplar-001-cycle-08.ome.tiff/path/to/exemplars/markers_exemplar001.csv
Copy as CSV: samplesheet.csv
sample,cycle_number,image_tiles,marker_sheet
exemplar-001,1,/path/to/exemplars/exemplar-001/exemplar-001-cycle-06.ome.tiff,/path/to/exemplars/markers_exemplar001.csv
exemplar-001,2,/path/to/exemplars/exemplar-001/exemplar-001-cycle-07.ome.tiff,/path/to/exemplars/markers_exemplar001.csv
exemplar-001,3,/path/to/exemplars/exemplar-001/exemplar-001-cycle-08.ome.tiff,/path/to/exemplars/markers_exemplar001.csv

Replace /path/to/exemplars with your folder. Every column is explained in The samplesheet.

The marker sheet

One row per channel, across all cycles. Save it as markers_exemplar001.csv next to the samplesheet; download it from GitHub.

channel_numbercycle_numbermarker_namechannel_rolechannel_compartmentfilterexcitation_wavelengthemission_wavelength
11DNA_6dnanuclearDAPI395431
21ELANEmarkercytoplasmFITC485525
31CD57markermembraneSytox555590
41CD45markermembraneCy5640690
52DNA_7dnanuclearDAPI395431
62CD11BmarkermembraneFITC485525
72SMAmarkercytoplasmSytox555590
82CD16markermembraneCy5640690
93DNA_8dnanuclearDAPI395431
103ECADmarkermembraneFITC485525
113FOXP3markernuclearSytox555590
123NCAMmarkermembraneCy5640690

Every column is explained in The marker sheet.

The parameters

Save as params.yml:

input: /path/to/exemplars/samplesheet.csv
outdir: /path/to/results/exemplar-001

use_instanseg: true
pixel_size: 0.65

patch_width_pixel: 1500

Cells are segmented by default; nuclei are not. Everything else stays at its default: no background subtraction, no TMA dearray.

Run

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

singularity runs every step in its container, size_small sets the resources for images up to about 50 GB, and slurm sends the steps to the cluster. On the MDC cluster add mdc. Set up your session first: Running on the cluster.

What runs, in order: BaSiCPy once per cycle, Ashlar once, then the conversion to a SpatialData store, tiled segmentation with InstanSeg on each patch, quantification and the QC report.

What you get

/path/to/results/exemplar-001/
├── preprocessing/
│   ├── illumination/   exemplar-001_cycle1-dfp.ome.tif, -ffp.ome.tif; per cycle
│   └── registration/   exemplar-001.ome.tif, exemplar-001_ashlar_qc/
├── exemplar-001.zarr/
│   ├── images/         exemplar-001, the stitched image, channels named from the marker sheet
│   ├── shapes/         image_patches, instanseg_cells
│   └── tables/         instanseg_table, one row per cell
├── qc/
│   ├── exemplar-001_instanseg_qc_report.html
│   ├── exemplar-001_instanseg_qc.json
│   └── exemplar-001_instanseg_qc_images/
└── pipeline_info/

Every file is described in Outputs.

What to check

  1. Open qc/exemplar-001_instanseg_qc_report.html in a browser. Start with “Stitching and registration”: did all three cycles align? See The QC report.

  2. In “Channels”, the twelve names match the marker sheet.

  3. “Nuclear stain across cycles” compares DNA_6 with DNA_8 per cell: a drop means cells were lost or bleached in later cycles.

  4. “Segmentation overlay” and “Cells per patch”: outlines sit on cells, and no patch inside the tissue is empty.

  5. Open the store with the outlines over the image; see Viewers.

If something looks wrong, see Common failures.

Next: Tutorial 4 runs two methods on the same data and compares them.