Skip to content

Latest commit

 

History

History
192 lines (130 loc) · 4.77 KB

File metadata and controls

192 lines (130 loc) · 4.77 KB

CLI reference

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.


merxen build-spatialdata

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.


merxen segment

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.


merxen enrich

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.


merxen qc

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.


merxen align

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.


merxen alignment-qc

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.


merxen compare

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.


merxen visualize

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.


Writing a standalone config

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.json

The Pydantic layer will complain loudly about anything missing or mis-typed.