nmrium 0.38.2 → 0.39.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/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +90 -67
- package/lib/component/NMRium.d.ts +1 -0
- package/lib/component/NMRium.js +4 -2
- package/lib/component/context/LoggerContext.js +5 -0
- package/lib/component/context/PreferencesContext.d.ts +4 -2
- package/lib/component/elements/formik/FormikError.d.ts +8 -0
- package/lib/component/elements/formik/FormikError.js +22 -0
- package/lib/component/hooks/useSaveSettings.js +18 -16
- package/lib/component/modal/LoadJCAMPModal.js +41 -28
- package/lib/component/modal/PredictSpectraModal.js +12 -2
- package/lib/component/modal/editRange/EditRangeModal.d.ts +7 -6
- package/lib/component/modal/editRange/EditRangeModal.js +33 -13
- package/lib/component/modal/setting/GeneralSettings.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +1 -1
- package/lib/component/panels/Panels.js +2 -2
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +9 -12
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -1
- package/lib/component/reducer/actions/DatabaseActions.js +6 -4
- package/lib/component/reducer/actions/DomainActions.js +3 -0
- package/lib/component/reducer/actions/IntegralsActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +6 -6
- package/lib/component/reducer/actions/ToolsActions.js +3 -32
- package/lib/component/reducer/actions/ZonesActions.js +2 -4
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +8 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +35 -0
- package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/data/PredictionManager.d.ts +3 -1
- package/lib/data/PredictionManager.js +27 -1
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +13 -6
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +23 -18
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +90 -67
- package/lib-cjs/component/NMRium.js +4 -2
- package/lib-cjs/component/context/LoggerContext.js +5 -0
- package/lib-cjs/component/elements/formik/FormikError.js +27 -0
- package/lib-cjs/component/hooks/useSaveSettings.js +17 -15
- package/lib-cjs/component/modal/LoadJCAMPModal.js +41 -28
- package/lib-cjs/component/modal/PredictSpectraModal.js +12 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +32 -12
- package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +1 -1
- package/lib-cjs/component/panels/Panels.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +9 -12
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -1
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +6 -4
- package/lib-cjs/component/reducer/actions/DomainActions.js +3 -0
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +3 -1
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +6 -6
- package/lib-cjs/component/reducer/actions/ToolsActions.js +26 -32
- package/lib-cjs/component/reducer/actions/ZonesActions.js +2 -4
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +37 -0
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib-cjs/data/PredictionManager.js +27 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +13 -6
- package/lib-cjs/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +23 -18
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +10 -10
|
@@ -27,9 +27,11 @@ exports.handleResurrectSpectrumFromJcamp = handleResurrectSpectrumFromJcamp;
|
|
|
27
27
|
function handleResurrectSpectrumFromRanges(draft, action) {
|
|
28
28
|
const { ranges, info } = action.payload;
|
|
29
29
|
const datum = (0, generateSpectrumFromRanges_1.generateSpectrumFromRanges)(ranges, info, draft.usedColors);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (datum) {
|
|
31
|
+
draft.data.push(datum);
|
|
32
|
+
(0, DomainActions_1.setDomain)(draft, { isYDomainShared: false });
|
|
33
|
+
(0, DomainActions_1.setIntegralsYDomain)(draft, [datum]);
|
|
34
|
+
(0, Zoom1DManager_1.setZoom)(draft, { scale: 0.8, spectrumID: datum.id });
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
exports.handleResurrectSpectrumFromRanges = handleResurrectSpectrumFromRanges;
|
|
@@ -9,6 +9,7 @@ const get1DDataXY_1 = require("../../../data/data1d/Spectrum1D/get1DDataXY");
|
|
|
9
9
|
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
10
10
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
11
11
|
const Constants_1 = require("../core/Constants");
|
|
12
|
+
const ZoomHistoryManager_1 = require("../helper/ZoomHistoryManager");
|
|
12
13
|
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
13
14
|
function getActiveData(draft) {
|
|
14
15
|
let data = draft.data.filter((datum) => (0, nucleusToString_1.default)(datum.info.nucleus) === draft.view.spectra.activeTab &&
|
|
@@ -195,11 +196,13 @@ exports.setMode = setMode;
|
|
|
195
196
|
function handleSetXDomain(draft, action) {
|
|
196
197
|
const xDomain = action.payload.xDomain;
|
|
197
198
|
draft.xDomain = xDomain;
|
|
199
|
+
(0, ZoomHistoryManager_1.addToBrushHistory)(draft, { xDomain, yDomain: draft.yDomain });
|
|
198
200
|
}
|
|
199
201
|
exports.handleSetXDomain = handleSetXDomain;
|
|
200
202
|
//action
|
|
201
203
|
function handleSetYDomain(draft, action) {
|
|
202
204
|
const yDomain = action.payload.yDomain;
|
|
203
205
|
draft.yDomain = yDomain;
|
|
206
|
+
(0, ZoomHistoryManager_1.addToBrushHistory)(draft, { xDomain: draft.xDomain, yDomain });
|
|
204
207
|
}
|
|
205
208
|
exports.handleSetYDomain = handleSetYDomain;
|
|
@@ -33,13 +33,15 @@ function handleAddIntegral(draft, action) {
|
|
|
33
33
|
const datum = data[activeSpectrum.index];
|
|
34
34
|
const { x, re } = datum.data;
|
|
35
35
|
const shiftX = (0, Spectrum1D_1.getShiftX)(datum);
|
|
36
|
+
const integration = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
|
|
36
37
|
const integral = {
|
|
37
38
|
id: (0, uuid_1.v4)(),
|
|
38
39
|
originFrom: from - shiftX,
|
|
39
40
|
originTo: to - shiftX,
|
|
40
41
|
from,
|
|
41
42
|
to,
|
|
42
|
-
|
|
43
|
+
integral: integration,
|
|
44
|
+
absolute: integration,
|
|
43
45
|
kind: 'signal',
|
|
44
46
|
};
|
|
45
47
|
datum.integrals.values.push(integral);
|
|
@@ -12,7 +12,6 @@ const nmr_processing_1 = require("nmr-processing");
|
|
|
12
12
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
13
13
|
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
14
14
|
const contours_1 = require("../../../data/data2d/Spectrum2D/contours");
|
|
15
|
-
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
16
15
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
17
16
|
const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
|
|
18
17
|
const Zoom1DManager_1 = require("../helper/Zoom1DManager");
|
|
@@ -213,8 +212,7 @@ function handleChangeActiveSpectrum(draft, action) {
|
|
|
213
212
|
(0, ToolsActions_1.setMargin)(draft);
|
|
214
213
|
(0, DomainActions_1.setMode)(draft);
|
|
215
214
|
}
|
|
216
|
-
if (
|
|
217
|
-
!toolOptions.data.activeFilterID) {
|
|
215
|
+
if (!toolOptions.data.activeFilterID) {
|
|
218
216
|
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
219
217
|
}
|
|
220
218
|
}
|
|
@@ -306,9 +304,11 @@ exports.handleAlignSpectraHandler = handleAlignSpectraHandler;
|
|
|
306
304
|
function handleGenerateSpectrumFromPublicationStringHandler(draft, action) {
|
|
307
305
|
const publicationString = action.payload.publicationText;
|
|
308
306
|
const spectrum = (0, Spectrum1D_1.generateSpectrumFromPublicationString)(publicationString, draft.usedColors);
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
307
|
+
if (spectrum) {
|
|
308
|
+
draft.data.push(spectrum);
|
|
309
|
+
(0, ToolsActions_1.setActiveTab)(draft);
|
|
310
|
+
(0, Zoom1DManager_1.setZoom)(draft, { scale: 0.8, spectrumID: spectrum.id });
|
|
311
|
+
}
|
|
312
312
|
}
|
|
313
313
|
exports.handleGenerateSpectrumFromPublicationStringHandler = handleGenerateSpectrumFromPublicationStringHandler;
|
|
314
314
|
//action
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -17,7 +40,7 @@ const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
|
|
|
17
40
|
const Reducer_1 = require("../Reducer");
|
|
18
41
|
const Constants_1 = require("../core/Constants");
|
|
19
42
|
const Zoom1DManager_1 = require("../helper/Zoom1DManager");
|
|
20
|
-
const ZoomHistoryManager_1 =
|
|
43
|
+
const ZoomHistoryManager_1 = __importStar(require("../helper/ZoomHistoryManager"));
|
|
21
44
|
const getActiveSpectra_1 = require("../helper/getActiveSpectra");
|
|
22
45
|
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
23
46
|
const getVerticalAlign_1 = require("../helper/getVerticalAlign");
|
|
@@ -160,7 +183,7 @@ function handleToggleRealImaginaryVisibility(draft) {
|
|
|
160
183
|
exports.handleToggleRealImaginaryVisibility = handleToggleRealImaginaryVisibility;
|
|
161
184
|
function handleBrushEnd(draft, action) {
|
|
162
185
|
const is2D = draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D;
|
|
163
|
-
const { height, margin, yDomain, yDomains, width, xDomains, xDomain, mode
|
|
186
|
+
const { height, margin, yDomain, yDomains, width, xDomains, xDomain, mode } = draft;
|
|
164
187
|
const xScale = (0, scale_1.getXScale)({ width, xDomains, xDomain, mode, margin });
|
|
165
188
|
const verticalAlign = (0, getVerticalAlign_1.getVerticalAlign)(draft);
|
|
166
189
|
const yScale = is2D
|
|
@@ -173,36 +196,7 @@ function handleBrushEnd(draft, action) {
|
|
|
173
196
|
const endY = yScale.invert(_endY);
|
|
174
197
|
const domainX = startX > endX ? [endX, startX] : [startX, endX];
|
|
175
198
|
const domainY = startY > endY ? [endY, startY] : [startY, endY];
|
|
176
|
-
|
|
177
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
178
|
-
draft.zoom.history,
|
|
179
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
180
|
-
draft.view.spectra.activeTab);
|
|
181
|
-
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
182
|
-
switch (trackID) {
|
|
183
|
-
case 'CENTER_2D':
|
|
184
|
-
draft.xDomain = domainX;
|
|
185
|
-
draft.yDomain = domainY;
|
|
186
|
-
break;
|
|
187
|
-
case 'TOP_1D':
|
|
188
|
-
draft.xDomain = domainX;
|
|
189
|
-
break;
|
|
190
|
-
case 'LEFT_1D':
|
|
191
|
-
draft.yDomain = domainY;
|
|
192
|
-
break;
|
|
193
|
-
default:
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
if (brushHistory) {
|
|
197
|
-
brushHistory.push({ xDomain, yDomain });
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
draft.xDomain = domainX;
|
|
202
|
-
if (brushHistory) {
|
|
203
|
-
brushHistory.push({ xDomain: domainX, yDomain: domainY });
|
|
204
|
-
}
|
|
205
|
-
}
|
|
199
|
+
(0, ZoomHistoryManager_1.addToBrushHistory)(draft, { trackID, xDomain: domainX, yDomain: domainY });
|
|
206
200
|
}
|
|
207
201
|
exports.handleBrushEnd = handleBrushEnd;
|
|
208
202
|
function setVerticalIndicatorXPosition(draft, action) {
|
|
@@ -62,10 +62,8 @@ exports.handleAutoZonesDetection = handleAutoZonesDetection;
|
|
|
62
62
|
function handleAutoSpectraZonesDetection(draft) {
|
|
63
63
|
for (const datum of draft.data) {
|
|
64
64
|
const { info, data } = datum;
|
|
65
|
-
if (info.dimension === 2) {
|
|
66
|
-
const { minX, maxX, minY, maxY } =
|
|
67
|
-
? data.re
|
|
68
|
-
: data.rr;
|
|
65
|
+
if (info.dimension === 2 && info.isFt) {
|
|
66
|
+
const { minX, maxX, minY, maxY } = data.rr;
|
|
69
67
|
const detectionOptions = {
|
|
70
68
|
selectedZone: { fromX: minX, toX: maxX, fromY: minY, toY: maxY },
|
|
71
69
|
thresholdFactor: 1,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addToBrushHistory = void 0;
|
|
4
|
+
const Constants_1 = require("../core/Constants");
|
|
3
5
|
function zoomHistoryManager(zoomHistory, nucleus, baseZoom) {
|
|
4
6
|
if (!zoomHistory[nucleus] && !Array.isArray(zoomHistory[nucleus])) {
|
|
5
7
|
zoomHistory[nucleus] = [];
|
|
@@ -32,3 +34,38 @@ function prepareGetLast(historyStack) {
|
|
|
32
34
|
return historyStack.at(-1);
|
|
33
35
|
};
|
|
34
36
|
}
|
|
37
|
+
function addToBrushHistory(draft, options) {
|
|
38
|
+
const { displayerMode } = draft;
|
|
39
|
+
const { trackID, xDomain, yDomain } = options;
|
|
40
|
+
const brushHistory = zoomHistoryManager(
|
|
41
|
+
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
42
|
+
draft.zoom.history,
|
|
43
|
+
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
44
|
+
draft.view.spectra.activeTab);
|
|
45
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
46
|
+
switch (trackID) {
|
|
47
|
+
case 'CENTER_2D':
|
|
48
|
+
draft.xDomain = xDomain;
|
|
49
|
+
draft.yDomain = yDomain;
|
|
50
|
+
break;
|
|
51
|
+
case 'TOP_1D':
|
|
52
|
+
draft.xDomain = xDomain;
|
|
53
|
+
break;
|
|
54
|
+
case 'LEFT_1D':
|
|
55
|
+
draft.yDomain = yDomain;
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
if (brushHistory) {
|
|
61
|
+
brushHistory.push({ xDomain, yDomain });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
draft.xDomain = xDomain;
|
|
66
|
+
if (brushHistory) {
|
|
67
|
+
brushHistory.push({ xDomain, yDomain });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.addToBrushHistory = addToBrushHistory;
|
|
@@ -9,12 +9,12 @@ const merge_1 = __importDefault(require("lodash/merge"));
|
|
|
9
9
|
const LocalStorage_1 = require("../../../utility/LocalStorage");
|
|
10
10
|
const workspaceDefaultProperties_1 = require("../../../workspaces/workspaceDefaultProperties");
|
|
11
11
|
function addWorkspace(draft, action) {
|
|
12
|
-
const {
|
|
12
|
+
const { workspaceKey, data } = action.payload;
|
|
13
13
|
const newWorkSpace = (0, merge_1.default)({}, workspaceDefaultProperties_1.workspaceDefaultProperties,
|
|
14
14
|
// eslint-disable-next-line unicorn/prefer-logical-operator-over-ternary
|
|
15
15
|
data ? data : draft.workspaces[draft.workspace.current], {
|
|
16
16
|
version: 1,
|
|
17
|
-
label:
|
|
17
|
+
label: workspaceKey,
|
|
18
18
|
source: 'user',
|
|
19
19
|
});
|
|
20
20
|
const newWorkspaceKey = (0, uuid_1.v4)();
|
|
@@ -32,7 +32,10 @@ exports.defaultPredictionOptions = {
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
exports.FREQUENCIES = [
|
|
35
|
+
{ value: 40, label: '40 MHz' },
|
|
35
36
|
{ value: 60, label: '60 MHz' },
|
|
37
|
+
{ value: 80, label: '80 MHz' },
|
|
38
|
+
{ value: 90, label: '90 MHz' },
|
|
36
39
|
{ value: 100, label: '100 MHz' },
|
|
37
40
|
{ value: 200, label: '200 MHz' },
|
|
38
41
|
{ value: 300, label: '300 MHz' },
|
|
@@ -44,9 +47,10 @@ exports.FREQUENCIES = [
|
|
|
44
47
|
{ value: 1200, label: '1200 MHz' },
|
|
45
48
|
];
|
|
46
49
|
const baseURL = 'https://nmr-prediction.service.zakodium.com';
|
|
47
|
-
async function predictSpectra(molfile) {
|
|
50
|
+
async function predictSpectra(molfile, logger) {
|
|
48
51
|
const molecule = full_1.default.Molecule.fromMolfile(molfile);
|
|
49
52
|
return (0, nmr_processing_1.predictAll)(molecule, {
|
|
53
|
+
logger,
|
|
50
54
|
predictOptions: {
|
|
51
55
|
C: {
|
|
52
56
|
webserviceURL: `${baseURL}/v1/predict/carbon`,
|
|
@@ -173,6 +177,7 @@ function generated2DSpectrum(params) {
|
|
|
173
177
|
frequency,
|
|
174
178
|
experiment,
|
|
175
179
|
});
|
|
180
|
+
const spectralWidth = getSpectralWidth(experiment, inputOptions);
|
|
176
181
|
const datum = (0, Spectrum2D_1.initiateDatum2D)({
|
|
177
182
|
data: { rr: { ...minMaxContent, noise: 0.01 } },
|
|
178
183
|
display: {
|
|
@@ -186,6 +191,7 @@ function generated2DSpectrum(params) {
|
|
|
186
191
|
originFrequency: frequency,
|
|
187
192
|
baseFrequency: frequency,
|
|
188
193
|
pulseSequence: 'prediction',
|
|
194
|
+
spectralWidth,
|
|
189
195
|
experiment,
|
|
190
196
|
},
|
|
191
197
|
}, []);
|
|
@@ -195,6 +201,26 @@ function generated2DSpectrum(params) {
|
|
|
195
201
|
function get2DWidth(nucleus) {
|
|
196
202
|
return nucleus[0] === nucleus[1] ? 0.02 : { x: 0.02, y: 0.2133 };
|
|
197
203
|
}
|
|
204
|
+
function getSpectralWidth(experiment, options) {
|
|
205
|
+
const formTo = options['1d'];
|
|
206
|
+
switch (experiment) {
|
|
207
|
+
case 'cosy': {
|
|
208
|
+
const { from, to } = formTo['1H'];
|
|
209
|
+
const diff = to - from;
|
|
210
|
+
return [diff, diff];
|
|
211
|
+
}
|
|
212
|
+
case 'hsqc':
|
|
213
|
+
case 'hmbc': {
|
|
214
|
+
const proton = formTo['1H'];
|
|
215
|
+
const carbon = formTo['13C'];
|
|
216
|
+
const protonDiff = proton.to - proton.from;
|
|
217
|
+
const carbonDiff = carbon.to - carbon.from;
|
|
218
|
+
return [protonDiff, carbonDiff];
|
|
219
|
+
}
|
|
220
|
+
default:
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
198
224
|
function calculateFrequency(nucleus, frequency) {
|
|
199
225
|
if (typeof nucleus === 'string') {
|
|
200
226
|
return (0, nmr_processing_1.getFrequency)(nucleus, { nucleus: '1H', frequency });
|
|
@@ -61,13 +61,20 @@ function detectSignal(data, options) {
|
|
|
61
61
|
exports.default = detectSignal;
|
|
62
62
|
function joinCouplings(result) {
|
|
63
63
|
const { chemShift: delta, js } = result;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
let jCouplings = js;
|
|
65
|
+
if (js.length > 1) {
|
|
66
|
+
try {
|
|
67
|
+
jCouplings = (0, nmr_processing_1.signalJoinCouplings)({
|
|
68
68
|
delta,
|
|
69
69
|
js,
|
|
70
|
-
}, { tolerance: 0.6, ignoreDiaIDs: true }).js
|
|
71
|
-
|
|
70
|
+
}, { tolerance: 0.6, ignoreDiaIDs: true }).js;
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
reportError(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
delta,
|
|
78
|
+
js: jCouplings,
|
|
72
79
|
};
|
|
73
80
|
}
|
|
@@ -5,24 +5,29 @@ const nmr_processing_1 = require("nmr-processing");
|
|
|
5
5
|
const initiateDatum1D_1 = require("../initiateDatum1D");
|
|
6
6
|
function generateSpectrumFromRanges(ranges, info, usedColors) {
|
|
7
7
|
const { nucleus, solvent, name = null, frequency = 400 } = info;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
frequency,
|
|
11
|
-
nbPoints: 2 ** 17,
|
|
12
|
-
});
|
|
13
|
-
const datum = (0, initiateDatum1D_1.initiateDatum1D)({
|
|
14
|
-
data: { x, im: null, re: y },
|
|
15
|
-
info: {
|
|
8
|
+
try {
|
|
9
|
+
const { x, y } = (0, nmr_processing_1.rangesToXY)(ranges, {
|
|
16
10
|
nucleus,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
frequency,
|
|
12
|
+
nbPoints: 2 ** 17,
|
|
13
|
+
});
|
|
14
|
+
const datum = (0, initiateDatum1D_1.initiateDatum1D)({
|
|
15
|
+
data: { x, im: null, re: y },
|
|
16
|
+
info: {
|
|
17
|
+
nucleus,
|
|
18
|
+
originFrequency: frequency,
|
|
19
|
+
baseFrequency: frequency,
|
|
20
|
+
pulseSequence: '',
|
|
21
|
+
solvent,
|
|
22
|
+
isFt: true,
|
|
23
|
+
name,
|
|
24
|
+
},
|
|
25
|
+
ranges: { values: ranges, options: { sum: 100 } },
|
|
26
|
+
}, { usedColors });
|
|
27
|
+
return datum;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
reportError(error);
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
exports.generateSpectrumFromRanges = generateSpectrumFromRanges;
|
package/lib-cjs/versionInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.39.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib-cjs/component/NMRium.js",
|
|
7
7
|
"module": "lib/component/NMRium.js",
|
|
@@ -81,12 +81,12 @@
|
|
|
81
81
|
"ml-baseline-correction-regression": "^1.0.2",
|
|
82
82
|
"ml-conrec": "^5.0.2",
|
|
83
83
|
"ml-gsd": "^12.1.3",
|
|
84
|
-
"ml-spectra-processing": "^12.
|
|
84
|
+
"ml-spectra-processing": "^12.5.0",
|
|
85
85
|
"ml-stat": "^1.3.3",
|
|
86
86
|
"multiplet-analysis": "^2.1.1",
|
|
87
87
|
"nmr-correlation": "^2.3.3",
|
|
88
88
|
"nmr-load-save": "^0.13.2",
|
|
89
|
-
"nmr-processing": "^9.7.
|
|
89
|
+
"nmr-processing": "^9.7.3",
|
|
90
90
|
"nmredata": "^0.9.2",
|
|
91
91
|
"numeral": "^2.0.6",
|
|
92
92
|
"openchemlib": "^8.3.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"react-plot": "^1.4.2",
|
|
105
105
|
"react-rnd": "^10.4.1",
|
|
106
106
|
"react-science": "^0.24.2",
|
|
107
|
-
"react-slider": "^2.0.
|
|
107
|
+
"react-slider": "^2.0.6",
|
|
108
108
|
"react-table": "^7.8.0",
|
|
109
109
|
"react-transition-group": "^4.4.5",
|
|
110
110
|
"react-use": "^17.4.0",
|
|
@@ -118,9 +118,9 @@
|
|
|
118
118
|
"@playwright/test": "^1.35.1",
|
|
119
119
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
120
120
|
"@types/d3": "^7.4.0",
|
|
121
|
-
"@types/node": "^20.3.
|
|
121
|
+
"@types/node": "^20.3.2",
|
|
122
122
|
"@types/papaparse": "^5.3.7",
|
|
123
|
-
"@types/react": "^18.2.
|
|
123
|
+
"@types/react": "^18.2.14",
|
|
124
124
|
"@types/react-dom": "^18.2.6",
|
|
125
125
|
"@types/react-table": "^7.7.14",
|
|
126
126
|
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
@@ -133,16 +133,16 @@
|
|
|
133
133
|
"modern-normalize": "^2.0.0",
|
|
134
134
|
"postcss-styled-syntax": "^0.4.0",
|
|
135
135
|
"prettier": "^2.8.8",
|
|
136
|
-
"rc-menu": "^9.
|
|
136
|
+
"rc-menu": "^9.10.0",
|
|
137
137
|
"react": "^18.2.0",
|
|
138
138
|
"react-dom": "^18.2.0",
|
|
139
|
-
"react-router-dom": "^6.
|
|
139
|
+
"react-router-dom": "^6.14.0",
|
|
140
140
|
"rimraf": "^5.0.1",
|
|
141
141
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
142
142
|
"serve": "^14.2.0",
|
|
143
|
-
"stylelint": "^15.
|
|
143
|
+
"stylelint": "^15.9.0",
|
|
144
144
|
"stylelint-config-standard": "^33.0.0",
|
|
145
|
-
"typescript": "~5.1.
|
|
145
|
+
"typescript": "~5.1.6",
|
|
146
146
|
"vite": "^4.3.9",
|
|
147
147
|
"vitest": "^0.32.2"
|
|
148
148
|
}
|