The merxen CLI is a Click command group registered by pyproject.toml
(line 44) and defined at
src/merxen/cli/init.py. Each subcommand
corresponds to exactly one Nextflow process, takes a single --config <path>.json argument, and validates it against the matching Pydantic model
in src/merxen/config.py.
$ merxen --help
Usage: merxen [OPTIONS] COMMAND [ARGS]...
MerXen spatial transcriptomics pipeline CLI.
Commands:
build-spatialdata Build a platform-specific SpatialData zarr from raw input
segment Run Cellpose + ProSeg segmentation for one dataset
enrich Enrich a segmented zarr with per-shape tables
qc Compute geometry and assignment QC metrics
align Align MERSCOPE into paired Xenium coordinates
alignment-qc Compute post-alignment QC metrics
compare Run cross-platform gene-level comparison
visualize Generate visualization artifacts for a pair
Logging is configured in the root main() group and streams to stderr at
INFO level.
Build or reuse a platform-specific SpatialData zarr.
merxen build-spatialdata --config build_config.json [--force-rerun]| Option | Description |
|---|---|
--config PATH |
JSON file validated against SpatialDataBuildConfig. |
--force-rerun |
Rebuild even if a cached zarr is available. |
Details: Stage 1 — SpatialData build.
Run Cellpose tiled segmentation, export transcripts, and run ProSeg.
merxen segment --config segment_config.json [--force-rerun]| Option | Description |
|---|---|
--config PATH |
JSON validated against SegmentationConfig. |
--force-rerun |
Ignore cached proseg_base_latest.zarr / proseg_base_raw.zarr in the output dir. |
Details: Stage 2 — Segmentation.
Enrich a segmented zarr with explicit shape layers and per-shape gene tables.
merxen enrich --config enrich_config.json [--force-rerun]| Option | Description |
|---|---|
--config PATH |
JSON validated against EnrichmentConfig. |
--force-rerun |
Overwrite existing shape layers and tables. |
Details: Stage 3 — Enrichment.
Compute per-cell geometry and transcript-assignment metrics.
merxen qc --config qc_config.json| Option | Description |
|---|---|
--config PATH |
JSON validated against QCConfig. |
Details: Stage 4 — QC.
Align a MERSCOPE section into paired Xenium coordinates.
merxen align --config align_config.json| Option | Description |
|---|---|
--config PATH |
JSON validated against AlignmentConfig. |
This command requires the optional alignment dependencies:
pip install spateo-release==1.1.1
pip install "anndata>=0.12.10"Details: Section alignment.
Compute SABench-style grid metrics and a centroid overlay for an aligned pair.
merxen alignment-qc --config alignment_qc_config.json| Option | Description |
|---|---|
--config PATH |
JSON validated against AlignmentQCConfig. |
Details: Section alignment.
Run cross-platform gene-level comparison (one pair at a time).
merxen compare --config compare_config.json| Option | Description |
|---|---|
--config PATH |
JSON validated against ComparisonConfig. |
Details: Stage 5 — Comparison.
Generate visualization artifacts for a paired dataset comparison.
merxen visualize --config visualize_config.json| Option | Description |
|---|---|
--config PATH |
JSON validated against VisualizationConfig. |
Details: Stage 6 — Visualization.
The Nextflow workflow writes these JSON configs for you, but you can also
hand-roll them to drive a single stage outside of Nextflow. Example for
merxen qc:
{
"dataset_name": "EXAMPLE01_MERSCOPE",
"latest_zarr_path": "/path/to/proseg_base_latest.zarr",
"output_dir": "./qc_out"
}Save as qc_config.json and run:
merxen qc --config qc_config.jsonThe Pydantic layer will complain loudly about anything missing or mis-typed.