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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exercise = void 0;
|
|
4
4
|
exports.exercise = {
|
|
5
|
-
version:
|
|
5
|
+
version: 2,
|
|
6
6
|
label: 'Exercise',
|
|
7
7
|
display: {
|
|
8
8
|
general: {
|
|
@@ -13,11 +13,17 @@ exports.exercise = {
|
|
|
13
13
|
integralsPanel: { display: true },
|
|
14
14
|
},
|
|
15
15
|
toolBarButtons: {
|
|
16
|
+
zoom: true,
|
|
17
|
+
zoomOut: true,
|
|
18
|
+
apodization: true,
|
|
19
|
+
zeroFilling: true,
|
|
20
|
+
fastFourierTransform: true,
|
|
21
|
+
phaseCorrection: true,
|
|
22
|
+
baselineCorrection: true,
|
|
23
|
+
peakPicking: true,
|
|
16
24
|
integral: true,
|
|
17
25
|
spectraCenterAlignments: true,
|
|
18
26
|
spectraStackAlignments: true,
|
|
19
|
-
zoomOut: true,
|
|
20
|
-
zoom: true,
|
|
21
27
|
},
|
|
22
28
|
},
|
|
23
29
|
};
|
package/lib-cjs/data/Filters.js
CHANGED
|
@@ -23,9 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.shift2DY = exports.shift2DX = exports.exclusionZones = exports.pareto = exports.centerMean = exports.standardDeviation = exports.equallySpaced = exports.fromTo = exports.digitalFilter = exports.zeroFilling = exports.shiftX = exports.autoPhaseCorrection = exports.phaseCorrection = exports.fft = exports.apodization = exports.baselineCorrection =
|
|
27
|
-
const absolute = __importStar(require("./data1d/filter1d/absolute"));
|
|
28
|
-
exports.absolute = absolute;
|
|
26
|
+
exports.shift2DY = exports.shift2DX = exports.exclusionZones = exports.pareto = exports.centerMean = exports.standardDeviation = exports.equallySpaced = exports.fromTo = exports.digitalFilter = exports.zeroFilling = exports.shiftX = exports.autoPhaseCorrection = exports.phaseCorrection = exports.fft = exports.apodization = exports.baselineCorrection = void 0;
|
|
29
27
|
const apodization = __importStar(require("./data1d/filter1d/apodization"));
|
|
30
28
|
exports.apodization = apodization;
|
|
31
29
|
const autoPhaseCorrection = __importStar(require("./data1d/filter1d/autoPhaseCorrection"));
|
|
@@ -23,14 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.toJSON = exports.addJcamps = exports.
|
|
26
|
+
exports.toJSON = exports.addJcamps = exports.fromJSON = exports.addJcamp = exports.addJcampFromURL = exports.DataExportOptions = void 0;
|
|
27
|
+
const nmr_load_save_1 = require("nmr-load-save");
|
|
27
28
|
const nmr_parser_1 = require("nmr-parser");
|
|
28
29
|
const Constants_1 = require("../component/reducer/core/Constants");
|
|
29
30
|
const Data1DManager = __importStar(require("./data1d/Data1DManager"));
|
|
30
31
|
const Datum1D = __importStar(require("./data1d/Spectrum1D"));
|
|
31
32
|
const Data2DManager = __importStar(require("./data2d/Data2DManager"));
|
|
32
33
|
const Datum2D = __importStar(require("./data2d/Spectrum2D"));
|
|
33
|
-
const MigrationManager_1 = require("./migration/MigrationManager");
|
|
34
34
|
const Molecule = __importStar(require("./molecules/Molecule"));
|
|
35
35
|
var DataExportOptions;
|
|
36
36
|
(function (DataExportOptions) {
|
|
@@ -88,41 +88,6 @@ function addData(spectra, datum, usedColors) {
|
|
|
88
88
|
spectra.push(Datum2D.initiateDatum2D(datum, usedColors));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function addJDF(spectra, jdf, options = {}, usedColors = {}) {
|
|
92
|
-
// need to parse the jcamp
|
|
93
|
-
let converted = (0, nmr_parser_1.fromJEOL)(jdf, {});
|
|
94
|
-
converted = converted[0];
|
|
95
|
-
let info = converted.description;
|
|
96
|
-
let metadata = info.metadata;
|
|
97
|
-
delete info.metadata;
|
|
98
|
-
info.acquisitionMode = 0;
|
|
99
|
-
info.experiment = info.dimension === 1 ? '1d' : '2d';
|
|
100
|
-
info.type = 'NMR SPECTRUM';
|
|
101
|
-
info.nucleus = info.nucleus[0];
|
|
102
|
-
info.numberOfPoints = info.numberOfPoints[0];
|
|
103
|
-
info.acquisitionTime = info.acquisitionTime[0];
|
|
104
|
-
info.baseFrequency = info.baseFrequency[0];
|
|
105
|
-
info.frequencyOffset = info.frequencyOffset[0];
|
|
106
|
-
info.spectralWidthClipped = converted.application.spectralWidthClipped;
|
|
107
|
-
if (info.dimension === 1) {
|
|
108
|
-
if (converted.dependentVariables) {
|
|
109
|
-
spectra.push(Data1DManager.fromCSD(converted, {
|
|
110
|
-
...options,
|
|
111
|
-
display: { ...options.display },
|
|
112
|
-
info,
|
|
113
|
-
meta: metadata,
|
|
114
|
-
}, usedColors));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (info.dimension === 2 && info.isFt) {
|
|
118
|
-
spectra.push(Data2DManager.fromCSD(converted, {
|
|
119
|
-
...options,
|
|
120
|
-
display: { ...options.display },
|
|
121
|
-
info,
|
|
122
|
-
}, usedColors));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.addJDF = addJDF;
|
|
126
91
|
async function fromJSON(data = [], usedColors = {}) {
|
|
127
92
|
const spectra = [];
|
|
128
93
|
let promises = [];
|
|
@@ -142,60 +107,6 @@ async function fromJSON(data = [], usedColors = {}) {
|
|
|
142
107
|
return spectra;
|
|
143
108
|
}
|
|
144
109
|
exports.fromJSON = fromJSON;
|
|
145
|
-
async function addBruker(options, data, usedColors) {
|
|
146
|
-
const spectra = [];
|
|
147
|
-
let result = await (0, nmr_parser_1.fromBruker)(data, {
|
|
148
|
-
converter: {
|
|
149
|
-
xy: true,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
let entries = result;
|
|
153
|
-
for (let entry of entries) {
|
|
154
|
-
let { info, dependentVariables } = entry;
|
|
155
|
-
if (info.dimension === 1) {
|
|
156
|
-
if (dependentVariables[0].components) {
|
|
157
|
-
spectra.push(Data1DManager.fromBruker(entry, {
|
|
158
|
-
...options,
|
|
159
|
-
display: { ...options.display },
|
|
160
|
-
}, usedColors));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
else if (info.dimension === 2) {
|
|
164
|
-
spectra.push(Data2DManager.fromBruker(entry, {
|
|
165
|
-
...options,
|
|
166
|
-
info,
|
|
167
|
-
display: { ...options.display },
|
|
168
|
-
}, usedColors));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return spectra;
|
|
172
|
-
}
|
|
173
|
-
exports.addBruker = addBruker;
|
|
174
|
-
// handle zip files
|
|
175
|
-
async function fromZip(zipFiles) {
|
|
176
|
-
const spectra = [];
|
|
177
|
-
for (let zipFile of zipFiles) {
|
|
178
|
-
await addBruker(spectra, { display: { name: zipFile.name } }, zipFile.binary);
|
|
179
|
-
}
|
|
180
|
-
return spectra;
|
|
181
|
-
}
|
|
182
|
-
exports.fromZip = fromZip;
|
|
183
|
-
function addJDFs(files, usedColors) {
|
|
184
|
-
const spectra = [];
|
|
185
|
-
for (const file of files) {
|
|
186
|
-
addJDF(spectra, file.binary, {
|
|
187
|
-
display: {
|
|
188
|
-
name: file.name,
|
|
189
|
-
},
|
|
190
|
-
source: {
|
|
191
|
-
jcampURL: file.jcampURL ? file.jcampURL : null,
|
|
192
|
-
file,
|
|
193
|
-
},
|
|
194
|
-
}, usedColors);
|
|
195
|
-
}
|
|
196
|
-
return spectra;
|
|
197
|
-
}
|
|
198
|
-
exports.addJDFs = addJDFs;
|
|
199
110
|
function addJcamps(files, usedColors) {
|
|
200
111
|
const spectra = [];
|
|
201
112
|
for (const file of files) {
|
|
@@ -232,7 +143,7 @@ function toJSON(state, target, dataExportOption = DataExportOptions.DATA_SOURCE)
|
|
|
232
143
|
const molecules = mols.map((mol) => Molecule.toJSON(mol));
|
|
233
144
|
return {
|
|
234
145
|
...(target === 'onDataChange' ? { actionType } : {}),
|
|
235
|
-
version:
|
|
146
|
+
version: nmr_load_save_1.CURRENT_EXPORT_VERSION,
|
|
236
147
|
spectra,
|
|
237
148
|
molecules,
|
|
238
149
|
correlations,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const nmr_processing_1 = require("nmr-processing");
|
|
4
4
|
const defaultPeakPickingOptions = {
|
|
5
5
|
minMaxRatio: 1,
|
|
6
|
+
shape: { kind: 'lorentzian' },
|
|
6
7
|
realTopDetection: true,
|
|
7
8
|
maxCriteria: true,
|
|
8
9
|
smoothY: false,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reduce = exports.isApplicable = exports.apply = exports.name = exports.id = void 0;
|
|
4
4
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
const padDataToNextPowerOfTwo_1 = require("./utils/padDataToNextPowerOfTwo");
|
|
5
6
|
exports.id = 'fft';
|
|
6
7
|
exports.name = 'FFT';
|
|
7
8
|
/**
|
|
@@ -13,6 +14,13 @@ function apply(datum1D) {
|
|
|
13
14
|
throw new Error('fft not applicable on this data');
|
|
14
15
|
}
|
|
15
16
|
let digitalFilterApplied = datum1D.filters.some((e) => e.name === 'digitalFilter' && e.flag);
|
|
17
|
+
const { data } = datum1D;
|
|
18
|
+
if (data.x.length !== data.re.length || data.x.length !== data.im.length) {
|
|
19
|
+
throw new Error('The length of data should be equal');
|
|
20
|
+
}
|
|
21
|
+
else if (!isPowerOfTwo(datum1D.data.x.length)) {
|
|
22
|
+
(0, padDataToNextPowerOfTwo_1.padDataToNextPowerOfTwo)(datum1D, digitalFilterApplied);
|
|
23
|
+
}
|
|
16
24
|
Object.assign(datum1D.data, (0, ml_spectra_processing_1.reimFFT)(datum1D.data, { applyZeroShift: true }));
|
|
17
25
|
if (digitalFilterApplied) {
|
|
18
26
|
let { digitalFilter = 0 } = datum1D.info;
|
|
@@ -53,3 +61,6 @@ function generateXAxis(datum1D) {
|
|
|
53
61
|
}
|
|
54
62
|
return xAxis;
|
|
55
63
|
}
|
|
64
|
+
function isPowerOfTwo(n) {
|
|
65
|
+
return n !== 0 && (n & (n - 1)) === 0;
|
|
66
|
+
}
|
|
@@ -15,10 +15,16 @@ function apply(datum1D, options = {}) {
|
|
|
15
15
|
if (!isApplicable(datum1D)) {
|
|
16
16
|
throw new Error('phaseCorrection not applicable on this data');
|
|
17
17
|
}
|
|
18
|
-
let { ph0, ph1 } = options;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
let { ph0, ph1, absolute } = options;
|
|
19
|
+
if (absolute) {
|
|
20
|
+
datum1D.data.re = (0, ml_spectra_processing_1.reimAbsolute)(datum1D.data);
|
|
21
|
+
datum1D.data.im = new Float64Array(0);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ph0 *= Math.PI / 180.0;
|
|
25
|
+
ph1 *= Math.PI / 180.0;
|
|
26
|
+
Object.assign(datum1D.data, (0, ml_spectra_processing_1.reimPhaseCorrection)(datum1D.data, ph0, ph1));
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
exports.apply = apply;
|
|
24
30
|
function isApplicable(datum1D) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.padDataToNextPowerOfTwo = void 0;
|
|
4
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
function padDataToNextPowerOfTwo(datum1D, digitalFilterApplied) {
|
|
6
|
+
const { x, re, im } = datum1D.data;
|
|
7
|
+
const size = nextPowerOfTwo(x.length);
|
|
8
|
+
let newRE = new Float64Array(size);
|
|
9
|
+
let newIM = new Float64Array(size);
|
|
10
|
+
const pointsToShift = getPointsToShift(datum1D);
|
|
11
|
+
newRE.set(re.slice(0, length - pointsToShift));
|
|
12
|
+
newIM.set(im.slice(0, length - pointsToShift));
|
|
13
|
+
if (pointsToShift > 0 && digitalFilterApplied) {
|
|
14
|
+
newRE.set(re.slice(re.length - pointsToShift), size - pointsToShift);
|
|
15
|
+
newIM.set(im.slice(re.length - pointsToShift), size - pointsToShift);
|
|
16
|
+
}
|
|
17
|
+
const newX = (0, ml_spectra_processing_1.xSequentialFill)({
|
|
18
|
+
from: x[0],
|
|
19
|
+
size,
|
|
20
|
+
step: x[1] - x[0],
|
|
21
|
+
});
|
|
22
|
+
datum1D.data = { ...datum1D.data, ...{ re: newRE, im: newIM, x: newX } };
|
|
23
|
+
}
|
|
24
|
+
exports.padDataToNextPowerOfTwo = padDataToNextPowerOfTwo;
|
|
25
|
+
function getPointsToShift(datum1D) {
|
|
26
|
+
let grpdly = datum1D.info?.digitalFilter || 0;
|
|
27
|
+
return grpdly > 0 ? Math.floor(grpdly) : 0;
|
|
28
|
+
}
|
|
29
|
+
function nextPowerOfTwo(n) {
|
|
30
|
+
if (n === 0)
|
|
31
|
+
return 1;
|
|
32
|
+
n--;
|
|
33
|
+
n |= n >> 1;
|
|
34
|
+
n |= n >> 2;
|
|
35
|
+
n |= n >> 4;
|
|
36
|
+
n |= n >> 8;
|
|
37
|
+
n |= n >> 16;
|
|
38
|
+
return n + 1;
|
|
39
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultContourOptions = void 0;
|
|
4
4
|
const ml_conrec_1 = require("ml-conrec");
|
|
5
|
-
const
|
|
5
|
+
const calculateSanPlot_1 = require("../utilities/calculateSanPlot");
|
|
6
6
|
exports.defaultContourOptions = {
|
|
7
7
|
positive: {
|
|
8
8
|
contourLevels: [0, 21],
|
|
@@ -25,7 +25,8 @@ class Processing2D {
|
|
|
25
25
|
const xs = getRange(minMax.minX, minMax.maxX, minMax.z[0].length);
|
|
26
26
|
const ys = getRange(minMax.minY, minMax.maxY, minMax.z.length);
|
|
27
27
|
this.conrec = new ml_conrec_1.Conrec(minMax.z, { xs, ys, swapAxes: false });
|
|
28
|
-
|
|
28
|
+
const sanResult = (0, calculateSanPlot_1.calculateSanPlot)('2D', minMax);
|
|
29
|
+
this.median = sanResult.positive;
|
|
29
30
|
this.minMax = minMax;
|
|
30
31
|
}
|
|
31
32
|
getLevel() {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateSanPlot = void 0;
|
|
4
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
function calculateSanPlot(dimension, data) {
|
|
6
|
+
const input = dimension === '1D'
|
|
7
|
+
? prepare1DData(data)
|
|
8
|
+
: prepare2DData(data);
|
|
9
|
+
return (0, ml_spectra_processing_1.xNoiseSanPlot)(input);
|
|
10
|
+
}
|
|
11
|
+
exports.calculateSanPlot = calculateSanPlot;
|
|
12
|
+
function prepare1DData(data) {
|
|
13
|
+
const length = data.re.length;
|
|
14
|
+
const jump = Math.floor(length / 307200) || 1;
|
|
15
|
+
const array = new Float64Array((length / jump) >> 0);
|
|
16
|
+
let index = 0;
|
|
17
|
+
for (let i = 0; i < array.length; i += jump) {
|
|
18
|
+
array[index++] = data.re[i];
|
|
19
|
+
}
|
|
20
|
+
return array;
|
|
21
|
+
}
|
|
22
|
+
function prepare2DData(data) {
|
|
23
|
+
let cols = data.z[0].length;
|
|
24
|
+
let rows = data.z.length;
|
|
25
|
+
let jump = Math.floor((cols * rows) / 204800) || 1;
|
|
26
|
+
const array = new Float64Array(((cols * rows) / jump) >> 0);
|
|
27
|
+
let index = 0;
|
|
28
|
+
// console.log('jump', jump, cols * rows);
|
|
29
|
+
for (let r = 0; r < rows; r += 1) {
|
|
30
|
+
for (let c = 0; c < cols; c += jump) {
|
|
31
|
+
array[index++] = data.z[r][c];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return array;
|
|
35
|
+
}
|
package/lib-cjs/versionInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.32.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib-cjs/component/NMRium.js",
|
|
7
7
|
"module": "lib/component/NMRium.js",
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"url": "git+https://github.com/cheminfo/nmrium.git"
|
|
39
39
|
},
|
|
40
40
|
"volta": {
|
|
41
|
-
"node": "16.
|
|
42
|
-
"npm": "8.15.1"
|
|
41
|
+
"node": "16.17.0"
|
|
43
42
|
},
|
|
44
43
|
"overrides": {
|
|
45
44
|
"react": "$react",
|
|
@@ -50,14 +49,15 @@
|
|
|
50
49
|
"react-dom": ">=18.0.0"
|
|
51
50
|
},
|
|
52
51
|
"dependencies": {
|
|
53
|
-
"@emotion/react": "^11.10.
|
|
52
|
+
"@emotion/react": "^11.10.4",
|
|
54
53
|
"@lukeed/uuid": "^2.0.0",
|
|
55
|
-
"analysis-ui-components": "^0.
|
|
54
|
+
"analysis-ui-components": "^0.17.3",
|
|
56
55
|
"cheminfo-font": "^1.9.0",
|
|
57
56
|
"cheminfo-types": "^1.4.0",
|
|
58
57
|
"d3": "^7.6.1",
|
|
59
58
|
"eventemitter3": "^4.0.7",
|
|
60
59
|
"file-saver": "^2.0.5",
|
|
60
|
+
"filelist-utils": "^0.11.0",
|
|
61
61
|
"formik": "^2.2.9",
|
|
62
62
|
"immer": "^9.0.15",
|
|
63
63
|
"jszip": "^3.10.1",
|
|
@@ -70,29 +70,30 @@
|
|
|
70
70
|
"ml-array-xy-equally-spaced": "^1.2.1",
|
|
71
71
|
"ml-baseline-correction-regression": "^1.0.0",
|
|
72
72
|
"ml-conrec": "^3.2.1",
|
|
73
|
-
"ml-gsd": "^12.
|
|
74
|
-
"ml-spectra-processing": "^11.
|
|
73
|
+
"ml-gsd": "^12.1.2",
|
|
74
|
+
"ml-spectra-processing": "^11.13.0",
|
|
75
75
|
"ml-stat": "^1.3.3",
|
|
76
76
|
"multiplet-analysis": "^2.0.0",
|
|
77
77
|
"nmr-correlation": "^2.3.3",
|
|
78
|
-
"nmr-
|
|
79
|
-
"nmr-
|
|
80
|
-
"
|
|
78
|
+
"nmr-load-save": "^0.3.0",
|
|
79
|
+
"nmr-parser": "^3.0.1",
|
|
80
|
+
"nmr-processing": "^9.2.0",
|
|
81
|
+
"nmredata": "^0.9.0",
|
|
81
82
|
"numeral": "^2.0.6",
|
|
82
83
|
"openchemlib": "^8.0.1",
|
|
83
84
|
"openchemlib-utils": "^2.0.0",
|
|
84
85
|
"re-resizable": "^6.9.9",
|
|
85
86
|
"react-d3-utils": "^0.5.1",
|
|
86
|
-
"react-dropzone": "^14.2.
|
|
87
|
+
"react-dropzone": "^14.2.3",
|
|
87
88
|
"react-error-boundary": "^3.1.4",
|
|
88
89
|
"react-icons": "^4.4.0",
|
|
89
90
|
"react-inspector": "^6.0.1",
|
|
90
91
|
"react-mf": "^2.0.1",
|
|
91
92
|
"react-ocl": "^5.0.0",
|
|
92
93
|
"react-ocl-nmr": "^2.0.0",
|
|
93
|
-
"react-plot": "^0.20.
|
|
94
|
+
"react-plot": "^0.20.2",
|
|
94
95
|
"react-rnd": "^10.3.7",
|
|
95
|
-
"react-slider": "^2.0.
|
|
96
|
+
"react-slider": "^2.0.4",
|
|
96
97
|
"react-table": "^7.8.0",
|
|
97
98
|
"react-transition-group": "^4.4.5",
|
|
98
99
|
"react-use": "^17.4.0",
|
|
@@ -103,28 +104,28 @@
|
|
|
103
104
|
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
|
|
104
105
|
"@babel/preset-react": "^7.18.6",
|
|
105
106
|
"@babel/preset-typescript": "^7.18.6",
|
|
106
|
-
"@playwright/test": "^1.
|
|
107
|
+
"@playwright/test": "^1.27.1",
|
|
107
108
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
108
109
|
"@types/d3": "^7.4.0",
|
|
109
|
-
"@types/jest": "^
|
|
110
|
-
"@types/node": "^18.
|
|
111
|
-
"@types/react": "^18.0.
|
|
110
|
+
"@types/jest": "^29.1.2",
|
|
111
|
+
"@types/node": "^18.8.5",
|
|
112
|
+
"@types/react": "^18.0.21",
|
|
112
113
|
"@types/react-dom": "^18.0.6",
|
|
113
|
-
"@vitejs/plugin-react": "^2.0
|
|
114
|
+
"@vitejs/plugin-react": "^2.1.0",
|
|
114
115
|
"@zakodium/eslint-config": "^6.0.0",
|
|
115
116
|
"cross-env": "^7.0.3",
|
|
116
|
-
"eslint": "^8.
|
|
117
|
-
"jest": "^29.
|
|
117
|
+
"eslint": "^8.25.0",
|
|
118
|
+
"jest": "^29.1.2",
|
|
118
119
|
"modern-normalize": "^1.1.0",
|
|
119
120
|
"prettier": "^2.7.1",
|
|
120
|
-
"rc-menu": "^9.6.
|
|
121
|
+
"rc-menu": "^9.6.4",
|
|
121
122
|
"react": "^18.2.0",
|
|
122
123
|
"react-dom": "^18.2.0",
|
|
123
|
-
"react-router-dom": "^6.
|
|
124
|
+
"react-router-dom": "^6.4.2",
|
|
124
125
|
"rimraf": "^3.0.2",
|
|
125
126
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
126
127
|
"serve": "^14.0.1",
|
|
127
|
-
"typescript": "~4.8.
|
|
128
|
-
"vite": "^3.
|
|
128
|
+
"typescript": "~4.8.4",
|
|
129
|
+
"vite": "^3.1.7"
|
|
129
130
|
}
|
|
130
|
-
}
|
|
131
|
+
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import Jszip from 'jszip';
|
|
2
|
-
import { NmrRecord, parseSDF } from 'nmredata';
|
|
3
|
-
import { addBruker, addJcamps } from '../../data/SpectraManager';
|
|
4
|
-
import { addRanges } from './util/nmredata/addRanges';
|
|
5
|
-
import { addZones } from './util/nmredata/addZones';
|
|
6
|
-
export async function nmredataToNmrium(file, usedColors) {
|
|
7
|
-
const jszip = new Jszip();
|
|
8
|
-
const zip = await jszip.loadAsync(file.binary);
|
|
9
|
-
const sdfFiles = await getSDF(zip.files);
|
|
10
|
-
const jsonData = await NmrRecord.toJSON({
|
|
11
|
-
sdf: sdfFiles[0],
|
|
12
|
-
zipFiles: zip.files,
|
|
13
|
-
});
|
|
14
|
-
let { spectra, molecules = [] } = jsonData;
|
|
15
|
-
let nmrium = {
|
|
16
|
-
spectra: [],
|
|
17
|
-
molecules,
|
|
18
|
-
};
|
|
19
|
-
for (const data of spectra) {
|
|
20
|
-
const { file, jcampURL } = data.source;
|
|
21
|
-
let spectrum = (await getSpectra(file, { jcampURL }, usedColors)) || [];
|
|
22
|
-
for (const spectrumData of spectrum) {
|
|
23
|
-
const { info } = spectrumData;
|
|
24
|
-
if (info.isFid)
|
|
25
|
-
continue;
|
|
26
|
-
if (info.dimension > 1) {
|
|
27
|
-
addZones(data.signals, spectrumData);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
addRanges(data.signals, spectrumData);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
nmrium.spectra.push(...spectrum);
|
|
34
|
-
}
|
|
35
|
-
return nmrium;
|
|
36
|
-
}
|
|
37
|
-
async function getSpectra(file, options = {}, usedColors = {}) {
|
|
38
|
-
const { xy = true, noContours = true, keepOriginal = true, jcampURL, } = options;
|
|
39
|
-
switch (file.extension) {
|
|
40
|
-
case 'jdx':
|
|
41
|
-
case 'dx':
|
|
42
|
-
return addJcamps([file], usedColors);
|
|
43
|
-
case 'zip':
|
|
44
|
-
return addBruker({ xy, noContours, keepOriginal }, file.binary, usedColors);
|
|
45
|
-
default:
|
|
46
|
-
if (!jcampURL) {
|
|
47
|
-
throw new Error('file extension is not supported');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function getSDF(zipFiles) {
|
|
52
|
-
let result = [];
|
|
53
|
-
for (const file in zipFiles) {
|
|
54
|
-
const pathFile = file.split('/');
|
|
55
|
-
if (/^[^.].+sdf$/.exec(pathFile[pathFile.length - 1])) {
|
|
56
|
-
const filename = pathFile[pathFile.length - 1].replace(/\.sdf/, '');
|
|
57
|
-
const root = pathFile.slice(0, pathFile.length - 1).join('/');
|
|
58
|
-
const sdf = await zipFiles[file].async('string');
|
|
59
|
-
let parserResult = parseSDF(`${sdf}`, { mixedEOL: true });
|
|
60
|
-
parserResult.filename = filename;
|
|
61
|
-
parserResult.root = root !== '' ? `${root}/` : '';
|
|
62
|
-
result.push(parserResult);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import Jszip from 'jszip';
|
|
2
|
-
import { getGroupedDiastereotopicAtomIDs } from 'openchemlib-utils';
|
|
3
|
-
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
4
|
-
import { get1DSignals } from './util/nmredata/get1DSignals';
|
|
5
|
-
import { get2DSignals } from './util/nmredata/get2DSignals';
|
|
6
|
-
import { getLabels } from './util/nmredata/getLabels';
|
|
7
|
-
const tags = {
|
|
8
|
-
solvent: 'SOLVENT',
|
|
9
|
-
temperature: 'TEMPERATURE',
|
|
10
|
-
assignment: 'ASSIGNMENT',
|
|
11
|
-
j: 'J',
|
|
12
|
-
signals: 'SIGNALS',
|
|
13
|
-
id: 'ID',
|
|
14
|
-
};
|
|
15
|
-
export async function nmriumToNmredata(state, options = {}) {
|
|
16
|
-
const { data, // it would be changed depending of the final location
|
|
17
|
-
molecules, } = state || {
|
|
18
|
-
data: [],
|
|
19
|
-
molecules: [],
|
|
20
|
-
};
|
|
21
|
-
let nmrRecord = new Jszip();
|
|
22
|
-
for (const molecule of molecules) {
|
|
23
|
-
await addNMReDATA(data, nmrRecord, {
|
|
24
|
-
...options,
|
|
25
|
-
molecule,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
if (!molecules.length)
|
|
29
|
-
await addNMReDATA(data, nmrRecord, options);
|
|
30
|
-
return nmrRecord;
|
|
31
|
-
}
|
|
32
|
-
async function addNMReDATA(data, nmrRecord, options = {}) {
|
|
33
|
-
let { id, prefix = '\n> <NMREDATA_', filename = 'nmredata', molecule, } = options;
|
|
34
|
-
let sdfResult = '';
|
|
35
|
-
let groupedDiaIDs;
|
|
36
|
-
if (molecule) {
|
|
37
|
-
molecule = OCLMolecule.fromMolfile(molecule.molfile);
|
|
38
|
-
sdfResult += molecule.toMolfile();
|
|
39
|
-
molecule.addImplicitHydrogens();
|
|
40
|
-
groupedDiaIDs = getGroupedDiastereotopicAtomIDs(molecule);
|
|
41
|
-
}
|
|
42
|
-
let labels = molecule
|
|
43
|
-
? getLabels(data, { groupedDiaIDs, molecule })
|
|
44
|
-
: { byDiaID: undefined, byAssignNumber: undefined };
|
|
45
|
-
sdfResult += `${prefix}VERSION>\n1.1\\\n`;
|
|
46
|
-
sdfResult += putTag(data, 'temperature', { prefix });
|
|
47
|
-
sdfResult += putTag(data, 'solvent', { prefix });
|
|
48
|
-
if (id)
|
|
49
|
-
sdfResult += `${prefix + tags.id}>\nid\\\n`;
|
|
50
|
-
sdfResult += formatAssignments(labels.byDiaID, { prefix });
|
|
51
|
-
sdfResult += await get1DSignals(data, nmrRecord, { prefix, labels });
|
|
52
|
-
sdfResult += await get2DSignals(data, nmrRecord, { prefix, labels });
|
|
53
|
-
sdfResult += '\n$$$$\n';
|
|
54
|
-
nmrRecord.file(`${filename}.sdf`, sdfResult);
|
|
55
|
-
}
|
|
56
|
-
function formatAssignments(labels, options) {
|
|
57
|
-
if (!labels)
|
|
58
|
-
return '';
|
|
59
|
-
const { prefix } = options;
|
|
60
|
-
let str = `${prefix + tags.assignment}>\n`;
|
|
61
|
-
for (let l in labels) {
|
|
62
|
-
let atoms = labels[l].atoms;
|
|
63
|
-
str += `${labels[l].label}, ${labels[l].shift}`; // change to add label
|
|
64
|
-
for (let atom of atoms)
|
|
65
|
-
str += `, ${atom}`;
|
|
66
|
-
str += '\\\n';
|
|
67
|
-
}
|
|
68
|
-
return str;
|
|
69
|
-
}
|
|
70
|
-
function putTag(spectra, tag, options = { prefix: '' }) {
|
|
71
|
-
const { prefix } = options;
|
|
72
|
-
let str = '';
|
|
73
|
-
for (let spectrum of spectra) {
|
|
74
|
-
if (spectrum.info[tag]) {
|
|
75
|
-
str += `${prefix + tags[tag]}>\n${String(spectrum.info[tag])}\\\n`;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return str;
|
|
80
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function addRanges(signals: any, datum: any): void;
|