Skip to content
Merged
Changes from all commits
Commits
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
@@ -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'
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -155,6 +164,8 @@ async function predictNMR(

if (!data) continue

const predictionShifts = getPredictionShifts(item.shifts)

const name = crypto.randomUUID()

outputSpectra.push({
Expand All @@ -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)
}
Expand Down
Loading