Skip to content

fix(multiplex-quant): auto-download chemistry registry on first use#196

Merged
rob-p merged 1 commit into
COMBINE-lab:mainfrom
an-altosian:fix/multiplex-quant-chemistry-auto-download
May 20, 2026
Merged

fix(multiplex-quant): auto-download chemistry registry on first use#196
rob-p merged 1 commit into
COMBINE-lab:mainfrom
an-altosian:fix/multiplex-quant-chemistry-auto-download

Conversation

@an-altosian
Copy link
Copy Markdown
Contributor

Summary

simpleaf multiplex-quant --chemistry <preset> currently fails with:

Error: Chemistry registry not found at <af_home>/chemistries.json.
Run `simpleaf chemistry refresh` first.

on the first run after a fresh install (or any time $ALEVIN_FRY_HOME/chemistries.json doesn't exist yet).

simpleaf quant doesn't have this requirement — its chemistry-resolution path (Chemistry::from_strget_single_custom_chem_from_fileparse_resource_json_file) auto-downloads chemistries.json from CHEMISTRIES_URL on first miss.

This PR replaces the explicit bail in multiplex_map_and_quant with the same prog_utils::download_to_file call that parse_resource_json_file itself uses, so the first-use UX of multiplex-quant matches quant.

Diff

5 lines changed, 1 file. No new abstractions, no behavior change beyond the first-use auto-download.

Test plan

  • Built with cargo build --release
  • With a fresh $ALEVIN_FRY_HOME (no chemistries.json), simpleaf multiplex-quant --chemistry 10x-flexv2-gex-3p ... now resolves the chemistry preset and proceeds (stops at the next downstream error, --organism is required, as expected). The registry file is downloaded into $ALEVIN_FRY_HOME/chemistries.json (7,463 bytes) during the call.
  • Subsequent runs reuse the existing file (no re-download — chem_path.exists() short-circuits).
  • The bail! for the file-missing case is removed but is replaced by download_to_file's own error path, which surfaces clear network errors if the URL is unreachable.

Related

Surfaced while debugging #195. Independent of that issue's collate-side fix.

Previously, the first invocation of `simpleaf multiplex-quant --chemistry
<preset>` would bail with "Chemistry registry not found at <path>. Run
`simpleaf chemistry refresh` first." when `chemistries.json` did not already
exist under `$ALEVIN_FRY_HOME`.

`simpleaf quant` does not have this requirement — it resolves chemistry via
`get_single_custom_chem_from_file` → `parse_resource_json_file`, which
transparently downloads the registry from `CHEMISTRIES_URL` on first miss.

Replace the explicit bail in `multiplex_map_and_quant` with the same
`prog_utils::download_to_file(CHEMISTRIES_URL, &chem_path)` call that
`parse_resource_json_file` itself uses, so multiplex-quant's first-use UX
matches `quant`'s.
rob-p pushed a commit that referenced this pull request May 20, 2026
download_to_file previously handled a non-success HTTP response (404,
403, rate-limit, 5xx) by emitting only a warning and returning Ok(())
without creating the destination file. Callers that open the file
immediately afterward then fail with a cryptic "No such file or
directory" instead of a clear download failure.

This was newly exposed by #196: multiplex-quant now downloads the
chemistry registry on first use, so a transient GitHub failure would
surface as a confusing missing-file error rather than the actionable
message that path used to print. Turning a non-success status into a
hard error fixes that and benefits all eight download_to_file callers
(chemistry registry, probe-set CSVs, plist files, protocol-estuary).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rob-p rob-p merged commit 8923a61 into COMBINE-lab:main May 20, 2026
7 checks passed
an-altosian added a commit to an-altosian/modules that referenced this pull request May 20, 2026
simpleaf 0.25.0 (Wave: community.wave.seqera.io/library/simpleaf:0.25.0--b9f96d8b71a01864)
bundles alevin-fry 0.15.0 with two upstream fixes that surfaced during the
multiplex-quant work:

- alevin-fry: per-record sample index now maps correctly to manifest ordinal
  in multi-barcode collation (fixes COMBINE-lab/simpleaf#195 — sample_name
  column omission and resulting polars i64 inference crash).
- simpleaf: multiplex-quant auto-downloads chemistries.json on first use
  (fixes COMBINE-lab/simpleaf#196 — no more "Run `simpleaf chemistry refresh`
  first" error).

Neither fix changes behavior for the index/quant code paths these modules
exercise, but bumping keeps all simpleaf modules on a single, current
container generation.
delfiterradas pushed a commit to grst/modules that referenced this pull request May 20, 2026
…hannel versions (nf-core#11696)

* Update simpleaf to 0.24.1 with Seqera Wave container and topic-channel versions

- Bump simpleaf 0.19.5 -> 0.24.1 (Wave container community.wave.seqera.io/library/simpleaf:0.24.1--41e05fd46d838d92).
- Align environment.yml pins with the container: alevin-fry 0.14.0, piscem 0.20.0, simpleaf 0.24.1. Removed salmon (no longer a simpleaf dependency in 0.24.x).
- Migrate versions output from versions.yml emit to topic-channel emits per the new nf-core convention (matches t1k/build pattern). Each tool emits (process, tool, version) into the shared `versions` topic.
- Update piscem index file assertions in tests: piscem 0.20 replaced .sshash/.json with .ssi/.ssi.mphf/_ver.json. Stub blocks updated to match.
- Inline `ALEVIN_FRY_HOME=.` in the simpleaf eval expression because the eval runs in a separate shell context from the script block.
- meta.yml regenerated by `nf-core modules lint --fix`, removed leftover versions.yml stanza.

All nf-tests pass (5/5 simpleaf/index, 2/2 simpleaf/quant). nf-core modules lint shows 0 failures.

* Bump simpleaf to 0.25.0 in index + quant modules

simpleaf 0.25.0 (Wave: community.wave.seqera.io/library/simpleaf:0.25.0--b9f96d8b71a01864)
bundles alevin-fry 0.15.0 with two upstream fixes that surfaced during the
multiplex-quant work:

- alevin-fry: per-record sample index now maps correctly to manifest ordinal
  in multi-barcode collation (fixes COMBINE-lab/simpleaf#195 — sample_name
  column omission and resulting polars i64 inference crash).
- simpleaf: multiplex-quant auto-downloads chemistries.json on first use
  (fixes COMBINE-lab/simpleaf#196 — no more "Run `simpleaf chemistry refresh`
  first" error).

Neither fix changes behavior for the index/quant code paths these modules
exercise, but bumping keeps all simpleaf modules on a single, current
container generation.
manascripts pushed a commit to manascripts/modules that referenced this pull request May 21, 2026
…hannel versions (nf-core#11696)

* Update simpleaf to 0.24.1 with Seqera Wave container and topic-channel versions

- Bump simpleaf 0.19.5 -> 0.24.1 (Wave container community.wave.seqera.io/library/simpleaf:0.24.1--41e05fd46d838d92).
- Align environment.yml pins with the container: alevin-fry 0.14.0, piscem 0.20.0, simpleaf 0.24.1. Removed salmon (no longer a simpleaf dependency in 0.24.x).
- Migrate versions output from versions.yml emit to topic-channel emits per the new nf-core convention (matches t1k/build pattern). Each tool emits (process, tool, version) into the shared `versions` topic.
- Update piscem index file assertions in tests: piscem 0.20 replaced .sshash/.json with .ssi/.ssi.mphf/_ver.json. Stub blocks updated to match.
- Inline `ALEVIN_FRY_HOME=.` in the simpleaf eval expression because the eval runs in a separate shell context from the script block.
- meta.yml regenerated by `nf-core modules lint --fix`, removed leftover versions.yml stanza.

All nf-tests pass (5/5 simpleaf/index, 2/2 simpleaf/quant). nf-core modules lint shows 0 failures.

* Bump simpleaf to 0.25.0 in index + quant modules

simpleaf 0.25.0 (Wave: community.wave.seqera.io/library/simpleaf:0.25.0--b9f96d8b71a01864)
bundles alevin-fry 0.15.0 with two upstream fixes that surfaced during the
multiplex-quant work:

- alevin-fry: per-record sample index now maps correctly to manifest ordinal
  in multi-barcode collation (fixes COMBINE-lab/simpleaf#195 — sample_name
  column omission and resulting polars i64 inference crash).
- simpleaf: multiplex-quant auto-downloads chemistries.json on first use
  (fixes COMBINE-lab/simpleaf#196 — no more "Run `simpleaf chemistry refresh`
  first" error).

Neither fix changes behavior for the index/quant code paths these modules
exercise, but bumping keeps all simpleaf modules on a single, current
container generation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants