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"
doneEach 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.
| 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 |
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.csvReplace /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_number | cycle_number | marker_name | channel_role | channel_compartment | filter | excitation_wavelength | emission_wavelength |
|---|---|---|---|---|---|---|---|
| 1 | 1 | DNA_6 | dna | nuclear | DAPI | 395 | 431 |
| 2 | 1 | ELANE | marker | cytoplasm | FITC | 485 | 525 |
| 3 | 1 | CD57 | marker | membrane | Sytox | 555 | 590 |
| 4 | 1 | CD45 | marker | membrane | Cy5 | 640 | 690 |
| 5 | 2 | DNA_7 | dna | nuclear | DAPI | 395 | 431 |
| 6 | 2 | CD11B | marker | membrane | FITC | 485 | 525 |
| 7 | 2 | SMA | marker | cytoplasm | Sytox | 555 | 590 |
| 8 | 2 | CD16 | marker | membrane | Cy5 | 640 | 690 |
| 9 | 3 | DNA_8 | dna | nuclear | DAPI | 395 | 431 |
| 10 | 3 | ECAD | marker | membrane | FITC | 485 | 525 |
| 11 | 3 | FOXP3 | marker | nuclear | Sytox | 555 | 590 |
| 12 | 3 | NCAM | marker | membrane | Cy5 | 640 | 690 |
Every cycle starts with its DNA stain, marked
dnainchannel_role. The pipeline uses it to align the cycles to each other.Marker names keep the original cycle numbers (
DNA_6toDNA_8), so you can still tell which acquisition a channel came from.
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: 1500use_instansegsegments cells with InstanSeg. It reads everydnaandmarkerchannel of the marker sheet, so there are no channels to choose.pixel_sizeis the size of one pixel in µm. For exemplar-001 it is 0.65, as recorded in the image’s metadata.patch_width_pixelcuts the image into 1500-pixel squares, here 3 × 2 patches, segmented side by side. See Patch size.
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.ymlsingularity 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¶
Open
qc/exemplar-001_instanseg_qc_report.htmlin a browser. Start with “Stitching and registration”: did all three cycles align? See The QC report.In “Channels”, the twelve names match the marker sheet.
“Nuclear stain across cycles” compares
DNA_6withDNA_8per cell: a drop means cells were lost or bleached in later cycles.“Segmentation overlay” and “Cells per patch”: outlines sit on cells, and no patch inside the tissue is empty.
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.