Skip to content
Merged

Fixes #195

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f80b261
Register cellposev4 in benchmark run scripts
dariarom94 Jul 19, 2026
1a2fa09
fix anndata version mismatch with txsim
dariarom94 Jul 19, 2026
82add80
add segger to workflow (test)
dariarom94 Jul 19, 2026
53e1728
duplicates when FOV stiching cleaned up
dariarom94 Jul 19, 2026
1186b7a
chunks issue atera
dariarom94 Jul 20, 2026
18644d7
segger update image
dariarom94 Jul 20, 2026
ecb302d
claude fix for segger
dariarom94 Jul 20, 2026
7d66898
Merge branch 'main' into fixes
dariarom94 Jul 20, 2026
d400ebe
atera version fix
dariarom94 Jul 20, 2026
64d7b4e
wf for the custom rnaseq scripts
dariarom94 Jul 20, 2026
3edfbf1
adjust the loader image name
dariarom94 Jul 20, 2026
cbd2f12
adjust the memory
dariarom94 Jul 20, 2026
184260e
troubleshootig edges
dariarom94 Jul 20, 2026
9fa9a33
Merge branch 'main' into fixes
dariarom94 Jul 20, 2026
36631c4
segger update
dariarom94 Jul 21, 2026
0626127
cell type label correction
dariarom94 Jul 21, 2026
3186435
fix boundaries
dariarom94 Jul 21, 2026
d8a7d93
Merge branch 'main' into fixes
dariarom94 Jul 21, 2026
3505718
OOM fixes
dariarom94 Jul 21, 2026
d6e110a
fix code
dariarom94 Jul 21, 2026
4660f26
RCTD
dariarom94 Jul 21, 2026
5abd651
segger to RAPIDS
dariarom94 Jul 21, 2026
fe2e90a
Merge branch 'main' into fixes
dariarom94 Jul 21, 2026
0b23474
fix rctd
dariarom94 Jul 22, 2026
196ff1f
segger debug (torchvision)
dariarom94 Jul 22, 2026
4be7bd4
Merge branch 'main' into fixes
dariarom94 Jul 22, 2026
b8d3d7b
save the xenium version
dariarom94 Jul 22, 2026
202ac49
add atera to datasets
dariarom94 Jul 22, 2026
14be8d0
Add gene efficiency correction as a separate pipeline stage (#183)
dariarom94 Jul 22, 2026
0cf0243
moscot to pca and segger troubleshooting
dariarom94 Jul 22, 2026
d7afb84
added fastreseg
dariarom94 Jul 23, 2026
f87a1d9
segger bug new fix
dariarom94 Jul 23, 2026
123e112
fastreseg to workflow
dariarom94 Jul 23, 2026
7549589
add fastreseg test
dariarom94 Jul 23, 2026
9fa9604
Merge branch 'main' into fixes
dariarom94 Jul 23, 2026
ff04467
optimized fastreseg build
dariarom94 Jul 23, 2026
7ffc514
Merge branch 'main' into fixes
dariarom94 Jul 23, 2026
a7404d8
add s3 paths
dariarom94 Jul 23, 2026
19e5f83
troubleshoot comseg/segger
dariarom94 Jul 24, 2026
aaca151
segger update
dariarom94 Jul 25, 2026
c9bdb91
data loader bug
dariarom94 Jul 25, 2026
1df9834
Merge branch 'main' into fixes
dariarom94 Jul 25, 2026
4467d32
rctd adjustment (raw counts)
dariarom94 Jul 26, 2026
58912e4
fix segger and comseg
dariarom94 Jul 26, 2026
0a5aa99
optimize cosmx
dariarom94 Jul 26, 2026
298e666
Merge branch 'main' into fixes
dariarom94 Jul 26, 2026
c921937
parameter test for cellpose4
dariarom94 Jul 26, 2026
57c2d79
add atera
dariarom94 Jul 26, 2026
cf67e09
add a test in pciseq and dynamic memory for bruker
dariarom94 Jul 27, 2026
9f71692
add test to vizgen data
dariarom94 Jul 28, 2026
d795f33
Merge branch 'main' into fixes
dariarom94 Jul 28, 2026
fefaadc
param sweep
dariarom94 Jul 28, 2026
4dc08d3
add params to segmentation
dariarom94 Jul 28, 2026
e9505f1
adjust segger mem
dariarom94 Jul 29, 2026
3a155be
update fastreseg to tacco
dariarom94 Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ cd "$REPO_ROOT"

set -e

publish_dir="s3://openproblems-data/resources/datasets"
# store the loader output locally, mirroring the process_datasets layout ($id/)
# under the sibling raw/ folder (same as the other *_nebius.sh spatial scripts)
publish_dir="/scratch/task_ist_preprocessing/raw"

cat > /tmp/params.yaml << HERE
param_list:
Expand Down
39 changes: 39 additions & 0 deletions scripts/run_benchmark/param_sweep/binning_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Parameter sweep for the binning segmentation method (the "poor segmentation"
# baseline: a fixed square grid of pseudo-cells, no image content used).
#
# Shared source of truth for both run_test_binning_local.sh (read as a local file)
# and run_test_binning_nebius.sh (read from GitHub via a raw URL, since the Nebius
# compute env pulls the repo but cannot see the launch host's local files).
#
# Consumed by the run_benchmark workflow via the `method_parameters_yaml` setting
# (src/workflows/run_benchmark/main.nf). For every method the workflow builds:
# * one "default" variant using the `default:` args below, and
# * one extra variant per value in each `sweep:` list, with that ONE arg overridden.
# The benchmark varies a SINGLE parameter at a time (a "star" around the default, not
# a full grid), so total binning variants = 1 default + sum(sweep list lengths) = 6.
#
# See src/methods_segmentation/binning/NOTES.md ("Optimization / tuning") for the
# rationale. The ONLY knob is the bin edge length. We sweep it in MICRONS
# (--bin_size_um), the physically meaningful unit, rather than raw pixels: the
# component converts um -> pixels from the image's coordinate transform. On this
# benchmark's standardized raw_ist grid (~1 um/pixel, target_unit_to_pixels=1) the
# two coincide, so a value in um is ~ the same value in px.
#
# NOTE: --bin_size_um is a NEWLY EXPOSED argument. It needs `viash ns build` +
# a binning container rebuild before it takes effect (see check-component). Until
# then, swap `bin_size_um` for the pre-existing `bin_size` (pixels) below.
parameters:
binning:
# Baseline == the shipped 30 px default, expressed in microns (~30 um on the
# 1 um/px grid): bins ~2-3 cell diameters across -> coarse pseudo-cells.
default:
bin_size_um: 30.0
sweep:
# bin_size_um: bin edge length in microns. Grounded in the ~1 um/px grid and
# brain/Xenium cell scale (nuclei ~5-8 um, whole cells ~10-15 um):
# 10 -> sub-cell / nucleus scale, many bins per cell (over-segmentation)
# 15 -> ~one whole cell per bin (best case for a fixed grid)
# 20 -> slightly coarse
# (30 = default, omitted here to avoid a duplicate variant)
# 40, 50 -> several cells per bin (strong under-segmentation)
bin_size_um: [10.0, 15.0, 20.0, 40.0, 50.0]
67 changes: 67 additions & 0 deletions scripts/run_benchmark/param_sweep/cellpose_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Parameter sweep for the cellpose (Cellpose v3, cyto/nuclei CNN) segmentation method.
# Shared source of truth for both run_test_cellpose_local.sh (read as a local file)
# and run_test_cellpose_nebius.sh (read from GitHub via a raw URL, since the Nebius
# compute env pulls the repo but cannot see the launch host's local files).
#
# Consumed by the run_benchmark workflow via the `method_parameters_yaml` setting
# (src/workflows/run_benchmark/main.nf). For every method the workflow builds:
# * one "default" variant using the `default:` args below, and
# * one extra variant per value in each `sweep:` list, with that ONE arg overridden.
# The benchmark varies a SINGLE parameter at a time (a "star" around the default, not
# a full grid), so total cellpose variants = 1 default + sum(sweep list lengths) = 20.
#
# See src/methods_segmentation/cellpose/NOTES.md ("Optimization / tuning") for the
# rationale, tiers, and defaults. Unlike cellposev4, this component's shipped defaults
# already equal Cellpose's own library defaults (quality-oriented) EXCEPT model_type
# (cyto vs library cyto3), so this sweep explores model choice + object scale +
# recall/precision dials rather than "walking back" speed-tuned defaults.
#
# NOTE: as of txsim@dev the v3 path runs on CPU (the wrapper never passes gpu=), so
# these 20 variants x the full downstream pipeline are slow; niter: 50 probes the
# speed lever. Trim the lists if the budget is tight.
parameters:
cellpose:
# Baseline == the component's shipped defaults (== Cellpose library defaults,
# except model_type). Applied to every variant; the "default variant" is exactly
# this point, so none of these values are repeated in the sweep lists below.
default:
model_type: cyto
diameter: 30.0
flow_threshold: 0.4
cellprob_threshold: 0.0
min_size: 15
resample: true
normalize: true
niter: 0
sweep:
# ---- Tier 1: highest impact on segmentation quality ----
# model_type: the most distinctive v3 knob (v4 has no model choice). On a single
# grayscale morphology plane the model matters: nuclei for a nuclear stain, cyto2
# (Cellpose 2.0) and cyto3 (Cellpose3 generalist) as improved generalists over
# the 2021 cyto default. All four are pre-cached in the image (config docker.run).
model_type: [nuclei, cyto2, cyto3]
# diameter: cellpose rescales so objects land near diam_mean (~30 px cyto).
# Xenium morphology (~0.2125 um/px) => nuclei ~38 px, whole cells ~60-70 px.
# 0.0 = auto-estimate via the SizeModel (slower). 30.0 = default (omitted).
diameter: [0.0, 40.0, 60.0]
# cellprob_threshold: recall<->precision dial (per-pixel logit ~ -6..+6, def 0),
# no speed cost. Lower -> recover more/dimmer cells; higher -> drop dim detections.
cellprob_threshold: [-2.0, -1.0, 1.0, 2.0]
# flow_threshold: flow-error QC (def 0.4). 0.2 = stricter shape filter;
# 0.6/0.8 = more permissive (keep cells with higher flow error -> more cells).
flow_threshold: [0.2, 0.6, 0.8]
# ---- Tier 2: quality/speed trade-offs ----
# min_size: def 15. 0 keeps small specks (recall on tiny cells); 50 drops debris.
min_size: [0, 50]
# resample: BOOLEAN, default true (the quality setting). Only non-default value
# is false -> dynamics on the downsampled grid (faster, coarser boundaries).
resample: [false]
# augment: BOOLEAN, default false. Only non-default is true -> test-time
# augmentation (accuracy ceiling at ~4-8x cost).
augment: [true]
# normalize: BOOLEAN, default true. Only non-default is false -> no percentile
# normalization (probes intensity sensitivity; usually worse for iST).
normalize: [false]
# niter: def 0 = auto (~200 at resample). 50 = fewer dynamics iterations ->
# faster (meaningful because the v3 path is CPU-bound).
niter: [50]
88 changes: 88 additions & 0 deletions scripts/run_benchmark/param_sweep/run_test_binning_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

# Test run: all default methods + binning segmentation, with a parameter sweep
# over the one binning knob (bin edge length, in microns).
# See src/methods_segmentation/binning/NOTES.md ("Optimization / tuning").
#
# NOTE: binning is a light CPU-only method (a numpy grid, no model, no image
# content used), so it runs comfortably on any Docker host. It is the deliberately
# "poor" segmentation baseline.
#
# NOTE: the sweep uses --bin_size_um, a NEWLY EXPOSED argument. Run
# 'viash ns build --setup cachedbuild' (or scripts/project/build_all_docker_containers.sh)
# so the regenerated binning container knows the arg before launching.

# get the root of the directory
REPO_ROOT=$(git rev-parse --show-toplevel)

# ensure that the command below is run from the root of the repository
cd "$REPO_ROOT"

set -e

echo "Running benchmark on test data (defaults + binning sweep)"
echo " Make sure to run 'scripts/project/build_all_docker_containers.sh'!"

# generate a unique id
RUN_ID="testrun_binning_$(date +%Y-%m-%d_%H-%M-%S)"
publish_dir="temp/results/${RUN_ID}"

cat > /tmp/params_settings.yaml << HERE
default_methods:
- custom_segmentation
- basic_transcript_assignment
- basic_count_aggregation
- basic_qc_filter
- alpha_shapes
- normalize_by_volume
- tacco
- no_correction
segmentation_methods:
- custom_segmentation
- binning
# - cellpose
# - cellposev4
# - stardist
# - watershed
transcript_assignment_methods:
- basic_transcript_assignment
count_aggregation_methods:
- basic_count_aggregation
qc_filtering_methods:
- basic_qc_filter
volume_calculation_methods:
- alpha_shapes
normalization_methods:
- normalize_by_volume
celltype_annotation_methods:
- ssam
expression_correction_methods:
- no_correction
gene_efficiency_correction_methods:
- no_correction
method_parameters_yaml: $REPO_ROOT/scripts/run_benchmark/binning_params.yaml
HERE

# Write the parameters to file (input_states version, NOTE: enable `-entry auto` for this)
cat > /tmp/params.yaml << HERE
input_states: resources_test/task_ist_preprocessing/**/state.yaml
rename_keys: 'input_sc:output_sc;input_sp:output_sp'
save_spatial_data: false
settings: '$(yq -o json /tmp/params_settings.yaml | jq -c .)'
output_state: "state.yaml"
publish_dir: "$publish_dir"
HERE

# The binning parameter sweep lives in a committed file (single source of truth,
# shared with run_test_binning_nebius.sh): scripts/run_benchmark/binning_params.yaml
# It defines a `default:` variant + one-arg-at-a-time `sweep:` variants (a "star"
# around the default, not a grid) => 6 binning variants. Edit that file to change
# the sweep. Referenced via $REPO_ROOT above so local Nextflow reads it directly.

nextflow run . \
-main-script target/nextflow/workflows/run_benchmark/main.nf \
-profile docker \
-resume \
-entry auto \
-c common/nextflow_helpers/labels_ci.config \
-params-file /tmp/params.yaml
109 changes: 109 additions & 0 deletions scripts/run_benchmark/param_sweep/run_test_binning_nebius.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/bin/bash

# Nebius test run: all default methods + binning segmentation, with a parameter
# sweep over the one binning knob (bin edge length, in microns).
# See src/methods_segmentation/binning/NOTES.md ("Optimization / tuning").
# Local sibling: run_test_binning_local.sh
#
# binning is a light CPU-only method (a numpy grid, no model), so it runs on the
# standard (non-GPU) compute env with no `gpu` label.
#
# NOTE: the sweep uses --bin_size_um, a NEWLY EXPOSED argument. The image on
# ghcr must be rebuilt (viash ns build + container rebuild, revision build/main)
# so the binning container knows the arg before launching (see check-component).
#
# PARAMS-FILE CAVEAT (why this differs from the local script):
# `tw launch --params-file` is read client-side, but `method_parameters_yaml`
# is a path the WORKFLOW opens at runtime on the cloud (readYaml -> Nextflow
# file()). A local /tmp path does not exist there, and /scratch (where results
# publish) is READ-ONLY from the launch host — which is why the binning
# method_params block is commented out in run_test_nebius.sh. file() does stage
# http(s):// though, and this repo is public, so we keep the sweep in a COMMITTED
# file (scripts/run_benchmark/binning_params.yaml) and read it from GitHub via
# its raw URL. => the params file must be committed AND PUSHED to $params_branch
# before launching (edit the file there, not here, to change the sweep).

# get the root of the directory
REPO_ROOT=$(git rev-parse --show-toplevel)

# ensure that the command below is run from the root of the repository
cd "$REPO_ROOT"

set -e

resources_test_s3=s3://openproblems-data/resources_test/task_ist_preprocessing
# Results publish to /scratch — created and written by the cloud compute env, so
# the launcher does NOT create it here (it is read-only from the launch host).
publish_dir="/scratch/results/runs/$(date +%Y-%m-%d_%H-%M-%S)_binning"

# The sweep lives in a committed file, read from GitHub at runtime. $params_branch
# defaults to the branch you are on; the file must be pushed there on GitHub. (This
# is independent of --revision below, which selects the pipeline CODE to run.)
params_repo="openproblems-bio/task_ist_preprocessing"
params_branch="$(git rev-parse --abbrev-ref HEAD)"
params_url="https://raw.githubusercontent.com/${params_repo}/${params_branch}/scripts/run_benchmark/param_sweep/binning_params.yaml"

cat > /tmp/params_settings.yaml << HERE
default_methods:
- custom_segmentation
- basic_transcript_assignment
- basic_count_aggregation
- basic_qc_filter
- alpha_shapes
- normalize_by_volume
- tacco
- no_correction
segmentation_methods:
- custom_segmentation
- binning
# - cellpose
# - cellposev4
# - stardist
# - watershed
transcript_assignment_methods:
- basic_transcript_assignment
count_aggregation_methods:
- basic_count_aggregation
qc_filtering_methods:
- basic_qc_filter
volume_calculation_methods:
- alpha_shapes
normalization_methods:
- normalize_by_volume
celltype_annotation_methods:
- tacco
expression_correction_methods:
- no_correction
gene_efficiency_correction_methods:
- no_correction
method_parameters_yaml: $params_url
HERE

# Write the parameters to file (input_states version, NOTE: enable `-entry_name auto` for this)
cat > /tmp/params.yaml << HERE
input_states: $resources_test_s3/**/state.yaml
rename_keys: 'input_sc:output_sc;input_sp:output_sp'
save_spatial_data: false
settings: '$(yq -o json /tmp/params_settings.yaml | jq -c .)'
output_state: "state.yaml"
publish_dir: "$publish_dir"
HERE

# Fail early with a clear message if the params file isn't reachable on GitHub yet.
if ! curl -fsSL -o /dev/null "$params_url"; then
echo "ERROR: params file not reachable at:" >&2
echo " $params_url" >&2
echo "Commit and push scripts/run_benchmark/binning_params.yaml to '$params_branch' first." >&2
exit 1
fi

tw launch https://github.com/openproblems-bio/task_ist_preprocessing.git \
--revision build/main \
--pull-latest \
--main-script target/nextflow/workflows/run_benchmark/main.nf \
--workspace 167877437119966 \
--compute-env 5hfmdCBxMRd4nHZaJKYEQZ \
--params-file /tmp/params.yaml \
--entry-name auto \
--config src/base/labels_nebius.config \
--labels task_ist_preprocessing,test,binning
Loading
Loading