Skip to content

feat(jump_rr): add compound_no_source7 dataset for production paper alignment #101

Description

@shntnu

Context

The JUMP production paper (jump-cellpainting/2024_Chandrasekaran_Production) uses compound profiles that exclude Source 7 (which made batch correction difficult). These profiles live in cpg0042 on S3, while jump_rr currently uses cpg0016 (all sources).

Per discussion in broadinstitute/jump_hub#91 (comment), we need to add compound_no_source7 as an additional dataset so jump_rr stays consistent with the production paper without breaking existing datasets.

What to add

A single new dataset compound_no_source7 pointing to:

https://cellpainting-gallery.s3.amazonaws.com/cpg0042-chandrasekaran-jump/source_all/workspace/profiles_assembled/compound_no_source7/v1.0/profiles_var_mad_int_featselect_harmony.parquet

SHA256: 8e1e5d9e50c8c7c95ed406981b02adb57c7ff9d253192ed52e661115379be6f1

This file is used for both matching (cosine similarity) and feature analysis — no separate _interpretable variant needed, because Harmony correction is per-feature (each corrected feature maps 1:1 to its original CellProfiler feature).

Feature name mapping

The harmony file has generic column names (X_1 through X_758). The CellProfiler names can be recovered positionally from the companion file:

https://cellpainting-gallery.s3.amazonaws.com/cpg0042-chandrasekaran-jump/source_all/workspace/profiles_assembled/compound_no_source7/v1.0/profiles_var_mad_int_featselect.parquet

Both files have exactly 758 features in the same order. Mapping: X_1Cells_AreaShape_Compactness, X_2Cells_AreaShape_Extent, etc. Only the parquet schema (column names) needs to be read — not the data (~2.7 GB).

Suggested implementation plan per Claude Opus (⚠️ unverified⚠️ )

Files to modify (all under libs/jump_rr/):

File Change
src/jump_rr/datasets.py Add COMPOUND_DATASETS constant, _LOCAL_URLS override dict, hash, get_babel_type() helper, early-return in get_profiles_url()
src/jump_rr/feature_mapping.py (new) get_harmony_feature_mapping() — schema-only read of featselect file, positional rename dict. rename_harmony_features(df) — applies the rename.
src/jump_rr/consensus.py get_range(): change dataset == "compound"dataset in COMPOUND_DATASETS
src/jump_rr/metadata.py write_metadata(): handle compound_no_source7 in prefix selection (line 94) and skip _interpretable suffix for source URL (lines 118-120)
src/jump_rr/calculate_matches.py Add ("compound_no_source7", 10) to loop. Change 3× dset != "compound"dset not in COMPOUND_DATASETS. Use get_babel_type(dset) for get_external_mappers().
src/jump_rr/calculate_features.py Add ("compound_no_source7", 10, 50) to loop. Rename features after loading. Use get_babel_type() for add_pert_type() and get_external_mappers().
src/jump_rr/galleries.py Add to loop. Change dset != "compound"dset not in COMPOUND_DATASETS. Use get_babel_type() for mappers.
tests/test_data_sources.py Add "compound_no_source7" to parametrize lists

Key design decisions:

  • COMPOUND_DATASETS = ("compound", "compound_no_source7") — single constant for all compound-type branching (GPU skip, mapper selection, image site range)
  • get_babel_type(dset) — maps dataset name to broad-babel plate_type (returns "compound" for both compound variants)
  • _LOCAL_URLS — bypass profile_index.json lookup for datasets not in the GitHub manifest
  • Feature rename uses pl.scan_parquet(url).collect_schema().names() (reads only parquet footer, not data)

No changes needed to: significance.py, replicability.py, parse_features.py, generate_databases.sh

Verification

  1. uv run pytest tests/ — existing tests pass + new URL test
  2. uv run ruff check src/ && uv run ruff format src/
  3. Smoke test: download dataset and verify feature rename produces CellProfiler names

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions