nmrium 0.27.0 → 0.28.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 -1
- package/lib/component/1d/IntegralsSeries.js +2 -6
- package/lib/component/1d/PeakAnnotation.js +2 -2
- package/lib/component/1d/PeakAnnotations.js +2 -4
- package/lib/component/1d/SpectraTracker.js +2 -2
- package/lib/component/1d/Viewer1D.js +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +28 -26
- package/lib/component/1d/ranges/Range.d.ts +1 -2
- package/lib/component/1d/ranges/Range.js +3 -4
- package/lib/component/1d/ranges/Ranges.js +3 -4
- package/lib/component/1d/tool/BaseLineZones.js +3 -6
- package/lib/component/1d/tool/VerticalIndicator.js +1 -1
- package/lib/component/2d/Contours.js +1 -5
- package/lib/component/2d/SignalDeltaLine.js +1 -1
- package/lib/component/2d/Viewer2D.js +1 -1
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/zones/IndicationLines.js +2 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +59 -41
- package/lib/component/NMRium.d.ts +14 -49
- package/lib/component/NMRium.js +14 -6
- package/lib/component/SplitPaneWrapper.js +2 -2
- package/lib/component/context/PreferencesContext.d.ts +3 -43
- package/lib/component/elements/Button.js +1 -1
- package/lib/component/elements/Logo.js +1 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
- package/lib/component/elements/Tab/Tabs.js +2 -1
- package/lib/component/elements/ToggleButton.js +2 -2
- package/lib/component/elements/accordion/Accordion.js +2 -6
- package/lib/component/elements/formik/Input.js +1 -1
- package/lib/component/elements/popup/Modal/Modal.js +1 -1
- package/lib/component/elements/popup/Modal/ModalContent.js +1 -1
- package/lib/component/elements/toggle/ToggleButtonGroup.js +2 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +7 -4
- package/lib/component/header/Header.js +2 -2
- package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +2 -1
- package/lib/component/hooks/useExport.js +2 -2
- package/lib/component/hooks/useFormatNumberByNucleus.js +3 -4
- package/lib/component/loader/DropZone.js +8 -2
- package/lib/component/loader/NoData.d.ts +3 -2
- package/lib/component/loader/NoData.js +31 -30
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -2
- package/lib/component/modal/editRange/EditRangeModal.d.ts +3 -3
- package/lib/component/modal/editRange/EditRangeModal.js +49 -54
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +2 -0
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +34 -0
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +1 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +11 -14
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +2 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +18 -29
- package/lib/component/modal/editZone/SignalsForm.js +1 -1
- package/lib/component/modal/setting/DatabasesTabContent.d.ts +2 -1
- package/lib/component/modal/setting/DatabasesTabContent.js +28 -30
- package/lib/component/modal/setting/settingsValidation.d.ts +150 -42
- package/lib/component/modal/setting/settingsValidation.js +6 -4
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +13 -15
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +2 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +12 -3
- package/lib/component/panels/RangesPanel/RangesPanel.js +19 -19
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +4 -4
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +48 -30
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -3
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -8
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
- package/lib/component/panels/SummaryPanel/utilities/{IsInView.d.ts → useInView.d.ts} +2 -2
- package/lib/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +13 -13
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +4 -0
- package/lib/component/panels/databasePanel/DatabasePanel.js +80 -26
- package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.d.ts +7 -0
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +8 -0
- package/lib/component/panels/databasePanel/DatabaseTable.js +14 -9
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +2 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +1 -3
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +8 -66
- package/lib/component/reducer/Reducer.js +13 -8
- package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
- package/lib/component/reducer/actions/DatabaseActions.js +21 -3
- package/lib/component/reducer/actions/DomainActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +2 -1
- package/lib/component/reducer/actions/FiltersActions.js +25 -4
- package/lib/component/reducer/actions/PreferencesActions.js +32 -20
- package/lib/component/reducer/actions/RangesActions.d.ts +2 -2
- package/lib/component/reducer/actions/RangesActions.js +45 -11
- package/lib/component/reducer/actions/SpectrumsActions.js +6 -9
- package/lib/component/reducer/actions/ToolsActions.js +66 -53
- package/lib/component/reducer/helper/getSpectrum.d.ts +5 -0
- package/lib/component/reducer/helper/getSpectrum.js +14 -0
- package/lib/component/reducer/preferences/actions/initPreferences.js +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -10
- package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/tool/BrushX.js +1 -1
- package/lib/component/tool/BrushXY.js +1 -1
- package/lib/component/tool/CrossLinePointer.js +1 -1
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +4 -3
- package/lib/component/toolbar/BasicToolBar.js +0 -1
- package/lib/component/toolbar/FunctionToolBar.js +9 -13
- package/lib/component/toolbar/ToolTypes.d.ts +1 -1
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/utility/Export.d.ts +7 -1
- package/lib/component/utility/Export.js +3 -3
- package/lib/component/utility/formatNumber.d.ts +1 -1
- package/lib/component/utility/formatNumber.js +4 -2
- package/lib/component/utility/isGoogleDocument.d.ts +1 -0
- package/lib/component/utility/isGoogleDocument.js +3 -0
- package/lib/component/utility/nmredataToNmrium.js +1 -2
- package/lib/component/utility/nmriumToNmredata.d.ts +2 -2
- package/lib/component/utility/nmriumToNmredata.js +2 -2
- package/lib/component/utility/util/nmredata/addSource.js +2 -2
- package/lib/component/workspaces/Workspace.d.ts +9 -4
- package/lib/component/workspaces/basic.js +15 -8
- package/lib/component/workspaces/exercise.js +2 -2
- package/lib/component/workspaces/process1D.js +1 -1
- package/lib/data/FiltersManager.js +1 -1
- package/lib/data/PredictionManager.js +7 -9
- package/lib/data/SpectraManager.d.ts +4 -12
- package/lib/data/SpectraManager.js +14 -23
- package/lib/data/data1d/Data1DManager.js +8 -1
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
- package/lib/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +36 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +38 -15
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
- package/lib/data/data1d/database.d.ts +5 -3
- package/lib/data/data1d/database.js +54 -4
- package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib/data/data2d/Processing2D.js +1 -1
- package/lib/data/molecules/Molecule.d.ts +4 -5
- package/lib/data/molecules/Molecule.js +3 -1
- package/lib/data/utilities/FindUtilities.js +1 -3
- package/lib/data/utilities/RangeUtilities.js +5 -6
- package/lib/data/utilities/ZoneUtilities.js +1 -1
- package/lib/data/utilities/getSum.js +1 -3
- package/lib/data/utilities/isMolFileEmpty.d.ts +1 -0
- package/lib/data/utilities/isMolFileEmpty.js +6 -0
- package/lib/types/NMRiumDataReturn.d.ts +15 -0
- package/lib/types/NMRiumDataReturn.js +1 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +10 -0
- package/lib/types/NMRiumGeneralPreferences.js +1 -0
- package/lib/types/NMRiumPanelPreferences.d.ts +16 -0
- package/lib/types/NMRiumPanelPreferences.js +1 -0
- package/lib/types/NMRiumToolBarPreferences.d.ts +20 -0
- package/lib/types/NMRiumToolBarPreferences.js +1 -0
- package/lib/types/Preferences.d.ts +5 -0
- package/lib/types/Preferences.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -1
- package/lib-cjs/component/1d/IntegralsSeries.js +2 -6
- package/lib-cjs/component/1d/PeakAnnotation.js +2 -2
- package/lib-cjs/component/1d/PeakAnnotations.js +2 -4
- package/lib-cjs/component/1d/SpectraTracker.js +2 -2
- package/lib-cjs/component/1d/Viewer1D.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +30 -25
- package/lib-cjs/component/1d/ranges/Range.js +3 -4
- package/lib-cjs/component/1d/ranges/Ranges.js +3 -4
- package/lib-cjs/component/1d/tool/BaseLineZones.js +3 -6
- package/lib-cjs/component/1d/tool/VerticalIndicator.js +1 -1
- package/lib-cjs/component/2d/Contours.js +1 -5
- package/lib-cjs/component/2d/SignalDeltaLine.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +1 -1
- package/lib-cjs/component/2d/YAxis.js +1 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +2 -3
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +59 -41
- package/lib-cjs/component/NMRium.js +13 -5
- package/lib-cjs/component/SplitPaneWrapper.js +2 -2
- package/lib-cjs/component/elements/Button.js +1 -1
- package/lib-cjs/component/elements/Logo.js +1 -1
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
- package/lib-cjs/component/elements/Tab/Tabs.js +2 -1
- package/lib-cjs/component/elements/ToggleButton.js +2 -2
- package/lib-cjs/component/elements/accordion/Accordion.js +2 -6
- package/lib-cjs/component/elements/formik/Input.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/Modal.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ModalContent.js +1 -1
- package/lib-cjs/component/elements/toggle/ToggleButtonGroup.js +2 -2
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -3
- package/lib-cjs/component/header/Header.js +2 -2
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -1
- package/lib-cjs/component/hooks/useExport.js +2 -2
- package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +2 -3
- package/lib-cjs/component/loader/DropZone.js +8 -2
- package/lib-cjs/component/loader/NoData.js +31 -30
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +47 -52
- package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +38 -0
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormTab.js +13 -16
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +18 -29
- package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +31 -33
- package/lib-cjs/component/modal/setting/settingsValidation.js +6 -4
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +12 -14
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
- package/lib-cjs/component/panels/Panels.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -1
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +18 -18
- package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +47 -29
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +6 -8
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
- package/lib-cjs/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -12
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +78 -24
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabaseStructureSearchModal.js +15 -0
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +14 -9
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +2 -4
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -3
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib-cjs/component/reducer/Reducer.js +13 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +22 -3
- package/lib-cjs/component/reducer/actions/DomainActions.js +1 -1
- package/lib-cjs/component/reducer/actions/FiltersActions.js +26 -4
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +30 -18
- package/lib-cjs/component/reducer/actions/RangesActions.js +46 -12
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +4 -7
- package/lib-cjs/component/reducer/actions/ToolsActions.js +63 -73
- package/lib-cjs/component/reducer/helper/getSpectrum.js +18 -0
- package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +1 -1
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib-cjs/component/reducer/types/Types.js +5 -3
- package/lib-cjs/component/tool/BrushX.js +1 -1
- package/lib-cjs/component/tool/BrushXY.js +1 -1
- package/lib-cjs/component/tool/CrossLinePointer.js +1 -1
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/toolbar/BasicToolBar.js +0 -1
- package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -13
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/utility/Export.js +4 -3
- package/lib-cjs/component/utility/formatNumber.js +3 -1
- package/lib-cjs/component/utility/isGoogleDocument.js +7 -0
- package/lib-cjs/component/utility/nmredataToNmrium.js +1 -2
- package/lib-cjs/component/utility/util/nmredata/addSource.js +2 -2
- package/lib-cjs/component/workspaces/basic.js +15 -8
- package/lib-cjs/component/workspaces/exercise.js +2 -2
- package/lib-cjs/component/workspaces/process1D.js +1 -1
- package/lib-cjs/data/FiltersManager.js +1 -1
- package/lib-cjs/data/PredictionManager.js +7 -9
- package/lib-cjs/data/SpectraManager.js +14 -23
- package/lib-cjs/data/data1d/Data1DManager.js +8 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
- package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +40 -16
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
- package/lib-cjs/data/data1d/database.js +55 -5
- package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib-cjs/data/data2d/Processing2D.js +1 -1
- package/lib-cjs/data/molecules/Molecule.js +3 -1
- package/lib-cjs/data/utilities/FindUtilities.js +1 -3
- package/lib-cjs/data/utilities/RangeUtilities.js +8 -6
- package/lib-cjs/data/utilities/ZoneUtilities.js +1 -1
- package/lib-cjs/data/utilities/getSum.js +1 -3
- package/lib-cjs/data/utilities/isMolFileEmpty.js +10 -0
- package/lib-cjs/types/NMRiumDataReturn.js +2 -0
- package/lib-cjs/types/NMRiumGeneralPreferences.js +2 -0
- package/lib-cjs/types/NMRiumPanelPreferences.js +2 -0
- package/lib-cjs/types/NMRiumToolBarPreferences.js +2 -0
- package/lib-cjs/types/Preferences.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +31 -31
- package/lib/component/1d/multiplicityTree/TempMultiplicityTree.d.ts +0 -2
- package/lib/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -14
- package/lib/component/panels/databasePanel/useDatabases.d.ts +0 -5
- package/lib/component/panels/databasePanel/useDatabases.js +0 -10
- package/lib-cjs/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -20
- package/lib-cjs/component/panels/databasePanel/useDatabases.js +0 -14
|
@@ -44,8 +44,7 @@ async function getSpectra(file, options = {}, usedColors = {}) {
|
|
|
44
44
|
return addBruker({ xy, noContours, keepOriginal }, file.binary, usedColors);
|
|
45
45
|
default:
|
|
46
46
|
if (!jcampURL) {
|
|
47
|
-
new Error('file extension is not supported');
|
|
48
|
-
return;
|
|
47
|
+
throw new Error('file extension is not supported');
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function nmriumToNmredata(state: any, options?: {}): Promise<
|
|
1
|
+
import Jszip from 'jszip';
|
|
2
|
+
export declare function nmriumToNmredata(state: any, options?: {}): Promise<Jszip>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Jszip from 'jszip';
|
|
2
2
|
import { getGroupedDiastereotopicAtomIDs } from 'openchemlib-utils';
|
|
3
3
|
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
4
4
|
import { get1DSignals } from './util/nmredata/get1DSignals';
|
|
@@ -18,7 +18,7 @@ export async function nmriumToNmredata(state, options = {}) {
|
|
|
18
18
|
data: [],
|
|
19
19
|
molecules: [],
|
|
20
20
|
};
|
|
21
|
-
let nmrRecord = new
|
|
21
|
+
let nmrRecord = new Jszip();
|
|
22
22
|
for (const molecule of molecules) {
|
|
23
23
|
await addNMReDATA(data, nmrRecord, {
|
|
24
24
|
...options,
|
|
@@ -26,14 +26,14 @@ export async function addSource(nmrRecord, options = {}) {
|
|
|
26
26
|
default:
|
|
27
27
|
if (!jcampURL)
|
|
28
28
|
break;
|
|
29
|
-
|
|
29
|
+
await fetch(jcampURL).then(async (jcamp) => {
|
|
30
30
|
if (!jcamp)
|
|
31
31
|
return;
|
|
32
32
|
let name = jcampURL.split('/').slice(-1);
|
|
33
33
|
const path = `jcamp/${dimension}/${name}`;
|
|
34
34
|
tag += `\nJcamp_Location=file:${path}\\`;
|
|
35
35
|
nmrRecord.file(path, await jcamp.arrayBuffer());
|
|
36
|
-
})
|
|
36
|
+
});
|
|
37
37
|
}
|
|
38
38
|
return tag;
|
|
39
39
|
}
|
|
@@ -50,10 +50,10 @@ export interface DatabasePanelPreferences {
|
|
|
50
50
|
showSmiles: boolean;
|
|
51
51
|
showSolvent: boolean;
|
|
52
52
|
showNames: boolean;
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
range: ColumnPreferences;
|
|
54
|
+
delta: ColumnPreferences;
|
|
55
55
|
showAssignment: boolean;
|
|
56
|
-
|
|
56
|
+
coupling: ColumnPreferences;
|
|
57
57
|
showMultiplicity: boolean;
|
|
58
58
|
color: string;
|
|
59
59
|
marginBottom: number;
|
|
@@ -77,16 +77,21 @@ export interface Formatting {
|
|
|
77
77
|
panels: Partial<PanelsPreferences>;
|
|
78
78
|
}
|
|
79
79
|
export interface Database {
|
|
80
|
+
key: string;
|
|
80
81
|
label: string;
|
|
81
82
|
url: string;
|
|
82
83
|
enabled: boolean;
|
|
83
84
|
}
|
|
85
|
+
export interface Databases {
|
|
86
|
+
data: Database[];
|
|
87
|
+
defaultDatabase: string;
|
|
88
|
+
}
|
|
84
89
|
export interface Workspace {
|
|
85
90
|
version: number;
|
|
86
91
|
label: string;
|
|
87
92
|
display: NMRiumPreferences;
|
|
88
93
|
controllers: Controllers;
|
|
89
94
|
formatting: Formatting;
|
|
90
|
-
databases:
|
|
95
|
+
databases: Databases;
|
|
91
96
|
}
|
|
92
97
|
export {};
|
|
@@ -11,7 +11,7 @@ export const basic = {
|
|
|
11
11
|
panels: {
|
|
12
12
|
spectraPanel: { display: true, open: true },
|
|
13
13
|
informationPanel: { display: true, open: false },
|
|
14
|
-
peaksPanel: { display:
|
|
14
|
+
peaksPanel: { display: false, open: false },
|
|
15
15
|
integralsPanel: { display: true, open: false },
|
|
16
16
|
rangesPanel: { display: true, open: false },
|
|
17
17
|
structuresPanel: { display: true, open: false },
|
|
@@ -23,6 +23,9 @@ export const basic = {
|
|
|
23
23
|
predictionPanel: { display: false, open: false },
|
|
24
24
|
automaticAssignmentPanel: { display: false, open: false },
|
|
25
25
|
},
|
|
26
|
+
toolBarButtons: {
|
|
27
|
+
peakTool: false,
|
|
28
|
+
},
|
|
26
29
|
},
|
|
27
30
|
controllers: {
|
|
28
31
|
dimmedSpectraTransparency: 0.1,
|
|
@@ -38,11 +41,15 @@ export const basic = {
|
|
|
38
41
|
},
|
|
39
42
|
panels: {},
|
|
40
43
|
},
|
|
41
|
-
databases:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
databases: {
|
|
45
|
+
defaultDatabase: '',
|
|
46
|
+
data: [
|
|
47
|
+
{
|
|
48
|
+
key: 'toc',
|
|
49
|
+
label: 'Toc',
|
|
50
|
+
url: 'https://data.cheminfo.org/nmr/database/toc.json',
|
|
51
|
+
enabled: true,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
48
55
|
};
|
|
@@ -36,10 +36,10 @@ export const exercise = {
|
|
|
36
36
|
integralTool: true,
|
|
37
37
|
zonePickingTool: false,
|
|
38
38
|
slicingTool: false,
|
|
39
|
-
|
|
39
|
+
rangePickingTool: false,
|
|
40
40
|
zeroFillingTool: false,
|
|
41
41
|
phaseCorrectionTool: false,
|
|
42
|
-
|
|
42
|
+
baselineCorrectionTool: false,
|
|
43
43
|
FFTTool: false,
|
|
44
44
|
multipleSpectraAnalysisTool: false,
|
|
45
45
|
exclusionZonesTool: false,
|
|
@@ -179,15 +179,13 @@ function calculateFrequency(nucleus, frequency) {
|
|
|
179
179
|
if (typeof nucleus === 'string') {
|
|
180
180
|
return getFrequency(nucleus, { nucleus: '1H', frequency });
|
|
181
181
|
}
|
|
182
|
+
else if (nucleus[0] === nucleus[1]) {
|
|
183
|
+
return `${frequency},${frequency}`;
|
|
184
|
+
}
|
|
182
185
|
else {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return `${frequency},${getFrequency(nucleus[1], {
|
|
188
|
-
nucleus: nucleus[0],
|
|
189
|
-
frequency,
|
|
190
|
-
})}`;
|
|
191
|
-
}
|
|
186
|
+
return `${frequency},${getFrequency(nucleus[1], {
|
|
187
|
+
nucleus: nucleus[0],
|
|
188
|
+
frequency,
|
|
189
|
+
})}`;
|
|
192
190
|
}
|
|
193
191
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NMRiumDataReturn } from '../types/NMRiumDataReturn';
|
|
1
2
|
export declare enum DataExportOptions {
|
|
2
3
|
ROW_DATA = "ROW_DATA",
|
|
3
4
|
DATA_SOURCE = "DATA_SOURCE"
|
|
@@ -15,15 +16,6 @@ export declare function addJcamps(files: any, usedColors: any): never[];
|
|
|
15
16
|
*
|
|
16
17
|
* @param {object} state
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
correlations: any;
|
|
22
|
-
multipleAnalysis: any;
|
|
23
|
-
exclusionZones: any;
|
|
24
|
-
version: number;
|
|
25
|
-
preferences: {
|
|
26
|
-
verticalAlign?: any;
|
|
27
|
-
activeTab: any;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
19
|
+
declare type JSONTarget = 'nmrium' | 'onDataChange';
|
|
20
|
+
export declare function toJSON(state: any, target: JSONTarget, dataExportOption?: DataExportOptionsType): NMRiumDataReturn;
|
|
21
|
+
export {};
|
|
@@ -81,7 +81,7 @@ export function addJDF(spectra, jdf, options = {}, usedColors = {}) {
|
|
|
81
81
|
spectra.push(Data1DManager.fromCSD(converted, {
|
|
82
82
|
...options,
|
|
83
83
|
display: { ...options.display },
|
|
84
|
-
info
|
|
84
|
+
info,
|
|
85
85
|
meta: metadata,
|
|
86
86
|
}, usedColors));
|
|
87
87
|
}
|
|
@@ -115,9 +115,9 @@ export async function fromJSON(data = [], usedColors = {}) {
|
|
|
115
115
|
export async function addBruker(options, data, usedColors) {
|
|
116
116
|
const spectra = [];
|
|
117
117
|
let result = await fromBruker(data, {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
converter: {
|
|
119
|
+
xy: true,
|
|
120
|
+
},
|
|
121
121
|
});
|
|
122
122
|
let entries = result;
|
|
123
123
|
for (let entry of entries) {
|
|
@@ -131,16 +131,11 @@ export async function addBruker(options, data, usedColors) {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
else if (info.dimension === 2) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}, usedColors));
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
// in case of 2D FID spectrum
|
|
143
|
-
}
|
|
134
|
+
spectra.push(Data2DManager.fromBruker(entry, {
|
|
135
|
+
...options,
|
|
136
|
+
info,
|
|
137
|
+
display: { ...options.display },
|
|
138
|
+
}, usedColors));
|
|
144
139
|
}
|
|
145
140
|
}
|
|
146
141
|
return spectra;
|
|
@@ -192,17 +187,13 @@ function getPreferences(state) {
|
|
|
192
187
|
: {}),
|
|
193
188
|
};
|
|
194
189
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @param {object} state
|
|
198
|
-
*/
|
|
199
|
-
export function toJSON(state, dataExportOption = DataExportOptions.DATA_SOURCE) {
|
|
200
|
-
const { data, molecules: mols, correlations, multipleAnalysis, toolOptions: { data: { exclusionZones }, }, } = state || {
|
|
190
|
+
export function toJSON(state, target, dataExportOption = DataExportOptions.DATA_SOURCE) {
|
|
191
|
+
const { data, molecules: mols, correlations, multipleAnalysis, actionType, } = state || {
|
|
201
192
|
data: [],
|
|
202
193
|
molecules: [],
|
|
203
194
|
correlations: {},
|
|
204
195
|
multipleAnalysis: {},
|
|
205
|
-
|
|
196
|
+
actionType: '',
|
|
206
197
|
};
|
|
207
198
|
const spectra = data.map((ob) => {
|
|
208
199
|
return ob.info.dimension === 1
|
|
@@ -212,12 +203,12 @@ export function toJSON(state, dataExportOption = DataExportOptions.DATA_SOURCE)
|
|
|
212
203
|
const preferences = getPreferences(state);
|
|
213
204
|
const molecules = mols.map((mol) => Molecule.toJSON(mol));
|
|
214
205
|
return {
|
|
206
|
+
...(target === 'onDataChange' ? { actionType } : {}),
|
|
207
|
+
version: CURRENT_EXPORT_VERSION,
|
|
215
208
|
spectra,
|
|
216
209
|
molecules,
|
|
217
210
|
correlations,
|
|
218
211
|
multipleAnalysis,
|
|
219
|
-
exclusionZones,
|
|
220
|
-
version: CURRENT_EXPORT_VERSION,
|
|
221
212
|
preferences,
|
|
222
213
|
};
|
|
223
214
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { initiateDatum1D } from './Spectrum1D';
|
|
2
2
|
export function fromBruker(result, options = {}, usedColors = {}) {
|
|
3
3
|
const { dependentVariables, info, meta, source } = result;
|
|
4
|
-
let data =
|
|
4
|
+
let { data } = dependentVariables[0].components[0];
|
|
5
|
+
const { x, re, im } = data;
|
|
6
|
+
if (x[0] > x[1]) {
|
|
7
|
+
x.reverse();
|
|
8
|
+
re.reverse();
|
|
9
|
+
if (im)
|
|
10
|
+
im.reverse();
|
|
11
|
+
}
|
|
5
12
|
if (data.im)
|
|
6
13
|
info.isComplex = true;
|
|
7
14
|
if (Array.isArray(info.nucleus))
|
|
@@ -65,17 +65,15 @@ function createLinks(ranges, jGraphTolerance = 0) {
|
|
|
65
65
|
}
|
|
66
66
|
end++;
|
|
67
67
|
}
|
|
68
|
+
else if (Math.abs(couplings[end - 1].coupling - nextCoupling.coupling) <
|
|
69
|
+
jGraphTolerance) {
|
|
70
|
+
start = end - 1;
|
|
71
|
+
}
|
|
68
72
|
else {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
else {
|
|
74
|
-
index++;
|
|
75
|
-
links[index] = initLink(couplings[end]);
|
|
76
|
-
start = end;
|
|
77
|
-
end = end + 1;
|
|
78
|
-
}
|
|
73
|
+
index++;
|
|
74
|
+
links[index] = initLink(couplings[end]);
|
|
75
|
+
start = end;
|
|
76
|
+
end = end + 1;
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
return links;
|
|
@@ -16,7 +16,7 @@ import { getRange } from '../../constants/References';
|
|
|
16
16
|
export function getReferenceShift(datum1D, options) {
|
|
17
17
|
let { from, to, nbPeaks, targetX, reference } = options;
|
|
18
18
|
if (reference) {
|
|
19
|
-
let data = getRange({ reference
|
|
19
|
+
let data = getRange({ reference, nucleus: datum1D.nucleus });
|
|
20
20
|
from = data.from;
|
|
21
21
|
to = data.to;
|
|
22
22
|
nbPeaks = data.nbPeaks;
|
|
@@ -7,13 +7,11 @@ export function updateRelatives(data, key, check, forceCalculateIntegral = false
|
|
|
7
7
|
if (data.options.isSumConstant || forceCalculateIntegral) {
|
|
8
8
|
factor = currentSum > 0 ? options.sum / currentSum : 0.0;
|
|
9
9
|
}
|
|
10
|
-
else {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
item.absolute;
|
|
16
|
-
}
|
|
10
|
+
else if (data.values?.[0]) {
|
|
11
|
+
const item = data.values[0];
|
|
12
|
+
factor =
|
|
13
|
+
(item[key] ? item[key] : options.sum) /
|
|
14
|
+
item.absolute;
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
data.values = data.values.map((value) => {
|
|
@@ -13,7 +13,7 @@ export function autoPeakPicking(datum1D, options) {
|
|
|
13
13
|
let peaks = xyAutoPeaksPicking({ x, y: re }, {
|
|
14
14
|
lookNegative,
|
|
15
15
|
noiseLevel: noise * noiseFactor,
|
|
16
|
-
minMaxRatio
|
|
16
|
+
minMaxRatio,
|
|
17
17
|
realTopDetection: true,
|
|
18
18
|
smoothY: false,
|
|
19
19
|
sgOptions: { windowSize: 15, polynomial: 3 },
|
|
@@ -1,8 +1,42 @@
|
|
|
1
|
+
import { Signal1D } from '../../../types/data1d';
|
|
1
2
|
import { Datum1D } from '../../../types/data1d/Datum1D';
|
|
2
3
|
import { SumParams } from '../SumManager';
|
|
3
|
-
interface
|
|
4
|
+
interface RangeOptions {
|
|
4
5
|
from: number;
|
|
5
6
|
to: number;
|
|
7
|
+
id?: string;
|
|
6
8
|
}
|
|
7
|
-
export declare function
|
|
9
|
+
export declare function createRangeObj({ from, to, absolute, id, signal, }: RangeOptions & {
|
|
10
|
+
signal: Omit<Signal1D, 'id'>;
|
|
11
|
+
absolute: number;
|
|
12
|
+
}): {
|
|
13
|
+
id: string;
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
absolute: number;
|
|
17
|
+
signals: {
|
|
18
|
+
peaks?: import("nmr-processing").NMRPeak1D[] | undefined;
|
|
19
|
+
kind?: string | undefined;
|
|
20
|
+
delta: number;
|
|
21
|
+
js?: import("nmr-processing").Jcoupling[] | undefined;
|
|
22
|
+
atoms?: number[] | undefined;
|
|
23
|
+
assignment?: string | undefined;
|
|
24
|
+
multiplicity?: string | undefined;
|
|
25
|
+
diaIDs?: string[] | undefined;
|
|
26
|
+
nbAtoms?: number | undefined;
|
|
27
|
+
integration?: number | undefined;
|
|
28
|
+
statistic?: {
|
|
29
|
+
mean: number;
|
|
30
|
+
sd: number;
|
|
31
|
+
min: number;
|
|
32
|
+
max: number;
|
|
33
|
+
nb: number;
|
|
34
|
+
} | undefined;
|
|
35
|
+
originDelta?: number | undefined;
|
|
36
|
+
id: string;
|
|
37
|
+
}[];
|
|
38
|
+
kind: string;
|
|
39
|
+
integration: number;
|
|
40
|
+
};
|
|
41
|
+
export declare function addRange(datum: Datum1D, options: RangeOptions & SumParams): void;
|
|
8
42
|
export {};
|
|
@@ -5,30 +5,53 @@ import { initSumOptions } from '../SumManager';
|
|
|
5
5
|
import detectSignal from './detectSignal';
|
|
6
6
|
import { mapRanges } from './mapRanges';
|
|
7
7
|
import { updateRangesRelativeValues } from './updateRangesRelativeValues';
|
|
8
|
+
export function createRangeObj({ from, to, absolute, id, signal, }) {
|
|
9
|
+
return {
|
|
10
|
+
id: id ? id : generateID(),
|
|
11
|
+
from,
|
|
12
|
+
to,
|
|
13
|
+
absolute,
|
|
14
|
+
signals: [{ id: generateID(), ...signal }],
|
|
15
|
+
kind: DatumKind.signal,
|
|
16
|
+
integration: 0,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
8
19
|
export function addRange(datum, options) {
|
|
9
|
-
const { from, to, molecules, nucleus } = options;
|
|
20
|
+
const { from, to, id, molecules, nucleus } = options;
|
|
10
21
|
const { x, re } = datum.data;
|
|
11
22
|
const absolute = xyIntegration({ x, y: re }, { from, to, reverse: true });
|
|
12
23
|
// detectSignal use the advance multiplet-analysis that can crash if too many points
|
|
13
24
|
const signal = detectSignal(x, re, from, to, datum.info.originFrequency);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
let range;
|
|
26
|
+
if (!signal) {
|
|
27
|
+
if (id === 'new') {
|
|
28
|
+
range = createRangeObj({
|
|
29
|
+
from,
|
|
30
|
+
to,
|
|
31
|
+
id,
|
|
32
|
+
absolute,
|
|
33
|
+
signal: { multiplicity: 's', kind: 'signal', delta: 0, js: [] },
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
range = createRangeObj({
|
|
19
39
|
from,
|
|
20
40
|
to,
|
|
41
|
+
id,
|
|
21
42
|
absolute,
|
|
22
|
-
|
|
23
|
-
kind: DatumKind.signal,
|
|
24
|
-
integration: 0,
|
|
25
|
-
};
|
|
26
|
-
datum.ranges.options = initSumOptions(datum.ranges.options, {
|
|
27
|
-
molecules,
|
|
28
|
-
nucleus,
|
|
43
|
+
signal,
|
|
29
44
|
});
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
if (range) {
|
|
48
|
+
datum.ranges.options = initSumOptions(datum.ranges.options, {
|
|
49
|
+
molecules,
|
|
50
|
+
nucleus,
|
|
51
|
+
});
|
|
52
|
+
datum.ranges.values = datum.ranges.values.concat(mapRanges([range], datum));
|
|
53
|
+
updateRangesRelativeValues(datum);
|
|
54
|
+
}
|
|
32
55
|
}
|
|
33
56
|
catch (e) {
|
|
34
57
|
throw new Error('Could not calculate the multiplicity');
|
|
@@ -3,8 +3,8 @@ import { analyseMultiplet } from 'multiplet-analysis';
|
|
|
3
3
|
export const MAX_LENGTH = 2048;
|
|
4
4
|
export default function detectSignal(x, re, from, to, frequency) {
|
|
5
5
|
const { fromIndex, toIndex } = xGetFromToIndex(x, {
|
|
6
|
-
from
|
|
7
|
-
to
|
|
6
|
+
from,
|
|
7
|
+
to,
|
|
8
8
|
});
|
|
9
9
|
if (toIndex - fromIndex <= MAX_LENGTH) {
|
|
10
10
|
const data = {
|
|
@@ -12,7 +12,7 @@ export default function detectSignal(x, re, from, to, frequency) {
|
|
|
12
12
|
y: re.subarray(fromIndex, toIndex),
|
|
13
13
|
};
|
|
14
14
|
const result = analyseMultiplet(data, {
|
|
15
|
-
frequency
|
|
15
|
+
frequency,
|
|
16
16
|
takeBestPartMultiplet: true,
|
|
17
17
|
symmetrizeEachStep: true,
|
|
18
18
|
});
|
|
@@ -17,7 +17,7 @@ export function mapRanges(ranges, datum) {
|
|
|
17
17
|
const shiftX = getShiftX(datum);
|
|
18
18
|
const error = getSpectrumErrorValue(datum);
|
|
19
19
|
return ranges.reduce((acc, newRange) => {
|
|
20
|
-
if (checkRange(newRange, datum, error))
|
|
20
|
+
if (checkRange(newRange, datum, error) && newRange.id !== 'new')
|
|
21
21
|
return acc;
|
|
22
22
|
const absolute = xyIntegration({ x, y: re }, { from: newRange.from, to: newRange.to, reverse: true });
|
|
23
23
|
const signals = newRange.signals.map((signal) => {
|
|
@@ -8,16 +8,18 @@ export interface DataBaseRange {
|
|
|
8
8
|
to: number;
|
|
9
9
|
signals: Array<DataBaseSignal>;
|
|
10
10
|
}
|
|
11
|
-
export declare type
|
|
11
|
+
export declare type LocalDatabase = {
|
|
12
|
+
key: string;
|
|
12
13
|
label: string;
|
|
13
14
|
url?: string;
|
|
14
15
|
value?: Array<DatabaseNMREntry>;
|
|
15
|
-
}
|
|
16
|
-
export declare const
|
|
16
|
+
};
|
|
17
|
+
export declare const DATA_BASES: LocalDatabase[];
|
|
17
18
|
export interface InitiateDatabaseResult {
|
|
18
19
|
data: DatabaseNMREntry[];
|
|
19
20
|
getSolvents: () => string[];
|
|
20
21
|
search: (keywords?: string | string[]) => DatabaseNMREntry[];
|
|
22
|
+
searchByStructure: (idCode: string) => DatabaseNMREntry[];
|
|
21
23
|
}
|
|
22
24
|
export declare function initiateDatabase(databases: DatabaseNMREntry[], nucleus: string): InitiateDatabaseResult;
|
|
23
25
|
export declare type PrepareDataResult = Partial<DataBaseRange | DataBaseSignal | Jcoupling>;
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { protonImpurities, carbonImpurities, } from 'nmr-processing';
|
|
2
|
+
import { MoleculesDB } from 'openchemlib-utils';
|
|
3
|
+
import OCL from 'openchemlib/full';
|
|
2
4
|
import { filter } from 'smart-array-filter';
|
|
3
5
|
import generateID from '../utilities/generateID';
|
|
4
|
-
export const
|
|
6
|
+
export const DATA_BASES = [
|
|
5
7
|
{
|
|
8
|
+
key: 'local_solvent',
|
|
6
9
|
label: 'Solvent database',
|
|
7
10
|
value: prepareDataBase([...protonImpurities, ...carbonImpurities]),
|
|
8
11
|
},
|
|
9
12
|
];
|
|
10
13
|
export function initiateDatabase(databases, nucleus) {
|
|
11
14
|
const data = databases.filter((datum) => datum.nucleus === nucleus);
|
|
15
|
+
const moleculesDB = prepareMoleculesDB(data);
|
|
12
16
|
const getSolvents = () => prepareGetSolvents(data);
|
|
13
17
|
const search = (keywords = []) => filter(data, { keywords });
|
|
14
|
-
|
|
18
|
+
const searchByStructure = (idCode) => processSearchByStructure(moleculesDB, idCode);
|
|
19
|
+
return { searchByStructure, data, getSolvents, search };
|
|
20
|
+
}
|
|
21
|
+
function processSearchByStructure(moleculesDB, idCode) {
|
|
22
|
+
// default format { format: 'idCode' }
|
|
23
|
+
// https://github.com/cheminfo/openchemlib-utils/blob/ef3a9c30be7efe225a24de04ea9cefc9299674aa/src/db/MoleculesDB.js#L102-L115
|
|
24
|
+
// todo: idCode may be null and the current version of search requires a string or molecule. `|| ''` will become useless in next release of openchemlib-util
|
|
25
|
+
const result = moleculesDB.search(idCode || '');
|
|
26
|
+
return result.map((entry) => entry.data, []);
|
|
15
27
|
}
|
|
16
28
|
function prepareGetSolvents(data) {
|
|
17
29
|
const result = [];
|
|
@@ -30,6 +42,44 @@ function prepareGetSolvents(data) {
|
|
|
30
42
|
// return { id: index, name: label };
|
|
31
43
|
// });
|
|
32
44
|
// }
|
|
45
|
+
function prepareMoleculesDB(array) {
|
|
46
|
+
let moleculesDB = new MoleculesDB(OCL);
|
|
47
|
+
for (let entry of array) {
|
|
48
|
+
//@ts-expect-error property will be defined in next release of nmr-processing
|
|
49
|
+
if (entry.ocl) {
|
|
50
|
+
try {
|
|
51
|
+
const molecule = OCL.Molecule.fromIDCode(
|
|
52
|
+
//@ts-expect-error property will be defined in next release of nmr-processing
|
|
53
|
+
entry.ocl.idCode,
|
|
54
|
+
//@ts-expect-error property will be defined in next release of nmr-processing
|
|
55
|
+
entry.ocl.coordinates);
|
|
56
|
+
moleculesDB.pushEntry(molecule, entry, {}, {
|
|
57
|
+
//@ts-expect-error property will be defined in next release of nmr-processing
|
|
58
|
+
idCode: entry.ocl.idCode,
|
|
59
|
+
//@ts-expect-error property will be defined in next release of nmr-processing
|
|
60
|
+
index: entry.ocl.index,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.log(`Could not parse idCode: ${JSON.stringify(
|
|
66
|
+
//@ts-expect-error property will be defined in next release of nmr-processing
|
|
67
|
+
entry.ocl)}`, e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (entry.smiles) {
|
|
71
|
+
try {
|
|
72
|
+
const molecule = OCL.Molecule.fromSmiles(entry.smiles);
|
|
73
|
+
moleculesDB.pushEntry(molecule, entry);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
// eslint-disable-next-line no-console
|
|
77
|
+
console.log(`Could not parse smiles: ${entry.smiles}`, e);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return moleculesDB;
|
|
82
|
+
}
|
|
33
83
|
function prepareDataBase(array) {
|
|
34
84
|
return array.map((item) => {
|
|
35
85
|
item.ranges = item.ranges.map((range) => ({
|
|
@@ -70,13 +120,13 @@ export function prepareData(data) {
|
|
|
70
120
|
function mapJs(js) {
|
|
71
121
|
if (js && js.length > 0) {
|
|
72
122
|
const { coupling, multiplicity } = js.reduce((acc, { coupling, multiplicity }) => {
|
|
73
|
-
acc.coupling.push(coupling
|
|
123
|
+
acc.coupling.push(coupling);
|
|
74
124
|
acc.multiplicity += multiplicity;
|
|
75
125
|
return acc;
|
|
76
126
|
}, { coupling: [], multiplicity: '' });
|
|
77
127
|
return { multiplicity, coupling: coupling.join(',') };
|
|
78
128
|
}
|
|
79
129
|
else {
|
|
80
|
-
return { multiplicity: '
|
|
130
|
+
return { multiplicity: '', coupling: '' };
|
|
81
131
|
}
|
|
82
132
|
}
|