When to use¶
A whole slide imaged with autofluorescence channels: a cycle, or channels, that record only the tissue’s own glow. backsub subtracts them from the markers before segmentation. The example below is made up; adapt the names and paths to your slide.
The samplesheet¶
One row per cycle:
| sample | cycle_number | image_tiles | marker_sheet |
|---|---|---|---|
| wsi01 | 1 | /data/myproject/raw/wsi01/cycle01.ome.tiff | /data/myproject/sheets/markers_wsi01.csv |
| wsi01 | 2 | /data/myproject/raw/wsi01/cycle02.ome.tiff | /data/myproject/sheets/markers_wsi01.csv |
Copy as CSV: samplesheet.csv
sample,cycle_number,image_tiles,marker_sheet
wsi01,1,/data/myproject/raw/wsi01/cycle01.ome.tiff,/data/myproject/sheets/markers_wsi01.csv
wsi01,2,/data/myproject/raw/wsi01/cycle02.ome.tiff,/data/myproject/sheets/markers_wsi01.csvColumns: The samplesheet.
The marker sheet¶
Cycle 1 records the background, cycle 2 the markers:
| channel_number | cycle_number | marker_name | channel_role | channel_compartment | filter | exposure | background | remove |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | DNA_1 | dna | nuclear | DAPI | 20 | ||
| 2 | 1 | AF_FITC | autofluorescence | FITC | 100 | true | ||
| 3 | 1 | AF_Cy5 | autofluorescence | Cy5 | 150 | true | ||
| 4 | 2 | DNA_2 | dna | nuclear | DAPI | 20 | ||
| 5 | 2 | CD45 | marker | membrane | FITC | 100 | AF_FITC | |
| 6 | 2 | PanCK | marker | cytoplasm | Cy5 | 150 | AF_Cy5 |
Copy as CSV: markers_wsi01.csv
channel_number,cycle_number,marker_name,channel_role,channel_compartment,filter,exposure,background,remove
1,1,DNA_1,dna,nuclear,DAPI,20,,
2,1,AF_FITC,autofluorescence,,FITC,100,,true
3,1,AF_Cy5,autofluorescence,,Cy5,150,,true
4,2,DNA_2,dna,nuclear,DAPI,20,,
5,2,CD45,marker,membrane,FITC,100,AF_FITC,
6,2,PanCK,marker,cytoplasm,Cy5,150,AF_Cy5,Every channel needs an
exposure: the background is scaled by the ratio of exposure times.backgroundnames a channel whosechannel_roleisautofluorescence.remove: truedrops the two background channels after subtraction. Keep at least onednachannel.
Columns: The marker sheet.
The parameters¶
Save as params.yml:
input: /data/myproject/sheets/samplesheet.csv
outdir: /data/myproject/results
use_backsub: true
use_cellpose: true
cellpose_channels: "CD45 DNA_1"
patch_width_pixel: 8000use_backsubturns subtraction on. See Background subtraction.cellpose_channelsgives Cellpose one membrane marker and the DNA stain, nuclear stain last. A channel thatremovedrops cannot be used here; the run stops at the start if it is.patch_width_pixel: 8000assumes a stitched image of about 100 000 × 60 000 pixels: about 100 patches. See Patch size.
Run¶
nextflow run CosciaLab/histo -r v3.2.0 \
-profile singularity,size_medium,slurm \
-params-file params.ymlsize_medium covers stitched images of about 50 to 200 GB; this one is about 72 GB at 16 bit.
See Profiles.
What runs: BaSiCPy per cycle, Ashlar, backsub, then the SpatialData store, tiled segmentation with Cellpose, quantification and the QC report.
What you get¶
results/
├── preprocessing/
│ ├── illumination/ wsi01_cycle1-dfp.ome.tif, -ffp.ome.tif; per cycle
│ ├── registration/ wsi01.ome.tif, wsi01_ashlar_qc/
│ └── background_subtraction/ wsi01_backsub.ome.tif, wsi01_backsub.csv
├── wsi01.zarr/
│ ├── images/ wsi01_backsub, the subtracted image
│ ├── shapes/ image_patches, cellpose_cells
│ └── tables/ cellpose_table
├── qc/ wsi01_cellpose_qc_report.html, wsi01_cellpose_qc.json,
│ wsi01_cellpose_qc_images/
└── pipeline_info/Every file: Outputs.
What to check¶
preprocessing/background_subtraction/wsi01_backsub.csv: the marker sheet everything after subtraction reads. The background channels are gone andchannel_numberis renumbered.“Zero pixels per channel” in the QC report, before and after subtraction. Many zero pixels after means real signal was subtracted away.
wsi01.ome.tifbesidewsi01_backsub.ome.tifin a viewer; see Viewers.“Segmentation overlay” and “Cells per patch”; see Common failures.