nmrium 0.20.2 → 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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/FooterBanner.js +1 -1
- package/lib/component/1d/Integral.js +1 -6
- package/lib/component/1d/Viewer1D.js +4 -4
- package/lib/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib/component/1d/utilities/scale.d.ts +1 -1
- package/lib/component/1d/utilities/scale.js +7 -6
- package/lib/component/2d/Viewer2D.js +5 -5
- package/lib/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib/component/NMRium.d.ts +10 -6
- package/lib/component/NMRium.js +3 -9
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/header/Header.js +13 -10
- package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
- package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
- package/lib/component/hooks/useIntegralPath.js +53 -0
- package/lib/component/hooks/useToolsFunctions.js +6 -6
- package/lib/component/hooks/useXScale.d.ts +2 -0
- package/lib/component/hooks/useXScale.js +7 -0
- package/lib/component/loader/DropZone.js +87 -87
- package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
- package/lib/component/modal/PredictSpectraModal.js +2 -32
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
- package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
- package/lib/component/modal/editZone/EditZoneModal.js +96 -0
- package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
- package/lib/component/modal/editZone/SignalFormTab.js +6 -0
- package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
- package/lib/component/modal/editZone/SignalsForm.js +62 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
- package/lib/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
- package/lib/component/modal/setting/GeneralSettings.js +13 -9
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- 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.d.ts +1 -1
- package/lib/component/panels/Panels.js +17 -14
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
- package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
- package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
- package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- 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/IgnoreActions.js +2 -1
- package/lib/component/reducer/Reducer.d.ts +9 -23
- package/lib/component/reducer/Reducer.js +7 -8
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
- package/lib/component/reducer/actions/DomainActions.js +20 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib/component/reducer/actions/LoadActions.js +29 -1
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib/component/reducer/actions/RangesActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +43 -56
- package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
- package/lib/component/reducer/actions/ZonesActions.js +33 -2
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
- package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/preferencesReducer.d.ts +3 -8
- package/lib/component/reducer/preferencesReducer.js +86 -37
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/toolbar/FunctionToolBar.js +7 -10
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +46 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +46 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +44 -0
- package/lib/data/PredictionManager.d.ts +35 -3
- package/lib/data/PredictionManager.js +45 -7
- package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
- package/lib/data/constants/DefaultPathLengths.js +8 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/FooterBanner.js +1 -1
- package/lib-cjs/component/1d/Integral.js +1 -6
- package/lib-cjs/component/1d/Viewer1D.js +4 -4
- package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib-cjs/component/1d/utilities/scale.js +7 -6
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib-cjs/component/NMRium.js +3 -10
- package/lib-cjs/component/header/Header.js +13 -10
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
- package/lib-cjs/component/hooks/useXScale.js +11 -0
- package/lib-cjs/component/loader/DropZone.js +87 -87
- package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
- package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
- package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
- package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
- package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
- package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
- package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
- 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 +18 -15
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
- package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
- package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- 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/IgnoreActions.js +2 -1
- package/lib-cjs/component/reducer/Reducer.js +7 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +29 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
- package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +87 -38
- package/lib-cjs/component/reducer/types/Types.js +6 -4
- package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +49 -0
- package/lib-cjs/component/workspaces/exercise1D.js +49 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +47 -0
- package/lib-cjs/data/PredictionManager.js +46 -8
- package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +1 -1
- package/lib/component/1d/utilities/useIntegralPath.js +0 -63
- package/lib/component/nmriumMode/basic.d.ts +0 -38
- package/lib/component/nmriumMode/basic.js +0 -37
- package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
- package/lib/component/nmriumMode/exercise1D.js +0 -37
- package/lib/component/nmriumMode/process1D.d.ts +0 -38
- package/lib/component/nmriumMode/process1D.js +0 -37
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
- package/lib/component/reducer/actions/Zoom.d.ts +0 -16
- package/lib/component/reducer/actions/Zoom.js +0 -92
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
- package/lib-cjs/component/nmriumMode/basic.js +0 -39
- package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
- package/lib-cjs/component/nmriumMode/process1D.js +0 -39
- package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
|
@@ -27,7 +27,7 @@ export const CHANGE_SPECTRUM_COLOR = 'CHANGE_SPECTRUM_COLOR';
|
|
|
27
27
|
export const ADD_INTEGRAL = 'ADD_INTEGRAL';
|
|
28
28
|
export const DELETE_INTEGRAL = 'DELETE_INTEGRAL';
|
|
29
29
|
export const TOGGLE_REAL_IMAGINARY_VISIBILITY = 'TOGGLE_REAL_IMAGINARY_VISIBILITY';
|
|
30
|
-
export const
|
|
30
|
+
export const SET_ZOOM = 'SET_ZOOM';
|
|
31
31
|
export const ADD_MOLECULE = 'ADD_MOLECULE';
|
|
32
32
|
export const SET_MOLECULE = 'SET_MOLECULE';
|
|
33
33
|
export const DELETE_MOLECULE = 'DELETE_MOLECULE';
|
|
@@ -76,6 +76,7 @@ export const SET_2D_LEVEL = 'SET_2D_LEVEL';
|
|
|
76
76
|
export const ADD_2D_ZONE = 'ADD_2D_ZONE';
|
|
77
77
|
export const DELETE_2D_ZONE = 'DELETE_2D_ZONE';
|
|
78
78
|
export const DELETE_2D_SIGNAL = 'DELETE_2D_SIGNAL';
|
|
79
|
+
export const SET_2D_SIGNAL_PATH_LENGTH = 'SET_2D_SIGNAL_PATH_LENGTH';
|
|
79
80
|
export const ADD_MISSING_PROJECTION = 'ADD_MISSING_PROJECTION';
|
|
80
81
|
export const SET_FILTER_SNAPSHOT = 'SET_FILTER_SNAPSHOT';
|
|
81
82
|
export const CHANGE_RANGE_RELATIVE = 'CHANGE_RANGE_RELATIVE';
|
|
@@ -93,6 +94,7 @@ export const FILTER_SPECTRA_COLUMN = 'FILTER_SPECTRA_COLUMN';
|
|
|
93
94
|
export const ALIGN_SPECTRA = 'ALIGN_SPECTRA';
|
|
94
95
|
export const CHANGE_ZONE_SIGNAL_VALUE = 'CHANGE_ZONE_SIGNAL_VALUE';
|
|
95
96
|
export const CHANGE_ZONE_SIGNAL_KIND = 'CHANGE_ZONE_SIGNAL_KIND';
|
|
97
|
+
export const SAVE_EDITED_ZONE = 'SAVE_EDITED_ZONE';
|
|
96
98
|
export const UNLINK_ZONE = 'UNLINK_ZONE';
|
|
97
99
|
export const SET_DIAID_ZONE = 'SET_DIAID_ZONE';
|
|
98
100
|
export const PREDICT_SPECTRA = 'PREDICT_SPECTRA';
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Toolbar } from 'analysis-ui-components';
|
|
3
3
|
import { SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrZeroFilling, } from 'cheminfo-font';
|
|
4
|
-
import lodashGet from 'lodash/get';
|
|
5
4
|
import { useState, useEffect, useCallback, memo } from 'react';
|
|
6
5
|
import { FaSearchPlus, FaExpand, FaDiceFour } from 'react-icons/fa';
|
|
7
6
|
import * as Filters from '../../data/Filters';
|
|
8
7
|
import { useChartData } from '../context/ChartContext';
|
|
9
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
|
-
import { usePreferences } from '../context/PreferencesContext';
|
|
11
9
|
import ToggleButton from '../elements/toggle/ToggleButton';
|
|
12
10
|
import ToggleButtonGroup from '../elements/toggle/ToggleButtonGroup';
|
|
11
|
+
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
13
12
|
import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
|
|
14
13
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
15
14
|
import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
@@ -17,7 +16,7 @@ import { APPLY_FFT_FILTER, SET_SELECTED_FILTER } from '../reducer/types/Types';
|
|
|
17
16
|
import { options } from './ToolTypes';
|
|
18
17
|
function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displayerMode, ftCounter, mode, }) {
|
|
19
18
|
const [option, setOption] = useState('');
|
|
20
|
-
const
|
|
19
|
+
const isButtonVisible = useCheckToolsVisibility();
|
|
21
20
|
const dispatch = useDispatch();
|
|
22
21
|
const { handleChangeOption, handleFullZoomOut } = useToolsFunctions();
|
|
23
22
|
const handleChange = useCallback((selectedOption) => {
|
|
@@ -34,25 +33,23 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
|
|
|
34
33
|
});
|
|
35
34
|
dispatch({ type: SET_SELECTED_FILTER, selectedFilter: null });
|
|
36
35
|
}, [dispatch]);
|
|
37
|
-
const isButtonVisible = useCallback((toolKey) => {
|
|
38
|
-
return !lodashGet(preferences, `display.toolBarButtons.${toolKey}`);
|
|
39
|
-
}, [preferences]);
|
|
40
36
|
return (_jsxs(_Fragment, { children: [_jsxs(ToggleButtonGroup, { value: option, onChange: handleChange, children: [isButtonVisible('hideZoomTool') && (_jsx(ToggleButton, { value: options.zoom.id, id: "zoomIn", title: `${options.zoom.label} ( Press z )`, children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaSearchPlus, {}, void 0) }, void 0) }, options.zoom.id)), isButtonVisible('hideZoomOutTool') && (_jsx(Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaExpand, {}, void 0) }, void 0) }, void 0)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
41
37
|
isButtonVisible('hidePeakTool') && (_jsx(ToggleButton, { value: options.peakPicking.id, title: `${options.peakPicking.label} ( Press p )`, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "peakPicking", children: _jsx(SvgNmrPeakPicking, {}, void 0) }, options.peakPicking.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
42
38
|
isButtonVisible('hideIntegralTool') && (_jsx(ToggleButton, { value: options.integral.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "integralPicking", title: `${options.integral.label} ( Press i )`, children: _jsx(SvgNmrIntegrate, {}, void 0) }, options.integral.id)), displayerMode === DISPLAYER_MODE.DM_2D &&
|
|
43
|
-
isButtonVisible('
|
|
44
|
-
isButtonVisible('
|
|
39
|
+
isButtonVisible('hideZonePickingTool') && (_jsx(ToggleButton, { value: options.zone2D.id, id: "zone2d", isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${options.zone2D.label} ( Press r )`, children: _jsx(FaDiceFour, {}, void 0) }, options.zone2D.id)), displayerMode === DISPLAYER_MODE.DM_2D &&
|
|
40
|
+
isButtonVisible('hideSlicingTool') && (_jsx(ToggleButton, { value: options.slicingTool.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "slic", title: `${options.slicingTool.label}`, children: _jsx("p", { children: "Slic" }, void 0) }, options.slicingTool.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
41
|
+
isButtonVisible('hideAutoRangesTool') && (_jsx(ToggleButton, { value: options.rangesPicking.id, isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${options.rangesPicking.label} ( Press r )`, id: "ranges-pick", children: _jsx(SvgNmrRangePicking, {}, void 0) }, options.rangesPicking.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
45
42
|
isButtonVisible('hideMultipleSpectraAnalysisTool') &&
|
|
46
43
|
ftCounter > 1 &&
|
|
47
44
|
mode === 'RTL' && (_jsx(ToggleButton, { value: options.multipleSpectraAnalysis.id, id: "multipleSpectraAnalysis", title: options.multipleSpectraAnalysis.label, children: _jsx(SvgNmrMultipleAnalysis, {}, void 0) }, options.multipleSpectraAnalysis.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
48
45
|
isButtonVisible('hideZeroFillingTool') && (_jsx(ToggleButton, { value: options.zeroFilling.id, isVisible: Filters.zeroFilling.isApplicable({ info }), id: "zeroFilling", title: options.zeroFilling.label, children: _jsx(SvgNmrZeroFilling, {}, void 0) }, options.zeroFilling.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
49
|
-
isButtonVisible('hidePhaseCorrectionTool') && (_jsx(ToggleButton, { value: options.phaseCorrection.id, id: "phaseCorrection", title: options.phaseCorrection.label
|
|
46
|
+
isButtonVisible('hidePhaseCorrectionTool') && (_jsx(ToggleButton, { value: options.phaseCorrection.id, id: "phaseCorrection", title: `${options.phaseCorrection.label} ( Press a )`, isVisible: activeSpectrum &&
|
|
50
47
|
info &&
|
|
51
48
|
Filters.phaseCorrection.isApplicable({ info }) &&
|
|
52
49
|
datum.im
|
|
53
50
|
? true
|
|
54
51
|
: false, children: _jsx(SvgNmrPhaseCorrection, {}, void 0) }, options.phaseCorrection.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
55
|
-
isButtonVisible('hideBaseLineCorrectionTool') && (_jsx(ToggleButton, { value: options.baseLineCorrection.id, id: "baseLineCorrection", title: options.baseLineCorrection.label
|
|
52
|
+
isButtonVisible('hideBaseLineCorrectionTool') && (_jsx(ToggleButton, { value: options.baseLineCorrection.id, id: "baseLineCorrection", title: `${options.baseLineCorrection.label} ( Press b )`, isVisible: activeSpectrum &&
|
|
56
53
|
info &&
|
|
57
54
|
Filters.baselineCorrection.isApplicable({ info })
|
|
58
55
|
? true
|
|
@@ -44,7 +44,7 @@ export const options = {
|
|
|
44
44
|
},
|
|
45
45
|
rangesPicking: {
|
|
46
46
|
id: 'rangesPicking',
|
|
47
|
-
label: 'Ranges Picking
|
|
47
|
+
label: 'Ranges Picking',
|
|
48
48
|
hasOptionPanel: true,
|
|
49
49
|
isFilter: false,
|
|
50
50
|
},
|
|
@@ -56,13 +56,13 @@ export const options = {
|
|
|
56
56
|
},
|
|
57
57
|
phaseCorrection: {
|
|
58
58
|
id: Filters.phaseCorrection.id,
|
|
59
|
-
label:
|
|
59
|
+
label: Filters.phaseCorrection.name,
|
|
60
60
|
hasOptionPanel: true,
|
|
61
61
|
isFilter: true,
|
|
62
62
|
},
|
|
63
63
|
baseLineCorrection: {
|
|
64
64
|
id: 'baseLineCorrection',
|
|
65
|
-
label: 'baseline correction
|
|
65
|
+
label: 'baseline correction',
|
|
66
66
|
hasOptionPanel: true,
|
|
67
67
|
isFilter: true,
|
|
68
68
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const basic = {
|
|
2
|
+
version: 1,
|
|
3
|
+
label: 'Default Mode',
|
|
4
|
+
display: {
|
|
5
|
+
general: {
|
|
6
|
+
disableMultipletAnalysis: false,
|
|
7
|
+
hideSetSumFromMolecule: false,
|
|
8
|
+
hideGeneralSettings: false,
|
|
9
|
+
hideExperimentalFeatures: false,
|
|
10
|
+
},
|
|
11
|
+
panels: {
|
|
12
|
+
hideSpectraPanel: false,
|
|
13
|
+
hideInformationPanel: false,
|
|
14
|
+
hidePeaksPanel: false,
|
|
15
|
+
hideIntegralsPanel: false,
|
|
16
|
+
hideRangesPanel: false,
|
|
17
|
+
hideStructuresPanel: false,
|
|
18
|
+
hideFiltersPanel: false,
|
|
19
|
+
hideZonesPanel: false,
|
|
20
|
+
hideSummaryPanel: false,
|
|
21
|
+
hideMultipleSpectraAnalysisPanel: false,
|
|
22
|
+
hideDatabasePanel: false,
|
|
23
|
+
hidePredictionPanel: false,
|
|
24
|
+
},
|
|
25
|
+
toolBarButtons: {
|
|
26
|
+
hideZoomTool: false,
|
|
27
|
+
hideZoomOutTool: false,
|
|
28
|
+
hideImport: false,
|
|
29
|
+
hideExportAs: false,
|
|
30
|
+
hideSpectraStackAlignments: false,
|
|
31
|
+
hideSpectraCenterAlignments: false,
|
|
32
|
+
hideRealImaginary: false,
|
|
33
|
+
hidePeakTool: false,
|
|
34
|
+
hideIntegralTool: false,
|
|
35
|
+
hideZonePickingTool: false,
|
|
36
|
+
hideSlicingTool: false,
|
|
37
|
+
hideAutoRangesTool: false,
|
|
38
|
+
hideZeroFillingTool: false,
|
|
39
|
+
hidePhaseCorrectionTool: false,
|
|
40
|
+
hideBaseLineCorrectionTool: false,
|
|
41
|
+
hideFFTTool: false,
|
|
42
|
+
hideMultipleSpectraAnalysisTool: false,
|
|
43
|
+
hideExclusionZonesTool: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export const exercise1D = {
|
|
2
|
+
version: 1,
|
|
3
|
+
label: 'Exercise 1D Mode',
|
|
4
|
+
display: {
|
|
5
|
+
general: {
|
|
6
|
+
disableMultipletAnalysis: true,
|
|
7
|
+
hideSetSumFromMolecule: true,
|
|
8
|
+
hideGeneralSettings: true,
|
|
9
|
+
hideExperimentalFeatures: true,
|
|
10
|
+
},
|
|
11
|
+
panels: {
|
|
12
|
+
hideSpectraPanel: false,
|
|
13
|
+
hideInformationPanel: true,
|
|
14
|
+
hidePeaksPanel: true,
|
|
15
|
+
hideIntegralsPanel: false,
|
|
16
|
+
hideRangesPanel: true,
|
|
17
|
+
hideStructuresPanel: true,
|
|
18
|
+
hideFiltersPanel: true,
|
|
19
|
+
hideZonesPanel: true,
|
|
20
|
+
hideSummaryPanel: true,
|
|
21
|
+
hideMultipleSpectraAnalysisPanel: true,
|
|
22
|
+
hideDatabasePanel: true,
|
|
23
|
+
hidePredictionPanel: false,
|
|
24
|
+
},
|
|
25
|
+
toolBarButtons: {
|
|
26
|
+
hideZoomTool: false,
|
|
27
|
+
hideZoomOutTool: false,
|
|
28
|
+
hideImport: true,
|
|
29
|
+
hideExportAs: true,
|
|
30
|
+
hideSpectraStackAlignments: false,
|
|
31
|
+
hideSpectraCenterAlignments: false,
|
|
32
|
+
hideRealImaginary: true,
|
|
33
|
+
hidePeakTool: false,
|
|
34
|
+
hideIntegralTool: false,
|
|
35
|
+
hideZonePickingTool: true,
|
|
36
|
+
hideSlicingTool: true,
|
|
37
|
+
hideAutoRangesTool: true,
|
|
38
|
+
hideZeroFillingTool: true,
|
|
39
|
+
hidePhaseCorrectionTool: true,
|
|
40
|
+
hideBaseLineCorrectionTool: true,
|
|
41
|
+
hideFFTTool: true,
|
|
42
|
+
hideMultipleSpectraAnalysisTool: true,
|
|
43
|
+
hideExclusionZonesTool: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const process1D = {
|
|
2
|
+
version: 1,
|
|
3
|
+
label: 'Process 1D Mode',
|
|
4
|
+
display: {
|
|
5
|
+
general: {
|
|
6
|
+
disableMultipletAnalysis: true,
|
|
7
|
+
hideSetSumFromMolecule: false,
|
|
8
|
+
hideGeneralSettings: false,
|
|
9
|
+
hideExperimentalFeatures: false,
|
|
10
|
+
},
|
|
11
|
+
panels: {
|
|
12
|
+
hideSpectraPanel: false,
|
|
13
|
+
hideInformationPanel: false,
|
|
14
|
+
hidePeaksPanel: false,
|
|
15
|
+
hideIntegralsPanel: false,
|
|
16
|
+
hideRangesPanel: true,
|
|
17
|
+
hideStructuresPanel: false,
|
|
18
|
+
hideFiltersPanel: false,
|
|
19
|
+
hideZonesPanel: true,
|
|
20
|
+
hideSummaryPanel: true,
|
|
21
|
+
hideMultipleSpectraAnalysisPanel: true,
|
|
22
|
+
hideDatabasePanel: false,
|
|
23
|
+
hidePredictionPanel: false,
|
|
24
|
+
},
|
|
25
|
+
toolBarButtons: {
|
|
26
|
+
hideZoomTool: false,
|
|
27
|
+
hideZoomOutTool: false,
|
|
28
|
+
hideImport: true,
|
|
29
|
+
hideExportAs: true,
|
|
30
|
+
hideSpectraStackAlignments: false,
|
|
31
|
+
hideSpectraCenterAlignments: false,
|
|
32
|
+
hideRealImaginary: false,
|
|
33
|
+
hidePeakTool: false,
|
|
34
|
+
hideIntegralTool: false,
|
|
35
|
+
hideAutoRangesTool: true,
|
|
36
|
+
hideZeroFillingTool: false,
|
|
37
|
+
hidePhaseCorrectionTool: false,
|
|
38
|
+
hideBaseLineCorrectionTool: false,
|
|
39
|
+
hideFFTTool: false,
|
|
40
|
+
hideMultipleSpectraAnalysisTool: true,
|
|
41
|
+
hideExclusionZonesTool: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -1,6 +1,38 @@
|
|
|
1
|
-
import { PredictionProps } from '../component/modal/PredictSpectraModal';
|
|
2
|
-
import { UsedColors } from '../types/UsedColors';
|
|
3
1
|
import { Datum1D } from './types/data1d';
|
|
4
2
|
import { Datum2D } from './types/data2d';
|
|
3
|
+
export interface PredictionOptions {
|
|
4
|
+
frequency: number;
|
|
5
|
+
'1d': {
|
|
6
|
+
'1H': {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
};
|
|
10
|
+
'13C': {
|
|
11
|
+
from: number;
|
|
12
|
+
to: number;
|
|
13
|
+
};
|
|
14
|
+
nbPoints: number;
|
|
15
|
+
lineWidth: number;
|
|
16
|
+
};
|
|
17
|
+
'2d': {
|
|
18
|
+
nbPoints: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
spectra: {
|
|
24
|
+
proton: boolean;
|
|
25
|
+
carbon: boolean;
|
|
26
|
+
cosy: boolean;
|
|
27
|
+
hsqc: boolean;
|
|
28
|
+
hmbc: boolean;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare const defaultPredictionOptions: PredictionOptions;
|
|
32
|
+
export declare const FREQUENCIES: Array<{
|
|
33
|
+
key: number;
|
|
34
|
+
value: number;
|
|
35
|
+
label: string;
|
|
36
|
+
}>;
|
|
5
37
|
export declare function predictSpectra(molfile: string): Promise<any>;
|
|
6
|
-
export declare function generateSpectra(data: Record<string, any>, inputOptions:
|
|
38
|
+
export declare function generateSpectra(data: Record<string, any>, inputOptions: PredictionOptions): Array<Datum1D | Datum2D>;
|
|
@@ -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
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
1
|
import * as FiltersTypes from '../../Filters';
|
|
3
2
|
import * as FiltersManager from '../../FiltersManager';
|
|
4
3
|
import generateID from '../../utilities/generateID';
|
|
5
4
|
import get1dColor from '../../utilities/getColor';
|
|
5
|
+
import { initiateIntegrals } from './integrals/initiateIntegrals';
|
|
6
|
+
import { initiatePeaks } from './peaks/initiatePeaks';
|
|
7
|
+
import { initiateRanges } from './ranges/initiateRanges';
|
|
6
8
|
export function initiateDatum1D(options, usedColors = {}) {
|
|
7
9
|
const datum = {};
|
|
8
10
|
datum.id = options.id || generateID();
|
|
@@ -35,27 +37,13 @@ export function initiateDatum1D(options, usedColors = {}) {
|
|
|
35
37
|
im: [],
|
|
36
38
|
}, options.data);
|
|
37
39
|
datum.originalData = datum.data;
|
|
38
|
-
datum.
|
|
40
|
+
datum.filters = Object.assign([], options.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} }
|
|
41
|
+
datum.peaks = initiatePeaks(options, datum);
|
|
39
42
|
// array of object {index: xIndex, xShift}
|
|
40
43
|
// in case the peak does not exactly correspond to the point value
|
|
41
44
|
// we can think about a second attributed `xShift`
|
|
42
|
-
datum.integrals =
|
|
43
|
-
|
|
44
|
-
options: {
|
|
45
|
-
sum: undefined,
|
|
46
|
-
isSumConstant: true,
|
|
47
|
-
sumAuto: true,
|
|
48
|
-
},
|
|
49
|
-
}, options.integrals); // array of object (from: xIndex, to: xIndex)
|
|
50
|
-
datum.filters = Object.assign([], options.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} }
|
|
51
|
-
datum.ranges = merge({
|
|
52
|
-
values: [],
|
|
53
|
-
options: {
|
|
54
|
-
sum: undefined,
|
|
55
|
-
isSumConstant: true,
|
|
56
|
-
sumAuto: true,
|
|
57
|
-
},
|
|
58
|
-
}, options.ranges);
|
|
45
|
+
datum.integrals = initiateIntegrals(options); // array of object (from: xIndex, to: xIndex)
|
|
46
|
+
datum.ranges = initiateRanges(options, datum);
|
|
59
47
|
//reapply filters after load the original data
|
|
60
48
|
FiltersManager.reapplyFilters(datum);
|
|
61
49
|
preprocessing(datum);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Integrals } from '../../../types/data1d';
|
|
2
|
+
export declare function initiateIntegrals(options: Partial<{
|
|
3
|
+
integrals: Integrals;
|
|
4
|
+
}>): {
|
|
5
|
+
values: never[];
|
|
6
|
+
options: {
|
|
7
|
+
sum: undefined;
|
|
8
|
+
isSumConstant: boolean;
|
|
9
|
+
sumAuto: boolean;
|
|
10
|
+
};
|
|
11
|
+
} & Integrals;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import median from 'ml-array-median';
|
|
2
2
|
import { xyAutoPeaksPicking } from 'nmr-processing';
|
|
3
|
-
import
|
|
4
|
-
import { getShiftX } from '../shift/getShiftX';
|
|
3
|
+
import { mapPeaks } from './mapPeaks';
|
|
5
4
|
export function autoPeakPicking(datum1D, options) {
|
|
6
5
|
const { minMaxRatio, maxNumberOfPeaks, noiseFactor, lookNegative, windowFromIndex, windowToIndex, } = options;
|
|
7
6
|
// we calculate the noise but this could be improved
|
|
8
7
|
const noise = median(datum1D.data.re.map((y) => Math.abs(y)));
|
|
9
8
|
let { re, x } = datum1D.data;
|
|
10
|
-
let { values: currentPeaks = [] } = datum1D.peaks || {};
|
|
11
9
|
if (windowFromIndex !== undefined && windowToIndex !== undefined) {
|
|
12
10
|
x = x.slice(windowFromIndex, windowToIndex);
|
|
13
11
|
re = re.slice(windowFromIndex, windowToIndex);
|
|
@@ -23,22 +21,5 @@ export function autoPeakPicking(datum1D, options) {
|
|
|
23
21
|
peaks.sort((a, b) => b.y - a.y);
|
|
24
22
|
if (maxNumberOfPeaks < peaks.length)
|
|
25
23
|
peaks = peaks.slice(0, maxNumberOfPeaks);
|
|
26
|
-
|
|
27
|
-
const error = (x[x.length - 1] - x[0]) / 10000;
|
|
28
|
-
return peaks.reduce((acc, newPeak) => {
|
|
29
|
-
// check if the peak is already exists
|
|
30
|
-
for (const { x } of currentPeaks) {
|
|
31
|
-
if (Math.abs(newPeak.x - x) < error) {
|
|
32
|
-
return acc;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
acc.push({
|
|
36
|
-
id: generateID(),
|
|
37
|
-
originalX: newPeak.x - shiftX,
|
|
38
|
-
x: newPeak.x,
|
|
39
|
-
y: newPeak.y,
|
|
40
|
-
width: newPeak.width,
|
|
41
|
-
});
|
|
42
|
-
return acc;
|
|
43
|
-
}, []);
|
|
24
|
+
return mapPeaks(peaks, datum1D);
|
|
44
25
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import generateID from '../../../utilities/generateID';
|
|
2
|
+
import { getSpectrumErrorValue } from '../getSpectrumErrorValue';
|
|
3
|
+
import { getShiftX } from '../shift/getShiftX';
|
|
4
|
+
function checkPeak(peak, datum, error) {
|
|
5
|
+
// check if the Peak is already exists
|
|
6
|
+
for (const { x } of datum.peaks?.values || []) {
|
|
7
|
+
if (Math.abs(peak.x - x) < error) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
export function mapPeaks(peaks, datum) {
|
|
14
|
+
const shiftX = getShiftX(datum);
|
|
15
|
+
const error = getSpectrumErrorValue(datum);
|
|
16
|
+
return peaks.reduce((acc, newPeak) => {
|
|
17
|
+
// check if the peak is already exists
|
|
18
|
+
if (checkPeak(newPeak, datum, error))
|
|
19
|
+
return acc;
|
|
20
|
+
acc.push({
|
|
21
|
+
id: newPeak?.id || generateID(),
|
|
22
|
+
originalX: newPeak.x - shiftX,
|
|
23
|
+
x: newPeak.x,
|
|
24
|
+
y: newPeak.y,
|
|
25
|
+
width: newPeak.width,
|
|
26
|
+
});
|
|
27
|
+
return acc;
|
|
28
|
+
}, []);
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Datum1D, Ranges } from '../../../types/data1d';
|
|
2
|
+
export declare function initiateRanges(options: Partial<{
|
|
3
|
+
ranges: Ranges;
|
|
4
|
+
}>, datum: Datum1D): {
|
|
5
|
+
values: never[];
|
|
6
|
+
options: {
|
|
7
|
+
sum: undefined;
|
|
8
|
+
isSumConstant: boolean;
|
|
9
|
+
sumAuto: boolean;
|
|
10
|
+
};
|
|
11
|
+
} & Ranges & {
|
|
12
|
+
values: import("../../../types/data1d").Range[];
|
|
13
|
+
};
|