Skip to content

Synthetic data example

Overview

This example analyzes simulated iterative RNA-FISH experiments generated by the StatPhysBio lab at ASU using merfish3d-analysis. You can also try the linked Google Colab notebook.

Preliminaries

You need a working uv environment, a CUDA-compatible NVIDIA GPU, and the simulation data. Allow space for the 2.3 GB archive, extracted data, and processing outputs.

git clone https://github.com/QI2lab/merfish3d-analysis
cd merfish3d-analysis
uv sync --group dev

mkdir -p simulation-data
curl -L \
  "https://zenodo.org/records/17274305/files/merfish3d_analysis-simulation.zip?download=1" \
  -o simulation-data/merfish3d_analysis-simulation.zip

echo "3c415493ca37bd19af14464badc45fae  simulation-data/merfish3d_analysis-simulation.zip" \
  | md5sum --check -
unzip simulation-data/merfish3d_analysis-simulation.zip -d simulation-data

The MERFISH simulations include cellular and uniform RNA distributions, each with axial spacings of 0.315, 1.0, and 1.5 µm:

simulation-data/merfish3d_analysis-simulation/
├── example_16bit_cells/
│   ├── 0.315/
│   ├── 1.0/
│   └── 1.5/
└── example_16bit_flat/
    ├── 0.315/
    ├── 1.0/
    └── 1.5/

Processing steps

First convert a simulation to the qi2lab acquisition format, then create a qi2lab datastore, preprocess, decode, and compare with ground truth. For example:

uv run sim-convert simulation-data/merfish3d_analysis-simulation/example_16bit_cells/0.315
uv run sim-datastore simulation-data/merfish3d_analysis-simulation/example_16bit_cells/0.315/sim_acquisition
uv run sim-preprocess simulation-data/merfish3d_analysis-simulation/example_16bit_cells/0.315/sim_acquisition
uv run sim-decode simulation-data/merfish3d_analysis-simulation/example_16bit_cells/0.315/sim_acquisition
uv run sim-f1score simulation-data/merfish3d_analysis-simulation/example_16bit_cells/0.315

Simulation tests

The GPU integration tests run the processing workflow against the Zenodo ground truth. To start with one case:

uv run pytest tests/test_simulation_example_pipeline.py -vv \
  -k 'test_simulation_standard_matrix and uniform and 0.315 and no-chromatic' \
  --simulation-data-root simulation-data/merfish3d_analysis-simulation

Run all standard simulation cases with:

uv run pytest tests/test_simulation_example_pipeline.py -vv \
  --simulation-data-root simulation-data/merfish3d_analysis-simulation

The standard matrix compares affine-only and SOFIMA registration across both RNA distributions and all axial spacings, with and without synthetic chromatic aberration. Each F1 score must be within 0.02 of its reference value or higher. The reference scores for the standard matrix are:

Dataset Axial spacing (µm) No chromatic aberration Chromatic aberration
Cells 0.315 0.9848 0.9823
Cells 1.0 0.9623 0.9483
Cells 1.5 0.3867 0.3352
Uniform 0.315 0.9899 0.9891
Uniform 1.0 0.9669 0.9641
Uniform 1.5 0.6090 0.5370

To include the longer deconvolution matrix, add --run-simulation-exhaustive. For the full local suite:

uv run pytest -vv --run-simulation-exhaustive \
  --simulation-data-root simulation-data/merfish3d_analysis-simulation

The default U-FISH simfish weights are downloaded when needed. The exhaustive run writes performance records to tests/data/simulation_performance.json; set MERFISH3D_PERFORMANCE_REPORT to use another path.