nmrium 0.22.0 → 0.23.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/FooterBanner.js +1 -1
- package/lib/component/NMRium.d.ts +3 -6
- package/lib/component/NMRium.js +1 -7
- package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
- package/lib/component/modal/PredictSpectraModal.js +2 -32
- package/lib/component/modal/setting/DisplayTabContent.js +4 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +10 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +9 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib/component/panels/Panels.js +7 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +6 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +88 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +2 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.js +33 -0
- package/lib/component/reducer/actions/LoadActions.js +7 -0
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/preferencesReducer.js +3 -4
- package/lib/component/workspaces/basic.js +1 -0
- package/lib/component/workspaces/exercise1D.js +1 -0
- package/lib/component/workspaces/process1D.js +1 -0
- package/lib/data/PredictionManager.d.ts +35 -3
- package/lib/data/PredictionManager.js +45 -7
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +1 -1
- package/lib-cjs/component/NMRium.js +1 -8
- package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +4 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib-cjs/component/panels/Panels.js +7 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +112 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +39 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +7 -0
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +3 -4
- package/lib-cjs/component/workspaces/basic.js +1 -0
- package/lib-cjs/component/workspaces/exercise1D.js +1 -0
- package/lib-cjs/component/workspaces/process1D.js +1 -0
- package/lib-cjs/data/PredictionManager.js +46 -8
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,37 @@ import { DatumKind } from './constants/SignalsKinds';
|
|
|
4
4
|
import { initiateDatum1D, mapRanges, updateIntegralsRelativeValues, } from './data1d/Spectrum1D';
|
|
5
5
|
import { initiateDatum2D } from './data2d/Spectrum2D';
|
|
6
6
|
import generateID from './utilities/generateID';
|
|
7
|
+
export const defaultPredictionOptions = {
|
|
8
|
+
frequency: 400,
|
|
9
|
+
'1d': {
|
|
10
|
+
'1H': { from: -1, to: 12 },
|
|
11
|
+
'13C': { from: -5, to: 220 },
|
|
12
|
+
nbPoints: 2 ** 17,
|
|
13
|
+
lineWidth: 1,
|
|
14
|
+
},
|
|
15
|
+
'2d': {
|
|
16
|
+
nbPoints: { x: 1024, y: 1024 },
|
|
17
|
+
},
|
|
18
|
+
spectra: {
|
|
19
|
+
proton: true,
|
|
20
|
+
carbon: true,
|
|
21
|
+
cosy: true,
|
|
22
|
+
hsqc: true,
|
|
23
|
+
hmbc: true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const FREQUENCIES = [
|
|
27
|
+
{ key: 1, value: 60, label: '60 MHz' },
|
|
28
|
+
{ key: 2, value: 100, label: '100 MHz' },
|
|
29
|
+
{ key: 3, value: 200, label: '200 MHz' },
|
|
30
|
+
{ key: 4, value: 300, label: '300 MHz' },
|
|
31
|
+
{ key: 5, value: 400, label: '400 MHz' },
|
|
32
|
+
{ key: 6, value: 500, label: '500 MHz' },
|
|
33
|
+
{ key: 7, value: 600, label: '600 MHz' },
|
|
34
|
+
{ key: 8, value: 800, label: '800 MHz' },
|
|
35
|
+
{ key: 9, value: 1000, label: '1000 MHz' },
|
|
36
|
+
{ key: 10, value: 1200, label: '1200 MHz' },
|
|
37
|
+
];
|
|
7
38
|
const baseURL = 'https://nmr-prediction.service.zakodium.com';
|
|
8
39
|
export async function predictSpectra(molfile) {
|
|
9
40
|
const molecule = OCL.Molecule.fromMolfile(molfile);
|
|
@@ -15,8 +46,9 @@ export async function predictSpectra(molfile) {
|
|
|
15
46
|
},
|
|
16
47
|
});
|
|
17
48
|
}
|
|
18
|
-
export function generateSpectra(data, inputOptions
|
|
49
|
+
export function generateSpectra(data, inputOptions) {
|
|
19
50
|
const spectra = [];
|
|
51
|
+
const color = '#593315';
|
|
20
52
|
for (const experiment in data) {
|
|
21
53
|
if (inputOptions.spectra[experiment]) {
|
|
22
54
|
const spectrum = data[experiment];
|
|
@@ -27,7 +59,7 @@ export function generateSpectra(data, inputOptions, usedColors) {
|
|
|
27
59
|
spectrum,
|
|
28
60
|
inputOptions,
|
|
29
61
|
experiment,
|
|
30
|
-
|
|
62
|
+
color,
|
|
31
63
|
});
|
|
32
64
|
spectra.push(datum);
|
|
33
65
|
break;
|
|
@@ -39,7 +71,7 @@ export function generateSpectra(data, inputOptions, usedColors) {
|
|
|
39
71
|
spectrum,
|
|
40
72
|
inputOptions,
|
|
41
73
|
experiment,
|
|
42
|
-
|
|
74
|
+
color,
|
|
43
75
|
});
|
|
44
76
|
spectra.push(datum);
|
|
45
77
|
break;
|
|
@@ -52,7 +84,7 @@ export function generateSpectra(data, inputOptions, usedColors) {
|
|
|
52
84
|
return spectra;
|
|
53
85
|
}
|
|
54
86
|
function generated1DSpectrum(params) {
|
|
55
|
-
const { spectrum, inputOptions, experiment,
|
|
87
|
+
const { spectrum, inputOptions, experiment, color } = params;
|
|
56
88
|
const { signals, ranges, nucleus } = spectrum;
|
|
57
89
|
const { '1d': { nbPoints }, frequency: freq, } = inputOptions;
|
|
58
90
|
const frequency = getFrequency(nucleus, freq);
|
|
@@ -63,6 +95,9 @@ function generated1DSpectrum(params) {
|
|
|
63
95
|
});
|
|
64
96
|
const datum = initiateDatum1D({
|
|
65
97
|
data: { x, im: null, re: y },
|
|
98
|
+
display: {
|
|
99
|
+
color,
|
|
100
|
+
},
|
|
66
101
|
info: {
|
|
67
102
|
nucleus,
|
|
68
103
|
originFrequency: frequency,
|
|
@@ -72,7 +107,7 @@ function generated1DSpectrum(params) {
|
|
|
72
107
|
experiment,
|
|
73
108
|
isFt: true,
|
|
74
109
|
},
|
|
75
|
-
},
|
|
110
|
+
}, []);
|
|
76
111
|
datum.ranges.values = mapRanges(ranges, datum);
|
|
77
112
|
updateIntegralsRelativeValues(datum);
|
|
78
113
|
return datum;
|
|
@@ -101,7 +136,7 @@ function mapZones(zones) {
|
|
|
101
136
|
}, []);
|
|
102
137
|
}
|
|
103
138
|
function generated2DSpectrum(params) {
|
|
104
|
-
const { spectrum, inputOptions, experiment,
|
|
139
|
+
const { spectrum, inputOptions, experiment, color } = params;
|
|
105
140
|
const { signals, zones, nuclei } = spectrum;
|
|
106
141
|
const xOption = inputOptions['1d'][nuclei[0]];
|
|
107
142
|
const yOption = inputOptions['1d'][nuclei[1]];
|
|
@@ -118,6 +153,9 @@ function generated2DSpectrum(params) {
|
|
|
118
153
|
});
|
|
119
154
|
const datum = initiateDatum2D({
|
|
120
155
|
data: { ...spectrumData, noise: 0.01 },
|
|
156
|
+
display: {
|
|
157
|
+
positiveColor: experiment === 'hmbc' ? '#e68337' : color,
|
|
158
|
+
},
|
|
121
159
|
info: {
|
|
122
160
|
nucleus: nuclei,
|
|
123
161
|
originFrequency: frequency,
|
|
@@ -125,7 +163,7 @@ function generated2DSpectrum(params) {
|
|
|
125
163
|
pulseSequence: experiment,
|
|
126
164
|
experiment: '2d',
|
|
127
165
|
},
|
|
128
|
-
},
|
|
166
|
+
}, []);
|
|
129
167
|
datum.zones.values = mapZones(zones);
|
|
130
168
|
return datum;
|
|
131
169
|
}
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.23.0' };
|
|
@@ -91,7 +91,7 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
|
|
|
91
91
|
100).toFixed(2), "%"] }, void 0)] }, void 0))] }, void 0)), activeSpectrum && ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "separator" }, void 0), (0, jsx_runtime_1.jsx)(io5_1.IoPulseSharp, {}, void 0), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "Intensity: " }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "value yvalue", children: format(getYValue(position.x)) }, void 0)] }, void 0)] }, void 0))] }, void 0));
|
|
92
92
|
}
|
|
93
93
|
const MemoizedFooterBanner = (0, react_2.memo)(FooterBannerInner);
|
|
94
|
-
const emptyData = { info: {}, data:
|
|
94
|
+
const emptyData = { info: {}, data: null };
|
|
95
95
|
function FooterBanner() {
|
|
96
96
|
const { margin, width, height, activeSpectrum, activeTab } = (0, ChartContext_1.useChartData)();
|
|
97
97
|
const spectrum = (0, useSpectrum_1.default)(emptyData);
|
|
@@ -22,7 +22,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.NMRiumWorkspaces = void 0;
|
|
26
25
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
27
26
|
/** @jsxImportSource @emotion/react */
|
|
28
27
|
const react_1 = require("@emotion/react");
|
|
@@ -121,12 +120,6 @@ const containerStyles = (0, react_1.css) `
|
|
|
121
120
|
border-right: 0.55px #bbbbbb solid;
|
|
122
121
|
}
|
|
123
122
|
`;
|
|
124
|
-
var NMRiumWorkspaces;
|
|
125
|
-
(function (NMRiumWorkspaces) {
|
|
126
|
-
NMRiumWorkspaces["EXERCISE_1D"] = "exercise1D";
|
|
127
|
-
NMRiumWorkspaces["PROCESS_1D"] = "process1D";
|
|
128
|
-
NMRiumWorkspaces["DEFAULT"] = "default";
|
|
129
|
-
})(NMRiumWorkspaces = exports.NMRiumWorkspaces || (exports.NMRiumWorkspaces = {}));
|
|
130
123
|
const defaultPreferences = {};
|
|
131
124
|
const defaultData = {
|
|
132
125
|
spectra: [],
|
|
@@ -134,7 +127,7 @@ const defaultData = {
|
|
|
134
127
|
function NMRium(props) {
|
|
135
128
|
return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.RootLayout, { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, children: (0, jsx_runtime_1.jsx)(InnerNMRium, { ...props }, void 0) }, void 0) }, void 0));
|
|
136
129
|
}
|
|
137
|
-
function InnerNMRium({ data: dataProp = defaultData, workspace =
|
|
130
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace = 'default', preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, }) {
|
|
138
131
|
const rootRef = (0, react_2.useRef)(null);
|
|
139
132
|
const elementsWraperRef = (0, react_2.useRef)(null);
|
|
140
133
|
const [show, toggle] = (0, react_use_1.useToggle)(false);
|
|
@@ -27,6 +27,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
27
27
|
const react_1 = require("@emotion/react");
|
|
28
28
|
const react_2 = require("react");
|
|
29
29
|
const Yup = __importStar(require("yup"));
|
|
30
|
+
const PredictionManager_1 = require("../../data/PredictionManager");
|
|
30
31
|
const generateNumbersPowerOfX_1 = __importDefault(require("../../data/utilities/generateNumbersPowerOfX"));
|
|
31
32
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
32
33
|
const CheckBox_1 = __importDefault(require("../elements/CheckBox"));
|
|
@@ -101,41 +102,10 @@ const styles = (0, react_1.css) `
|
|
|
101
102
|
color: #005d9e;
|
|
102
103
|
}
|
|
103
104
|
`;
|
|
104
|
-
const FREQUENCIES = [
|
|
105
|
-
{ key: 1, value: 60, label: '60 MHz' },
|
|
106
|
-
{ key: 2, value: 100, label: '100 MHz' },
|
|
107
|
-
{ key: 3, value: 200, label: '200 MHz' },
|
|
108
|
-
{ key: 4, value: 300, label: '300 MHz' },
|
|
109
|
-
{ key: 5, value: 400, label: '400 MHz' },
|
|
110
|
-
{ key: 6, value: 500, label: '500 MHz' },
|
|
111
|
-
{ key: 7, value: 600, label: '600 MHz' },
|
|
112
|
-
{ key: 8, value: 800, label: '800 MHz' },
|
|
113
|
-
{ key: 9, value: 1000, label: '1000 MHz' },
|
|
114
|
-
{ key: 10, value: 1200, label: '1200 MHz' },
|
|
115
|
-
];
|
|
116
105
|
const NUMBER_OF_POINTS_1D = (0, generateNumbersPowerOfX_1.default)(12, 19);
|
|
117
106
|
const NUMBER_OF_POINTS_2D = (0, generateNumbersPowerOfX_1.default)(10, 10, {
|
|
118
107
|
format: (value) => value,
|
|
119
108
|
});
|
|
120
|
-
const INITIAL_VALUE = {
|
|
121
|
-
frequency: 400,
|
|
122
|
-
'1d': {
|
|
123
|
-
'1H': { from: -1, to: 12 },
|
|
124
|
-
'13C': { from: -5, to: 220 },
|
|
125
|
-
nbPoints: 2 ** 17,
|
|
126
|
-
lineWidth: 1,
|
|
127
|
-
},
|
|
128
|
-
'2d': {
|
|
129
|
-
nbPoints: { x: 1024, y: 1024 },
|
|
130
|
-
},
|
|
131
|
-
spectra: {
|
|
132
|
-
proton: true,
|
|
133
|
-
carbon: false,
|
|
134
|
-
cosy: false,
|
|
135
|
-
hsqc: false,
|
|
136
|
-
hmbc: false,
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
109
|
const predictionFormValidation = Yup.object().shape({
|
|
140
110
|
frequency: Yup.number().integer().required().label('Frequency'),
|
|
141
111
|
'1d': Yup.object({
|
|
@@ -181,7 +151,7 @@ function PredictSpectraModal({ onClose = () => null, molfile, }) {
|
|
|
181
151
|
const initValues = (0, react_2.useMemo)(() => {
|
|
182
152
|
const { isApproved: isAgree, ...options } = predictionPreferences;
|
|
183
153
|
setApproved(isAgree);
|
|
184
|
-
return Object.assign(
|
|
154
|
+
return Object.assign(PredictionManager_1.defaultPredictionOptions, options);
|
|
185
155
|
}, [predictionPreferences]);
|
|
186
156
|
const submitHandler = (0, react_2.useCallback)(async (values) => {
|
|
187
157
|
setPredictionPreferences({ ...values, isApproved });
|
|
@@ -208,6 +178,6 @@ function PredictSpectraModal({ onClose = () => null, molfile, }) {
|
|
|
208
178
|
const approveCheckHandler = (0, react_2.useCallback)((e) => {
|
|
209
179
|
setApproved(e.target.checked);
|
|
210
180
|
}, []);
|
|
211
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: refForm, initialValues: initValues, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Spectrometer Frequency :" }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "1D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Line Width : " }, void 0), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }, void 0), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: { width: 290, height: 30, margin: 0 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "2D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "middle-x", children: " X " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "row margin-10", children: (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "Spectra " }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", style: { justifyContent: 'space-between' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.proton" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.carbon" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.cosy" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "COSY", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hsqc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HSQC", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hmbc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HMBC", className: "nucleus-label" }, void 0)] }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "warning-container", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.default, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), (0, jsx_runtime_1.jsx)("p", { children: "I confirm that the chemical structure is not confidential." }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn", disabled: !isApproved, children: "Predict spectrum" }, void 0) }, void 0)] }, void 0));
|
|
181
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: refForm, initialValues: initValues, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Spectrometer Frequency :" }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: PredictionManager_1.FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "1D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Line Width : " }, void 0), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }, void 0), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: { width: 290, height: 30, margin: 0 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "2D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "middle-x", children: " X " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "row margin-10", children: (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "Spectra " }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", style: { justifyContent: 'space-between' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.proton" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.carbon" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.cosy" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "COSY", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hsqc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HSQC", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hmbc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HMBC", className: "nucleus-label" }, void 0)] }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "warning-container", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.default, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), (0, jsx_runtime_1.jsx)("p", { children: "I confirm that the chemical structure is not confidential." }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn", disabled: !isApproved, children: "Predict spectrum" }, void 0) }, void 0)] }, void 0));
|
|
212
182
|
}
|
|
213
183
|
exports.default = PredictSpectraModal;
|
|
@@ -51,6 +51,10 @@ const LIST = [
|
|
|
51
51
|
label: 'Database Panel',
|
|
52
52
|
name: 'display.panels.hideDatabasePanel',
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
label: 'Prediction Panel',
|
|
56
|
+
name: 'display.panels.hidePredictionPanel',
|
|
57
|
+
},
|
|
54
58
|
{
|
|
55
59
|
label: 'Experimental Features',
|
|
56
60
|
name: 'display.general.hideExperimentalFeatures',
|
|
@@ -23,16 +23,21 @@ const useAtomAssignment_1 = __importDefault(require("./useAtomAssignment"));
|
|
|
23
23
|
const styles = {
|
|
24
24
|
panel: (0, react_1.css)({
|
|
25
25
|
display: 'flex',
|
|
26
|
+
overflow: 'auto',
|
|
26
27
|
flexGrow: 1,
|
|
27
28
|
width: '100%',
|
|
28
29
|
height: '100%',
|
|
29
30
|
flexDirection: 'column',
|
|
30
31
|
}),
|
|
31
|
-
|
|
32
|
+
innerPanel: (0, react_1.css)({
|
|
32
33
|
display: 'flex',
|
|
33
|
-
flex: '1
|
|
34
|
+
flex: '1',
|
|
34
35
|
flexDirection: 'column',
|
|
35
|
-
|
|
36
|
+
overflow: 'auto',
|
|
37
|
+
}),
|
|
38
|
+
molecule: (0, react_1.css)({
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flex: '1',
|
|
36
41
|
}),
|
|
37
42
|
toolbar: (0, react_1.css)({
|
|
38
43
|
display: 'flex',
|
|
@@ -57,7 +62,7 @@ const styles = {
|
|
|
57
62
|
minHeight: 0,
|
|
58
63
|
}),
|
|
59
64
|
};
|
|
60
|
-
function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab, displayerMode, }) {
|
|
65
|
+
function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab, displayerMode, onMoleculeChange, actionsOptions, children, }) {
|
|
61
66
|
const [currentIndex, setCurrentIndex] = (0, react_2.useState)(0);
|
|
62
67
|
const [molecules, setMolecules] = (0, react_2.useState)([]);
|
|
63
68
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
@@ -73,6 +78,9 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
|
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
80
|
}, [molecules.length, moleculesProp]);
|
|
81
|
+
(0, react_2.useEffect)(() => {
|
|
82
|
+
onMoleculeChange?.(molecules[currentIndex] || null);
|
|
83
|
+
}, [currentIndex, molecules, onMoleculeChange]);
|
|
76
84
|
const handleReplaceMolecule = (0, react_2.useCallback)((key, molfile) => {
|
|
77
85
|
dispatch({ type: Types_1.SET_MOLECULE, molfile, key });
|
|
78
86
|
}, [dispatch]);
|
|
@@ -86,21 +94,21 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
|
|
|
86
94
|
const moleculeIndexHandler = (0, react_2.useCallback)((index) => {
|
|
87
95
|
setCurrentIndex(index);
|
|
88
96
|
}, []);
|
|
89
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: styles.panel, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.molecule, children: (0, jsx_runtime_1.jsx)(NextPrev_1.default, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => ((0, jsx_runtime_1.jsxs)("div", { css: styles.items, children: [(0, jsx_runtime_1.jsxs)("span", { css: styles.toolbar, children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: mol.mf }, void 0), " - ", mol.mw?.toFixed(2)] }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: styles.panel, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler, actionsOptions: actionsOptions }, void 0), (0, jsx_runtime_1.jsxs)("div", { css: styles.innerPanel, children: [(0, jsx_runtime_1.jsx)("div", { css: styles.molecule, children: (0, jsx_runtime_1.jsx)(NextPrev_1.default, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => ((0, jsx_runtime_1.jsxs)("div", { css: styles.items, children: [(0, jsx_runtime_1.jsxs)("span", { css: styles.toolbar, children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: mol.mf }, void 0), " - ", mol.mw?.toFixed(2)] }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
|
|
98
|
+
backgroundColor: (index + 1) % 2 !== 0 ? '#fafafa' : 'white',
|
|
99
|
+
}, children: (0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ height, width }) => {
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, id: `molSVG${index}`, width: width, height: height, molfile: mol.molfile || '', setMolfile: (molfile) => handleReplaceMolecule(mol.key, molfile), setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight &&
|
|
101
|
+
currentDiaIDsToHighlight.length > 0
|
|
102
|
+
? 'red'
|
|
103
|
+
: '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight &&
|
|
104
|
+
currentDiaIDsToHighlight.length > 0
|
|
105
|
+
? currentDiaIDsToHighlight
|
|
106
|
+
: assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover }, void 0));
|
|
107
|
+
} }, void 0) }, void 0)] }, mol.key)))) : ((0, jsx_runtime_1.jsx)("div", { css: styles.slider, style: { height: '100%' }, onClick: () => openMoleculeEditorHandler(), children: (0, jsx_runtime_1.jsx)("span", { children: "Click to draw molecule" }, void 0) }, void 0)) }, void 0) }, void 0), children] }, void 0)] }, void 0));
|
|
100
108
|
}
|
|
101
109
|
const MemoizedMoleculePanel = (0, react_2.memo)(MoleculePanelInner);
|
|
102
110
|
const emptyData = { ranges: {}, zones: {} };
|
|
103
|
-
function MoleculePanel() {
|
|
111
|
+
function MoleculePanel({ onMoleculeChange, children, actionsOptions, }) {
|
|
104
112
|
const { molecules, displayerMode, activeTab } = (0, ChartContext_1.useChartData)();
|
|
105
113
|
const data = (0, useSpectrum_1.default)(emptyData);
|
|
106
114
|
const ranges = data?.ranges || {};
|
|
@@ -111,6 +119,8 @@ function MoleculePanel() {
|
|
|
111
119
|
activeTab,
|
|
112
120
|
ranges,
|
|
113
121
|
zones,
|
|
114
|
-
|
|
122
|
+
onMoleculeChange,
|
|
123
|
+
actionsOptions,
|
|
124
|
+
}, children: children }, void 0));
|
|
115
125
|
}
|
|
116
126
|
exports.default = MoleculePanel;
|
|
@@ -60,7 +60,7 @@ const MOL_EXPORT_MENU = [
|
|
|
60
60
|
label: 'Export as SVG',
|
|
61
61
|
},
|
|
62
62
|
];
|
|
63
|
-
function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange = () => null, onOpenMoleculeEditor = () => null, }) {
|
|
63
|
+
function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange = () => null, onOpenMoleculeEditor = () => null, actionsOptions = {}, }) {
|
|
64
64
|
const alert = (0, Alert_1.useAlert)();
|
|
65
65
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
66
66
|
const modal = (0, Modal_1.useModal)();
|
|
@@ -126,7 +126,7 @@ function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange =
|
|
|
126
126
|
width: 600,
|
|
127
127
|
});
|
|
128
128
|
}, [modal, molecules, currentIndex]);
|
|
129
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: toolbarStyle, children: [(0, jsx_runtime_1.jsx)(MenuButton_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}, void 0), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler }, void 0), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Paste molfile", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handlePaste, children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Add Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Delete Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handleDelete, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}, void 0) }, void 0) }, void 0), molecules && molecules.length > 0 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}, void 0) }, void 0)), (0, jsx_runtime_1.jsxs)("p", { children: [molecules &&
|
|
129
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: toolbarStyle, children: [!actionsOptions.hideExport && ((0, jsx_runtime_1.jsx)(MenuButton_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}, void 0), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler }, void 0)), !actionsOptions.hidePast && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Paste molfile", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handlePaste, children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hideAdd && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Add Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hideDelete && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Delete Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handleDelete, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hidePredict && molecules && molecules.length > 0 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}, void 0) }, void 0)), (0, jsx_runtime_1.jsxs)("p", { children: [molecules &&
|
|
130
130
|
molecules.length > 0 &&
|
|
131
131
|
`${+(currentIndex + 1)} / ${molecules.length}`, ' '] }, void 0)] }, void 0));
|
|
132
132
|
}
|
|
@@ -25,6 +25,7 @@ const SummaryPanel_1 = __importDefault(require("./SummaryPanel/SummaryPanel"));
|
|
|
25
25
|
const ZonesPanel_1 = __importDefault(require("./ZonesPanel/ZonesPanel"));
|
|
26
26
|
const DatabasePanel_1 = __importDefault(require("./databasePanel/DatabasePanel"));
|
|
27
27
|
const FilterPanel_1 = __importDefault(require("./filtersPanel/FilterPanel"));
|
|
28
|
+
const PredictionPanel_1 = __importDefault(require("./predictionPanel/PredictionPanel"));
|
|
28
29
|
const accordionItems = [
|
|
29
30
|
{
|
|
30
31
|
title: 'Spectra',
|
|
@@ -107,6 +108,12 @@ const accordionItems = [
|
|
|
107
108
|
mode: null,
|
|
108
109
|
isExperimental: true,
|
|
109
110
|
},
|
|
111
|
+
{
|
|
112
|
+
title: 'Prediction',
|
|
113
|
+
component: (0, jsx_runtime_1.jsx)(PredictionPanel_1.default, {}, void 0),
|
|
114
|
+
hidePreferenceKey: 'hidePredictionPanel',
|
|
115
|
+
mode: null,
|
|
116
|
+
},
|
|
110
117
|
];
|
|
111
118
|
exports.TOOLS_PANELS_ACCORDION = {
|
|
112
119
|
null: 'Spectra',
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
26
|
+
/** @jsxImportSource @emotion/react */
|
|
27
|
+
const react_1 = require("@emotion/react");
|
|
28
|
+
const react_2 = require("react");
|
|
29
|
+
const Yup = __importStar(require("yup"));
|
|
30
|
+
const PredictionManager_1 = require("../../../data/PredictionManager");
|
|
31
|
+
const IsotopesViewer_1 = __importDefault(require("../../elements/IsotopesViewer"));
|
|
32
|
+
const Label_1 = __importDefault(require("../../elements/Label"));
|
|
33
|
+
const FormikErrorsSummary_1 = __importDefault(require("../../elements/formik/FormikErrorsSummary"));
|
|
34
|
+
const FormikForm_1 = __importDefault(require("../../elements/formik/FormikForm"));
|
|
35
|
+
const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
|
|
36
|
+
const FormikSelect_1 = __importDefault(require("../../elements/formik/FormikSelect"));
|
|
37
|
+
const styles = (0, react_1.css) `
|
|
38
|
+
padding: 10px;
|
|
39
|
+
border-top: solid #f2f2f2 1px;
|
|
40
|
+
|
|
41
|
+
.row {
|
|
42
|
+
flex: row;
|
|
43
|
+
display: flex;
|
|
44
|
+
padding-bottom: 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.inner-content {
|
|
48
|
+
flex: 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.custom-label {
|
|
52
|
+
width: 160px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.footer-container {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: row-reverse;
|
|
58
|
+
align-items: flex-end;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.btn:not([disabled]):hover {
|
|
62
|
+
background-color: #ffffff;
|
|
63
|
+
}
|
|
64
|
+
.btn:hover {
|
|
65
|
+
background-color: #f2f2f2 !important;
|
|
66
|
+
}
|
|
67
|
+
.btn:disabled {
|
|
68
|
+
opacity: 0.5;
|
|
69
|
+
}
|
|
70
|
+
.btn {
|
|
71
|
+
border: none;
|
|
72
|
+
padding: 0 15px;
|
|
73
|
+
background-color: #ffffff;
|
|
74
|
+
border-radius: 5px;
|
|
75
|
+
height: 25px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.input {
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
border-radius: 5px;
|
|
81
|
+
border: 1px solid #cccccc;
|
|
82
|
+
padding: 5px;
|
|
83
|
+
width: 100px;
|
|
84
|
+
margin-right: 10px;
|
|
85
|
+
height: initial !important;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
const predictionFormValidation = Yup.object().shape({
|
|
89
|
+
frequency: Yup.number().integer().required().label('Frequency'),
|
|
90
|
+
'1d': Yup.object({
|
|
91
|
+
'1H': Yup.object({
|
|
92
|
+
from: Yup.number().integer().required().label("1H ' From ' "),
|
|
93
|
+
to: Yup.number().integer().required().label("1H ' To ' "),
|
|
94
|
+
}),
|
|
95
|
+
'13C': Yup.object().shape({
|
|
96
|
+
from: Yup.number().integer().required().label("13C ' From ' "),
|
|
97
|
+
to: Yup.number().integer().required().label("13C ' To ' "),
|
|
98
|
+
}),
|
|
99
|
+
lineWidth: Yup.number().integer().min(1).required().label('Line Width'),
|
|
100
|
+
}),
|
|
101
|
+
});
|
|
102
|
+
function PredictionOptions({ onPredict = () => null }) {
|
|
103
|
+
const refForm = (0, react_2.useRef)();
|
|
104
|
+
const handleSave = (0, react_2.useCallback)(() => {
|
|
105
|
+
refForm.current.submitForm();
|
|
106
|
+
}, []);
|
|
107
|
+
const submitHandler = (0, react_2.useCallback)(async (values) => {
|
|
108
|
+
onPredict(values);
|
|
109
|
+
}, [onPredict]);
|
|
110
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: refForm, initialValues: PredictionManager_1.defaultPredictionOptions, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Frequency : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: PredictionManager_1.FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Line Width : " }, void 0), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }, void 0), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " }, void 0)] }, void 0)] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn", children: "Predict spectrum" }, void 0) }, void 0)] }, void 0));
|
|
111
|
+
}
|
|
112
|
+
exports.default = PredictionOptions;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
9
|
+
const Alert_1 = require("../../elements/popup/Alert");
|
|
10
|
+
const Types_1 = require("../../reducer/types/Types");
|
|
11
|
+
const MoleculePanel_1 = __importDefault(require("../MoleculesPanel/MoleculePanel"));
|
|
12
|
+
const PredictionOptions_1 = __importDefault(require("./PredictionOptions"));
|
|
13
|
+
function PredictionPane() {
|
|
14
|
+
const [molecule, setMolecule] = (0, react_1.useState)();
|
|
15
|
+
const changeHandler = (0, react_1.useCallback)((molecule) => {
|
|
16
|
+
setMolecule(molecule);
|
|
17
|
+
}, []);
|
|
18
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
19
|
+
const alert = (0, Alert_1.useAlert)();
|
|
20
|
+
const predictHandler = (0, react_1.useCallback)(async (values) => {
|
|
21
|
+
if (molecule) {
|
|
22
|
+
dispatch({
|
|
23
|
+
type: Types_1.SET_LOADING_FLAG,
|
|
24
|
+
isLoading: true,
|
|
25
|
+
});
|
|
26
|
+
const hideLoading = await alert.showLoading(`Predict 1H, 13C, COSY, HSQC, and HMBC in progress`);
|
|
27
|
+
dispatch({
|
|
28
|
+
type: Types_1.PREDICT_SPECTRA,
|
|
29
|
+
payload: { mol: molecule, options: values },
|
|
30
|
+
});
|
|
31
|
+
hideLoading();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
alert.error('No Molecule selected');
|
|
35
|
+
}
|
|
36
|
+
}, [alert, dispatch, molecule]);
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(MoleculePanel_1.default, { onMoleculeChange: changeHandler, actionsOptions: { hidePredict: true, hideDelete: true, hideExport: true }, children: (0, jsx_runtime_1.jsx)(PredictionOptions_1.default, { onPredict: predictHandler }, void 0) }, void 0));
|
|
38
|
+
}
|
|
39
|
+
exports.default = PredictionPane;
|
|
@@ -26,6 +26,11 @@ const MoleculeManager = __importStar(require("../../../data/molecules/MoleculeMa
|
|
|
26
26
|
const Constants_1 = require("../../panels/SummaryPanel/CorrelationTable/Constants");
|
|
27
27
|
const PreferencesActions_1 = require("./PreferencesActions");
|
|
28
28
|
const ToolsActions_1 = require("./ToolsActions");
|
|
29
|
+
function resetState(draft) {
|
|
30
|
+
draft.activeSpectrum = null;
|
|
31
|
+
draft.activeTab = '';
|
|
32
|
+
draft.tabActiveSpectrum = {};
|
|
33
|
+
}
|
|
29
34
|
function setIsLoading(draft, isLoading) {
|
|
30
35
|
draft.isLoading = isLoading;
|
|
31
36
|
}
|
|
@@ -119,6 +124,7 @@ function loadJcampFile(draft, actions) {
|
|
|
119
124
|
}
|
|
120
125
|
exports.loadJcampFile = loadJcampFile;
|
|
121
126
|
function handleLoadJsonFile(draft, action) {
|
|
127
|
+
resetState(draft);
|
|
122
128
|
setData(draft, action.payload);
|
|
123
129
|
const preferences = action.payload?.preferences || {};
|
|
124
130
|
(0, ToolsActions_1.setActiveTab)(draft, { tab: preferences?.activeTab || '' });
|
|
@@ -144,6 +150,7 @@ function handleLoadZIPFile(draft, action) {
|
|
|
144
150
|
}
|
|
145
151
|
exports.handleLoadZIPFile = handleLoadZIPFile;
|
|
146
152
|
function handleLoadNmredata(draft, action) {
|
|
153
|
+
resetState(draft);
|
|
147
154
|
setData(draft, action.payload);
|
|
148
155
|
(0, ToolsActions_1.setActiveTab)(draft);
|
|
149
156
|
(0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { align: 'auto-check' });
|
|
@@ -80,7 +80,7 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
80
80
|
draft.isLoading = false;
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
for (const spectrum of (0, PredictionManager_1.generateSpectra)(data, options
|
|
83
|
+
for (const spectrum of (0, PredictionManager_1.generateSpectra)(data, options)) {
|
|
84
84
|
draft.data.push(spectrum);
|
|
85
85
|
draft.tabActiveSpectrum[(0, nucleusToString_1.default)(spectrum.info.nucleus)] = {
|
|
86
86
|
id: spectrum.id,
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.preferencesInitialState = exports.SET_PANELS_PREFERENCES = exports.RESET_PREFERENCES = exports.SET_PREFERENCES = exports.INIT_PREFERENCES = void 0;
|
|
7
7
|
const immer_1 = require("immer");
|
|
8
8
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
9
|
-
const NMRium_1 = require("../NMRium");
|
|
10
9
|
const LocalStorage_1 = require("../utility/LocalStorage");
|
|
11
10
|
const workspaces_1 = __importDefault(require("../workspaces"));
|
|
12
11
|
exports.INIT_PREFERENCES = 'INIT_PREFERENCES';
|
|
@@ -16,9 +15,9 @@ exports.SET_PANELS_PREFERENCES = 'SET_PANELS_PREFERENCES';
|
|
|
16
15
|
const LOCAL_STORAGE_VERSION = 3;
|
|
17
16
|
function getPreferencesByWorkspace(workspace) {
|
|
18
17
|
switch (workspace) {
|
|
19
|
-
case
|
|
18
|
+
case 'exercise1D':
|
|
20
19
|
return workspaces_1.default.exercise1D;
|
|
21
|
-
case
|
|
20
|
+
case 'process1D':
|
|
22
21
|
return workspaces_1.default.process1D;
|
|
23
22
|
default:
|
|
24
23
|
return workspaces_1.default.basic;
|
|
@@ -107,7 +106,7 @@ function handleInit(draft, action) {
|
|
|
107
106
|
});
|
|
108
107
|
mapNucleus(draft);
|
|
109
108
|
}
|
|
110
|
-
draft.display = (0, merge_1.default)({}, getPreferencesByWorkspace(
|
|
109
|
+
draft.display = (0, merge_1.default)({}, getPreferencesByWorkspace('default').display, hiddenModeFeatures, hiddenLocalStorageFeatures);
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
function handleSetPreferences(draft, action) {
|