nmrium 1.8.0 → 1.9.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/2d/useTracesSpectra.d.ts.map +1 -1
- package/lib/component/2d/useTracesSpectra.js +2 -0
- package/lib/component/2d/useTracesSpectra.js.map +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts.map +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +6 -0
- package/lib/component/EventsTrackers/KeysListenerTracker.js.map +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -6
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
- package/lib/component/panels/databasePanel/DatabaseInfo.d.ts +5 -0
- package/lib/component/panels/databasePanel/DatabaseInfo.d.ts.map +1 -0
- package/lib/component/panels/databasePanel/DatabaseInfo.js +29 -0
- package/lib/component/panels/databasePanel/DatabaseInfo.js.map +1 -0
- package/lib/component/panels/databasePanel/DatabaseTable.d.ts.map +1 -1
- package/lib/component/panels/databasePanel/DatabaseTable.js +21 -3
- package/lib/component/panels/databasePanel/DatabaseTable.js.map +1 -1
- package/lib/component/panels/informationPanel/InformationEditionModal.js +1 -1
- package/lib/component/panels/informationPanel/InformationEditionModal.js.map +1 -1
- package/lib/component/reducer/actions/DatabaseActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +4 -2
- package/lib/component/reducer/actions/DatabaseActions.js.map +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js.map +1 -1
- package/lib/component/toolbar/ToolBar.d.ts.map +1 -1
- package/lib/component/toolbar/ToolBar.js +5 -1
- package/lib/component/toolbar/ToolBar.js.map +1 -1
- package/lib/component/toolbar/ToolTypes.js +1 -1
- package/lib/component/toolbar/ToolTypes.js.map +1 -1
- package/lib/component/utility/filterDatabaseInfoEntry.d.ts +3 -0
- package/lib/component/utility/filterDatabaseInfoEntry.d.ts.map +1 -0
- package/lib/component/utility/filterDatabaseInfoEntry.js +9 -0
- package/lib/component/utility/filterDatabaseInfoEntry.js.map +1 -0
- package/lib/component/workspaces/prediction.js +1 -1
- package/lib/component/workspaces/prediction.js.map +1 -1
- package/lib/component/workspaces/simulation.js +1 -1
- package/lib/component/workspaces/simulation.js.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js.map +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +2 -1
- package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
- package/lib/data/molecules/MoleculeManager.js +30 -3
- package/lib/data/molecules/MoleculeManager.js.map +1 -1
- package/lib/utils/clipboard/clipboardHooks.js +4 -4
- package/lib/utils/clipboard/clipboardHooks.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +12 -11
- package/src/component/2d/useTracesSpectra.ts +2 -0
- package/src/component/EventsTrackers/KeysListenerTracker.tsx +6 -0
- package/src/component/modal/MultipletAnalysisModal.tsx +1 -1
- package/src/component/modal/setting/settings-tabs/ToolsTabContent.tsx +1 -1
- package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +9 -7
- package/src/component/panels/databasePanel/DatabaseInfo.tsx +43 -0
- package/src/component/panels/databasePanel/DatabaseTable.tsx +33 -1
- package/src/component/panels/informationPanel/InformationEditionModal.tsx +2 -0
- package/src/component/reducer/actions/DatabaseActions.ts +4 -2
- package/src/component/reducer/preferences/panelsPreferencesDefaultValues.ts +1 -1
- package/src/component/toolbar/ToolBar.tsx +6 -1
- package/src/component/toolbar/ToolTypes.ts +1 -1
- package/src/component/utility/filterDatabaseInfoEntry.ts +10 -0
- package/src/component/workspaces/prediction.ts +1 -1
- package/src/component/workspaces/simulation.ts +1 -1
- package/src/component/workspaces/workspaceDefaultProperties.ts +1 -1
- package/src/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.ts +2 -1
- package/src/data/molecules/MoleculeManager.ts +40 -4
- package/src/utils/clipboard/clipboardHooks.ts +6 -6
- package/src/versionInfo.ts +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Classes } from '@blueprintjs/core';
|
|
2
2
|
import dlv from 'dlv';
|
|
3
|
+
import type { DatabaseNMREntry } from 'nmr-processing';
|
|
3
4
|
import type { CSSProperties } from 'react';
|
|
4
5
|
import { memo, useMemo } from 'react';
|
|
5
6
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
6
|
-
import { FaDownload, FaMinus, FaPlus } from 'react-icons/fa';
|
|
7
|
+
import { FaDownload, FaInfoCircle, FaMinus, FaPlus } from 'react-icons/fa';
|
|
7
8
|
import { IdcodeSvgRenderer, SmilesSvgRenderer } from 'react-ocl';
|
|
8
9
|
import { Button } from 'react-science/ui';
|
|
9
10
|
import type { CellProps } from 'react-table';
|
|
@@ -18,6 +19,8 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences.js';
|
|
|
18
19
|
import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus.js';
|
|
19
20
|
import { formatNumber } from '../../utility/formatNumber.js';
|
|
20
21
|
|
|
22
|
+
import { DatabaseInfo } from './DatabaseInfo.tsx';
|
|
23
|
+
|
|
21
24
|
interface ToggleEvent {
|
|
22
25
|
onAdd: (row: any) => void;
|
|
23
26
|
onRemove: (row: any) => void;
|
|
@@ -144,6 +147,7 @@ const databaseTableColumns = (
|
|
|
144
147
|
width={width}
|
|
145
148
|
idcode={idCode}
|
|
146
149
|
coordinates={coordinates}
|
|
150
|
+
noAtomCustomLabels
|
|
147
151
|
/>
|
|
148
152
|
);
|
|
149
153
|
} else if (smiles) {
|
|
@@ -152,6 +156,7 @@ const databaseTableColumns = (
|
|
|
152
156
|
height={height}
|
|
153
157
|
width={width}
|
|
154
158
|
smiles={smiles}
|
|
159
|
+
noAtomCustomLabels
|
|
155
160
|
/>
|
|
156
161
|
);
|
|
157
162
|
} else {
|
|
@@ -177,6 +182,33 @@ function DatabaseTable({
|
|
|
177
182
|
|
|
178
183
|
const initialColumns = useMemo<ColumnDef[]>(
|
|
179
184
|
() => [
|
|
185
|
+
{
|
|
186
|
+
index: 0,
|
|
187
|
+
id: 'meta',
|
|
188
|
+
Header: '',
|
|
189
|
+
style: {
|
|
190
|
+
width: '1%',
|
|
191
|
+
maxWidth: '25px',
|
|
192
|
+
minWidth: '25px',
|
|
193
|
+
padding: 0,
|
|
194
|
+
},
|
|
195
|
+
Cell: ({ row }: CellProps<PrepareDataResult>) => {
|
|
196
|
+
return (
|
|
197
|
+
<Button
|
|
198
|
+
style={{ padding: 0 }}
|
|
199
|
+
minimal
|
|
200
|
+
small
|
|
201
|
+
icon={<FaInfoCircle />}
|
|
202
|
+
tooltipProps={{
|
|
203
|
+
content: (
|
|
204
|
+
<DatabaseInfo data={row.original as DatabaseNMREntry} />
|
|
205
|
+
),
|
|
206
|
+
}}
|
|
207
|
+
/>
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
enableRowSpan: true,
|
|
211
|
+
},
|
|
180
212
|
{
|
|
181
213
|
index: 10,
|
|
182
214
|
id: 'add-button',
|
|
@@ -151,6 +151,7 @@ function InnerInformationPanel(props: InnerInformationPanelProps) {
|
|
|
151
151
|
<Input2Controller
|
|
152
152
|
control={control}
|
|
153
153
|
name={`metaInfo.${row.index}.value`}
|
|
154
|
+
mapValue={String}
|
|
154
155
|
noShadowBox
|
|
155
156
|
/>
|
|
156
157
|
);
|
|
@@ -196,6 +197,7 @@ function InnerInformationPanel(props: InnerInformationPanelProps) {
|
|
|
196
197
|
);
|
|
197
198
|
|
|
198
199
|
const values = watch('metaInfo');
|
|
200
|
+
|
|
199
201
|
return (
|
|
200
202
|
<>
|
|
201
203
|
<StyledDialogBody>
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
resurrectSpectrumFromRanges,
|
|
13
13
|
resurrectSpectrumFromSignals,
|
|
14
14
|
} from '../../../data/data1d/Spectrum1D/ranges/resurrectSpectrum.js';
|
|
15
|
+
import { filterDatabaseInfoEntry } from '../../utility/filterDatabaseInfoEntry.ts';
|
|
15
16
|
import type { State } from '../Reducer.js';
|
|
16
17
|
import { setZoom } from '../helper/Zoom1DManager.js';
|
|
17
18
|
import zoomHistoryManager from '../helper/ZoomHistoryManager.js';
|
|
@@ -59,7 +60,6 @@ function handleResurrectSpectrum(
|
|
|
59
60
|
ranges,
|
|
60
61
|
signals,
|
|
61
62
|
solvent,
|
|
62
|
-
meta = {},
|
|
63
63
|
names = [],
|
|
64
64
|
id: spectrumID,
|
|
65
65
|
} = databaseEntry;
|
|
@@ -68,6 +68,7 @@ function handleResurrectSpectrum(
|
|
|
68
68
|
|
|
69
69
|
if (source === 'jcamp') {
|
|
70
70
|
const { spectrum } = action.payload;
|
|
71
|
+
|
|
71
72
|
resurrectedSpectrum = {
|
|
72
73
|
...spectrum,
|
|
73
74
|
id: spectrumID,
|
|
@@ -115,7 +116,8 @@ function handleResurrectSpectrum(
|
|
|
115
116
|
|
|
116
117
|
if (!resurrectedSpectrum) return;
|
|
117
118
|
|
|
118
|
-
|
|
119
|
+
const filterDatabaseEntryInfo = filterDatabaseInfoEntry(databaseEntry);
|
|
120
|
+
resurrectedSpectrum.customInfo = filterDatabaseEntryInfo;
|
|
119
121
|
|
|
120
122
|
draft.data.push(resurrectedSpectrum);
|
|
121
123
|
|
|
@@ -296,7 +296,12 @@ export default function ToolBar() {
|
|
|
296
296
|
},
|
|
297
297
|
{
|
|
298
298
|
id: 'multipleSpectraAnalysis',
|
|
299
|
-
tooltip:
|
|
299
|
+
tooltip: {
|
|
300
|
+
title: options.multipleSpectraAnalysis.label,
|
|
301
|
+
shortcuts: ['m'],
|
|
302
|
+
description:
|
|
303
|
+
'Integrate multiple spectra at once and adjust integration zones by dragging their edges.',
|
|
304
|
+
},
|
|
300
305
|
icon: <SvgNmrMultipleAnalysis />,
|
|
301
306
|
checkOptions: { checkSpectrumType: false },
|
|
302
307
|
isVisible: ftCounter > 0,
|
|
@@ -227,7 +227,7 @@ export const options: RecordOptions = {
|
|
|
227
227
|
},
|
|
228
228
|
multipleSpectraAnalysis: {
|
|
229
229
|
id: 'multipleSpectraAnalysis',
|
|
230
|
-
label: 'Multiple spectra
|
|
230
|
+
label: 'Multiple spectra integration',
|
|
231
231
|
hasOptionPanel: false,
|
|
232
232
|
isFilter: false,
|
|
233
233
|
mode: '1D',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getJPathsAsObject } from 'get-jpaths';
|
|
2
|
+
import type { DatabaseNMREntry } from 'nmr-processing';
|
|
3
|
+
|
|
4
|
+
export function filterDatabaseInfoEntry(input: DatabaseNMREntry) {
|
|
5
|
+
return getJPathsAsObject(input, {
|
|
6
|
+
maxArrayElements: 5,
|
|
7
|
+
maxDepth: 10,
|
|
8
|
+
includeJPathRegexps: [/^(smiles|names|meta)\./],
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -19,6 +19,7 @@ export function detectSignalsByMultipletAnalysis(
|
|
|
19
19
|
};
|
|
20
20
|
const from = data.x[fromIndex];
|
|
21
21
|
const to = data.x[toIndex];
|
|
22
|
+
const widthHz = (to - from) * frequency;
|
|
22
23
|
|
|
23
24
|
const peaks = xyAutoPeaksPicking(data, {
|
|
24
25
|
from,
|
|
@@ -87,7 +88,7 @@ export function detectSignalsByMultipletAnalysis(
|
|
|
87
88
|
analyzer: {
|
|
88
89
|
frequency,
|
|
89
90
|
minimalResolution: 0.1,
|
|
90
|
-
maxTestedJ:
|
|
91
|
+
maxTestedJ: widthHz,
|
|
91
92
|
checkSymmetryFirst: true,
|
|
92
93
|
takeBestPartMultiplet: true,
|
|
93
94
|
correctVerticalOffset: true,
|
|
@@ -100,16 +100,52 @@ function getLabelNumber(reserveNumbers: number[]): number {
|
|
|
100
100
|
return 1;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
export const parseErrorMessage =
|
|
104
|
+
'Failed to parse SMILES or molfile. Please paste a valid format';
|
|
105
|
+
|
|
106
|
+
function validateMolecules(molecules: StateMolecule[]) {
|
|
107
|
+
if (!molecules?.length) {
|
|
108
|
+
throw new Error(parseErrorMessage);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const failedIndexes: number[] = [];
|
|
112
|
+
for (let i = 0; i < molecules.length; i++) {
|
|
113
|
+
const { molfile } = molecules[i];
|
|
114
|
+
const molecule = Molecule.fromMolfile(molfile);
|
|
115
|
+
const atomCount = molecule.getAllAtoms();
|
|
116
|
+
|
|
117
|
+
if (atomCount === 0) {
|
|
118
|
+
failedIndexes.push(i);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (failedIndexes.length > 0) {
|
|
123
|
+
throw new Error(
|
|
124
|
+
`Error parsing molecule at position(s):[${failedIndexes.join(', ')}]. ${parseErrorMessage}`,
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
103
129
|
/**
|
|
104
130
|
* We will extract the molecule(s) from the text.
|
|
105
131
|
* Because a molfile is actually a SDF we can just call 'readSDF' method
|
|
106
132
|
* @param text - text containing one or several molecules in SMILES, molfile or SDF format
|
|
107
133
|
* @returns
|
|
108
134
|
*/
|
|
109
|
-
export function getMolecules(text
|
|
135
|
+
export function getMolecules(text?: string) {
|
|
136
|
+
if (!text?.trim()) {
|
|
137
|
+
throw new Error(parseErrorMessage);
|
|
138
|
+
}
|
|
139
|
+
|
|
110
140
|
// parse SDF
|
|
111
|
-
|
|
112
|
-
|
|
141
|
+
let molecules = [];
|
|
142
|
+
const parse = /v[23]000/i.test(text) ? readSDF : readSMILES;
|
|
143
|
+
try {
|
|
144
|
+
molecules = parse(text);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
throw new Error(parseErrorMessage, { cause: error });
|
|
113
147
|
}
|
|
114
|
-
|
|
148
|
+
|
|
149
|
+
validateMolecules(molecules);
|
|
150
|
+
return molecules;
|
|
115
151
|
}
|
|
@@ -115,20 +115,20 @@ export function useClipboard(): UseClipboardReturn {
|
|
|
115
115
|
|
|
116
116
|
const clipboardAPI = useMemo(
|
|
117
117
|
() => ({
|
|
118
|
-
async read(): Promise<ClipboardItems
|
|
118
|
+
async read(): Promise<ClipboardItems> {
|
|
119
119
|
try {
|
|
120
120
|
return await read();
|
|
121
|
-
} catch {
|
|
121
|
+
} catch (error) {
|
|
122
122
|
setShouldFallback('read');
|
|
123
|
-
|
|
123
|
+
throw new Error('Failed to read from clipboard', { cause: error });
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
|
-
async readText(): Promise<string
|
|
126
|
+
async readText(): Promise<string> {
|
|
127
127
|
try {
|
|
128
128
|
return await readText();
|
|
129
|
-
} catch {
|
|
129
|
+
} catch (error) {
|
|
130
130
|
setShouldFallback('readText');
|
|
131
|
-
|
|
131
|
+
throw new Error('Failed to read from clipboard', { cause: error });
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
async write(data: ClipboardItems): Promise<void> {
|
package/src/versionInfo.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v1.
|
|
1
|
+
export default { version: 'v1.9.0' };
|