nmrium 0.40.1 → 0.41.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/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/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/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/useXScale.d.ts +1 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -2
- 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/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 +2 -4
- 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/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 +1 -1
- 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 +251 -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 +2 -0
- package/lib/component/reducer/actions/MoleculeActions.js +51 -2
- 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/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/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 +1 -0
- 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 +5 -5
- package/lib/data/data1d/database.js +3 -3
- 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 +1 -1
- package/lib/data/molecules/MoleculeManager.js +7 -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/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/InputRange.js +1 -1
- 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/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/settingsValidation.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- 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/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 +1 -1
- 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 +251 -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 +54 -2
- 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/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/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 +1 -0
- 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 +3 -3
- 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 +7 -7
- 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
|
@@ -22,8 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.handleChangeMoleculeLabel = exports.handleChangeFloatMoleculePosition = exports.handleToggleMoleculeAtomsNumbers = exports.handleFloatMoleculeOverSpectrum = exports.handlePredictSpectraFromMolecule = exports.handleDeleteMolecule = exports.handleSetMolecule = exports.handleAddMolecule = void 0;
|
|
30
|
+
const full_1 = __importDefault(require("openchemlib/full"));
|
|
31
|
+
const openchemlib_utils_1 = require("openchemlib-utils");
|
|
27
32
|
const PredictionManager_1 = require("../../../data/PredictionManager");
|
|
28
33
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
29
34
|
const Molecule_1 = require("../../../data/molecules/Molecule");
|
|
@@ -101,10 +106,11 @@ function handleDeleteMolecule(draft, action) {
|
|
|
101
106
|
exports.handleDeleteMolecule = handleDeleteMolecule;
|
|
102
107
|
//action
|
|
103
108
|
function handlePredictSpectraFromMolecule(draft, action) {
|
|
104
|
-
const { predictedSpectra, options, molecule, action: predictionAction = 'save', } = action.payload;
|
|
109
|
+
const { logger, predictedSpectra, options, molecule, action: predictionAction = 'save', } = action.payload;
|
|
110
|
+
checkPredictions(predictedSpectra, options, molecule.molfile, logger);
|
|
105
111
|
const color = (0, generateColor_1.generateColor)(false, draft.usedColors['1d']);
|
|
106
112
|
const spectraIds = [];
|
|
107
|
-
for (const spectrum of (0, PredictionManager_1.generateSpectra)(predictedSpectra, options, color)) {
|
|
113
|
+
for (const spectrum of (0, PredictionManager_1.generateSpectra)(predictedSpectra, options, color, logger)) {
|
|
108
114
|
draft.data.push(spectrum);
|
|
109
115
|
spectraIds.push(spectrum.id);
|
|
110
116
|
}
|
|
@@ -130,6 +136,52 @@ function handlePredictSpectraFromMolecule(draft, action) {
|
|
|
130
136
|
(0, ToolsActions_1.setActiveTab)(draft, { refreshActiveTab: true, tab: '1H' });
|
|
131
137
|
}
|
|
132
138
|
exports.handlePredictSpectraFromMolecule = handlePredictSpectraFromMolecule;
|
|
139
|
+
function checkPredictions(predictedSpectra, inputOptions, molfile, logger) {
|
|
140
|
+
const { spectra } = inputOptions;
|
|
141
|
+
const missing2DPrediction = [];
|
|
142
|
+
const molecule = full_1.default.Molecule.fromMolfile(molfile);
|
|
143
|
+
molecule.addImplicitHydrogens();
|
|
144
|
+
const { atoms } = (0, openchemlib_utils_1.getAtoms)(molecule);
|
|
145
|
+
for (const [experiment, required] of Object.entries(spectra)) {
|
|
146
|
+
if (!required || predictedSpectra[experiment])
|
|
147
|
+
continue;
|
|
148
|
+
let message = '';
|
|
149
|
+
switch (experiment) {
|
|
150
|
+
case 'proton': {
|
|
151
|
+
message =
|
|
152
|
+
atoms.H - (0, openchemlib_utils_1.nbLabileH)(molecule) === 0
|
|
153
|
+
? 'No non-labile hydrogen found in the molecule, the proton spectrum could not be predicted'
|
|
154
|
+
: `Proton was not predicted`;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 'carbon': {
|
|
158
|
+
message = `${experiment} was not predicted. ${!('C' in atoms) ? 'No carbons found in the molecule' : ''}`;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case 'cosy':
|
|
162
|
+
message = !predictedSpectra.proton
|
|
163
|
+
? `Proton prediction is missing, so COSY experiment can not be simulated`
|
|
164
|
+
: `There was a error in ${experiment.toUpperCase()} prediction`;
|
|
165
|
+
break;
|
|
166
|
+
case 'hsqc':
|
|
167
|
+
case 'hmbc':
|
|
168
|
+
if (!predictedSpectra[experiment]) {
|
|
169
|
+
missing2DPrediction.push(experiment);
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
default:
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
if (message.length > 0) {
|
|
176
|
+
logger.warn(message);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (missing2DPrediction.length > 0) {
|
|
180
|
+
logger.warn(`Carbon or proton prediction are missing, so ${missing2DPrediction.length > 1
|
|
181
|
+
? missing2DPrediction.join(' and ')
|
|
182
|
+
: missing2DPrediction[0]} can not be simulated`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
133
185
|
function setPredictedSpectraReference(draft, moleculeId, spectraIds) {
|
|
134
186
|
const predictedSpectraIds = draft.view.predictions?.[moleculeId];
|
|
135
187
|
// check if the molecule predicted and return and the spectra Ids
|
|
@@ -3,13 +3,14 @@ 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.setSpectraMetaInfo = exports.handleOrderSpectra = exports.handleRecolorSpectraBasedOnDistinctValue = exports.handleToggleSpectraLegend = exports.handleImportSpectraMetaInfo = exports.handleGenerateSpectrumFromPublicationStringHandler = exports.handleAlignSpectraHandler = exports.handleAddMissingProjectionHandler = exports.handleDeleteSpectra = exports.handleChangeSpectrumSetting = exports.handleChangeActiveSpectrum = exports.handleChangeSpectraVisibilityByNucleus = exports.handleChangeSpectrumVisibilityById = void 0;
|
|
6
|
+
exports.setSpectraMetaInfo = exports.handleSimulateSpectrum = exports.handleOrderSpectra = exports.handleRecolorSpectraBasedOnDistinctValue = exports.handleToggleSpectraLegend = exports.handleImportSpectraMetaInfo = exports.handleGenerateSpectrumFromPublicationStringHandler = exports.handleAlignSpectraHandler = exports.handleAddMissingProjectionHandler = exports.handleDeleteSpectra = exports.handleChangeSpectrumSetting = exports.handleChangeActiveSpectrum = exports.handleChangeSpectraVisibilityByNucleus = exports.handleChangeSpectrumVisibilityById = void 0;
|
|
7
7
|
const immer_1 = require("immer");
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const omitBy_1 = __importDefault(require("lodash/omitBy"));
|
|
10
10
|
const set_1 = __importDefault(require("lodash/set"));
|
|
11
11
|
const nmr_processing_1 = require("nmr-processing");
|
|
12
12
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
13
|
+
const spectrumSimulation_1 = require("../../../data/data1d/spectrumSimulation");
|
|
13
14
|
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
14
15
|
const contours_1 = require("../../../data/data2d/Spectrum2D/contours");
|
|
15
16
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
@@ -267,7 +268,7 @@ function handleAddMissingProjectionHandler(draft, action) {
|
|
|
267
268
|
const { index } = activeSpectrum;
|
|
268
269
|
const Spectrum2D = state.data[index];
|
|
269
270
|
const { info, data } = Spectrum2D;
|
|
270
|
-
for (
|
|
271
|
+
for (const n of nucleus) {
|
|
271
272
|
const datum1D = (0, Spectrum2D_1.getMissingProjection)(info.isFid ? data.re : data.rr, n, info, draft.usedColors);
|
|
272
273
|
draft.data.push(datum1D);
|
|
273
274
|
}
|
|
@@ -282,7 +283,7 @@ exports.handleAddMissingProjectionHandler = handleAddMissingProjectionHandler;
|
|
|
282
283
|
//action
|
|
283
284
|
function handleAlignSpectraHandler(draft, action) {
|
|
284
285
|
if (draft.data && draft.data.length > 0) {
|
|
285
|
-
for (
|
|
286
|
+
for (const datum of draft.data) {
|
|
286
287
|
if (datum.info?.dimension === 1 &&
|
|
287
288
|
datum.info.nucleus === draft.view.spectra.activeTab &&
|
|
288
289
|
!datum.info?.isFid) {
|
|
@@ -386,3 +387,42 @@ function handleOrderSpectra(draft, action) {
|
|
|
386
387
|
.concat(sortedSpectra);
|
|
387
388
|
}
|
|
388
389
|
exports.handleOrderSpectra = handleOrderSpectra;
|
|
390
|
+
function handleSimulateSpectrum(draft, simulateSpectrumOptions) {
|
|
391
|
+
const { payload: { spinSystem, data, options, keepSpectrum = false }, } = simulateSpectrumOptions;
|
|
392
|
+
const { x, y } = (0, spectrumSimulation_1.simulateSpectrum)(spinSystem, {
|
|
393
|
+
data,
|
|
394
|
+
options,
|
|
395
|
+
});
|
|
396
|
+
let spectrumIndex = -1;
|
|
397
|
+
if (!keepSpectrum && draft.view.currentSimulatedSpectrumKey) {
|
|
398
|
+
spectrumIndex = draft.data.findIndex((s) => s.id === draft.view.currentSimulatedSpectrumKey);
|
|
399
|
+
}
|
|
400
|
+
const { frequency, to, from } = options;
|
|
401
|
+
const info = {
|
|
402
|
+
originFrequency: frequency,
|
|
403
|
+
baseFrequency: frequency,
|
|
404
|
+
name: spinSystem,
|
|
405
|
+
};
|
|
406
|
+
if (spectrumIndex !== -1) {
|
|
407
|
+
const spectrum = draft.data[spectrumIndex];
|
|
408
|
+
spectrum.data = { x, re: y };
|
|
409
|
+
spectrum.info = { ...spectrum.info, ...info };
|
|
410
|
+
const [x1, x2] = draft.originDomain.xDomain;
|
|
411
|
+
const isInXDomain = to - from <= x2 - x1;
|
|
412
|
+
(0, DomainActions_1.setDomain)(draft, { updateYDomain: false, updateXDomain: !isInXDomain });
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
const spectrum = (0, Spectrum1D_1.initiateDatum1D)({
|
|
416
|
+
data: { x, re: y },
|
|
417
|
+
info: {
|
|
418
|
+
isFt: true,
|
|
419
|
+
nucleus: '1H',
|
|
420
|
+
...info,
|
|
421
|
+
},
|
|
422
|
+
}, { usedColors: draft.usedColors });
|
|
423
|
+
draft.data.push(spectrum);
|
|
424
|
+
draft.view.currentSimulatedSpectrumKey = spectrum.id;
|
|
425
|
+
(0, ToolsActions_1.setActiveTab)(draft);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
exports.handleSimulateSpectrum = handleSimulateSpectrum;
|
|
@@ -350,10 +350,10 @@ function setDisplayerMode(draft, data) {
|
|
|
350
350
|
}
|
|
351
351
|
//utility
|
|
352
352
|
function setTabActiveSpectrum(draft, dataGroupByTab) {
|
|
353
|
-
|
|
353
|
+
const tabs2D = [];
|
|
354
354
|
const tabActiveSpectrum = {};
|
|
355
355
|
const tabkeys = Object.keys(dataGroupByTab).sort((a, b) => a.split(',').length > b.split(',').length ? -1 : 1);
|
|
356
|
-
for (
|
|
356
|
+
for (const tabKey of tabkeys) {
|
|
357
357
|
const data = dataGroupByTab[tabKey];
|
|
358
358
|
const nucleusLength = tabKey.split(',').length;
|
|
359
359
|
if (nucleusLength === 2) {
|
|
@@ -82,7 +82,7 @@ function handleChangeZoneSignalDelta(draft, action) {
|
|
|
82
82
|
if (activeSpectrum?.id) {
|
|
83
83
|
const { index } = activeSpectrum;
|
|
84
84
|
const { xShift, yShift } = (0, Spectrum2D_1.changeZoneSignal)(draft.data[index], zoneId, signal);
|
|
85
|
-
|
|
85
|
+
const filters = [];
|
|
86
86
|
if (xShift !== 0) {
|
|
87
87
|
filters.push({ name: nmr_processing_1.Filters.shift2DX.id, value: { shift: xShift } });
|
|
88
88
|
}
|
|
@@ -5,7 +5,7 @@ const LocalStorage_1 = require("../../../utility/LocalStorage");
|
|
|
5
5
|
function setActiveWorkspace(draft, action) {
|
|
6
6
|
if (action.payload) {
|
|
7
7
|
const { workspace } = action.payload;
|
|
8
|
-
|
|
8
|
+
const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
9
9
|
draft.workspace.current = workspace;
|
|
10
10
|
localData.currentWorkspace = workspace;
|
|
11
11
|
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
@@ -9,15 +9,14 @@ const LocalStorage_1 = require("../../../utility/LocalStorage");
|
|
|
9
9
|
const getActiveWorkspace_1 = require("../utilities/getActiveWorkspace");
|
|
10
10
|
const mapNucleiFormatting_1 = require("../utilities/mapNucleiFormatting");
|
|
11
11
|
function setPreferences(draft, action) {
|
|
12
|
-
|
|
12
|
+
const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
13
13
|
const currentWorkspacePreferences = (0, getActiveWorkspace_1.getActiveWorkspace)(draft);
|
|
14
14
|
if (action.payload) {
|
|
15
|
-
|
|
16
|
-
formatting = (0, mapNucleiFormatting_1.mapNucleiFormatting)(formatting);
|
|
15
|
+
const { formatting, ...restPreferences } = action.payload;
|
|
17
16
|
draft.workspaces[draft.workspace.current] = {
|
|
18
17
|
...currentWorkspacePreferences,
|
|
19
18
|
...restPreferences,
|
|
20
|
-
formatting,
|
|
19
|
+
formatting: (0, mapNucleiFormatting_1.mapNucleiFormatting)(formatting),
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
22
|
if (draft.workspaces[draft.workspace.current].source === 'user') {
|
|
@@ -49,6 +49,10 @@ exports.WORKSPACES = [
|
|
|
49
49
|
key: 'embedded',
|
|
50
50
|
label: workspaces_1.default.embedded.label,
|
|
51
51
|
},
|
|
52
|
+
{
|
|
53
|
+
key: 'simulation',
|
|
54
|
+
label: workspaces_1.default.simulation.label,
|
|
55
|
+
},
|
|
52
56
|
];
|
|
53
57
|
exports.preferencesInitialState = {
|
|
54
58
|
version: LOCAL_STORAGE_VERSION,
|
|
@@ -62,7 +66,7 @@ exports.preferencesInitialState = {
|
|
|
62
66
|
};
|
|
63
67
|
function initPreferencesState(state) {
|
|
64
68
|
const nmrLocalStorageVersion = (0, LocalStorage_1.getLocalStorage)('nmr-local-storage-version', false);
|
|
65
|
-
|
|
69
|
+
const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
66
70
|
// remove old nmr-local-storage-version key
|
|
67
71
|
if (nmrLocalStorageVersion && localData?.version) {
|
|
68
72
|
(0, LocalStorage_1.removeData)('nmr-local-storage-version');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.flatObject = void 0;
|
|
4
4
|
function flatObject(data) {
|
|
5
|
-
|
|
5
|
+
const result = {};
|
|
6
6
|
JSON.parse(JSON.stringify(data), (key, value) => {
|
|
7
7
|
if (value?.hidden !== true && key) {
|
|
8
8
|
result[key] = result[key]++ || 1;
|
|
@@ -81,19 +81,19 @@ exports.exportAsSVG = exportAsSVG;
|
|
|
81
81
|
function exportAsPng(rootRef, elementID, fileName = 'experiment') {
|
|
82
82
|
const { blob, width, height } = getBlob(rootRef, elementID);
|
|
83
83
|
try {
|
|
84
|
-
|
|
84
|
+
const canvas = document.createElement('canvas');
|
|
85
85
|
canvas.width = width;
|
|
86
86
|
canvas.height = height;
|
|
87
|
-
|
|
87
|
+
const context = canvas.getContext('2d');
|
|
88
88
|
if (context) {
|
|
89
89
|
context.fillStyle = 'white';
|
|
90
90
|
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
const img = new Image();
|
|
93
|
+
const url = URL.createObjectURL(blob);
|
|
94
94
|
img.addEventListener('load', () => {
|
|
95
95
|
context?.drawImage(img, 0, 0);
|
|
96
|
-
|
|
96
|
+
const png = canvas.toDataURL('image/png', 1);
|
|
97
97
|
(0, file_saver_1.saveAs)(png, `${fileName}.png`);
|
|
98
98
|
URL.revokeObjectURL(png);
|
|
99
99
|
});
|
|
@@ -144,15 +144,15 @@ function copyBlobToClipboard(canvas) {
|
|
|
144
144
|
function copyPNGToClipboard(rootRef, elementID) {
|
|
145
145
|
const { blob, width, height } = getBlob(rootRef, elementID);
|
|
146
146
|
try {
|
|
147
|
-
|
|
147
|
+
const canvas = document.createElement('canvas');
|
|
148
148
|
canvas.width = width;
|
|
149
149
|
canvas.height = height;
|
|
150
|
-
|
|
150
|
+
const context = canvas.getContext('2d');
|
|
151
151
|
if (context) {
|
|
152
152
|
context.fillStyle = 'white';
|
|
153
153
|
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
const img = new Image();
|
|
156
156
|
const url = URL.createObjectURL(blob);
|
|
157
157
|
img.addEventListener('load', () => {
|
|
158
158
|
context?.drawImage(img, 0, 0);
|
|
@@ -171,7 +171,7 @@ function copyPNGToClipboard(rootRef, elementID) {
|
|
|
171
171
|
}
|
|
172
172
|
exports.copyPNGToClipboard = copyPNGToClipboard;
|
|
173
173
|
function getBlob(rootRef, elementID) {
|
|
174
|
-
|
|
174
|
+
const _svg = rootRef.getRootNode()
|
|
175
175
|
.querySelector(`#${elementID}`)
|
|
176
176
|
?.cloneNode(true);
|
|
177
177
|
const width = Number(_svg?.getAttribute('width').replace('px', ''));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUniqueNuclei = void 0;
|
|
4
4
|
function getUniqueNuclei(nuclei) {
|
|
5
|
-
|
|
5
|
+
const uniqueNuclei = {};
|
|
6
6
|
for (const nucleus of nuclei) {
|
|
7
7
|
const _nuclei = nucleus.split(',');
|
|
8
8
|
for (const _nucleus of _nuclei) {
|
|
@@ -6,6 +6,7 @@ const embedded_1 = require("./embedded");
|
|
|
6
6
|
const exercise_1 = require("./exercise");
|
|
7
7
|
const prediction_1 = require("./prediction");
|
|
8
8
|
const process1D_1 = require("./process1D");
|
|
9
|
+
const simulation_1 = require("./simulation");
|
|
9
10
|
exports.default = {
|
|
10
11
|
exercise: exercise_1.exercise,
|
|
11
12
|
default: basic_1.basic,
|
|
@@ -13,4 +14,5 @@ exports.default = {
|
|
|
13
14
|
prediction: prediction_1.prediction,
|
|
14
15
|
assignment: assignment_1.assignment,
|
|
15
16
|
embedded: embedded_1.embedded,
|
|
17
|
+
simulation: simulation_1.simulation,
|
|
16
18
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.simulation = void 0;
|
|
4
|
+
exports.simulation = {
|
|
5
|
+
version: 1,
|
|
6
|
+
label: 'Simulation',
|
|
7
|
+
general: {
|
|
8
|
+
dimmedSpectraOpacity: 0.5,
|
|
9
|
+
verticalSplitterPosition: '440px',
|
|
10
|
+
verticalSplitterCloseThreshold: 600,
|
|
11
|
+
spectraRendering: 'auto',
|
|
12
|
+
loggingLevel: 'info',
|
|
13
|
+
},
|
|
14
|
+
display: {
|
|
15
|
+
panels: {
|
|
16
|
+
spectraPanel: { display: true },
|
|
17
|
+
simulationPanel: { display: true, open: true },
|
|
18
|
+
},
|
|
19
|
+
toolBarButtons: {
|
|
20
|
+
exportAs: true,
|
|
21
|
+
import: true,
|
|
22
|
+
spectraCenterAlignments: true,
|
|
23
|
+
spectraStackAlignments: true,
|
|
24
|
+
zoomOut: true,
|
|
25
|
+
zoom: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
formatting: {
|
|
29
|
+
nuclei: {},
|
|
30
|
+
panels: {
|
|
31
|
+
spectra: {
|
|
32
|
+
nuclei: {
|
|
33
|
+
'1H': {
|
|
34
|
+
columns: [
|
|
35
|
+
{
|
|
36
|
+
name: 'visible',
|
|
37
|
+
label: '',
|
|
38
|
+
description: 'Show/Hide Spectrum',
|
|
39
|
+
visible: true,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'name',
|
|
43
|
+
label: 'Spectrum Name',
|
|
44
|
+
description: 'Spectrum Name',
|
|
45
|
+
jpath: ['info', 'name'],
|
|
46
|
+
visible: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: 'Frequency',
|
|
50
|
+
description: 'frequency',
|
|
51
|
+
jpath: ['info', 'originFrequency'],
|
|
52
|
+
visible: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
jpath: ['info', 'nucleus'],
|
|
56
|
+
label: 'Experiment',
|
|
57
|
+
visible: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'color',
|
|
61
|
+
label: '',
|
|
62
|
+
description: 'Spectrum Color',
|
|
63
|
+
visible: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -24,6 +24,7 @@ exports.workspaceDefaultProperties = {
|
|
|
24
24
|
peaksPanel: { display: false, open: false },
|
|
25
25
|
predictionPanel: { display: false, open: false },
|
|
26
26
|
summaryPanel: { display: false, open: false },
|
|
27
|
+
simulationPanel: { display: false, open: false },
|
|
27
28
|
},
|
|
28
29
|
toolBarButtons: {
|
|
29
30
|
baselineCorrection: false,
|
|
@@ -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 });
|