diff --git a/app/scripts/nmr-cli/src/prediction/engines/nmrshift/nmrshift.engine.ts b/app/scripts/nmr-cli/src/prediction/engines/nmrshift/nmrshift.engine.ts index 8e22e8e..9386b4b 100644 --- a/app/scripts/nmr-cli/src/prediction/engines/nmrshift/nmrshift.engine.ts +++ b/app/scripts/nmr-cli/src/prediction/engines/nmrshift/nmrshift.engine.ts @@ -1,6 +1,6 @@ import type { Options } from 'yargs' import type { Spectrum } from '@zakodium/nmrium-core' -import https from 'https' +import https from 'node:https' import axios, { type AxiosResponse } from 'axios' import { defineEngine } from '../registry.js' @@ -63,6 +63,15 @@ function getBaseUrl(): string { return url } +function getPredictionShifts(shifts: ShiftsItem[]) { + // NMRShiftDB atom numbers are 1-based and follow openchemlib's addImplicitHydrogens order. + return shifts.map(({ atom, prediction, status }) => ({ + atom, + prediction, + status, + })) +} + async function callPredict( structure: string, options: { @@ -155,6 +164,8 @@ async function predictNMR( if (!data) continue + const predictionShifts = getPredictionShifts(item.shifts) + const name = crypto.randomUUID() outputSpectra.push({ @@ -171,6 +182,8 @@ async function predictNMR( isFt: true, name, nucleus: experimentInfo.nucleus, + // Kept so clients can label atoms and mark the matching peaks. + predictionShifts, }, } as unknown as Spectrum) }