nmrium 0.46.0 → 0.47.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/Chart1D.js +3 -1
- package/lib/component/1d/Viewer1D.js +4 -21
- package/lib/component/1d/integral/Integration.js +2 -1
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/2d/1d-tracer/Top1DChart.js +1 -1
- package/lib/component/2d/zones/Signal.js +1 -1
- package/lib/component/2d/zones/Zone.js +1 -1
- package/lib/component/elements/Header.js +1 -1
- package/lib/component/elements/formik/FormikColorPickerDropdown.d.ts +6 -0
- package/lib/component/elements/formik/FormikColorPickerDropdown.js +14 -0
- package/lib/component/hooks/useActiveSpectrumIntegralsViewState.js +1 -0
- package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
- package/lib/component/loader/DropZone.js +4 -2
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +2 -1
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.d.ts +2 -0
- package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +131 -0
- package/lib/component/modal/setting/settingsValidation.js +12 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +16 -2
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/databasePanel/DatabasePreferences.js +2 -2
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +3 -2
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/IntegralsActions.d.ts +8 -2
- package/lib/component/reducer/actions/IntegralsActions.js +10 -1
- package/lib/component/reducer/actions/LoadActions.d.ts +3 -1
- package/lib/component/reducer/actions/LoadActions.js +9 -4
- package/lib/component/reducer/actions/PeaksActions.js +1 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +9 -3
- package/lib/component/toolbar/BasicToolBar.js +4 -4
- package/lib/component/toolbar/FunctionToolBar.js +2 -1
- package/lib/component/workspaces/exercise.js +1 -0
- package/lib/component/workspaces/prediction.js +5 -0
- package/lib/component/workspaces/simulation.js +5 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +41 -0
- package/lib/data/PredictionManager.js +1 -1
- package/lib/data/constants/Multiplets.js +1 -1
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +9 -1
- package/lib/data/data1d/Spectrum1D/get1DColor.js +12 -4
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +6 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +7 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +32 -19
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +10 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +70 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -0
- package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +9 -2
- package/lib/data/data2d/Spectrum2D/get2DColor.js +13 -5
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts +7 -2
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -2
- package/lib/data/utilities/getCustomColor.d.ts +4 -0
- package/lib/data/utilities/getCustomColor.js +38 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +11 -11
- package/lib/component/elements/formik/FormikColorInput.d.ts +0 -8
- package/lib/component/elements/formik/FormikColorInput.js +0 -15
|
@@ -45,7 +45,7 @@ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, re
|
|
|
45
45
|
pointerEvents: 'none',
|
|
46
46
|
fontSize: '12px',
|
|
47
47
|
transform: 'rotate(90deg)',
|
|
48
|
-
} }) },
|
|
48
|
+
} }) }, selectedTool), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3 } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(Button.Done, { fill: "clear", onClick: onStructureClick, style: { padding: '5px' }, children: !idCode ? (_jsx(BsHexagon, { style: {
|
|
49
49
|
fontSize: '12px',
|
|
50
50
|
} })) : (_jsx(BsHexagonFill, { style: {
|
|
51
51
|
fontSize: '12px',
|
|
@@ -33,7 +33,8 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
|
|
|
33
33
|
const modal = useModal();
|
|
34
34
|
const alert = useAlert();
|
|
35
35
|
const selectedFilterIndex = useRef();
|
|
36
|
-
const handelFilterCheck = useCallback((id,
|
|
36
|
+
const handelFilterCheck = useCallback((id, event) => {
|
|
37
|
+
const { checked: enabled } = event.target;
|
|
37
38
|
void (async () => {
|
|
38
39
|
const hideLoading = await alert.showLoading(`${enabled ? 'Enable' : 'Disable'} filter in progress`);
|
|
39
40
|
setTimeout(() => {
|
|
@@ -109,7 +110,7 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
|
|
|
109
110
|
style: { width: '30px' },
|
|
110
111
|
Cell: ({ row }) => {
|
|
111
112
|
const { flag, id } = row.original;
|
|
112
|
-
return (_jsx(ColumnWrapper, { children: _jsx(Checkbox, { onChange: (
|
|
113
|
+
return (_jsx(ColumnWrapper, { children: _jsx(Checkbox, { onChange: (event) => handelFilterCheck(id, event), checked: flag }) }));
|
|
113
114
|
},
|
|
114
115
|
},
|
|
115
116
|
{
|
|
@@ -173,6 +173,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
173
173
|
return IntegralsActions.handleChangeIntegralsRelativeValue(draft, action);
|
|
174
174
|
case 'CUT_INTEGRAL':
|
|
175
175
|
return IntegralsActions.handleCutIntegral(draft, action);
|
|
176
|
+
case 'TOGGLE_INTEGRALS_VIEW_PROPERTY':
|
|
177
|
+
return IntegralsActions.handleToggleIntegralsViewProperty(draft, action);
|
|
176
178
|
case 'SET_X_DOMAIN':
|
|
177
179
|
return DomainActions.handleSetXDomain(draft, action);
|
|
178
180
|
case 'SET_Y_DOMAIN':
|
|
@@ -13,7 +13,7 @@ function handleResurrectSpectrumFromJcamp(draft, action) {
|
|
|
13
13
|
},
|
|
14
14
|
display: {
|
|
15
15
|
...spectrum.display,
|
|
16
|
-
...get1DColor(spectrum.display, draft.usedColors),
|
|
16
|
+
...get1DColor(spectrum.display, { usedColors: draft.usedColors }),
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
draft.data.push(spectrum);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { IntegralsViewState } from 'nmr-load-save';
|
|
2
3
|
import { Integral } from 'nmr-processing';
|
|
3
4
|
import { SetSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
4
5
|
import { State } from '../Reducer';
|
|
5
6
|
import { ActionType } from '../types/ActionType';
|
|
7
|
+
import { FilterType } from '../../utility/filterType';
|
|
6
8
|
type ChangeIntegralSumAction = ActionType<'CHANGE_INTEGRAL_SUM', {
|
|
7
9
|
options: SetSumOptions;
|
|
8
10
|
}>;
|
|
@@ -23,7 +25,10 @@ type ChangeIntegralRelativeValueAction = ActionType<'CHANGE_INTEGRAL_RELATIVE',
|
|
|
23
25
|
type CutIntegralAction = ActionType<'CUT_INTEGRAL', {
|
|
24
26
|
cutValue: number;
|
|
25
27
|
}>;
|
|
26
|
-
|
|
28
|
+
type ToggleIntegralsViewAction = ActionType<'TOGGLE_INTEGRALS_VIEW_PROPERTY', {
|
|
29
|
+
key: keyof FilterType<IntegralsViewState, boolean>;
|
|
30
|
+
}>;
|
|
31
|
+
export type IntegralsActions = ChangeIntegralSumAction | AddIntegralAction | DeleteIntegralAction | ChangeIntegralAction | ChangeIntegralRelativeValueAction | CutIntegralAction | ToggleIntegralsViewAction | ActionType<'CHANGE_INTEGRALS_SUM_FLAG'>;
|
|
27
32
|
declare function handleChangeIntegralSum(draft: Draft<State>, action: ChangeIntegralSumAction): void;
|
|
28
33
|
declare function handleAddIntegral(draft: Draft<State>, action: AddIntegralAction): void;
|
|
29
34
|
declare function handleDeleteIntegral(draft: Draft<State>, action: DeleteIntegralAction): void;
|
|
@@ -31,4 +36,5 @@ declare function handleChangeIntegral(draft: Draft<State>, action: ChangeIntegra
|
|
|
31
36
|
declare function handleChangeIntegralsRelativeValue(draft: Draft<State>, action: ChangeIntegralRelativeValueAction): void;
|
|
32
37
|
declare function handleChangeIntegralsSumFlag(draft: any): void;
|
|
33
38
|
declare function handleCutIntegral(draft: Draft<State>, action: CutIntegralAction): void;
|
|
34
|
-
|
|
39
|
+
declare function handleToggleIntegralsViewProperty(draft: Draft<State>, action: ToggleIntegralsViewAction): void;
|
|
40
|
+
export { handleCutIntegral, handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, handleToggleIntegralsViewProperty, };
|
|
@@ -6,6 +6,7 @@ import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/
|
|
|
6
6
|
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
7
7
|
import getRange from '../helper/getRange';
|
|
8
8
|
import { getSpectrum } from '../helper/getSpectrum';
|
|
9
|
+
import { setIntegralsViewProperty } from '../helper/setIntegralsViewProperty';
|
|
9
10
|
function handleChangeIntegralSum(draft, action) {
|
|
10
11
|
const { options } = action.payload;
|
|
11
12
|
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
@@ -121,4 +122,12 @@ function handleCutIntegral(draft, action) {
|
|
|
121
122
|
}
|
|
122
123
|
updateIntegralsRelativeValues(spectrum);
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
function toggleIntegralsViewProperty(draft, key) {
|
|
126
|
+
setIntegralsViewProperty(draft, key, (flag) => !flag);
|
|
127
|
+
}
|
|
128
|
+
//action
|
|
129
|
+
function handleToggleIntegralsViewProperty(draft, action) {
|
|
130
|
+
const { key } = action.payload;
|
|
131
|
+
toggleIntegralsViewProperty(draft, key);
|
|
132
|
+
}
|
|
133
|
+
export { handleCutIntegral, handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, handleToggleIntegralsViewProperty, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
-
import { Spectrum, NmriumState } from 'nmr-load-save';
|
|
2
|
+
import { Spectrum, NmriumState, SpectraColors } from 'nmr-load-save';
|
|
3
3
|
import { ParseResult } from 'papaparse';
|
|
4
4
|
import { StateMoleculeExtended } from '../../../data/molecules/Molecule';
|
|
5
5
|
import { UsedColors } from '../../../types/UsedColors';
|
|
@@ -13,6 +13,7 @@ interface InputProps extends InitiateProps {
|
|
|
13
13
|
usedColors?: UsedColors;
|
|
14
14
|
parseMetaFileResult?: ParseResult<any> | null;
|
|
15
15
|
resetSourceObject?: boolean;
|
|
16
|
+
spectraColors?: SpectraColors;
|
|
16
17
|
}
|
|
17
18
|
type SetIsLoadingAction = ActionType<'SET_LOADING_FLAG', {
|
|
18
19
|
isLoading: boolean;
|
|
@@ -23,6 +24,7 @@ export type LoadActions = SetIsLoadingAction | LoadDropFilesAction | InitiateAct
|
|
|
23
24
|
declare function initSpectra(inputSpectra: Spectrum[], options: {
|
|
24
25
|
usedColors: UsedColors;
|
|
25
26
|
molecules: StateMoleculeExtended[];
|
|
27
|
+
spectraColors: SpectraColors;
|
|
26
28
|
}): any;
|
|
27
29
|
declare function handleSetIsLoading(draft: Draft<State>, action: SetIsLoadingAction): void;
|
|
28
30
|
declare function handleInitiate(draft: Draft<State>, action: InitiateAction): State | undefined;
|
|
@@ -42,7 +42,7 @@ function setCorrelation(draft, correlations) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
function setData(draft, input) {
|
|
45
|
-
const { nmriumState: { data, view }, parseMetaFileResult = null, } = input || {
|
|
45
|
+
const { nmriumState: { data, view }, parseMetaFileResult = null, spectraColors = { oneDimension: [], twoDimensions: [] }, } = input || {
|
|
46
46
|
nmriumState: { data: { spectra: [], molecules: [], correlations: {} } },
|
|
47
47
|
multipleAnalysis: {},
|
|
48
48
|
};
|
|
@@ -62,6 +62,7 @@ function setData(draft, input) {
|
|
|
62
62
|
draft.data = draft.data.concat(initSpectra(spectra, {
|
|
63
63
|
usedColors: draft.usedColors,
|
|
64
64
|
molecules: draft.molecules,
|
|
65
|
+
spectraColors,
|
|
65
66
|
}));
|
|
66
67
|
setCorrelation(draft, correlations);
|
|
67
68
|
if (parseMetaFileResult) {
|
|
@@ -75,14 +76,18 @@ function setData(draft, input) {
|
|
|
75
76
|
}
|
|
76
77
|
function initSpectra(inputSpectra, options) {
|
|
77
78
|
const spectra = [];
|
|
78
|
-
const { usedColors, molecules } = options;
|
|
79
|
+
const { usedColors, molecules, spectraColors } = options;
|
|
79
80
|
for (const spectrum of inputSpectra) {
|
|
80
81
|
const { info } = spectrum;
|
|
81
82
|
if (info.dimension === 1) {
|
|
82
|
-
spectra.push(initiateDatum1D(spectrum, {
|
|
83
|
+
spectra.push(initiateDatum1D(spectrum, {
|
|
84
|
+
usedColors,
|
|
85
|
+
molecules,
|
|
86
|
+
colors: spectraColors.oneDimension,
|
|
87
|
+
}));
|
|
83
88
|
}
|
|
84
89
|
else if (info.dimension === 2) {
|
|
85
|
-
spectra.push(initiateDatum2D({ ...spectrum }, { usedColors }));
|
|
90
|
+
spectra.push(initiateDatum2D({ ...spectrum }, { usedColors, colors: spectraColors.twoDimensions }));
|
|
86
91
|
}
|
|
87
92
|
}
|
|
88
93
|
return spectra;
|
|
@@ -4,9 +4,9 @@ import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
|
4
4
|
import { getShiftX, autoPeakPicking, optimizePeaks, } from '../../../data/data1d/Spectrum1D';
|
|
5
5
|
import { defaultPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
|
|
6
6
|
import { defaultRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
7
|
+
import { getClosePeak } from '../../utility/getClosePeak';
|
|
7
8
|
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
8
9
|
import getRange from '../helper/getRange';
|
|
9
|
-
import { getClosePeak } from '../../utility/getClosePeak';
|
|
10
10
|
//action
|
|
11
11
|
function handleAddPeak(draft, action) {
|
|
12
12
|
const { x: mouseXPosition } = action.payload;
|
|
@@ -342,13 +342,19 @@ function handleRecolorSpectraBasedOnDistinctValue(draft, action) {
|
|
|
342
342
|
}
|
|
343
343
|
else {
|
|
344
344
|
//reset spectra colors
|
|
345
|
-
const
|
|
345
|
+
const usedColors = { '1d': [], '2d': [] };
|
|
346
346
|
for (const spectrum of spectra) {
|
|
347
347
|
if (isSpectrum1D(spectrum)) {
|
|
348
|
-
spectrum.display.color = get1DColor(spectrum,
|
|
348
|
+
spectrum.display.color = get1DColor(spectrum, {
|
|
349
|
+
usedColors,
|
|
350
|
+
regenerate: true,
|
|
351
|
+
}).color;
|
|
349
352
|
}
|
|
350
353
|
else {
|
|
351
|
-
const { positiveColor, negativeColor } = get2DColor(spectrum,
|
|
354
|
+
const { positiveColor, negativeColor } = get2DColor(spectrum, {
|
|
355
|
+
usedColors,
|
|
356
|
+
regenerate: true,
|
|
357
|
+
});
|
|
352
358
|
spectrum.display.positiveColor = positiveColor;
|
|
353
359
|
spectrum.display.negativeColor = negativeColor;
|
|
354
360
|
}
|
|
@@ -15,7 +15,7 @@ import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
|
15
15
|
import { useVerticalAlign } from '../hooks/useVerticalAlign';
|
|
16
16
|
import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
|
|
17
17
|
import { LoadJCAMPModal } from '../modal/LoadJCAMPModal';
|
|
18
|
-
import { useMetaInformationImportationModal } from '../modal/metaImportation
|
|
18
|
+
import { useMetaInformationImportationModal } from '../modal/metaImportation';
|
|
19
19
|
import { options } from './ToolTypes';
|
|
20
20
|
const IMPORT_MENU = [
|
|
21
21
|
{
|
|
@@ -161,11 +161,11 @@ function BasicToolBarInner({ verticalAlign, ftCounter, fidCounter, }) {
|
|
|
161
161
|
saveAsHandler,
|
|
162
162
|
saveToClipboardHandler,
|
|
163
163
|
]);
|
|
164
|
-
return (_jsxs(Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: isLoadModalOpened, onCloseDialog: closeLoadModal }), isButtonVisible('import') && (_jsx(DropdownMenu, { placement: "right", onSelect: (data) => {
|
|
164
|
+
return (_jsxs(Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: isLoadModalOpened, onCloseDialog: closeLoadModal }), isButtonVisible('import') && (_jsx(DropdownMenu, { placement: "right-start", onSelect: (data) => {
|
|
165
165
|
importHandler(data);
|
|
166
|
-
},
|
|
166
|
+
}, targetTagName: "div", targetProps: { style: { flex: 'none' } }, options: importMenu, children: _jsx(Toolbar.Item, { id: options.import.id, title: options.import.label, icon: _jsx(FaFileImport, {}) }) })), isButtonVisible('exportAs') && (_jsx(DropdownMenu, { onSelect: (data) => {
|
|
167
167
|
exportHandler(data);
|
|
168
|
-
}, placement: "right",
|
|
168
|
+
}, placement: "right-start", targetTagName: "div", targetProps: { style: { flex: 'none' } }, options: exportMenu, children: _jsx(Toolbar.Item, { id: options.exportAs.id, title: options.exportAs.label, icon: _jsx(FaFileExport, {}) }) })), isButtonVisible('spectraStackAlignments') && ftCounter > 1 && (_jsx(Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && (_jsx(Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display real ' : 'Display imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", icon: _jsx(SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
|
|
169
169
|
(ftCounter > 0 || fidCounter > 0) && (_jsx(Toolbar.Item, { id: "baseline-position", title: verticalAlign === 'bottom'
|
|
170
170
|
? 'Baseline center ( Press c )'
|
|
171
171
|
: 'Baseline bottom ( Press c )', onClick: alignSpectrumsVerticallyHandler, className: "cheminfo", icon: _jsx(_Fragment, { children: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})) }) }))] }));
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { SvgNmrApodization, SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrZeroFilling, } from 'cheminfo-font';
|
|
3
3
|
import { useState, useEffect, useCallback, memo } from 'react';
|
|
4
4
|
import { FaSearchPlus, FaExpand, FaDiceFour } from 'react-icons/fa';
|
|
5
|
+
import { PiKnifeBold } from 'react-icons/pi';
|
|
5
6
|
import { Toolbar } from 'react-science/ui';
|
|
6
7
|
import { useChartData } from '../context/ChartContext';
|
|
7
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
@@ -66,7 +67,7 @@ function FunctionToolBarInner({ defaultValue, ftCounter, }) {
|
|
|
66
67
|
{
|
|
67
68
|
id: 'slicing',
|
|
68
69
|
label: options.slicing.label,
|
|
69
|
-
icon: _jsx(
|
|
70
|
+
icon: _jsx(PiKnifeBold, {}),
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
id: 'rangePicking',
|
|
@@ -10,6 +10,11 @@ export const simulation = {
|
|
|
10
10
|
invert: false,
|
|
11
11
|
},
|
|
12
12
|
display: {
|
|
13
|
+
general: {
|
|
14
|
+
hideGeneralSettings: true,
|
|
15
|
+
hideLogs: true,
|
|
16
|
+
hideWorkspaces: true,
|
|
17
|
+
},
|
|
13
18
|
panels: {
|
|
14
19
|
spectraPanel: { display: true },
|
|
15
20
|
simulationPanel: { display: true, open: true },
|
|
@@ -185,4 +185,45 @@ export const workspaceDefaultProperties = {
|
|
|
185
185
|
],
|
|
186
186
|
},
|
|
187
187
|
},
|
|
188
|
+
spectraColors: {
|
|
189
|
+
oneDimension: [],
|
|
190
|
+
twoDimensions: [
|
|
191
|
+
{
|
|
192
|
+
jpath: ['info', 'experiment'],
|
|
193
|
+
value: 'cosy',
|
|
194
|
+
positiveColor: 'darkblue',
|
|
195
|
+
negativeColor: 'blue',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
jpath: ['info', 'experiment'],
|
|
199
|
+
value: 'noesy',
|
|
200
|
+
positiveColor: 'pink',
|
|
201
|
+
negativeColor: 'yellow',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
jpath: ['info', 'experiment'],
|
|
205
|
+
value: 'roesy',
|
|
206
|
+
positiveColor: 'pink',
|
|
207
|
+
negativeColor: 'yellow',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
jpath: ['info', 'experiment'],
|
|
211
|
+
value: 'tocsy',
|
|
212
|
+
positiveColor: 'green',
|
|
213
|
+
negativeColor: 'yellow',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
jpath: ['info', 'experiment'],
|
|
217
|
+
value: 'hsqc',
|
|
218
|
+
positiveColor: 'black',
|
|
219
|
+
negativeColor: 'yellow',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
jpath: ['info', 'experiment'],
|
|
223
|
+
value: 'hmbc',
|
|
224
|
+
positiveColor: 'darkviolet',
|
|
225
|
+
negativeColor: 'yellow',
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
},
|
|
188
229
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { SpectrumOneDimensionColor } from 'nmr-load-save';
|
|
2
|
+
import { UsedColors } from '../../../types/UsedColors';
|
|
3
|
+
interface GetOnDimensionColorOption {
|
|
4
|
+
usedColors?: UsedColors;
|
|
5
|
+
colors?: SpectrumOneDimensionColor[];
|
|
6
|
+
regenerate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function get1DColor(spectrum: any, options: GetOnDimensionColorOption): {
|
|
2
9
|
color: string;
|
|
3
10
|
};
|
|
11
|
+
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { generateColor } from '../../utilities/generateColor';
|
|
2
|
-
|
|
2
|
+
import { getCustomColor } from '../../utilities/getCustomColor';
|
|
3
|
+
export function get1DColor(spectrum, options) {
|
|
4
|
+
const { regenerate = false, usedColors = {}, colors } = options;
|
|
3
5
|
let color = 'black';
|
|
4
|
-
if (
|
|
5
|
-
|
|
6
|
+
if (!spectrum?.display?.color || regenerate) {
|
|
7
|
+
const customColor = getCustomColor(spectrum, colors);
|
|
8
|
+
if (customColor) {
|
|
9
|
+
color = customColor;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
color = generateColor(false, usedColors?.['1d'] || []);
|
|
13
|
+
}
|
|
6
14
|
}
|
|
7
15
|
else {
|
|
8
|
-
color =
|
|
16
|
+
color = spectrum.display.color;
|
|
9
17
|
}
|
|
10
18
|
if (usedColors['1d']) {
|
|
11
19
|
usedColors['1d'].push(color);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Spectrum1D } from 'nmr-load-save';
|
|
1
|
+
import { Spectrum1D, SpectrumOneDimensionColor } from 'nmr-load-save';
|
|
2
2
|
import { UsedColors } from '../../../types/UsedColors';
|
|
3
3
|
import { StateMoleculeExtended } from '../../molecules/Molecule';
|
|
4
4
|
export interface InitiateDatum1DOptions {
|
|
5
5
|
usedColors?: UsedColors;
|
|
6
6
|
molecules?: StateMoleculeExtended[];
|
|
7
|
+
colors?: SpectrumOneDimensionColor[];
|
|
7
8
|
}
|
|
8
9
|
export declare function initiateDatum1D(spectrum: any, options?: InitiateDatum1DOptions): Spectrum1D;
|
|
@@ -8,7 +8,7 @@ import { initiateIntegrals } from './integrals/initiateIntegrals';
|
|
|
8
8
|
import { initiatePeaks } from './peaks/initiatePeaks';
|
|
9
9
|
import { initiateRanges } from './ranges/initiateRanges';
|
|
10
10
|
export function initiateDatum1D(spectrum, options = {}) {
|
|
11
|
-
const { usedColors
|
|
11
|
+
const { usedColors, colors, molecules = [] } = options;
|
|
12
12
|
const { integrals, ranges, ...restSpectrum } = spectrum;
|
|
13
13
|
const spectrumObj = { ...restSpectrum };
|
|
14
14
|
spectrumObj.id = spectrum.id || v4();
|
|
@@ -16,7 +16,7 @@ export function initiateDatum1D(spectrum, options = {}) {
|
|
|
16
16
|
isVisible: true,
|
|
17
17
|
isRealSpectrumVisible: true,
|
|
18
18
|
...spectrum.display,
|
|
19
|
-
...get1DColor(spectrum, usedColors),
|
|
19
|
+
...get1DColor(spectrum, { usedColors, colors }),
|
|
20
20
|
};
|
|
21
21
|
spectrumObj.info = {
|
|
22
22
|
nucleus: '1H', // 1H, 13C, 19F, ...
|
|
@@ -15,6 +15,7 @@ export declare function createRangeObj({ from, to, absolute, signals, }: RangeOp
|
|
|
15
15
|
signals: {
|
|
16
16
|
peaks?: import("nmr-processing").NMRPeak1D[] | undefined;
|
|
17
17
|
kind?: string | undefined;
|
|
18
|
+
assignment?: string | undefined;
|
|
18
19
|
diaIDs?: string[] | undefined;
|
|
19
20
|
integration?: number | undefined;
|
|
20
21
|
multiplicity: string;
|
|
@@ -22,7 +23,6 @@ export declare function createRangeObj({ from, to, absolute, signals, }: RangeOp
|
|
|
22
23
|
js: import("nmr-processing").Jcoupling[];
|
|
23
24
|
delta: number;
|
|
24
25
|
atoms?: number[] | undefined;
|
|
25
|
-
assignment?: string | undefined;
|
|
26
26
|
statistic?: {
|
|
27
27
|
mean: number;
|
|
28
28
|
sd: number;
|
|
@@ -14,7 +14,7 @@ export function changeRange(spectrum, range) {
|
|
|
14
14
|
frequency,
|
|
15
15
|
});
|
|
16
16
|
if (index !== -1) {
|
|
17
|
-
|
|
17
|
+
const [newRange] = mapRanges([
|
|
18
18
|
{
|
|
19
19
|
...spectrum.ranges.values[index],
|
|
20
20
|
originalFrom: from,
|
|
@@ -23,7 +23,10 @@ export function changeRange(spectrum, range) {
|
|
|
23
23
|
absolute,
|
|
24
24
|
signals,
|
|
25
25
|
},
|
|
26
|
-
], spectrum)
|
|
27
|
-
|
|
26
|
+
], spectrum);
|
|
27
|
+
if (newRange) {
|
|
28
|
+
spectrum.ranges.values[index] = newRange;
|
|
29
|
+
updateRangesRelativeValues(spectrum);
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { DataXY } from 'cheminfo-types';
|
|
2
|
-
export declare const MAX_LENGTH = 4092;
|
|
3
2
|
export default function detectSignals(data: DataXY, options: {
|
|
4
3
|
from: number;
|
|
5
4
|
to: number;
|
|
6
5
|
nucleus: string;
|
|
7
6
|
frequency: number;
|
|
8
7
|
}): {
|
|
8
|
+
multiplicity: any;
|
|
9
|
+
kind: string;
|
|
10
|
+
delta: number;
|
|
11
|
+
js: any;
|
|
12
|
+
peaks: import("nmr-processing").NMRPeak1DWithShapeID[];
|
|
13
|
+
diaIDs: never[];
|
|
14
|
+
}[] | {
|
|
9
15
|
delta: number;
|
|
10
16
|
id?: string | undefined;
|
|
11
17
|
js: import("nmr-processing").Jcoupling[];
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
+
import { xGetFromToIndex } from 'ml-spectra-processing';
|
|
1
2
|
import { xyAutoRangesPicking } from 'nmr-processing';
|
|
2
|
-
|
|
3
|
+
import { detectSignalsByMultipletAnalysis } from './detectSignalsByMultipletAnalysis';
|
|
4
|
+
const MAX_LENGTH = 4092;
|
|
3
5
|
export default function detectSignals(data, options) {
|
|
4
6
|
const { from, to, frequency, nucleus } = options;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
const { fromIndex, toIndex } = xGetFromToIndex(data.x, { from, to });
|
|
8
|
+
if (toIndex - fromIndex >= MAX_LENGTH) {
|
|
9
|
+
const ranges = xyAutoRangesPicking(data, {
|
|
10
|
+
peakPicking: {
|
|
11
|
+
to,
|
|
12
|
+
from,
|
|
13
|
+
frequency,
|
|
14
|
+
},
|
|
15
|
+
ranges: {
|
|
16
|
+
symRatio: 2.5,
|
|
17
|
+
frequency,
|
|
18
|
+
nucleus,
|
|
19
|
+
compile: true,
|
|
20
|
+
frequencyCluster: 16,
|
|
21
|
+
keepPeaks: true,
|
|
22
|
+
clean: 0.3,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return ranges
|
|
26
|
+
.flatMap((r) => r.signals || [])
|
|
27
|
+
.map((s) => ({ multiplicity: '', js: [], ...s }));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return detectSignalsByMultipletAnalysis(data, {
|
|
31
|
+
...options,
|
|
32
|
+
fromIndex,
|
|
33
|
+
toIndex,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
23
36
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataXY } from 'cheminfo-types';
|
|
2
|
+
import { NMRPeak1DWithShapeID } from 'nmr-processing';
|
|
3
|
+
export declare function detectSignalsByMultipletAnalysis(data: DataXY, options: any): {
|
|
4
|
+
multiplicity: any;
|
|
5
|
+
kind: string;
|
|
6
|
+
delta: number;
|
|
7
|
+
js: any;
|
|
8
|
+
peaks: NMRPeak1DWithShapeID[];
|
|
9
|
+
diaIDs: never[];
|
|
10
|
+
}[];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { analyseMultiplet } from 'multiplet-analysis';
|
|
2
|
+
import { signalJoinCouplings, xyAutoPeaksPicking, } from 'nmr-processing';
|
|
3
|
+
export function detectSignalsByMultipletAnalysis(data, options) {
|
|
4
|
+
const { fromIndex, toIndex, frequency } = options;
|
|
5
|
+
const dataRoi = {
|
|
6
|
+
x: data.x.slice(fromIndex, toIndex),
|
|
7
|
+
y: data.y.slice(fromIndex, toIndex),
|
|
8
|
+
};
|
|
9
|
+
const result = analyseMultiplet(dataRoi, {
|
|
10
|
+
frequency,
|
|
11
|
+
minimalResolution: 0.1,
|
|
12
|
+
maxTestedJ: 17,
|
|
13
|
+
checkSymmetryFirst: true,
|
|
14
|
+
takeBestPartMultiplet: true,
|
|
15
|
+
correctVerticalOffset: true,
|
|
16
|
+
symmetrizeEachStep: false,
|
|
17
|
+
decreasingJvalues: true,
|
|
18
|
+
makeShortCutForSpeed: true,
|
|
19
|
+
});
|
|
20
|
+
if (result && result.chemShift === undefined)
|
|
21
|
+
return [];
|
|
22
|
+
const { delta, js } = joinCouplings(result);
|
|
23
|
+
let cs = 0;
|
|
24
|
+
let area = 0;
|
|
25
|
+
for (let i = 0; i < dataRoi.x.length; i++) {
|
|
26
|
+
cs += dataRoi.x[i] * dataRoi.y[i];
|
|
27
|
+
area += dataRoi.y[i];
|
|
28
|
+
}
|
|
29
|
+
cs /= area;
|
|
30
|
+
const peaks = xyAutoPeaksPicking(dataRoi, { frequency });
|
|
31
|
+
const multiplicity = getMultiplicity(js, { cs, delta, peaks });
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
multiplicity,
|
|
35
|
+
kind: 'signal',
|
|
36
|
+
delta: cs,
|
|
37
|
+
js,
|
|
38
|
+
peaks,
|
|
39
|
+
diaIDs: [],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function getMultiplicity(js, options) {
|
|
44
|
+
const { cs, delta, peaks } = options;
|
|
45
|
+
if (js?.length > 0) {
|
|
46
|
+
return js.map((j) => j.multiplicity).join('');
|
|
47
|
+
}
|
|
48
|
+
//check if the massive center is closer to the shift from multiplet-analysis,
|
|
49
|
+
//if true, is it possibly a singlet.
|
|
50
|
+
return peaks.length === 1 && Math.abs(cs - delta) / cs < 1e-3 ? 's' : 'm';
|
|
51
|
+
}
|
|
52
|
+
function joinCouplings(result) {
|
|
53
|
+
const { chemShift: delta, js } = result;
|
|
54
|
+
let jCouplings = js;
|
|
55
|
+
if (js.length > 1) {
|
|
56
|
+
try {
|
|
57
|
+
jCouplings = signalJoinCouplings({
|
|
58
|
+
delta,
|
|
59
|
+
js,
|
|
60
|
+
}, { tolerance: 0.6, ignoreDiaIDs: true }).js;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
reportError(error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
delta,
|
|
68
|
+
js: jCouplings,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -45,6 +45,7 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
|
|
|
45
45
|
nbAtoms?: number | undefined;
|
|
46
46
|
multiplicity?: string | undefined;
|
|
47
47
|
diaIDs?: string[] | undefined;
|
|
48
|
+
assignment?: string | undefined;
|
|
48
49
|
pubIntegral?: number | undefined;
|
|
49
50
|
}[];
|
|
50
51
|
};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import { Color2D } from 'nmr-load-save';
|
|
2
|
-
|
|
1
|
+
import { Color2D, SpectrumTwoDimensionsColor } from 'nmr-load-save';
|
|
2
|
+
import { UsedColors } from '../../../types/UsedColors';
|
|
3
|
+
interface GetTwoDimensionsColorOption {
|
|
4
|
+
usedColors?: UsedColors;
|
|
5
|
+
colors?: SpectrumTwoDimensionsColor[];
|
|
6
|
+
regenerate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function get2DColor(spectrum: any, options: GetTwoDimensionsColorOption): Color2D;
|
|
9
|
+
export {};
|