nmr-processing 9.0.3 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assignment/get13CAssignments.js +2 -5
- package/lib/assignment/get13CAssignments.js.map +1 -1
- package/lib/assignment/get1HAssignments.js +2 -5
- package/lib/assignment/get1HAssignments.js.map +1 -1
- package/lib/assignment/utils/getAssignment/checkIDs.d.ts +1 -1
- package/lib/assignment/utils/getAssignment/checkIDs.js +3 -6
- package/lib/assignment/utils/getAssignment/checkIDs.js.map +1 -1
- package/lib/peaks/NMRPeak1D.d.ts +1 -0
- package/lib/peaks/peakToXY.js +6 -1
- package/lib/peaks/peakToXY.js.map +1 -1
- package/lib/peaks/peaksFilterImpurities.d.ts +1 -1
- package/lib/peaks/peaksFilterImpurities.js.map +1 -1
- package/lib/peaks/peaksToRanges.js +3 -0
- package/lib/peaks/peaksToRanges.js.map +1 -1
- package/lib/peaks/peaksToXY.js +4 -1
- package/lib/peaks/peaksToXY.js.map +1 -1
- package/lib/peaks/solventSuppression.js +2 -1
- package/lib/peaks/solventSuppression.js.map +1 -1
- package/lib/peaks/util/addMissingIDs.d.ts +7 -0
- package/lib/peaks/util/addMissingIDs.js +16 -0
- package/lib/peaks/util/addMissingIDs.js.map +1 -0
- package/lib/peaks/util/convertWidth.d.ts +3 -3
- package/lib/peaks/util/convertWidth.js +7 -7
- package/lib/peaks/util/convertWidth.js.map +1 -1
- package/lib/peaks/util/convertWidthToHz.d.ts +2 -2
- package/lib/peaks/util/convertWidthToHz.js.map +1 -1
- package/lib/peaks/util/convertWidthToPPM.d.ts +1 -1
- package/lib/peaks/util/convertWidthToPPM.js.map +1 -1
- package/lib/peaks/util/determineRealTop.d.ts +1 -1
- package/lib/peaks/util/determineRealTop.js.map +1 -1
- package/lib/peaks/util/setIDs.d.ts +5 -0
- package/lib/peaks/util/setIDs.js +14 -0
- package/lib/peaks/util/setIDs.js.map +1 -0
- package/lib/prediction/predictCOSY.d.ts +4 -2
- package/lib/prediction/predictCarbon.js +4 -1
- package/lib/prediction/predictCarbon.js.map +1 -1
- package/lib/prediction/predictHMBC.d.ts +4 -2
- package/lib/prediction/predictHSQC.d.ts +4 -2
- package/lib/prediction/predictProton.js +2 -0
- package/lib/prediction/predictProton.js.map +1 -1
- package/lib/prediction/utils/predict2D.d.ts +4 -2
- package/lib/prediction/utils/predict2D.js +6 -3
- package/lib/prediction/utils/predict2D.js.map +1 -1
- package/lib/ranges/markSolventSignal.js +4 -6
- package/lib/ranges/markSolventSignal.js.map +1 -1
- package/lib/ranges/utils/joinRanges.js +2 -0
- package/lib/ranges/utils/joinRanges.js.map +1 -1
- package/lib/signals/signalsJoin.js +2 -0
- package/lib/signals/signalsJoin.js.map +1 -1
- package/lib/signals/signalsToRanges.d.ts +3 -1
- package/lib/signals/signalsToRanges.js +2 -0
- package/lib/signals/signalsToRanges.js.map +1 -1
- package/lib/signals/utils/jAnalyzer.d.ts +1 -0
- package/lib/signals/utils/jAnalyzer.js.map +1 -1
- package/lib/utilities/clone.d.ts +1 -0
- package/lib/utilities/clone.js +9 -0
- package/lib/utilities/clone.js.map +1 -0
- package/lib/utilities/hasProperty.d.ts +3 -0
- package/lib/utilities/hasProperty.js +8 -0
- package/lib/utilities/hasProperty.js.map +1 -0
- package/lib/xy/xyAutoPeaksPicking.d.ts +4 -2
- package/lib/xy/xyAutoPeaksPicking.js +17 -7
- package/lib/xy/xyAutoPeaksPicking.js.map +1 -1
- package/lib/xy/xyPeaksOptimization.d.ts +3 -1
- package/lib/xy/xyPeaksOptimization.js.map +1 -1
- package/lib/xyz/NMRSignal2D.d.ts +2 -2
- package/lib/xyz/util/formatZone.d.ts +2 -3
- package/lib/xyz/util/formatZone.js +2 -0
- package/lib/xyz/util/formatZone.js.map +1 -1
- package/lib/xyz/xyzAutoZonesPicking.d.ts +7 -1
- package/lib/xyz/xyzAutoZonesPicking.js +8 -5
- package/lib/xyz/xyzAutoZonesPicking.js.map +1 -1
- package/lib/xyz/xyzJResAnalyzer.d.ts +4 -1
- package/lib/xyz/xyzJResAnalyzer.js +8 -3
- package/lib/xyz/xyzJResAnalyzer.js.map +1 -1
- package/lib-esm/assignment/get13CAssignments.js +1 -1
- package/lib-esm/assignment/get13CAssignments.js.map +1 -1
- package/lib-esm/assignment/get1HAssignments.js +1 -1
- package/lib-esm/assignment/get1HAssignments.js.map +1 -1
- package/lib-esm/assignment/utils/getAssignment/checkIDs.js +1 -1
- package/lib-esm/assignment/utils/getAssignment/checkIDs.js.map +1 -1
- package/lib-esm/peaks/peakToXY.js +6 -1
- package/lib-esm/peaks/peakToXY.js.map +1 -1
- package/lib-esm/peaks/peaksFilterImpurities.js.map +1 -1
- package/lib-esm/peaks/peaksToRanges.js +3 -0
- package/lib-esm/peaks/peaksToRanges.js.map +1 -1
- package/lib-esm/peaks/peaksToXY.js +4 -1
- package/lib-esm/peaks/peaksToXY.js.map +1 -1
- package/lib-esm/peaks/solventSuppression.js +2 -1
- package/lib-esm/peaks/solventSuppression.js.map +1 -1
- package/lib-esm/peaks/util/addMissingIDs.js +12 -0
- package/lib-esm/peaks/util/addMissingIDs.js.map +1 -0
- package/lib-esm/peaks/util/convertWidth.js +7 -7
- package/lib-esm/peaks/util/convertWidth.js.map +1 -1
- package/lib-esm/peaks/util/convertWidthToHz.js.map +1 -1
- package/lib-esm/peaks/util/convertWidthToPPM.js.map +1 -1
- package/lib-esm/peaks/util/determineRealTop.js.map +1 -1
- package/lib-esm/peaks/util/setIDs.js +10 -0
- package/lib-esm/peaks/util/setIDs.js.map +1 -0
- package/lib-esm/prediction/predictCarbon.js +4 -1
- package/lib-esm/prediction/predictCarbon.js.map +1 -1
- package/lib-esm/prediction/predictProton.js +2 -0
- package/lib-esm/prediction/predictProton.js.map +1 -1
- package/lib-esm/prediction/utils/predict2D.js +6 -3
- package/lib-esm/prediction/utils/predict2D.js.map +1 -1
- package/lib-esm/ranges/markSolventSignal.js +3 -2
- package/lib-esm/ranges/markSolventSignal.js.map +1 -1
- package/lib-esm/ranges/utils/joinRanges.js +2 -0
- package/lib-esm/ranges/utils/joinRanges.js.map +1 -1
- package/lib-esm/signals/signalsJoin.js +2 -0
- package/lib-esm/signals/signalsJoin.js.map +1 -1
- package/lib-esm/signals/signalsToRanges.js +2 -0
- package/lib-esm/signals/signalsToRanges.js.map +1 -1
- package/lib-esm/signals/utils/jAnalyzer.js.map +1 -1
- package/lib-esm/utilities/clone.js +5 -0
- package/lib-esm/utilities/clone.js.map +1 -0
- package/lib-esm/utilities/hasProperty.js +4 -0
- package/lib-esm/utilities/hasProperty.js.map +1 -0
- package/lib-esm/xy/xyAutoPeaksPicking.js +18 -8
- package/lib-esm/xy/xyAutoPeaksPicking.js.map +1 -1
- package/lib-esm/xy/xyPeaksOptimization.js.map +1 -1
- package/lib-esm/xyz/util/formatZone.js +2 -0
- package/lib-esm/xyz/util/formatZone.js.map +1 -1
- package/lib-esm/xyz/xyzAutoZonesPicking.js +8 -5
- package/lib-esm/xyz/xyzAutoZonesPicking.js.map +1 -1
- package/lib-esm/xyz/xyzJResAnalyzer.js +8 -3
- package/lib-esm/xyz/xyzJResAnalyzer.js.map +1 -1
- package/package.json +4 -3
- package/src/assignment/get13CAssignments.ts +1 -1
- package/src/assignment/get1HAssignments.ts +1 -1
- package/src/assignment/utils/getAssignment/checkIDs.ts +2 -1
- package/src/ml-matrix-peaks-finder.d.ts +1 -0
- package/src/peaks/NMRPeak1D.ts +1 -0
- package/src/peaks/peakToXY.ts +12 -1
- package/src/peaks/peaksFilterImpurities.ts +4 -4
- package/src/peaks/peaksToRanges.ts +3 -0
- package/src/peaks/peaksToXY.ts +6 -3
- package/src/peaks/solventSuppression.ts +2 -1
- package/src/peaks/util/addMissingIDs.ts +17 -0
- package/src/peaks/util/convertWidth.ts +16 -11
- package/src/peaks/util/convertWidthToHz.ts +5 -2
- package/src/peaks/util/convertWidthToPPM.ts +4 -1
- package/src/peaks/util/determineRealTop.ts +1 -1
- package/src/peaks/util/setIDs.ts +14 -0
- package/src/prediction/predictCarbon.ts +4 -1
- package/src/prediction/predictProton.ts +2 -0
- package/src/prediction/utils/predict2D.ts +6 -3
- package/src/ranges/markSolventSignal.ts +4 -2
- package/src/ranges/utils/joinRanges.ts +3 -0
- package/src/signals/signalsJoin.ts +2 -0
- package/src/signals/signalsToRanges.ts +5 -2
- package/src/signals/utils/jAnalyzer.ts +1 -0
- package/src/utilities/clone.ts +5 -0
- package/src/utilities/hasProperty.ts +6 -0
- package/src/xy/xyAutoPeaksPicking.ts +34 -14
- package/src/xy/xyPeaksOptimization.ts +2 -2
- package/src/xyz/NMRSignal2D.ts +2 -2
- package/src/xyz/util/formatZone.ts +6 -4
- package/src/xyz/xyzAutoZonesPicking.ts +24 -9
- package/src/xyz/xyzJResAnalyzer.ts +24 -16
- package/lib/assignment/utils/generateID.d.ts +0 -1
- package/lib/assignment/utils/generateID.js +0 -13
- package/lib/assignment/utils/generateID.js.map +0 -1
- package/lib-esm/assignment/utils/generateID.js +0 -10
- package/lib-esm/assignment/utils/generateID.js.map +0 -1
- package/src/assignment/utils/generateID.ts +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xyzJResAnalyzer.js","sourceRoot":"","sources":["../../src/xyz/xyzJResAnalyzer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xyzJResAnalyzer.js","sourceRoot":"","sources":["../../src/xyz/xyzJResAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,SAAS,MAAM,4BAA4B,CAAC;AAInD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;AA4ClC,MAAM,UAAU,e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,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YAC9B,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,MAAkC,CAAC,CAAC;SAClD;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmr-processing",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Pure functions allowing to process NMR spectra.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"typescript": "^4.7.4"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
+
"@lukeed/uuid": "^2.0.0",
|
|
57
58
|
"binary-search": "^1.3.6",
|
|
58
59
|
"cross-fetch": "^3.1.5",
|
|
59
60
|
"form-data": "^4.0.0",
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"ml-array-mean": "^1.1.6",
|
|
64
65
|
"ml-array-rescale": "^1.3.7",
|
|
65
66
|
"ml-array-sum": "^1.1.6",
|
|
66
|
-
"ml-gsd": "^12.
|
|
67
|
+
"ml-gsd": "^12.1.0",
|
|
67
68
|
"ml-hclust": "^3.1.0",
|
|
68
69
|
"ml-levenberg-marquardt": "^4.1.0",
|
|
69
70
|
"ml-matrix": "^6.10.2",
|
|
@@ -78,4 +79,4 @@
|
|
|
78
79
|
"openchemlib-utils": "^2.0.0",
|
|
79
80
|
"spectrum-generator": "^8.0.4"
|
|
80
81
|
}
|
|
81
|
-
}
|
|
82
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
1
2
|
import { Molecule } from 'openchemlib';
|
|
2
3
|
import { addDiastereotopicMissingChirality } from 'openchemlib-utils';
|
|
3
4
|
|
|
@@ -13,7 +14,6 @@ import type {
|
|
|
13
14
|
Targets,
|
|
14
15
|
} from './get1HAssignments';
|
|
15
16
|
import { RestrictionByCS1D, buildAssignments } from './utils/buildAssignments';
|
|
16
|
-
import generateID from './utils/generateID';
|
|
17
17
|
|
|
18
18
|
function checkAtomsAndDiaIDs(
|
|
19
19
|
signals: NMRSignal1D[],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
1
2
|
import { Molecule } from 'openchemlib';
|
|
2
3
|
import { addDiastereotopicMissingChirality } from 'openchemlib-utils';
|
|
3
4
|
|
|
@@ -10,7 +11,6 @@ import type { NMRSignal1D } from '../signals/NMRSignal1D';
|
|
|
10
11
|
import { MakeMandatory } from '../utilities/MakeMandatory';
|
|
11
12
|
|
|
12
13
|
import { buildAssignments, RestrictionByCS1D } from './utils/buildAssignments';
|
|
13
|
-
import generateID from './utils/generateID';
|
|
14
14
|
|
|
15
15
|
export type NMRSignal1DWithAtomsAndDiaIDs = MakeMandatory<
|
|
16
16
|
NMRSignal1D,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
2
|
+
|
|
1
3
|
import type { NMRRange, NMRZone } from '../../..';
|
|
2
4
|
import type { SpectraData } from '../../getAssignments';
|
|
3
5
|
import type {
|
|
@@ -5,7 +7,6 @@ import type {
|
|
|
5
7
|
NMRRangeWithIds,
|
|
6
8
|
NMRZoneWithIds,
|
|
7
9
|
} from '../../nmrAssigment';
|
|
8
|
-
import generateID from '../generateID';
|
|
9
10
|
|
|
10
11
|
import { isSpectraData1D } from './isSpectraData1D';
|
|
11
12
|
|
package/src/peaks/NMRPeak1D.ts
CHANGED
package/src/peaks/peakToXY.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
import { addMissingShape } from 'ml-gsd';
|
|
2
|
+
import { getShape1D } from 'ml-peak-shape-generator';
|
|
3
|
+
|
|
1
4
|
import { NMRPeak1D } from './NMRPeak1D';
|
|
2
5
|
import { peaksToXY, PeaksToXYOptions } from './peaksToXY';
|
|
3
6
|
|
|
4
7
|
export function peakToXY(peak: NMRPeak1D, options: PeaksToXYOptions) {
|
|
5
|
-
|
|
8
|
+
const newPeak = addMissingShape([peak])[0];
|
|
9
|
+
const factor = getShape1D(newPeak.shape).getFactor();
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
from = newPeak.x - (peak.width * factor) / options.frequency,
|
|
13
|
+
to = newPeak.x + (peak.width * factor) / options.frequency,
|
|
14
|
+
} = options;
|
|
15
|
+
|
|
16
|
+
return peaksToXY([peak], { ...options, from, to });
|
|
6
17
|
}
|
|
@@ -34,8 +34,8 @@ interface OptionsCheckImpurity {
|
|
|
34
34
|
* Try to remove peaks of impurities.
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
-
export function peaksFilterImpurities(
|
|
38
|
-
peakList:
|
|
37
|
+
export function peaksFilterImpurities<T extends NMRPeak1D>(
|
|
38
|
+
peakList: T[],
|
|
39
39
|
options: OptionsPeaksFilterImpurities = {},
|
|
40
40
|
) {
|
|
41
41
|
let { solvent, error = 0.025, remove = false } = options;
|
|
@@ -56,8 +56,8 @@ export function peaksFilterImpurities(
|
|
|
56
56
|
return peakList;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function checkImpurity(
|
|
60
|
-
peakList:
|
|
59
|
+
function checkImpurity<T extends NMRPeak1D>(
|
|
60
|
+
peakList: T[],
|
|
61
61
|
impurity: ImpuritySignal[],
|
|
62
62
|
options: OptionsCheckImpurity,
|
|
63
63
|
) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
1
2
|
import type { DataXY } from 'cheminfo-types';
|
|
2
3
|
import { xyIntegration } from 'ml-spectra-processing';
|
|
3
4
|
|
|
@@ -90,6 +91,7 @@ const assignSignal = (
|
|
|
90
91
|
nucleus: string,
|
|
91
92
|
): SignalIntern => {
|
|
92
93
|
return {
|
|
94
|
+
id: generateID(),
|
|
93
95
|
delta: NaN,
|
|
94
96
|
nbPeaks: 1,
|
|
95
97
|
kind: 'signal',
|
|
@@ -232,6 +234,7 @@ export function peaksToRanges(
|
|
|
232
234
|
for (let i = 0; i < signals.length; i++) {
|
|
233
235
|
let signal = signals[i];
|
|
234
236
|
const range: NMRRange = {
|
|
237
|
+
id: generateID(),
|
|
235
238
|
from: signal.integralData.from,
|
|
236
239
|
to: signal.integralData.to,
|
|
237
240
|
integration: signal.integralData.value,
|
package/src/peaks/peaksToXY.ts
CHANGED
|
@@ -26,8 +26,11 @@ export interface PeaksToXYOptions extends OptionsSG1D {
|
|
|
26
26
|
|
|
27
27
|
export function peaksToXY(peaks: NMRPeak1D[], options: PeaksToXYOptions) {
|
|
28
28
|
const { frequency, nbPoints = 1024, shape } = options;
|
|
29
|
-
const newPeaks = convertWidthToPPM(peaks, { frequency });
|
|
30
29
|
|
|
30
|
+
if (!frequency) {
|
|
31
|
+
throw new Error('frequency is mandatory');
|
|
32
|
+
}
|
|
33
|
+
const newPeaks = convertWidthToPPM(peaks, { frequency });
|
|
31
34
|
return generateSpectrum(newPeaks, {
|
|
32
35
|
generator: {
|
|
33
36
|
...getFromTo(newPeaks, options),
|
|
@@ -50,8 +53,8 @@ function getFromTo(newPeaks: NMRPeak1D[], options: PeaksToXYOptions) {
|
|
|
50
53
|
const lastPeak = newPeaks[newPeaks.length - 1];
|
|
51
54
|
|
|
52
55
|
const {
|
|
53
|
-
from = firstPeak.x - firstPeak.width * 2,
|
|
54
|
-
to = lastPeak.x + lastPeak.width * 2,
|
|
56
|
+
from = firstPeak.x - (firstPeak.width * 2) / options.frequency,
|
|
57
|
+
to = lastPeak.x + (lastPeak.width * 2) / options.frequency,
|
|
55
58
|
} = options;
|
|
56
59
|
|
|
57
60
|
return {
|
|
@@ -9,6 +9,7 @@ import { addDummySignals } from '../signals/addDummySignals';
|
|
|
9
9
|
import { signalsToSpinSystem } from '../signals/simulation/signalsToSpinSystem';
|
|
10
10
|
import { simulateXYPeaks } from '../signals/simulation/simulateXYPeaks';
|
|
11
11
|
import { splitSpinSystem } from '../signals/simulation/splitSpinSystem';
|
|
12
|
+
import { cloneArray } from '../utilities/clone';
|
|
12
13
|
|
|
13
14
|
import { NMRPeak1D } from './NMRPeak1D';
|
|
14
15
|
|
|
@@ -17,7 +18,7 @@ export function solventSuppression<T extends NMRPeak1D>(
|
|
|
17
18
|
solvent: NMRSignal1D[],
|
|
18
19
|
options: { markSolventPeaks?: boolean; solventZoneExtension?: number } = {},
|
|
19
20
|
) {
|
|
20
|
-
const peaks =
|
|
21
|
+
const peaks = cloneArray(peakList).sort((a, b) => a.x - b.x);
|
|
21
22
|
|
|
22
23
|
const xValues = peaks.map((peak) => peak.x);
|
|
23
24
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
2
|
+
|
|
3
|
+
const { parse, stringify } = JSON;
|
|
4
|
+
|
|
5
|
+
export function addMissingIDs<T extends { id?: string }>(
|
|
6
|
+
peaks: T[],
|
|
7
|
+
options: { output?: T[] } = {},
|
|
8
|
+
) {
|
|
9
|
+
const { output = parse(stringify(peaks)) as T[] } = options;
|
|
10
|
+
for (const peak of output) {
|
|
11
|
+
if (!('id' in peak)) {
|
|
12
|
+
peak.id = generateID();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return output as (T & { id: string })[];
|
|
17
|
+
}
|
|
@@ -1,40 +1,45 @@
|
|
|
1
|
+
import { Shape1D } from 'ml-peak-shape-generator';
|
|
2
|
+
|
|
1
3
|
import { MakeMandatory } from '../../utilities/MakeMandatory';
|
|
4
|
+
import { hasProperty } from '../../utilities/hasProperty';
|
|
2
5
|
import { NMRPeak1D } from '../NMRPeak1D';
|
|
3
6
|
|
|
7
|
+
const { parse, stringify } = JSON;
|
|
8
|
+
|
|
4
9
|
export type NMRPeak1DWithShape = MakeMandatory<NMRPeak1D, 'shape'>;
|
|
5
10
|
|
|
6
|
-
export interface ConvertWidthOptions {
|
|
11
|
+
export interface ConvertWidthOptions<T> {
|
|
7
12
|
convertTo: string & { _kind?: 'hz' | 'ppm' };
|
|
8
13
|
frequency: number;
|
|
9
|
-
output?:
|
|
14
|
+
output?: T[];
|
|
10
15
|
}
|
|
11
16
|
/**
|
|
12
17
|
* convert width and fwhm to ppm
|
|
13
18
|
*/
|
|
14
|
-
export function convertWidth
|
|
19
|
+
export function convertWidth<T extends NMRPeak1D>(
|
|
20
|
+
peaks: T[],
|
|
21
|
+
options: ConvertWidthOptions<T>,
|
|
22
|
+
): T[] {
|
|
15
23
|
const {
|
|
16
24
|
frequency,
|
|
17
25
|
convertTo,
|
|
18
|
-
output =
|
|
26
|
+
output = parse(stringify(peaks)) as T[],
|
|
19
27
|
} = options;
|
|
20
28
|
|
|
21
29
|
const convert = getConverter(convertTo, frequency);
|
|
22
30
|
|
|
23
31
|
for (const peak of output) {
|
|
24
32
|
peak.width = convert(peak.width);
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
if (hasProperty(peak, 'shape')) {
|
|
34
|
+
const shape = peak.shape as Shape1D;
|
|
35
|
+
if (shape.fwhm) {
|
|
36
|
+
shape.fwhm = convert(shape.fwhm);
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
39
|
}
|
|
31
40
|
return output;
|
|
32
41
|
}
|
|
33
42
|
|
|
34
|
-
function hasShape(peak: NMRPeak1D): peak is NMRPeak1DWithShape {
|
|
35
|
-
return 'shape' in peak;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
43
|
function getConverter(convertTo: string, frequency: number) {
|
|
39
44
|
switch (convertTo) {
|
|
40
45
|
case 'ppm':
|
|
@@ -2,8 +2,11 @@ import { NMRPeak1D } from '../NMRPeak1D';
|
|
|
2
2
|
|
|
3
3
|
import { convertWidth, ConvertWidthOptions } from './convertWidth';
|
|
4
4
|
|
|
5
|
-
export type ConvertWidthTo = Omit<ConvertWidthOptions
|
|
5
|
+
export type ConvertWidthTo<T> = Omit<ConvertWidthOptions<T>, 'convertTo'>;
|
|
6
6
|
|
|
7
|
-
export function convertWidthToHz
|
|
7
|
+
export function convertWidthToHz<T extends NMRPeak1D>(
|
|
8
|
+
peaks: T[],
|
|
9
|
+
options: ConvertWidthTo<T>,
|
|
10
|
+
): T[] {
|
|
8
11
|
return convertWidth(peaks, { ...options, convertTo: 'hz' });
|
|
9
12
|
}
|
|
@@ -3,6 +3,9 @@ import { NMRPeak1D } from '../NMRPeak1D';
|
|
|
3
3
|
import { convertWidth } from './convertWidth';
|
|
4
4
|
import { ConvertWidthTo } from './convertWidthToHz';
|
|
5
5
|
|
|
6
|
-
export function convertWidthToPPM
|
|
6
|
+
export function convertWidthToPPM<T extends NMRPeak1D>(
|
|
7
|
+
peaks: T[],
|
|
8
|
+
options: ConvertWidthTo<T>,
|
|
9
|
+
) {
|
|
7
10
|
return convertWidth(peaks, { ...options, convertTo: 'ppm' });
|
|
8
11
|
}
|
|
@@ -9,7 +9,7 @@ const direction16Y = [-2, -1, 0, 1, 2, -2, 2, -2, 2, -2, 2, -2, -1, 0, 1, 2];
|
|
|
9
9
|
|
|
10
10
|
type Data = number[] | Float64Array;
|
|
11
11
|
|
|
12
|
-
export function determineRealTop(peaks:
|
|
12
|
+
export function determineRealTop<T extends Peak2D>(peaks: T[], options: any) {
|
|
13
13
|
let { nCols, absoluteData, originalData, minX, maxX, minY, maxY } = options;
|
|
14
14
|
for (let i = 0; i < peaks.length; i++) {
|
|
15
15
|
let xIndex = Math.round(peaks[i].x);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
2
|
+
|
|
3
|
+
const { parse, stringify } = JSON;
|
|
4
|
+
|
|
5
|
+
export function setIDs<T>(peaks: T[], options: { output?: T[] } = {}) {
|
|
6
|
+
const output = (options.output || parse(stringify(peaks))) as (T & {
|
|
7
|
+
id?: string;
|
|
8
|
+
})[];
|
|
9
|
+
for (const peak of output) {
|
|
10
|
+
peak.id = generateID();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return output as (T & { id: string })[];
|
|
14
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
1
2
|
import fetch from 'cross-fetch';
|
|
2
3
|
import type { Molecule } from 'openchemlib';
|
|
3
4
|
|
|
5
|
+
import { setIDs } from '../peaks/util/setIDs';
|
|
4
6
|
import type { NMRSignal1D } from '../signals/NMRSignal1D';
|
|
5
7
|
import { signalsToRanges } from '../signals/signalsToRanges';
|
|
6
8
|
import type { MakeMandatory } from '../utilities/MakeMandatory';
|
|
@@ -117,6 +119,7 @@ function formatSignals(predictions: Prediction[]) {
|
|
|
117
119
|
for (const prediction of predictions) {
|
|
118
120
|
const { atoms, nbAtoms, delta, diaIDs, statistic } = prediction;
|
|
119
121
|
const signal = {
|
|
122
|
+
id: generateID(),
|
|
120
123
|
delta: delta || NaN,
|
|
121
124
|
atoms,
|
|
122
125
|
diaIDs,
|
|
@@ -144,5 +147,5 @@ function joinSignalByDiaID(signals: NMRSignal1D[]) {
|
|
|
144
147
|
joinedSignals[diaID].atoms.push(...signal.atoms);
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
|
-
return Object.values(joinedSignals);
|
|
150
|
+
return setIDs(Object.values(joinedSignals));
|
|
148
151
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
1
2
|
import fetch from 'cross-fetch';
|
|
2
3
|
import FormData from 'form-data';
|
|
3
4
|
import type { Molecule } from 'openchemlib';
|
|
@@ -86,6 +87,7 @@ function protonParser(
|
|
|
86
87
|
let couplings = fields.slice(4);
|
|
87
88
|
let atom = Number(fields[0]) - 1;
|
|
88
89
|
let signal: NMRSignal1D = {
|
|
90
|
+
id: generateID(),
|
|
89
91
|
atoms: [atom],
|
|
90
92
|
diaIDs: [diaIDs[atom]],
|
|
91
93
|
nbAtoms: 1,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
1
2
|
import { agnes, Cluster } from 'ml-hclust';
|
|
2
3
|
import { Matrix } from 'ml-matrix';
|
|
3
4
|
import { Molecule } from 'openchemlib';
|
|
@@ -20,6 +21,7 @@ import type { Prediction1D } from '../prediction1D';
|
|
|
20
21
|
|
|
21
22
|
import { getNuclei } from './getNuclei';
|
|
22
23
|
import { getPredictions } from './getPredictions';
|
|
24
|
+
import { setIDs } from '../../peaks/util/setIDs';
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
|
|
@@ -216,8 +218,8 @@ export async function predict2D(
|
|
|
216
218
|
continue;
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
let peak: any = { z: 100 };
|
|
220
|
-
let signal: any = { x: {}, y: {} };
|
|
221
|
+
let peak: any = { id: generateID(), z: 100 };
|
|
222
|
+
let signal: any = { id: generateID(), x: {}, y: {} };
|
|
221
223
|
for (let axis in fromToDiaID) {
|
|
222
224
|
let diaID = fromToDiaID[axis].oclID;
|
|
223
225
|
peak[axis] = signalsByDiaID[axis][diaID].delta;
|
|
@@ -262,7 +264,7 @@ function splitSignals(joinedSignals: NMRSignal2D[]) {
|
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
}
|
|
265
|
-
return signals;
|
|
267
|
+
return setIDs(signals);
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
interface AddSelftCorrelationOptions {
|
|
@@ -333,6 +335,7 @@ function createZones(signals: NMRSignal2D[], options: CreateZonesOptions) {
|
|
|
333
335
|
}
|
|
334
336
|
|
|
335
337
|
zones.push({
|
|
338
|
+
id: generateID(),
|
|
336
339
|
...fromTo(signal, { joinDistance, from, to }),
|
|
337
340
|
signals: signal,
|
|
338
341
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
2
|
+
|
|
1
3
|
import { NMRRangeWithIds, NMRSignal1DWithId } from '../assignment/nmrAssigment';
|
|
2
|
-
import generateID from '../assignment/utils/generateID';
|
|
3
4
|
import { addIDs } from '../assignment/utils/getAssignment/checkIDs';
|
|
4
5
|
import { NMRPeak1D } from '../peaks/NMRPeak1D';
|
|
5
6
|
import { detectSignals } from '../peaks/peaksToRanges';
|
|
6
7
|
import { solventSuppression } from '../peaks/solventSuppression';
|
|
7
8
|
import { NMRSignal1D } from '../signals/NMRSignal1D';
|
|
8
9
|
import { SignalIntern } from '../signals/utils/jAnalyzer';
|
|
10
|
+
import { cloneArray } from '../utilities/clone';
|
|
9
11
|
import { NMRRange } from '../xy/NMRRange';
|
|
10
12
|
|
|
11
13
|
interface NMRPeak1DWithSignalID extends NMRPeak1D {
|
|
@@ -19,7 +21,7 @@ export function markSolventPeaks<T extends NMRRange>(
|
|
|
19
21
|
options: any = {},
|
|
20
22
|
) {
|
|
21
23
|
const { frequency = 400 } = options;
|
|
22
|
-
const ranges = addIDs(
|
|
24
|
+
const ranges = addIDs(cloneArray(input)) as NMRRangeWithIds[];
|
|
23
25
|
|
|
24
26
|
let peakList: NMRPeak1DWithSignalID[] = [];
|
|
25
27
|
for (const range of ranges) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
2
|
+
|
|
1
3
|
import type { NMRRange } from '../../xy/NMRRange';
|
|
2
4
|
|
|
3
5
|
export function joinRanges(ranges: NMRRange[]) {
|
|
@@ -8,6 +10,7 @@ export function joinRanges(ranges: NMRRange[]) {
|
|
|
8
10
|
const nextRange = ranges[i + 1];
|
|
9
11
|
|
|
10
12
|
if (currentRange.to > nextRange.from) {
|
|
13
|
+
currentRange.id = generateID();
|
|
11
14
|
currentRange.to = Math.max(nextRange.to, currentRange.to);
|
|
12
15
|
if (currentRange.signals && nextRange.signals) {
|
|
13
16
|
currentRange.signals = currentRange.signals.concat(nextRange.signals);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
1
2
|
import mean from 'ml-array-mean';
|
|
2
3
|
import sum from 'ml-array-sum';
|
|
3
4
|
|
|
@@ -93,6 +94,7 @@ export function signalsJoin(
|
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
let signal: Signal1DWidthJsAndDiaID = {
|
|
97
|
+
id: generateID(),
|
|
96
98
|
nbAtoms: sum(group.map((item) => item.nbAtoms || 0)),
|
|
97
99
|
delta: mean(group.map((item) => item.delta)),
|
|
98
100
|
diaIDs: group[0].diaIDs,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 as generateID } from '@lukeed/uuid';
|
|
2
|
+
|
|
1
3
|
import type { MakeMandatory } from '../utilities/MakeMandatory';
|
|
2
4
|
import { rangeFromSignal } from '../utilities/rangeFromSignal';
|
|
3
5
|
import type { NMRRange } from '../xy/NMRRange';
|
|
@@ -18,7 +20,7 @@ interface SignalsToRangesOptions {
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
type Signals1DWithNbAtoms = MakeMandatory<NMRSignal1D, 'nbAtoms'>;
|
|
21
|
-
type RangeFullfiled = MakeMandatory<NMRRange, 'integration' | 'signals'>;
|
|
23
|
+
type RangeFullfiled = MakeMandatory<NMRRange, 'integration' | 'signals' | 'id'>;
|
|
22
24
|
|
|
23
25
|
interface WrappedSignal {
|
|
24
26
|
from: number;
|
|
@@ -37,7 +39,7 @@ function checkNbAtoms(
|
|
|
37
39
|
export function signalsToRanges(
|
|
38
40
|
signals: NMRSignal1D[],
|
|
39
41
|
options: SignalsToRangesOptions = {},
|
|
40
|
-
):
|
|
42
|
+
): RangeFullfiled[] {
|
|
41
43
|
checkNbAtoms(signals);
|
|
42
44
|
|
|
43
45
|
const { tolerance = 0.05, frequency = 400 } = options;
|
|
@@ -59,6 +61,7 @@ export function signalsToRanges(
|
|
|
59
61
|
for (let signal of wrapped) {
|
|
60
62
|
if (range.from === undefined || signal.from > range.to) {
|
|
61
63
|
range = {
|
|
64
|
+
id: generateID(),
|
|
62
65
|
from: signal.from,
|
|
63
66
|
to: signal.to,
|
|
64
67
|
integration: signal.original.nbAtoms,
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { DataXY } from 'cheminfo-types';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
gsd,
|
|
4
|
+
optimizePeaks,
|
|
5
|
+
joinBroadPeaks,
|
|
6
|
+
GSDPeakID,
|
|
4
7
|
GSDOptions,
|
|
5
8
|
OptimizePeaksOptions,
|
|
6
9
|
JoinBroadPeaksOptions,
|
|
10
|
+
GSDPeakOptimizedID,
|
|
7
11
|
} from 'ml-gsd';
|
|
8
12
|
import {
|
|
9
13
|
xyExtract,
|
|
@@ -13,6 +17,7 @@ import {
|
|
|
13
17
|
|
|
14
18
|
import { NMRPeak1D } from '..';
|
|
15
19
|
import { convertWidthToHz } from '../peaks/util/convertWidthToHz';
|
|
20
|
+
import { MakeMandatory } from '../utilities/MakeMandatory';
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Implementation of the peak picking method described by Cobas in:
|
|
@@ -72,10 +77,12 @@ export interface OptionsXYAutoPeaksPicking extends Partial<GetPeakListOptions> {
|
|
|
72
77
|
frequency: number;
|
|
73
78
|
}
|
|
74
79
|
|
|
80
|
+
export type NMRPeak1DWithID = MakeMandatory<NMRPeak1D, 'id'>;
|
|
81
|
+
|
|
75
82
|
export function xyAutoPeaksPicking(
|
|
76
83
|
data: DataXY,
|
|
77
84
|
options: OptionsXYAutoPeaksPicking,
|
|
78
|
-
):
|
|
85
|
+
): NMRPeak1DWithID[] {
|
|
79
86
|
const {
|
|
80
87
|
from,
|
|
81
88
|
to,
|
|
@@ -180,23 +187,23 @@ function getPeakList(data: DataXY, options: GetPeakListOptions) {
|
|
|
180
187
|
realTopDetection,
|
|
181
188
|
});
|
|
182
189
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
const newPeaks = broadWidth
|
|
191
|
+
? joinBroadPeaks(peakList, {
|
|
192
|
+
broadRatio,
|
|
193
|
+
broadWidth,
|
|
194
|
+
shape,
|
|
195
|
+
optimization,
|
|
196
|
+
}).map(toNMRPeak1DStructure)
|
|
197
|
+
: peakList.map(toNMRPeak1DStructure);
|
|
191
198
|
|
|
192
199
|
return convertWidthToHz(
|
|
193
200
|
optimize
|
|
194
|
-
? optimizePeaks(data,
|
|
201
|
+
? optimizePeaks(data, newPeaks, {
|
|
195
202
|
shape,
|
|
196
203
|
factorLimits,
|
|
197
204
|
optimization,
|
|
198
|
-
})
|
|
199
|
-
:
|
|
205
|
+
}).map(toNMRPeak1DStructure)
|
|
206
|
+
: newPeaks,
|
|
200
207
|
{ frequency },
|
|
201
208
|
);
|
|
202
209
|
}
|
|
@@ -217,3 +224,16 @@ function getCutOff(data: number[] | Float64Array, options: OptionsGetCutOff) {
|
|
|
217
224
|
: formatResult(xAbsoluteMedian(data) * thresholdFactor);
|
|
218
225
|
}
|
|
219
226
|
}
|
|
227
|
+
|
|
228
|
+
function toNMRPeak1DStructure(
|
|
229
|
+
peak: GSDPeakID | GSDPeakOptimizedID,
|
|
230
|
+
): NMRPeak1DWithID {
|
|
231
|
+
const { id, shape, x, y, width } = peak;
|
|
232
|
+
return {
|
|
233
|
+
id,
|
|
234
|
+
x,
|
|
235
|
+
y,
|
|
236
|
+
width,
|
|
237
|
+
shape,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
@@ -10,9 +10,9 @@ export interface XYPeaksOptimizationOptions extends OptimizePeaksOptions {
|
|
|
10
10
|
*/
|
|
11
11
|
frequency: number;
|
|
12
12
|
}
|
|
13
|
-
export function xyPeaksOptimization(
|
|
13
|
+
export function xyPeaksOptimization<T extends PeakXYWidth>(
|
|
14
14
|
data: DataXY,
|
|
15
|
-
peaks:
|
|
15
|
+
peaks: T[],
|
|
16
16
|
options: XYPeaksOptimizationOptions,
|
|
17
17
|
) {
|
|
18
18
|
const { frequency } = options;
|