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.

Samplesheet Dependencies & Channel Naming

This document outlines the critical dependencies between the input samplesheet, the Nextflow pipeline logic, and the Python scripts that generate load_data.csv files for CellProfiler. Correctly formatting your samplesheet and naming your files is essential for the pipeline to function correctly.

Samplesheet Requirements

The samplesheet is the single source of truth for experimental metadata. The pipeline expects specific columns to be present.

Required Columns

ColumnDescriptionCritical Dependency
batchBatch identifier (e.g., Batch1)Used for grouping images for illumination calculation.
platePlate identifier (e.g., Plate1)CRITICAL: Must match the plate name used in filenames for the Combined Analysis step.
wellWell identifier (e.g., A01)CRITICAL: Used to map images to metadata.
siteSite/Field number (e.g., 1)CRITICAL: Used to map images to metadata.
channelsComma-separated list of channelsCRITICAL: Used as column headers in load_data.csv. Must match the channel names parsed from filenames (see below).
armpainting or barcodingDetermines which subworkflow processes the image.
cycleImaging round number (both arms)CRITICAL for barcoding: drives cycle grouping and Cycle{NN}_ column naming. For painting/phenotyping: the real per-round imaging cycle (use 1 for single-round data) - used only for stitching/cross-round alignment, never for illumination-correction column naming, since phenotyping rounds already use distinct channel names (e.g. DNA vs DNA2).

Metadata Flow

  1. Ingestion: The samplesheet is read by main.nf.

  2. Channel Creation: Nextflow creates channels carrying [meta, image] tuples. meta contains all the columns above.

  3. Metadata JSON construction (Groovy): Each CellProfiler module’s Nextflow subworkflow builds a canonical metadata JSON object (one entry per image/channel, see Python Scripts) and passes it to generate_load_data_csv.py via --metadata-json. generate_load_data_csv.py itself does no filename parsing - every field (well, site, channel, cycle, column_prefix, etc.) is stated explicitly in that JSON.

    • Illumination Calculation/Application: channel comes directly from the samplesheet’s channels column for both arms (via expandImageChannels in Groovy). cycle is carried through for barcoding, but explicitly nulled out for painting (expandImageChannels(..., record_cycle: false)) - phenotyping rounds use distinct channel names instead of Cycle{NN}_-prefixed columns, so real per-round cycle values never reach these CSVs.

    • Segmentation Check, Preprocessing & Combined Analysis: these steps consume images generated by an earlier pipeline stage, so their Groovy code derives channel/cycle by parsing the standardized filenames those earlier stages produced (see regexes below) before building the metadata JSON entry.


Channel Naming Constraints

The Nextflow workflow code (not the Python script - see above) uses regular expressions to parse filenames and extract Channel and Cycle information when building the metadata JSON for segcheck, preprocess, and combined analysis. This is where most user errors occur.

Cell Painting Arm

Input Images (Raw)

Corrected Images (Intermediate)

Barcoding Arm

Input Images (Raw)

Preprocessing & Alignment


Combined Analysis Dependencies

The Combined Analysis step merges data from both arms. This is the most fragile step regarding naming.

The “Plate Name” Trap

The Python script groups files by (Plate, Well, Site).

The Constraint: The input files for combined analysis are generated by previous steps (IllumApply). These files are named using the metadata from those previous steps.

Channel Matching

Before invoking generate_load_data_csv.py, the combined-analysis Groovy code (workflows/{nf-pooled-cellpainting,no-stitch,stitch-align-crop}.nf) uses regex to identify if a file is “Cell Painting” or “Barcoding” based on its filename pattern, so it can set the right arm/column_prefix/channel/cycle in the metadata JSON entry:

  1. Barcoding Pattern: Looks for Cycle(\d+).

    • Matches: ..._Cycle01_A.tiff

  2. Cell Painting Pattern: Looks for Corr(.+).

    • Matches: ..._CorrDNA.tiff

Impact: If you name a Cell Painting channel Cycle1 (e.g., CorrCycle1.tiff), the script might mistakenly try to parse it as a barcoding image because of the Cycle keyword.


Summary Checklist

Before running the pipeline: