nmrium 0.30.0 → 0.32.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/ApodizationLine.js +3 -1
- package/lib/component/1d/FooterBanner.js +20 -11
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +3 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +3 -1
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +4 -2
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/2d/Viewer2D.js +4 -4
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -3
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/loader/DropZone.js +15 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +110 -96
- package/lib/component/reducer/Reducer.js +45 -41
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +12 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +227 -232
- package/lib/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +22 -6
- package/lib/component/reducer/actions/PeaksActions.js +19 -12
- package/lib/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
- package/lib/component/reducer/actions/RangesActions.js +89 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +44 -27
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +69 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/reducer/types/Types.d.ts +5 -0
- package/lib/component/reducer/types/Types.js +5 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib/component/toolbar/BasicToolBar.js +12 -13
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/Export.js +7 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +9 -3
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- package/lib/data/SpectraManager.d.ts +0 -4
- package/lib/data/SpectraManager.js +2 -87
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +19 -10
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +3 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +3 -1
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +4 -2
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -3
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/loader/DropZone.js +14 -149
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +48 -43
- package/lib-cjs/component/reducer/actions/DomainActions.js +12 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
- package/lib-cjs/component/reducer/actions/PeaksActions.js +19 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
- package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib-cjs/component/reducer/types/Types.js +8 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib-cjs/component/toolbar/BasicToolBar.js +11 -12
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/Export.js +7 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +9 -3
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- package/lib-cjs/data/SpectraManager.js +3 -92
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -19
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/migration/migrateToVersion3.d.ts +0 -1
- package/lib/data/migration/migrateToVersion3.js +0 -55
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/migration/MigrationManager.js +0 -26
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLabels = void 0;
|
|
4
|
-
const openchemlib_utils_1 = require("openchemlib-utils");
|
|
5
|
-
const flat2DSignals_1 = require("./flat2DSignals");
|
|
6
|
-
const getToFix_1 = require("./getToFix");
|
|
7
|
-
function getLabels(data, options = { groupedDiaIDs: [] }) {
|
|
8
|
-
const { groupedDiaIDs, molecule } = options;
|
|
9
|
-
let connections = (0, openchemlib_utils_1.getShortestPaths)(molecule, { toLabel: 'H', maxLength: 1 });
|
|
10
|
-
let byDiaID = {};
|
|
11
|
-
let byAssignNumber = {};
|
|
12
|
-
for (let spectrum of data) {
|
|
13
|
-
let { dimension, nucleus } = spectrum.info;
|
|
14
|
-
let toFix = (0, getToFix_1.getToFix)(nucleus);
|
|
15
|
-
let [roiKey, flatSignals] = dimension > 1 ? ['zones', flat2DSignals_1.flat2DSignals] : ['ranges', (s) => s || []];
|
|
16
|
-
let rois = spectrum[roiKey].values || [];
|
|
17
|
-
for (let roi of rois) {
|
|
18
|
-
let signals = flatSignals(roi.signals);
|
|
19
|
-
for (let i = 0; i < signals.length; i++) {
|
|
20
|
-
let diaIDs = signals[i].diaIDs || [];
|
|
21
|
-
for (let diaID of diaIDs) {
|
|
22
|
-
let delta = Number(signals[i].delta).toFixed(toFix[i % dimension]);
|
|
23
|
-
// get atomLabel
|
|
24
|
-
let groupedOclID = groupedDiaIDs.find((dia) => {
|
|
25
|
-
if (dia.oclID === diaID)
|
|
26
|
-
return true;
|
|
27
|
-
return false;
|
|
28
|
-
});
|
|
29
|
-
// the addition of one in atom number it is because the atoms enumeration starts from zero
|
|
30
|
-
let labelOptions = {
|
|
31
|
-
atom: groupedOclID.atoms[0],
|
|
32
|
-
molecule,
|
|
33
|
-
connections,
|
|
34
|
-
atomLabel: groupedOclID.atomLabel,
|
|
35
|
-
};
|
|
36
|
-
byDiaID[diaID] = {
|
|
37
|
-
atoms: groupedOclID.atoms.map((e) => e + 1),
|
|
38
|
-
shift: delta,
|
|
39
|
-
label: createLabel(labelOptions),
|
|
40
|
-
};
|
|
41
|
-
for (let atom of groupedOclID.atoms) {
|
|
42
|
-
labelOptions.atom = atom;
|
|
43
|
-
byAssignNumber[atom] = {
|
|
44
|
-
shift: delta,
|
|
45
|
-
diaID,
|
|
46
|
-
label: createLabel(labelOptions),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return { byAssignNumber, byDiaID };
|
|
54
|
-
}
|
|
55
|
-
exports.getLabels = getLabels;
|
|
56
|
-
function createLabel(options) {
|
|
57
|
-
const { atom, molecule, atomLabel, connections } = options;
|
|
58
|
-
let label = '';
|
|
59
|
-
if (atomLabel !== 'C') {
|
|
60
|
-
let connectedTo = connections[atom];
|
|
61
|
-
let path = connectedTo.find((e) => e && e.length > 1);
|
|
62
|
-
let pLabel = `${atomLabel}${path[0] + 1}`;
|
|
63
|
-
let hLabel = `${molecule.getAtomLabel(path[1])}${path[1] + 1}`;
|
|
64
|
-
label = `${pLabel}${hLabel}`;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
label = `${atomLabel}${atom + 1}`;
|
|
68
|
-
}
|
|
69
|
-
return label;
|
|
70
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getToFix = void 0;
|
|
4
|
-
function getToFix(nucleusArray) {
|
|
5
|
-
if (!Array.isArray(nucleusArray))
|
|
6
|
-
nucleusArray = [nucleusArray];
|
|
7
|
-
let toFix = [];
|
|
8
|
-
for (let nucleus of nucleusArray) {
|
|
9
|
-
toFix.push(chooseDecimal(nucleus));
|
|
10
|
-
}
|
|
11
|
-
return toFix;
|
|
12
|
-
}
|
|
13
|
-
exports.getToFix = getToFix;
|
|
14
|
-
function chooseDecimal(nucleus) {
|
|
15
|
-
switch (nucleus.toUpperCase()) {
|
|
16
|
-
case '1H':
|
|
17
|
-
return 2;
|
|
18
|
-
case '13C':
|
|
19
|
-
return 1;
|
|
20
|
-
default:
|
|
21
|
-
return 1;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reduce = exports.isApplicable = exports.apply = exports.name = exports.id = void 0;
|
|
4
|
-
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
-
exports.id = 'absolute';
|
|
6
|
-
exports.name = 'Absolute';
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {Datum1d} datum1d
|
|
10
|
-
*/
|
|
11
|
-
function apply(datum1D) {
|
|
12
|
-
if (!isApplicable(datum1D)) {
|
|
13
|
-
throw new Error('absolute not applicable on this data');
|
|
14
|
-
}
|
|
15
|
-
datum1D.data.re = (0, ml_spectra_processing_1.reimAbsolute)(datum1D.data);
|
|
16
|
-
datum1D.data.im = new Float64Array(0);
|
|
17
|
-
datum1D.info = { ...datum1D.info, isComplex: false };
|
|
18
|
-
}
|
|
19
|
-
exports.apply = apply;
|
|
20
|
-
function isApplicable(datum1D) {
|
|
21
|
-
if (datum1D.info.isComplex && !datum1D.info.isFid)
|
|
22
|
-
return true;
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
exports.isApplicable = isApplicable;
|
|
26
|
-
function reduce() {
|
|
27
|
-
return {
|
|
28
|
-
once: false,
|
|
29
|
-
reduce: null,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.reduce = reduce;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.migrate = exports.CURRENT_EXPORT_VERSION = void 0;
|
|
7
|
-
const migrateToVersion1_1 = __importDefault(require("./migrateToVersion1"));
|
|
8
|
-
const migrateToVersion2_1 = __importDefault(require("./migrateToVersion2"));
|
|
9
|
-
const migrateToVersion3_1 = __importDefault(require("./migrateToVersion3"));
|
|
10
|
-
exports.CURRENT_EXPORT_VERSION = 3;
|
|
11
|
-
function migrationPipe(functions) {
|
|
12
|
-
return (input) => functions.reduce((input, func) => func(input), input);
|
|
13
|
-
}
|
|
14
|
-
function migrate(data) {
|
|
15
|
-
let migrationsFuncs = [
|
|
16
|
-
migrateToVersion1_1.default,
|
|
17
|
-
migrateToVersion2_1.default,
|
|
18
|
-
migrateToVersion3_1.default,
|
|
19
|
-
];
|
|
20
|
-
let index = data?.version || 0;
|
|
21
|
-
if (index > exports.CURRENT_EXPORT_VERSION) {
|
|
22
|
-
throw new Error('This file can not be imported using the current NMRium version, Please move to the new one !!! ');
|
|
23
|
-
}
|
|
24
|
-
return migrationPipe(migrationsFuncs.slice(index))(data);
|
|
25
|
-
}
|
|
26
|
-
exports.migrate = migrate;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.changeKeys = void 0;
|
|
4
|
-
function changeKeys(data, changedKeys) {
|
|
5
|
-
return JSON.parse(JSON.stringify(data), function reviver(key, value) {
|
|
6
|
-
if (key in changedKeys) {
|
|
7
|
-
this[changedKeys[key]] = value;
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
return value;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
exports.changeKeys = changeKeys;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const changeKeys_1 = require("./changeKeys");
|
|
4
|
-
/**
|
|
5
|
-
* changes from version 0 to version 1:
|
|
6
|
-
* all change done on objects keys naming
|
|
7
|
-
* j => js
|
|
8
|
-
* signal => signals
|
|
9
|
-
* integral => integration
|
|
10
|
-
* peak => peaks
|
|
11
|
-
* diaID => diaIDs
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
function migrateToVersion1(data) {
|
|
15
|
-
if (data?.version === 1)
|
|
16
|
-
return data;
|
|
17
|
-
const newData = { ...data, version: 1 };
|
|
18
|
-
const changedKeys = {
|
|
19
|
-
j: 'js',
|
|
20
|
-
signal: 'signals',
|
|
21
|
-
integral: 'integration',
|
|
22
|
-
peak: 'peaks',
|
|
23
|
-
diaID: 'diaIDs',
|
|
24
|
-
};
|
|
25
|
-
for (const spectrum of newData.spectra) {
|
|
26
|
-
if (spectrum.ranges) {
|
|
27
|
-
spectrum.ranges = (0, changeKeys_1.changeKeys)(spectrum.ranges, changedKeys);
|
|
28
|
-
}
|
|
29
|
-
else if (spectrum.zones) {
|
|
30
|
-
spectrum.zones = (0, changeKeys_1.changeKeys)(spectrum.zones, changedKeys);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return newData;
|
|
34
|
-
}
|
|
35
|
-
exports.default = migrateToVersion1;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const changeKeys_1 = require("./changeKeys");
|
|
4
|
-
/*
|
|
5
|
-
* changes from version 1 to version 2:
|
|
6
|
-
1- peaks :
|
|
7
|
-
delta => x , originDelta => originalX, intensity => y,
|
|
8
|
-
paths:
|
|
9
|
-
- peak
|
|
10
|
-
|
|
11
|
-
2- range/signals :
|
|
12
|
-
atomIDs => atoms , intensity => y,
|
|
13
|
-
|
|
14
|
-
paths:
|
|
15
|
-
- range > signals
|
|
16
|
-
- range > signals > js
|
|
17
|
-
- range > signals > peaks
|
|
18
|
-
|
|
19
|
-
3- zone/signals :
|
|
20
|
-
we have two cases the
|
|
21
|
-
a)
|
|
22
|
-
get out the inner object fromTo:{from,to} => {from,to}
|
|
23
|
-
paths:
|
|
24
|
-
- zone > signals > x
|
|
25
|
-
- zone > signals > y
|
|
26
|
-
b)
|
|
27
|
-
{ fromTo,deltaX,resolutionX,nucleusX,deltaY,resolutionY,nucleusY,shiftX,shiftY} =>
|
|
28
|
-
{
|
|
29
|
-
x: {
|
|
30
|
-
from: fromTo[0].from,
|
|
31
|
-
to: fromTo[0].to,
|
|
32
|
-
delta: deltaX,
|
|
33
|
-
resolution: resolutionX,
|
|
34
|
-
nucleus: nucleusX,
|
|
35
|
-
},
|
|
36
|
-
y: {
|
|
37
|
-
from: fromTo[1].from,
|
|
38
|
-
to: fromTo[1].to,
|
|
39
|
-
delta: deltaY,
|
|
40
|
-
resolution: resolutionY,
|
|
41
|
-
nucleus: nucleusY,
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
paths:
|
|
46
|
-
-zone>signals
|
|
47
|
-
*/
|
|
48
|
-
function migrateToVersion2(data) {
|
|
49
|
-
if (data?.version === 2)
|
|
50
|
-
return data;
|
|
51
|
-
const newData = { ...data, version: 2 };
|
|
52
|
-
const changedKeys = {
|
|
53
|
-
peaks: {
|
|
54
|
-
delta: 'x',
|
|
55
|
-
originDelta: 'originalX',
|
|
56
|
-
intensity: 'y',
|
|
57
|
-
},
|
|
58
|
-
ranges: {
|
|
59
|
-
atomIDs: 'atoms',
|
|
60
|
-
intensity: 'y', // signal > peaks
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
for (const spectrum of newData.spectra) {
|
|
64
|
-
if (spectrum.peaks) {
|
|
65
|
-
spectrum.peaks = (0, changeKeys_1.changeKeys)(spectrum.peaks, changedKeys.peaks);
|
|
66
|
-
}
|
|
67
|
-
else if (spectrum.ranges) {
|
|
68
|
-
spectrum.ranges = (0, changeKeys_1.changeKeys)(spectrum.ranges, changedKeys.ranges);
|
|
69
|
-
}
|
|
70
|
-
else if (spectrum.zones) {
|
|
71
|
-
spectrum.zones.values = mapZones(spectrum.zones.values);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return newData;
|
|
75
|
-
}
|
|
76
|
-
exports.default = migrateToVersion2;
|
|
77
|
-
function mapZones(zones) {
|
|
78
|
-
return zones.map((zone) => {
|
|
79
|
-
if (zone.signals) {
|
|
80
|
-
zone.signals = zone.signals.map((signal) => {
|
|
81
|
-
if (signal.x && signal.y) {
|
|
82
|
-
const { x: { fromTo: fromToX, ...resX }, y: { fromTo: fromToY, ...resY }, } = signal;
|
|
83
|
-
signal = {
|
|
84
|
-
...signal,
|
|
85
|
-
x: { ...resX, ...fromToX },
|
|
86
|
-
y: { ...resY, ...fromToY },
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
const { fromTo, deltaX, resolutionX, nucleusX, deltaY, resolutionY, nucleusY, shiftX, shiftY, ...resSignal } = signal;
|
|
91
|
-
signal = {
|
|
92
|
-
...resSignal,
|
|
93
|
-
x: {
|
|
94
|
-
from: fromTo[0].from,
|
|
95
|
-
to: fromTo[0].to,
|
|
96
|
-
delta: deltaX,
|
|
97
|
-
resolution: resolutionX,
|
|
98
|
-
nucleus: nucleusX,
|
|
99
|
-
},
|
|
100
|
-
y: {
|
|
101
|
-
from: fromTo[1].from,
|
|
102
|
-
to: fromTo[1].to,
|
|
103
|
-
delta: deltaY,
|
|
104
|
-
resolution: resolutionY,
|
|
105
|
-
nucleus: nucleusY,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return signal;
|
|
110
|
-
}, []);
|
|
111
|
-
}
|
|
112
|
-
return zone;
|
|
113
|
-
}, []);
|
|
114
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* changes from version 2 to version 3:
|
|
4
|
-
change the filters, replace the line broadening filter with the apodization filter and the order should apodization filter > zero filling instead of zero filling > line broadening
|
|
5
|
-
|
|
6
|
-
- line broadening filter object
|
|
7
|
-
{
|
|
8
|
-
"name": "lineBroadening",
|
|
9
|
-
"value": 1,
|
|
10
|
-
... other props
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
- apodization filter object
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
"name": "apodization",
|
|
17
|
-
"value": {
|
|
18
|
-
"lineBroadening": 1,
|
|
19
|
-
"gaussBroadening": 0,
|
|
20
|
-
"lineBroadeningCenter": 0
|
|
21
|
-
},
|
|
22
|
-
... other props
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const apodizationObject = {
|
|
28
|
-
name: 'apodization',
|
|
29
|
-
label: 'Apodization',
|
|
30
|
-
value: {
|
|
31
|
-
lineBroadening: 1,
|
|
32
|
-
gaussBroadening: 0,
|
|
33
|
-
lineBroadeningCenter: 0,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
function migrateToVersion3(data) {
|
|
37
|
-
if (data?.version === 3)
|
|
38
|
-
return data;
|
|
39
|
-
const newData = { ...data, version: 3 };
|
|
40
|
-
for (const spectrum of newData.spectra) {
|
|
41
|
-
if (Array.isArray(spectrum?.filters) && spectrum?.filters.length > 0) {
|
|
42
|
-
// look for the index of lineBroadening filter
|
|
43
|
-
const lineBroadeningFilterIndex = spectrum.filters.findIndex((filter) => filter.name === 'lineBroadening');
|
|
44
|
-
if (lineBroadeningFilterIndex !== -1) {
|
|
45
|
-
//replace lineBroadening filter with apodization filter and swipe zero filling filter with apodization filter
|
|
46
|
-
const temp = {
|
|
47
|
-
...spectrum.filters[lineBroadeningFilterIndex],
|
|
48
|
-
...apodizationObject,
|
|
49
|
-
};
|
|
50
|
-
spectrum.filters[lineBroadeningFilterIndex] =
|
|
51
|
-
spectrum.filters[lineBroadeningFilterIndex - 1];
|
|
52
|
-
spectrum.filters[lineBroadeningFilterIndex - 1] = temp;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return newData;
|
|
57
|
-
}
|
|
58
|
-
exports.default = migrateToVersion3;
|