Skip to content

feat(nmr-cli): add nmr-correlation as a new command - #140

Merged
vcnainala merged 6 commits into
NFDI4Chem:developmentfrom
MuhammadAbeerAkmal:nmr-correlation-command
Sep 21, 2026
Merged

vcnainala merged 6 commits into
NFDI4Chem:developmentfrom
MuhammadAbeerAkmal:nmr-correlation-command

Conversation

@MuhammadAbeerAkmal

@MuhammadAbeerAkmal MuhammadAbeerAkmal commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Problem:
No CLI command currently exposes nmr-correlation's functionality, requested in #66, build correlation data from NMR spectra given a spectra ZIP URL and molecular formula.

What changed:

  • New correlation command in nmr-cli, following the same pattern as peaks-to-nmrium: fetches spectra from a URL, processes them, and calls nmr-correlation's buildCorrelationData(...).
  • Default tolerances (H: 0.02, C: 0.25) confirmed by @vcnainala
  • Reused/extended the existing spectra-fetching logic in prase-spectra.ts (extracted a shared buildWebSource helper to avoid duplicating URL-parsing logic) instead of rewriting it.
  • Guards against invalid CLI input (NaN tolerance overrides fall back to defaults instead of corrupting results), surfaces internal processing logs in the output, and filters out any spectrum that fails to parse instead of passing it through to buildCorrelationData unchecked.

Known limitation:
While testing, I found a pre-existing, unrelated bug #139 that currently makes every spectrum fail a step of the shared processing pipeline, meaning real cross-spectrum correlation links couldn't be verified end-to-end with public test data. The formula-only fallback path (when no spectra process successfully) is fully verified and correct; the "compares/links real signals" path is implemented per nmr-correlation's documented API but untested pending a fix for #139.

@hamed-musallam

Copy link
Copy Markdown
Collaborator

I will review this PR as soon as I can. Thanks

Comment thread app/scripts/nmr-cli/src/parse/prase-spectra.ts
Comment thread app/scripts/nmr-cli/src/correlation.ts Outdated
Comment thread app/scripts/nmr-cli/src/index.ts Outdated
Comment thread app/scripts/nmr-cli/src/correlation.ts Outdated
Comment thread app/scripts/nmr-cli/src/correlation.ts Outdated
Comment thread app/scripts/nmr-cli/src/correlation.ts Outdated
Comment thread app/scripts/nmr-cli/src/correlation.ts Outdated
@hamed-musallam
hamed-musallam self-requested a review September 10, 2026 07:53
@hamed-musallam hamed-musallam changed the title feat: expose nmr-correlation package as a new nmr-cli command feat(nmr-cli): add nmr-correlation as a new command Sep 10, 2026
@hamed-musallam

Copy link
Copy Markdown
Collaborator

All the comments have been addressed by @MuhammadAbeerAkmal . Could you please review and approve it, @vcnainala? Thank you!

@hamed-musallam hamed-musallam linked an issue Sep 10, 2026 that may be closed by this pull request
@vcnainala
vcnainala merged commit 63d1e48 into NFDI4Chem:development Sep 21, 2026
1 check passed
NishaSharma14 added a commit that referenced this pull request Sep 29, 2026
* feat: add include/exclude file filters to parse-spectra (#138)

* feat(nmr-cli): update NMRium core packages to v2.6.0

* chore(nmr-cli): update dependencies

* feat(nmr-cli): add include/exclude file filters to parse-spectra

* feat(API): add include/exclude file filters to spectra parse endpoints

* feat(nmr-cli): update NMRium core packages to v2.7.0

* refactor: parallelize parse spectra pipeline across concurrent worker/browser lanes (#141)

Replace the single-threaded, one-browser-per-spectrum flow with a fixed
number of concurrent lanes, each owning a persistent worker thread (CPU
processing/detection) and, when snapshots are enabled, a persistent
browser page:

- run-pipeline.ts / run-concurrency.ts: drive parse -> process -> detect
  -> snapshot across N lanes instead of one spectrum at a time.
- spectrum-worker.ts / worker-entry.ts: offload processing, detection,
  and serialization to worker threads so CPU work no longer blocks the
  main thread.
- browser-manager.ts: reuse one browser/context per lane across every
  spectrum it handles, instead of relaunching per spectrum.
- prase-spectra.ts: delegate to the new pipeline; stream output via
  outputResult instead of buffering the full result in memory.

* Revert "refactor: parallelize parse spectra pipeline across concurrent worker…" (#142)

This reverts commit 1c39986.

* feat(nmr-cli): add nmr-correlation as a new command (#140)

* feat: expose nmr-correlation package as a new nmr-cli command

* Address review: support local directory input, filter for FT spectra, add real yargs defaults/aliases

* Address round 2 review: explicit if/else branching, clarify spectrum filter rationale

* Address review: filter correlation spectra by ranges/zones instead of reference equality

* Address review: extract readSpectra and filterSpectra helper functions

* chore: upgrade actions and dependencies in workflow files to latest versions

* fix: update miniconda3 version and improve nodejs installation proces… (#145)

* fix: update miniconda3 version and improve nodejs installation process in Dockerfile

* fix: use conda-forge as the only conda channel

---------

Co-authored-by: hamed musallam <hamed.musallam@gmail.com>

* fix: correct GitHub contributors badge link and minor text adjustments in README

---------

Co-authored-by: hamed-musallam <35760236+hamed-musallam@users.noreply.github.com>
Co-authored-by: abeer.dev <56149548+MuhammadAbeerAkmal@users.noreply.github.com>
Co-authored-by: hamed musallam <hamed.musallam@gmail.com>
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.

Expose correlation package functionality

3 participants