nmrium 0.40.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/FooterBanner.js +5 -4
- package/lib/component/1d/Viewer1D.js +121 -104
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
- package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +7 -4
- package/lib/component/1d/tool/PeakPointer.js +1 -1
- package/lib/component/1d/utilities/scale.js +1 -3
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib/component/2d/FooterBanner.js +3 -2
- package/lib/component/2d/Viewer2D.js +51 -29
- package/lib/component/2d/XAxis.js +1 -1
- package/lib/component/2d/YAxis.js +1 -1
- package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
- package/lib/component/2d/utilities/scale.d.ts +5 -5
- package/lib/component/2d/zones/Signal.js +1 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
- package/lib/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib/component/NMRium.d.ts +2 -2
- package/lib/component/NMRium.js +39 -26
- package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
- package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib/component/elements/Input.js +1 -0
- package/lib/component/elements/InputRange.js +1 -1
- package/lib/component/elements/MenuButton.d.ts +1 -1
- package/lib/component/elements/MoleculeSelection.d.ts +1 -1
- package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
- package/lib/component/elements/Scroller.d.ts +15 -0
- package/lib/component/elements/Scroller.js +31 -0
- package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
- package/lib/component/elements/ToolbarMenu.d.ts +1 -1
- package/lib/component/elements/accordion/Accordion.d.ts +1 -1
- package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
- package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib/component/elements/formik/SelectBox.d.ts +1 -1
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +3 -2
- package/lib/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
- package/lib/component/elements/popup/Alert/Context.js +6 -2
- package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
- package/lib/component/elements/popup/Alert/Provider.js +3 -3
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
- package/lib/component/elements/popup/Modal/Provider.js +3 -1
- package/lib/component/elements/popup/options.d.ts +22 -19
- package/lib/component/elements/resizer/Resizer.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.js +1 -1
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib/component/highlight/index.d.ts +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib/component/hooks/useExport.js +2 -1
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
- package/lib/component/hooks/usePanelPreferences.js +2 -2
- package/lib/component/hooks/useSaveSettings.js +9 -11
- package/lib/component/hooks/useXScale.d.ts +1 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -2
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
- package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
- package/lib/component/modal/AlignSpectraModal.js +11 -1
- package/lib/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
- package/lib/component/modal/PredictSpectraModal.js +25 -28
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib/component/modal/editZone/SignalsForm.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib/component/modal/setting/settingsValidation.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib/component/panels/Panels.js +13 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +34 -27
- package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
- package/lib/component/reducer/Reducer.d.ts +13 -12
- package/lib/component/reducer/Reducer.js +253 -239
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
- package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
- package/lib/component/reducer/actions/DomainActions.js +30 -1
- package/lib/component/reducer/actions/FiltersActions.js +4 -4
- package/lib/component/reducer/actions/LoadActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +8 -2
- package/lib/component/reducer/actions/MoleculeActions.js +58 -3
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
- package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
- package/lib/component/reducer/actions/ToolsActions.js +2 -2
- package/lib/component/reducer/actions/ZonesActions.js +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
- package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts +4 -4
- package/lib/component/utility/PathBuilder.js +11 -0
- package/lib/component/utility/export.js +9 -9
- package/lib/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib/component/utility/getUniqueNuclei.js +1 -1
- package/lib/component/utility/jpathToArray.js +1 -1
- package/lib/component/workspaces/index.d.ts +1 -0
- package/lib/component/workspaces/index.js +2 -0
- package/lib/component/workspaces/simulation.d.ts +2 -0
- package/lib/component/workspaces/simulation.js +68 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +9 -5
- package/lib/data/PredictionManager.d.ts +8 -7
- package/lib/data/PredictionManager.js +95 -22
- package/lib/data/SpectraManager.js +1 -1
- package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
- package/lib/data/constants/SignalsKinds.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib/data/data1d/database.d.ts +9 -7
- package/lib/data/data1d/database.js +13 -6
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
- package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
- package/lib/data/data1d/spectrumSimulation.js +53 -0
- package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
- package/lib/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +2 -1
- package/lib/data/molecules/MoleculeManager.js +21 -7
- package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
- package/lib/data/utilities/FindUtilities.js +4 -4
- package/lib/data/utilities/RangeUtilities.d.ts +1 -1
- package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
- package/lib/data/utilities/calculateSanPlot.js +3 -3
- package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib/utils/clipboard/clipboard.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +5 -4
- package/lib-cjs/component/1d/Viewer1D.js +120 -103
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
- package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
- package/lib-cjs/component/1d/utilities/scale.js +1 -3
- package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib-cjs/component/2d/FooterBanner.js +3 -2
- package/lib-cjs/component/2d/Viewer2D.js +50 -28
- package/lib-cjs/component/2d/XAxis.js +1 -1
- package/lib-cjs/component/2d/YAxis.js +1 -1
- package/lib-cjs/component/2d/zones/Signal.js +1 -2
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib-cjs/component/NMRium.js +37 -24
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib-cjs/component/elements/Input.js +1 -0
- package/lib-cjs/component/elements/InputRange.js +1 -1
- package/lib-cjs/component/elements/Scroller.js +35 -0
- package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
- package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -2
- package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib-cjs/component/hooks/useExport.js +2 -1
- package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
- package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
- package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib-cjs/component/panels/Panels.js +13 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +34 -27
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
- package/lib-cjs/component/reducer/Reducer.js +253 -239
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
- package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
- package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +62 -3
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
- package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib-cjs/component/utility/PathBuilder.js +11 -0
- package/lib-cjs/component/utility/export.js +9 -9
- package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
- package/lib-cjs/component/utility/jpathToArray.js +1 -1
- package/lib-cjs/component/workspaces/index.js +2 -0
- package/lib-cjs/component/workspaces/simulation.js +71 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +9 -5
- package/lib-cjs/data/PredictionManager.js +96 -22
- package/lib-cjs/data/SpectraManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib-cjs/data/data1d/database.js +13 -6
- package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib-cjs/data/matrixGeneration.js +1 -1
- package/lib-cjs/data/molecules/MoleculeManager.js +23 -8
- package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib-cjs/data/utilities/FindUtilities.js +4 -4
- package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
- package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -20
|
@@ -3,15 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateSpectra = exports.predictSpectra = exports.FREQUENCIES = exports.
|
|
6
|
+
exports.generateSpectra = exports.predictSpectra = exports.FREQUENCIES = exports.getDefaultPredictionOptions = void 0;
|
|
7
7
|
const uuid_1 = require("@lukeed/uuid");
|
|
8
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
8
9
|
const nmr_processing_1 = require("nmr-processing");
|
|
9
10
|
const full_1 = __importDefault(require("openchemlib/full"));
|
|
10
11
|
const SignalsKinds_1 = require("./constants/SignalsKinds");
|
|
11
12
|
const Spectrum1D_1 = require("./data1d/Spectrum1D");
|
|
12
13
|
const Spectrum2D_1 = require("./data2d/Spectrum2D");
|
|
13
14
|
const generateColor_1 = require("./utilities/generateColor");
|
|
14
|
-
|
|
15
|
+
const getDefaultPredictionOptions = () => ({
|
|
15
16
|
name: '',
|
|
16
17
|
frequency: 400,
|
|
17
18
|
'1d': {
|
|
@@ -30,7 +31,9 @@ exports.defaultPredictionOptions = {
|
|
|
30
31
|
hsqc: true,
|
|
31
32
|
hmbc: true,
|
|
32
33
|
},
|
|
33
|
-
|
|
34
|
+
autoExtendRange: true,
|
|
35
|
+
});
|
|
36
|
+
exports.getDefaultPredictionOptions = getDefaultPredictionOptions;
|
|
34
37
|
exports.FREQUENCIES = [
|
|
35
38
|
{ value: 40, label: '40 MHz' },
|
|
36
39
|
{ value: 60, label: '60 MHz' },
|
|
@@ -47,10 +50,9 @@ exports.FREQUENCIES = [
|
|
|
47
50
|
{ value: 1200, label: '1200 MHz' },
|
|
48
51
|
];
|
|
49
52
|
const baseURL = 'https://nmr-prediction.service.zakodium.com';
|
|
50
|
-
async function predictSpectra(molfile
|
|
53
|
+
async function predictSpectra(molfile) {
|
|
51
54
|
const molecule = full_1.default.Molecule.fromMolfile(molfile);
|
|
52
55
|
return (0, nmr_processing_1.predictAll)(molecule, {
|
|
53
|
-
logger,
|
|
54
56
|
predictOptions: {
|
|
55
57
|
C: {
|
|
56
58
|
webserviceURL: `${baseURL}/v1/predict/carbon`,
|
|
@@ -66,17 +68,19 @@ function generateName(name, options) {
|
|
|
66
68
|
: `${frequency}MHz`;
|
|
67
69
|
return name || `${experiment.toUpperCase()}_${freq}_${(0, uuid_1.v4)()}`;
|
|
68
70
|
}
|
|
69
|
-
function generateSpectra(predictedSpectra, inputOptions, color) {
|
|
71
|
+
function generateSpectra(predictedSpectra, inputOptions, color, logger) {
|
|
72
|
+
const options = JSON.parse(JSON.stringify(inputOptions));
|
|
73
|
+
checkFromTo(predictedSpectra, options, logger);
|
|
70
74
|
const spectra = [];
|
|
71
75
|
for (const experiment in predictedSpectra) {
|
|
72
|
-
if (
|
|
76
|
+
if (options.spectra[experiment]) {
|
|
73
77
|
const spectrum = predictedSpectra[experiment];
|
|
74
78
|
switch (experiment) {
|
|
75
79
|
case 'proton':
|
|
76
80
|
case 'carbon': {
|
|
77
81
|
const datum = generated1DSpectrum({
|
|
78
82
|
spectrum,
|
|
79
|
-
|
|
83
|
+
options,
|
|
80
84
|
experiment,
|
|
81
85
|
color,
|
|
82
86
|
});
|
|
@@ -88,7 +92,7 @@ function generateSpectra(predictedSpectra, inputOptions, color) {
|
|
|
88
92
|
case 'hmbc': {
|
|
89
93
|
const datum = generated2DSpectrum({
|
|
90
94
|
spectrum,
|
|
91
|
-
|
|
95
|
+
options,
|
|
92
96
|
experiment,
|
|
93
97
|
color,
|
|
94
98
|
});
|
|
@@ -103,14 +107,84 @@ function generateSpectra(predictedSpectra, inputOptions, color) {
|
|
|
103
107
|
return spectra;
|
|
104
108
|
}
|
|
105
109
|
exports.generateSpectra = generateSpectra;
|
|
110
|
+
function checkFromTo(predictedSpectra, inputOptions, logger) {
|
|
111
|
+
const setFromTo = (inputOptions, nucleus, fromTo) => {
|
|
112
|
+
inputOptions['1d'][nucleus].to = fromTo.to;
|
|
113
|
+
inputOptions['1d'][nucleus].from = fromTo.from;
|
|
114
|
+
if (fromTo.signalsOutOfRange) {
|
|
115
|
+
signalsOutOfRange[nucleus] = true;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const { autoExtendRange, spectra } = inputOptions;
|
|
119
|
+
const signalsOutOfRange = {};
|
|
120
|
+
for (const experiment in predictedSpectra) {
|
|
121
|
+
if (!spectra[experiment])
|
|
122
|
+
continue;
|
|
123
|
+
if (predictedSpectra[experiment].signals.length === 0)
|
|
124
|
+
continue;
|
|
125
|
+
if (['carbon', 'proton'].includes(experiment)) {
|
|
126
|
+
const spectrum = predictedSpectra[experiment];
|
|
127
|
+
const { signals, nucleus } = spectrum;
|
|
128
|
+
const { from, to } = inputOptions['1d'][nucleus];
|
|
129
|
+
const fromTo = getNewFromTo({
|
|
130
|
+
deltas: signals.map((s) => s.delta),
|
|
131
|
+
from,
|
|
132
|
+
to,
|
|
133
|
+
nucleus,
|
|
134
|
+
autoExtendRange,
|
|
135
|
+
});
|
|
136
|
+
setFromTo(inputOptions, nucleus, fromTo);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const { signals, nuclei } = predictedSpectra[experiment];
|
|
140
|
+
for (const nucleus of nuclei) {
|
|
141
|
+
const axis = nucleus === '1H' ? 'x' : 'y';
|
|
142
|
+
const { from, to } = inputOptions['1d'][nucleus];
|
|
143
|
+
const fromTo = getNewFromTo({
|
|
144
|
+
deltas: signals.map((s) => s[axis].delta),
|
|
145
|
+
from,
|
|
146
|
+
to,
|
|
147
|
+
nucleus,
|
|
148
|
+
autoExtendRange,
|
|
149
|
+
});
|
|
150
|
+
setFromTo(inputOptions, nucleus, fromTo);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
for (const nucleus of ['1H', '13C']) {
|
|
155
|
+
if (signalsOutOfRange[nucleus]) {
|
|
156
|
+
const { from, to } = inputOptions['1d'][nucleus];
|
|
157
|
+
if (autoExtendRange) {
|
|
158
|
+
logger.info(`There are ${nucleus} signals out of the range, it was extended to ${from}-${to}.`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
logger.warn(`There are ${nucleus} signals out of the range.`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function getNewFromTo(params) {
|
|
167
|
+
const { deltas, nucleus, autoExtendRange } = params;
|
|
168
|
+
let { from, to } = params;
|
|
169
|
+
const { min, max } = (0, ml_spectra_processing_1.xMinMaxValues)(deltas);
|
|
170
|
+
const signalsOutOfRange = from > min || to < max;
|
|
171
|
+
if (autoExtendRange && signalsOutOfRange) {
|
|
172
|
+
const spread = nucleus === '1H' ? 0.2 : 2;
|
|
173
|
+
if (from > min)
|
|
174
|
+
from = min - spread;
|
|
175
|
+
if (to < max)
|
|
176
|
+
to = max + spread;
|
|
177
|
+
}
|
|
178
|
+
return { from, to, signalsOutOfRange };
|
|
179
|
+
}
|
|
106
180
|
function generated1DSpectrum(params) {
|
|
107
|
-
const { spectrum,
|
|
108
|
-
const { signals,
|
|
109
|
-
const { name, '1d': { nbPoints }, frequency: freq, } =
|
|
181
|
+
const { spectrum, options, experiment, color } = params;
|
|
182
|
+
const { signals, joinedSignals, nucleus } = spectrum;
|
|
183
|
+
const { name, '1d': { nbPoints }, frequency: freq, } = options;
|
|
110
184
|
const SpectrumName = generateName(name, { frequency: freq, experiment });
|
|
111
185
|
const frequency = calculateFrequency(nucleus, freq);
|
|
112
186
|
const { x, y } = (0, nmr_processing_1.signalsToXY)(signals, {
|
|
113
|
-
...
|
|
187
|
+
...options['1d'][nucleus],
|
|
114
188
|
frequency,
|
|
115
189
|
nbPoints,
|
|
116
190
|
});
|
|
@@ -131,7 +205,7 @@ function generated1DSpectrum(params) {
|
|
|
131
205
|
title: SpectrumName,
|
|
132
206
|
},
|
|
133
207
|
}, {});
|
|
134
|
-
datum.ranges.values = (0, Spectrum1D_1.mapRanges)(
|
|
208
|
+
datum.ranges.values = (0, Spectrum1D_1.mapRanges)((0, nmr_processing_1.signalsToRanges)(joinedSignals, { frequency: frequency }), datum);
|
|
135
209
|
(0, Spectrum1D_1.updateIntegralsRelativeValues)(datum);
|
|
136
210
|
return datum;
|
|
137
211
|
}
|
|
@@ -157,27 +231,27 @@ function mapZones(zones) {
|
|
|
157
231
|
});
|
|
158
232
|
}
|
|
159
233
|
function generated2DSpectrum(params) {
|
|
160
|
-
const { spectrum,
|
|
234
|
+
const { spectrum, options, experiment, color } = params;
|
|
161
235
|
const { signals, zones, nuclei } = spectrum;
|
|
162
|
-
const xOption =
|
|
163
|
-
const yOption =
|
|
236
|
+
const xOption = options['1d'][nuclei[0]];
|
|
237
|
+
const yOption = options['1d'][nuclei[1]];
|
|
164
238
|
const width = get2DWidth(nuclei);
|
|
165
|
-
const frequency = calculateFrequency(nuclei,
|
|
239
|
+
const frequency = calculateFrequency(nuclei, options.frequency);
|
|
166
240
|
const minMaxContent = (0, nmr_processing_1.signals2DToZ)(signals, {
|
|
167
241
|
from: { x: xOption.from, y: yOption.from },
|
|
168
242
|
to: { x: xOption.to, y: yOption.to },
|
|
169
243
|
nbPoints: {
|
|
170
|
-
x:
|
|
171
|
-
y:
|
|
244
|
+
x: options['2d'].nbPoints.x,
|
|
245
|
+
y: options['2d'].nbPoints.y,
|
|
172
246
|
},
|
|
173
247
|
width,
|
|
174
248
|
factor: 3,
|
|
175
249
|
});
|
|
176
|
-
const SpectrumName = generateName(
|
|
250
|
+
const SpectrumName = generateName(options.name, {
|
|
177
251
|
frequency,
|
|
178
252
|
experiment,
|
|
179
253
|
});
|
|
180
|
-
const spectralWidth = getSpectralWidth(experiment,
|
|
254
|
+
const spectralWidth = getSpectralWidth(experiment, options);
|
|
181
255
|
const datum = (0, Spectrum2D_1.initiateDatum2D)({
|
|
182
256
|
data: { rr: { ...minMaxContent, noise: 0.01 } },
|
|
183
257
|
display: {
|
|
@@ -57,7 +57,7 @@ function addJcamp(output, jcamp, options, usedColors) {
|
|
|
57
57
|
if (spectraIn.length === 0)
|
|
58
58
|
return;
|
|
59
59
|
const spectra = [];
|
|
60
|
-
for (
|
|
60
|
+
for (const spectrum of spectraIn) {
|
|
61
61
|
const data = getData(spectrum, usedColors);
|
|
62
62
|
if (!data)
|
|
63
63
|
continue;
|
|
@@ -4,9 +4,9 @@ const uuid_1 = require("@lukeed/uuid");
|
|
|
4
4
|
function generateJGraphData(ranges, jGraphTolerance) {
|
|
5
5
|
if (!ranges && !Array.isArray(ranges))
|
|
6
6
|
return null;
|
|
7
|
-
|
|
7
|
+
const signals = [];
|
|
8
8
|
let jCouplingMax = 0;
|
|
9
|
-
|
|
9
|
+
const links = createLinks(ranges, jGraphTolerance);
|
|
10
10
|
for (const range of ranges) {
|
|
11
11
|
for (const signal of range.signals) {
|
|
12
12
|
const { id: signalId, ...restSignal } = signal;
|
|
@@ -29,7 +29,7 @@ function getJsCouplingMax(js) {
|
|
|
29
29
|
}
|
|
30
30
|
function getCouplings(ranges) {
|
|
31
31
|
const couplings = [];
|
|
32
|
-
for (
|
|
32
|
+
for (const range of ranges) {
|
|
33
33
|
for (const { delta, js } of range.signals) {
|
|
34
34
|
for (const { coupling } of js || []) {
|
|
35
35
|
couplings.push({ coupling, delta });
|
|
@@ -20,9 +20,10 @@ const References_1 = require("../../constants/References");
|
|
|
20
20
|
* @param {string} [options.reference]
|
|
21
21
|
*/
|
|
22
22
|
function getReferenceShift(datum1D, options) {
|
|
23
|
-
|
|
23
|
+
const { reference } = options;
|
|
24
|
+
let { from, to, nbPeaks, targetX } = options;
|
|
24
25
|
if (reference) {
|
|
25
|
-
|
|
26
|
+
const data = (0, References_1.getRange)({ reference, nucleus: datum1D.nucleus });
|
|
26
27
|
from = data.from;
|
|
27
28
|
to = data.to;
|
|
28
29
|
nbPeaks = data.nbPeaks;
|
|
@@ -43,7 +44,7 @@ function xyCalibrate(data, range = {}, options = {}) {
|
|
|
43
44
|
polynomial: 3,
|
|
44
45
|
},
|
|
45
46
|
}, } = options;
|
|
46
|
-
|
|
47
|
+
const { from, to } = range;
|
|
47
48
|
if (from === undefined || to === undefined)
|
|
48
49
|
return 0;
|
|
49
50
|
const fromIndex = (0, ml_spectra_processing_1.xFindClosestIndex)(data.x, from);
|
|
@@ -52,7 +53,7 @@ function xyCalibrate(data, range = {}, options = {}) {
|
|
|
52
53
|
x: data.x.slice(fromIndex, toIndex),
|
|
53
54
|
y: data.y.slice(fromIndex, toIndex),
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
+
const peaks = (0, ml_gsd_1.gsd)(sliceddata, gsdOptions)
|
|
56
57
|
.sort((a, b) => b.y - a.y)
|
|
57
58
|
.slice(0, nbPeaks);
|
|
58
59
|
if (peaks.length === 0)
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changeIntegralsRelative = void 0;
|
|
4
|
-
function changeIntegralsRelative(spectrum,
|
|
5
|
-
const
|
|
4
|
+
function changeIntegralsRelative(spectrum, data) {
|
|
5
|
+
const { id, value } = data;
|
|
6
|
+
const index = spectrum.integrals.values.findIndex((integral) => integral.id === id);
|
|
6
7
|
if (index !== -1) {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
8
|
+
const { absolute } = spectrum.integrals.values[index];
|
|
9
|
+
const ratio = absolute / value;
|
|
10
|
+
let sum = 0;
|
|
11
|
+
const integrals = [];
|
|
12
|
+
for (const integralRecord of spectrum.integrals.values) {
|
|
13
|
+
const integral = integralRecord.absolute / ratio;
|
|
14
|
+
sum += integral;
|
|
15
|
+
integrals.push({ ...integralRecord, integral });
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
spectrum.integrals.values = values;
|
|
17
|
+
spectrum.integrals.values = integrals;
|
|
19
18
|
spectrum.integrals.options = {
|
|
20
19
|
...spectrum.integrals.options,
|
|
21
20
|
mf: undefined,
|
|
@@ -9,10 +9,16 @@ exports.changeRangeRelativeValue = void 0;
|
|
|
9
9
|
function changeRangeRelativeValue(spectrum, data) {
|
|
10
10
|
const { id, value } = data;
|
|
11
11
|
const index = spectrum.ranges.values.findIndex((range) => range.id === id);
|
|
12
|
-
if (index !== -1
|
|
13
|
-
const { absolute
|
|
12
|
+
if (index !== -1) {
|
|
13
|
+
const { absolute } = spectrum.ranges.values[index];
|
|
14
14
|
const ratio = absolute / value;
|
|
15
|
-
const
|
|
15
|
+
const ranges = [];
|
|
16
|
+
let sum = 0;
|
|
17
|
+
for (const range of spectrum.ranges.values) {
|
|
18
|
+
const integration = range.absolute / ratio;
|
|
19
|
+
sum += integration;
|
|
20
|
+
ranges.push({ ...range, integration });
|
|
21
|
+
}
|
|
16
22
|
spectrum.ranges.options = {
|
|
17
23
|
...spectrum.ranges.options,
|
|
18
24
|
mf: undefined,
|
|
@@ -20,12 +26,7 @@ function changeRangeRelativeValue(spectrum, data) {
|
|
|
20
26
|
sumAuto: false,
|
|
21
27
|
sum,
|
|
22
28
|
};
|
|
23
|
-
spectrum.ranges.values =
|
|
24
|
-
return {
|
|
25
|
-
...range,
|
|
26
|
-
integration: range.absolute / ratio,
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
+
spectrum.ranges.values = ranges;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
exports.changeRangeRelativeValue = changeRangeRelativeValue;
|
|
@@ -20,11 +20,18 @@ function initiateDatabase(databases, nucleus) {
|
|
|
20
20
|
const data = databases.filter((datum) => datum.nucleus === nucleus);
|
|
21
21
|
const moleculesDB = prepareMoleculesDB(data);
|
|
22
22
|
const getSolvents = () => prepareGetSolvents(data);
|
|
23
|
-
const search = (keywords =
|
|
24
|
-
|
|
25
|
-
return { searchByStructure, data, getSolvents, search };
|
|
23
|
+
const search = ({ idCode = '', keywords = '', }) => prepareSearch({ idCode, keywords, data, moleculesDB });
|
|
24
|
+
return { data, getSolvents, search };
|
|
26
25
|
}
|
|
27
26
|
exports.initiateDatabase = initiateDatabase;
|
|
27
|
+
function prepareSearch(options) {
|
|
28
|
+
const { data, keywords = [], moleculesDB, idCode } = options;
|
|
29
|
+
let searchData = data;
|
|
30
|
+
if (idCode) {
|
|
31
|
+
searchData = processSearchByStructure(moleculesDB, idCode);
|
|
32
|
+
}
|
|
33
|
+
return (0, smart_array_filter_1.filter)(searchData, { keywords });
|
|
34
|
+
}
|
|
28
35
|
function processSearchByStructure(moleculesDB, idCode) {
|
|
29
36
|
// default format { format: 'idCode' }
|
|
30
37
|
// https://github.com/cheminfo/openchemlib-utils/blob/ef3a9c30be7efe225a24de04ea9cefc9299674aa/src/db/MoleculesDB.js#L102-L115
|
|
@@ -50,8 +57,8 @@ function prepareGetSolvents(data) {
|
|
|
50
57
|
// });
|
|
51
58
|
// }
|
|
52
59
|
function prepareMoleculesDB(array) {
|
|
53
|
-
|
|
54
|
-
for (
|
|
60
|
+
const moleculesDB = new openchemlib_utils_1.MoleculesDB(full_1.default);
|
|
61
|
+
for (const entry of array) {
|
|
55
62
|
if (entry.ocl) {
|
|
56
63
|
try {
|
|
57
64
|
const molecule = full_1.default.Molecule.fromIDCode(entry.ocl.idCode, entry.ocl.coordinates);
|
|
@@ -91,7 +98,7 @@ function prepareData(data) {
|
|
|
91
98
|
const result = [];
|
|
92
99
|
let index = 0;
|
|
93
100
|
for (const item of data) {
|
|
94
|
-
|
|
101
|
+
const ids = [];
|
|
95
102
|
const { ranges, ...restItemKeys } = item;
|
|
96
103
|
if (!ranges) {
|
|
97
104
|
ids.push((0, uuid_1.v4)());
|
|
@@ -87,7 +87,7 @@ function analyzeSpectra(spectraAnalysis, options) {
|
|
|
87
87
|
}
|
|
88
88
|
exports.analyzeSpectra = analyzeSpectra;
|
|
89
89
|
function generateAnalyzeSpectra(multipleSpectraAnalysis, spectra, nucleus) {
|
|
90
|
-
|
|
90
|
+
const data = {};
|
|
91
91
|
const { sum, columns, code } = multipleSpectraAnalysis.analysisOptions;
|
|
92
92
|
for (const columnKey in columns) {
|
|
93
93
|
const { from, to } = columns[columnKey];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.simulateSpectrum = exports.getSpinSystems = exports.defaultSimulationOptions = void 0;
|
|
4
|
+
const nmr_processing_1 = require("nmr-processing");
|
|
5
|
+
exports.defaultSimulationOptions = {
|
|
6
|
+
data: [],
|
|
7
|
+
options: {
|
|
8
|
+
frequency: 200,
|
|
9
|
+
from: -1,
|
|
10
|
+
to: 12,
|
|
11
|
+
nbPoints: 2 ** 16,
|
|
12
|
+
lineWidth: 1,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
function getSpinSystems() {
|
|
16
|
+
const spinSystem = [];
|
|
17
|
+
let temp = 'A';
|
|
18
|
+
for (let i = 66; i <= 72; i++) {
|
|
19
|
+
temp += String.fromCodePoint(i);
|
|
20
|
+
spinSystem.push(temp);
|
|
21
|
+
}
|
|
22
|
+
return spinSystem;
|
|
23
|
+
}
|
|
24
|
+
exports.getSpinSystems = getSpinSystems;
|
|
25
|
+
function simulateSpectrum(spinSystem, options) {
|
|
26
|
+
const spinsLength = spinSystem.length;
|
|
27
|
+
const chemicalShifts = new Array(spinsLength);
|
|
28
|
+
const multiplicity = new Array(spinsLength);
|
|
29
|
+
const { data: spinsData, options: simulateOptions } = options;
|
|
30
|
+
for (let i = 0; i < spinsLength; i++) {
|
|
31
|
+
chemicalShifts[i] = spinsData[i][0];
|
|
32
|
+
multiplicity[i] = 2;
|
|
33
|
+
}
|
|
34
|
+
const chemicalShiftsLength = chemicalShifts.length;
|
|
35
|
+
const couplingConstants = new Array(chemicalShiftsLength);
|
|
36
|
+
for (let i = 0; i < chemicalShiftsLength; i++) {
|
|
37
|
+
couplingConstants[i] = new Array(chemicalShiftsLength);
|
|
38
|
+
for (let j = 0; j < chemicalShiftsLength; j++) {
|
|
39
|
+
couplingConstants[i][j] = 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for (let i = 0; i < spinsData.length; i++) {
|
|
43
|
+
for (let j = 1; j < chemicalShiftsLength; j++) {
|
|
44
|
+
const couplingVal = spinsData[i][j];
|
|
45
|
+
const jIndex = j - 1;
|
|
46
|
+
if (couplingVal !== null) {
|
|
47
|
+
couplingConstants[i][jIndex] = couplingVal;
|
|
48
|
+
couplingConstants[jIndex][i] = couplingVal;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return (0, nmr_processing_1.simulate1D)({
|
|
53
|
+
chemicalShifts,
|
|
54
|
+
couplingConstants,
|
|
55
|
+
levels: multiplicity,
|
|
56
|
+
}, simulateOptions);
|
|
57
|
+
}
|
|
58
|
+
exports.simulateSpectrum = simulateSpectrum;
|
|
@@ -39,7 +39,7 @@ function contoursManager(spectrumID, state, options) {
|
|
|
39
39
|
}
|
|
40
40
|
exports.contoursManager = contoursManager;
|
|
41
41
|
function prepareWheel(value, options) {
|
|
42
|
-
|
|
42
|
+
const { shiftKey, currentLevel, contourOptions } = options;
|
|
43
43
|
const sign = Math.sign(value);
|
|
44
44
|
const positiveBoundary = contourOptions.positive.contourLevels;
|
|
45
45
|
const negativeBoundary = contourOptions.negative.contourLevels;
|
|
@@ -130,6 +130,12 @@ function getContours(zoomLevel, options) {
|
|
|
130
130
|
if (negative) {
|
|
131
131
|
_range = _range.map((value) => -value);
|
|
132
132
|
}
|
|
133
|
+
if (_range.every((r) => r === 0)) {
|
|
134
|
+
return {
|
|
135
|
+
contours: _range.map((r) => ({ zValue: r, lines: [] })),
|
|
136
|
+
timeout: false,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
133
139
|
return conrec.drawContour({
|
|
134
140
|
contourDrawer: 'basic',
|
|
135
141
|
levels: _range,
|
|
@@ -11,16 +11,16 @@ function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
|
|
|
11
11
|
// temporary because nucleus was undefined;
|
|
12
12
|
if (index === -1)
|
|
13
13
|
index = 0;
|
|
14
|
-
|
|
14
|
+
const info = {
|
|
15
15
|
nucleus: datumInfo.nucleus[index],
|
|
16
16
|
isFid: false,
|
|
17
17
|
isComplex: false,
|
|
18
18
|
dimension: 1,
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const from = index === 0 ? datum.minX : datum.minY;
|
|
21
|
+
const to = index === 0 ? datum.maxX : datum.maxY;
|
|
22
|
+
const nbPoints = index === 0 ? datum.z[0].length : datum.z.length;
|
|
23
|
+
const projection = new Float64Array(nbPoints);
|
|
24
24
|
if (index === 1) {
|
|
25
25
|
for (let i = 0; i < datum.z.length; i++) {
|
|
26
26
|
for (let j = 0; j < datum.z[0].length; j++) {
|
|
@@ -35,7 +35,7 @@ function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const data = {
|
|
39
39
|
x: (0, ml_spectra_processing_1.zoneToX)({ from, to }, nbPoints),
|
|
40
40
|
re: projection,
|
|
41
41
|
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getShift = void 0;
|
|
4
4
|
const nmr_processing_1 = require("nmr-processing");
|
|
5
5
|
function getShift(spectrum) {
|
|
6
|
-
|
|
6
|
+
const shift = { x: 0, y: 0 };
|
|
7
7
|
if (spectrum?.filters) {
|
|
8
8
|
for (const filter of spectrum.filters) {
|
|
9
9
|
if (filter.name === nmr_processing_1.Filters.shift2DX.id) {
|
|
@@ -16,26 +16,26 @@ function getSlice(spectrum, position) {
|
|
|
16
16
|
return;
|
|
17
17
|
if (yIndex < 0 || yIndex >= data.z.length)
|
|
18
18
|
return;
|
|
19
|
-
|
|
19
|
+
const infoX = {
|
|
20
20
|
nucleus: info.nucleus[0],
|
|
21
21
|
isFid: false,
|
|
22
22
|
isComplex: false,
|
|
23
23
|
dimension: 1,
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
const dataX = {
|
|
26
26
|
x: (0, ml_spectra_processing_1.zoneToX)({ from: data.minX, to: data.maxX }, data.z[0].length),
|
|
27
27
|
re: new Float64Array(data.z[0].length),
|
|
28
28
|
};
|
|
29
29
|
for (let i = 0; i < data.z[0].length; i++) {
|
|
30
30
|
dataX.re[i] += data.z[yIndex][i];
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
const infoY = {
|
|
33
33
|
nucleus: info.nucleus[1],
|
|
34
34
|
isFid: false,
|
|
35
35
|
isComplex: false,
|
|
36
36
|
dimension: 1,
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
const dataY = {
|
|
39
39
|
x: (0, ml_spectra_processing_1.zoneToX)({ from: data.minY, to: data.maxY }, data.z.length),
|
|
40
40
|
re: new Float64Array(data.z.length),
|
|
41
41
|
};
|
|
@@ -32,7 +32,7 @@ exports.getDetectionZones = getDetectionZones;
|
|
|
32
32
|
function autoZonesDetection(data, options) {
|
|
33
33
|
const { clean, tolerances, thresholdFactor, maxPercentCutOff, convolutionByFFT, info: { nucleus: nuclei, originFrequency }, } = options;
|
|
34
34
|
const { enhanceSymmetry = nuclei[0] === nuclei[1] } = options;
|
|
35
|
-
|
|
35
|
+
const zones = (0, nmr_processing_1.xyzAutoZonesPicking)(data, {
|
|
36
36
|
nuclei,
|
|
37
37
|
tolerances,
|
|
38
38
|
observedFrequencies: originFrequency,
|
|
@@ -58,7 +58,7 @@ function getSubMatrix(datum, selectedZone) {
|
|
|
58
58
|
[xIndexFrom, xIndexTo] = [xIndexTo, xIndexFrom];
|
|
59
59
|
if (yIndexFrom > yIndexTo)
|
|
60
60
|
[yIndexFrom, yIndexTo] = [yIndexTo, yIndexFrom];
|
|
61
|
-
|
|
61
|
+
const dataMatrix = {
|
|
62
62
|
z: [],
|
|
63
63
|
maxX: data.minX + xIndexTo * xStep,
|
|
64
64
|
minX: data.minX + xIndexFrom * xStep,
|
|
@@ -67,14 +67,14 @@ function getSubMatrix(datum, selectedZone) {
|
|
|
67
67
|
};
|
|
68
68
|
let maxZ = Number.MIN_SAFE_INTEGER;
|
|
69
69
|
let minZ = Number.MAX_SAFE_INTEGER;
|
|
70
|
-
|
|
70
|
+
const nbXPoints = xIndexTo - xIndexFrom + 1;
|
|
71
71
|
for (let j = yIndexFrom; j < yIndexTo; j++) {
|
|
72
|
-
|
|
72
|
+
const row = new Float32Array(nbXPoints);
|
|
73
73
|
let xIndex = xIndexFrom;
|
|
74
74
|
for (let i = 0; i < nbXPoints; i++) {
|
|
75
75
|
row[i] = data.z[j][xIndex++];
|
|
76
76
|
}
|
|
77
|
-
for (
|
|
77
|
+
for (const rowValue of row) {
|
|
78
78
|
if (maxZ < rowValue)
|
|
79
79
|
maxZ = rowValue;
|
|
80
80
|
if (minZ > rowValue)
|
|
@@ -20,7 +20,7 @@ function isLeave(fieldOptions) {
|
|
|
20
20
|
function flattenFields(filterName, data, properties, keysPath, parentObject, level) {
|
|
21
21
|
for (const fieldKey in data) {
|
|
22
22
|
let _keysPath = [];
|
|
23
|
-
|
|
23
|
+
const _keysPathObject = parentObject || null;
|
|
24
24
|
let _level = level || 0;
|
|
25
25
|
if (keysPath) {
|
|
26
26
|
_keysPath = _keysPath.concat(keysPath);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLabelNumber = exports.extractLabelsNumbers = exports.extractNumber = exports.setMolfile = exports.addMolfile = exports.fromJSON = void 0;
|
|
3
|
+
exports.getMolecules = exports.getLabelNumber = exports.extractLabelsNumbers = exports.extractNumber = exports.setMolfile = exports.addMolfile = exports.fromJSON = void 0;
|
|
4
|
+
const filelist_utils_1 = require("filelist-utils");
|
|
5
|
+
const nmr_load_save_1 = require("nmr-load-save");
|
|
4
6
|
const full_1 = require("openchemlib/full");
|
|
5
7
|
const Molecule_1 = require("./Molecule");
|
|
6
8
|
function fromJSON(mols, reservedMolecules = []) {
|
|
@@ -9,7 +11,7 @@ function fromJSON(mols, reservedMolecules = []) {
|
|
|
9
11
|
for (const mol of mols) {
|
|
10
12
|
const molecule = full_1.Molecule.fromMolfile(mol.molfile);
|
|
11
13
|
const fragments = molecule.getFragments();
|
|
12
|
-
for (
|
|
14
|
+
for (const fragment of fragments) {
|
|
13
15
|
molecules.push((0, Molecule_1.initMolecule)({
|
|
14
16
|
molfile: fragment.toMolfileV3(),
|
|
15
17
|
label: mol.label || `P${getLabelNumber(reservedNumbers)}`,
|
|
@@ -25,8 +27,8 @@ function addMolfile(molecules, molfile) {
|
|
|
25
27
|
// try to parse molfile
|
|
26
28
|
// this will throw if the molecule can not be parsed !
|
|
27
29
|
const molecule = full_1.Molecule.fromMolfile(molfile);
|
|
28
|
-
|
|
29
|
-
for (
|
|
30
|
+
const fragments = molecule.getFragments();
|
|
31
|
+
for (const fragment of fragments) {
|
|
30
32
|
molecules.push((0, Molecule_1.initMolecule)({
|
|
31
33
|
molfile: fragment.toMolfileV3(),
|
|
32
34
|
label: `P${getLabelNumber(reservedNumbers)}`,
|
|
@@ -40,11 +42,11 @@ function setMolfile(molecules, currentMolecule) {
|
|
|
40
42
|
const reservedNumbers = extractLabelsNumbers(molecules);
|
|
41
43
|
// try to parse molfile
|
|
42
44
|
// this will throw if the molecule can not be parsed !
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
const molecule = full_1.Molecule.fromMolfile(molfile);
|
|
46
|
+
const fragments = molecule.getFragments();
|
|
45
47
|
if (fragments.length > 1) {
|
|
46
48
|
molecules = molecules.filter((m) => m.id !== id);
|
|
47
|
-
for (
|
|
49
|
+
for (const fragment of fragments) {
|
|
48
50
|
molecules.push((0, Molecule_1.initMolecule)({
|
|
49
51
|
molfile: fragment.toMolfileV3(),
|
|
50
52
|
label: `P${getLabelNumber(reservedNumbers)}`,
|
|
@@ -58,7 +60,7 @@ function setMolfile(molecules, currentMolecule) {
|
|
|
58
60
|
id,
|
|
59
61
|
label,
|
|
60
62
|
});
|
|
61
|
-
|
|
63
|
+
const molIndex = molecules.findIndex((m) => m.id === id);
|
|
62
64
|
molecules.splice(molIndex, 1, _mol);
|
|
63
65
|
}
|
|
64
66
|
// we will split if we have many fragments
|
|
@@ -89,3 +91,16 @@ function getLabelNumber(reserveNumbers) {
|
|
|
89
91
|
return 1;
|
|
90
92
|
}
|
|
91
93
|
exports.getLabelNumber = getLabelNumber;
|
|
94
|
+
async function getMolecules(text) {
|
|
95
|
+
let extension = 'smi';
|
|
96
|
+
if (/v[23]000/i.test(text)) {
|
|
97
|
+
extension = 'sdf';
|
|
98
|
+
}
|
|
99
|
+
const file = new File([text], `file.${extension}`, {
|
|
100
|
+
type: 'text/plain',
|
|
101
|
+
});
|
|
102
|
+
const collection = await (0, filelist_utils_1.fileCollectionFromFiles)([file]);
|
|
103
|
+
const { nmriumState: { data }, } = await (0, nmr_load_save_1.read)(collection);
|
|
104
|
+
return data?.molecules || [];
|
|
105
|
+
}
|
|
106
|
+
exports.getMolecules = getMolecules;
|