react-cheminfo 0.69.0 → 0.71.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/README.md +70 -2
- package/lib/about/core/providers.d.ts +6 -0
- package/lib/about/core/providers.d.ts.map +1 -1
- package/lib/about/core/providers.js +7 -0
- package/lib/about/core/providers.js.map +1 -1
- package/lib/about/ui/AboutProvidedBy.js +34 -0
- package/lib/about/ui/AboutProvidedBy.js.map +1 -1
- package/lib/chart/ui/useChartPointer.d.ts +9 -1
- package/lib/chart/ui/useChartPointer.d.ts.map +1 -1
- package/lib/chart/ui/useChartPointer.js +11 -3
- package/lib/chart/ui/useChartPointer.js.map +1 -1
- package/lib/credits/core/credits.d.ts +41 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +50 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/download/core/drawingMarkup.d.ts +8 -1
- package/lib/download/core/drawingMarkup.d.ts.map +1 -1
- package/lib/download/core/drawingMarkup.js +13 -1
- package/lib/download/core/drawingMarkup.js.map +1 -1
- package/lib/download/core/figurePng.d.ts +14 -0
- package/lib/download/core/figurePng.d.ts.map +1 -1
- package/lib/download/core/figurePng.js +21 -6
- package/lib/download/core/figurePng.js.map +1 -1
- package/lib/download/core/figureSvg.d.ts.map +1 -1
- package/lib/download/core/figureSvg.js +5 -3
- package/lib/download/core/figureSvg.js.map +1 -1
- package/lib/download/core/figureTarget.d.ts +13 -0
- package/lib/download/core/figureTarget.d.ts.map +1 -1
- package/lib/download/core/figureTarget.js +25 -5
- package/lib/download/core/figureTarget.js.map +1 -1
- package/lib/download/core/svgBounds.d.ts +15 -0
- package/lib/download/core/svgBounds.d.ts.map +1 -1
- package/lib/download/core/svgBounds.js +20 -0
- package/lib/download/core/svgBounds.js.map +1 -1
- package/lib/download/core/svgToPng.d.ts.map +1 -1
- package/lib/download/core/svgToPng.js +4 -2
- package/lib/download/core/svgToPng.js.map +1 -1
- package/lib/format/core/relativeTime.d.ts +8 -3
- package/lib/format/core/relativeTime.d.ts.map +1 -1
- package/lib/format/core/relativeTime.js +19 -7
- package/lib/format/core/relativeTime.js.map +1 -1
- package/lib/host/core/connectHost.d.ts +25 -34
- package/lib/host/core/connectHost.d.ts.map +1 -1
- package/lib/host/core/connectHost.js +43 -89
- package/lib/host/core/connectHost.js.map +1 -1
- package/lib/host/core/hostOutputs.d.ts +58 -0
- package/lib/host/core/hostOutputs.d.ts.map +1 -0
- package/lib/host/core/hostOutputs.js +151 -0
- package/lib/host/core/hostOutputs.js.map +1 -0
- package/lib/host/core/index.d.ts +9 -3
- package/lib/host/core/index.d.ts.map +1 -1
- package/lib/host/core/index.js +4 -1
- package/lib/host/core/index.js.map +1 -1
- package/lib/host/core/irKinds.d.ts +124 -0
- package/lib/host/core/irKinds.d.ts.map +1 -0
- package/lib/host/core/irKinds.js +46 -0
- package/lib/host/core/irKinds.js.map +1 -0
- package/lib/host/core/kinds.d.ts +13 -5
- package/lib/host/core/kinds.d.ts.map +1 -1
- package/lib/host/core/kinds.js +11 -5
- package/lib/host/core/kinds.js.map +1 -1
- package/lib/host/core/protocol.d.ts +50 -7
- package/lib/host/core/protocol.d.ts.map +1 -1
- package/lib/host/core/protocol.js +10 -6
- package/lib/host/core/protocol.js.map +1 -1
- package/lib/host/core/selectInputs.d.ts +37 -0
- package/lib/host/core/selectInputs.d.ts.map +1 -0
- package/lib/host/core/selectInputs.js +110 -0
- package/lib/host/core/selectInputs.js.map +1 -0
- package/lib/host/testing/sciPeaks.d.ts +31 -0
- package/lib/host/testing/sciPeaks.d.ts.map +1 -1
- package/lib/host/testing/sciPeaks.js +73 -0
- package/lib/host/testing/sciPeaks.js.map +1 -1
- package/lib/host/testing/standInHost.d.ts +9 -1
- package/lib/host/testing/standInHost.d.ts.map +1 -1
- package/lib/host/testing/standInHost.js +19 -1
- package/lib/host/testing/standInHost.js.map +1 -1
- package/lib/host/ui/useHostConnection.d.ts +13 -5
- package/lib/host/ui/useHostConnection.d.ts.map +1 -1
- package/lib/host/ui/useHostConnection.js +4 -3
- package/lib/host/ui/useHostConnection.js.map +1 -1
- package/lib/host-testing.d.ts +2 -2
- package/lib/host-testing.d.ts.map +1 -1
- package/lib/host-testing.js +2 -2
- package/lib/host-testing.js.map +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts +1 -1
- package/lib/i18n/core/chromeCatalog.d.ts.map +1 -1
- package/lib/ir/core/handPicking.d.ts +58 -0
- package/lib/ir/core/handPicking.d.ts.map +1 -0
- package/lib/ir/core/handPicking.js +130 -0
- package/lib/ir/core/handPicking.js.map +1 -0
- package/lib/ir/core/index.d.ts +3 -0
- package/lib/ir/core/index.d.ts.map +1 -1
- package/lib/ir/core/index.js +3 -0
- package/lib/ir/core/index.js.map +1 -1
- package/lib/ir/core/irBandState.d.ts +57 -0
- package/lib/ir/core/irBandState.d.ts.map +1 -0
- package/lib/ir/core/irBandState.js +119 -0
- package/lib/ir/core/irBandState.js.map +1 -0
- package/lib/ir/core/irCommands.d.ts +11 -0
- package/lib/ir/core/irCommands.d.ts.map +1 -1
- package/lib/ir/core/irCommands.js +6 -0
- package/lib/ir/core/irCommands.js.map +1 -1
- package/lib/ir/core/irPeaks.d.ts +28 -0
- package/lib/ir/core/irPeaks.d.ts.map +1 -0
- package/lib/ir/core/irPeaks.js +66 -0
- package/lib/ir/core/irPeaks.js.map +1 -0
- package/lib/ir/core/irReducer.d.ts +8 -0
- package/lib/ir/core/irReducer.d.ts.map +1 -1
- package/lib/ir/core/irReducer.js +15 -32
- package/lib/ir/core/irReducer.js.map +1 -1
- package/lib/ir/core/irSpectrum.d.ts +15 -0
- package/lib/ir/core/irSpectrum.d.ts.map +1 -1
- package/lib/ir/core/irSpectrum.js.map +1 -1
- package/lib/ir/core/irState.d.ts +9 -6
- package/lib/ir/core/irState.d.ts.map +1 -1
- package/lib/ir/core/irState.js +10 -6
- package/lib/ir/core/irState.js.map +1 -1
- package/lib/ir/core/pickBands.d.ts +14 -0
- package/lib/ir/core/pickBands.d.ts.map +1 -1
- package/lib/ir/core/pickBands.js +39 -33
- package/lib/ir/core/pickBands.js.map +1 -1
- package/lib/ir/core/ramanBands.d.ts +9 -1
- package/lib/ir/core/ramanBands.d.ts.map +1 -1
- package/lib/ir/core/ramanBands.js +2 -2
- package/lib/ir/core/ramanBands.js.map +1 -1
- package/lib/ir/core/spectrumBands.d.ts +46 -0
- package/lib/ir/core/spectrumBands.d.ts.map +1 -0
- package/lib/ir/core/spectrumBands.js +98 -0
- package/lib/ir/core/spectrumBands.js.map +1 -0
- package/lib/ir/ui/BandRow.d.ts +5 -0
- package/lib/ir/ui/BandRow.d.ts.map +1 -1
- package/lib/ir/ui/BandRow.js +4 -3
- package/lib/ir/ui/BandRow.js.map +1 -1
- package/lib/ir/ui/BandsPanel.d.ts +5 -0
- package/lib/ir/ui/BandsPanel.d.ts.map +1 -1
- package/lib/ir/ui/BandsPanel.js +36 -16
- package/lib/ir/ui/BandsPanel.js.map +1 -1
- package/lib/ir/ui/BandsToolbar.d.ts +9 -0
- package/lib/ir/ui/BandsToolbar.d.ts.map +1 -0
- package/lib/ir/ui/BandsToolbar.js +61 -0
- package/lib/ir/ui/BandsToolbar.js.map +1 -0
- package/lib/ir/ui/IrCanvas.d.ts +2 -1
- package/lib/ir/ui/IrCanvas.d.ts.map +1 -1
- package/lib/ir/ui/IrCanvas.js +19 -5
- package/lib/ir/ui/IrCanvas.js.map +1 -1
- package/lib/ir/ui/IrChart.d.ts.map +1 -1
- package/lib/ir/ui/IrChart.js +8 -1
- package/lib/ir/ui/IrChart.js.map +1 -1
- package/lib/ir/ui/IrDocumentationDialog.js +1 -1
- package/lib/ir/ui/IrDocumentationDialog.js.map +1 -1
- package/lib/ir/ui/IrEditor.d.ts +4 -2
- package/lib/ir/ui/IrEditor.d.ts.map +1 -1
- package/lib/ir/ui/IrEditor.js.map +1 -1
- package/lib/ir/ui/IrShell.d.ts.map +1 -1
- package/lib/ir/ui/IrShell.js +6 -0
- package/lib/ir/ui/IrShell.js.map +1 -1
- package/lib/ir/ui/IrStatusBar.d.ts.map +1 -1
- package/lib/ir/ui/IrStatusBar.js +1 -1
- package/lib/ir/ui/IrStatusBar.js.map +1 -1
- package/lib/ir/ui/IrToolbar.d.ts +4 -3
- package/lib/ir/ui/IrToolbar.d.ts.map +1 -1
- package/lib/ir/ui/IrToolbar.js +5 -4
- package/lib/ir/ui/IrToolbar.js.map +1 -1
- package/lib/ir/ui/VibrationalEditor.d.ts +2 -1
- package/lib/ir/ui/VibrationalEditor.d.ts.map +1 -1
- package/lib/ir/ui/VibrationalEditor.js.map +1 -1
- package/lib/ir/ui/irActions.d.ts +5 -0
- package/lib/ir/ui/irActions.d.ts.map +1 -1
- package/lib/ir/ui/irActions.js +6 -0
- package/lib/ir/ui/irActions.js.map +1 -1
- package/lib/ir/ui/irChartProps.d.ts +4 -1
- package/lib/ir/ui/irChartProps.d.ts.map +1 -1
- package/lib/ir/ui/useIrEditor.d.ts +5 -11
- package/lib/ir/ui/useIrEditor.d.ts.map +1 -1
- package/lib/ir/ui/useIrEditor.js +17 -18
- package/lib/ir/ui/useIrEditor.js.map +1 -1
- package/lib/locales/de.json +63 -0
- package/lib/locales/en.json +63 -0
- package/lib/locales/es.json +63 -0
- package/lib/locales/fr.json +63 -0
- package/lib/locales/it.json +63 -0
- package/lib/mass/core/analyseSpectrum.d.ts +85 -0
- package/lib/mass/core/analyseSpectrum.d.ts.map +1 -0
- package/lib/mass/core/analyseSpectrum.js +101 -0
- package/lib/mass/core/analyseSpectrum.js.map +1 -0
- package/lib/mass/core/ascendingTrace.d.ts +24 -0
- package/lib/mass/core/ascendingTrace.d.ts.map +1 -0
- package/lib/mass/core/ascendingTrace.js +57 -0
- package/lib/mass/core/ascendingTrace.js.map +1 -0
- package/lib/mass/core/centroidPeaks.d.ts +77 -0
- package/lib/mass/core/centroidPeaks.d.ts.map +1 -0
- package/lib/mass/core/centroidPeaks.js +62 -0
- package/lib/mass/core/centroidPeaks.js.map +1 -0
- package/lib/mass/core/detectMassFormat.d.ts +24 -0
- package/lib/mass/core/detectMassFormat.d.ts.map +1 -0
- package/lib/mass/core/detectMassFormat.js +105 -0
- package/lib/mass/core/detectMassFormat.js.map +1 -0
- package/lib/mass/core/downloadSpectra.d.ts +24 -0
- package/lib/mass/core/downloadSpectra.d.ts.map +1 -0
- package/lib/mass/core/downloadSpectra.js +35 -0
- package/lib/mass/core/downloadSpectra.js.map +1 -0
- package/lib/mass/core/fromJcamp.d.ts +46 -0
- package/lib/mass/core/fromJcamp.d.ts.map +1 -0
- package/lib/mass/core/fromJcamp.js +123 -0
- package/lib/mass/core/fromJcamp.js.map +1 -0
- package/lib/mass/core/fromText.d.ts +30 -0
- package/lib/mass/core/fromText.d.ts.map +1 -0
- package/lib/mass/core/fromText.js +39 -0
- package/lib/mass/core/fromText.js.map +1 -0
- package/lib/mass/core/index.d.ts +70 -0
- package/lib/mass/core/index.d.ts.map +1 -0
- package/lib/mass/core/index.js +42 -0
- package/lib/mass/core/index.js.map +1 -0
- package/lib/mass/core/jcampTechnique.d.ts +38 -0
- package/lib/mass/core/jcampTechnique.d.ts.map +1 -0
- package/lib/mass/core/jcampTechnique.js +70 -0
- package/lib/mass/core/jcampTechnique.js.map +1 -0
- package/lib/mass/core/labelStackBox.d.ts +49 -0
- package/lib/mass/core/labelStackBox.d.ts.map +1 -0
- package/lib/mass/core/labelStackBox.js +44 -0
- package/lib/mass/core/labelStackBox.js.map +1 -0
- package/lib/mass/core/labelledPeaks.d.ts +79 -0
- package/lib/mass/core/labelledPeaks.d.ts.map +1 -0
- package/lib/mass/core/labelledPeaks.js +74 -0
- package/lib/mass/core/labelledPeaks.js.map +1 -0
- package/lib/mass/core/loadMassSpectra.d.ts +57 -0
- package/lib/mass/core/loadMassSpectra.d.ts.map +1 -0
- package/lib/mass/core/loadMassSpectra.js +45 -0
- package/lib/mass/core/loadMassSpectra.js.map +1 -0
- package/lib/mass/core/loadedMassSpectrum.d.ts +42 -0
- package/lib/mass/core/loadedMassSpectrum.d.ts.map +1 -0
- package/lib/mass/core/loadedMassSpectrum.js +15 -0
- package/lib/mass/core/loadedMassSpectrum.js.map +1 -0
- package/lib/mass/core/massCommands.d.ts +170 -0
- package/lib/mass/core/massCommands.d.ts.map +1 -0
- package/lib/mass/core/massCommands.js +95 -0
- package/lib/mass/core/massCommands.js.map +1 -0
- package/lib/mass/core/massDomain.d.ts +121 -0
- package/lib/mass/core/massDomain.d.ts.map +1 -0
- package/lib/mass/core/massDomain.js +179 -0
- package/lib/mass/core/massDomain.js.map +1 -0
- package/lib/mass/core/massEditorApi.d.ts +65 -0
- package/lib/mass/core/massEditorApi.d.ts.map +1 -0
- package/lib/mass/core/massEditorApi.js +10 -0
- package/lib/mass/core/massEditorApi.js.map +1 -0
- package/lib/mass/core/massFormat.d.ts +78 -0
- package/lib/mass/core/massFormat.d.ts.map +1 -0
- package/lib/mass/core/massFormat.js +168 -0
- package/lib/mass/core/massFormat.js.map +1 -0
- package/lib/mass/core/massMeta.d.ts +85 -0
- package/lib/mass/core/massMeta.d.ts.map +1 -0
- package/lib/mass/core/massMeta.js +182 -0
- package/lib/mass/core/massMeta.js.map +1 -0
- package/lib/mass/core/massReducer.d.ts +82 -0
- package/lib/mass/core/massReducer.d.ts.map +1 -0
- package/lib/mass/core/massReducer.js +163 -0
- package/lib/mass/core/massReducer.js.map +1 -0
- package/lib/mass/core/massResolution.d.ts +92 -0
- package/lib/mass/core/massResolution.d.ts.map +1 -0
- package/lib/mass/core/massResolution.js +126 -0
- package/lib/mass/core/massResolution.js.map +1 -0
- package/lib/mass/core/massSidePanels.d.ts +28 -0
- package/lib/mass/core/massSidePanels.d.ts.map +1 -0
- package/lib/mass/core/massSidePanels.js +12 -0
- package/lib/mass/core/massSidePanels.js.map +1 -0
- package/lib/mass/core/massSpectrum.d.ts +206 -0
- package/lib/mass/core/massSpectrum.d.ts.map +1 -0
- package/lib/mass/core/massSpectrum.js +41 -0
- package/lib/mass/core/massSpectrum.js.map +1 -0
- package/lib/mass/core/massState.d.ts +145 -0
- package/lib/mass/core/massState.d.ts.map +1 -0
- package/lib/mass/core/massState.js +102 -0
- package/lib/mass/core/massState.js.map +1 -0
- package/lib/mass/core/massStateEdits.d.ts +51 -0
- package/lib/mass/core/massStateEdits.d.ts.map +1 -0
- package/lib/mass/core/massStateEdits.js +90 -0
- package/lib/mass/core/massStateEdits.js.map +1 -0
- package/lib/mass/core/massSummary.d.ts +77 -0
- package/lib/mass/core/massSummary.d.ts.map +1 -0
- package/lib/mass/core/massSummary.js +174 -0
- package/lib/mass/core/massSummary.js.map +1 -0
- package/lib/mass/core/mzDecimalsSetting.d.ts +36 -0
- package/lib/mass/core/mzDecimalsSetting.d.ts.map +1 -0
- package/lib/mass/core/mzDecimalsSetting.js +42 -0
- package/lib/mass/core/mzDecimalsSetting.js.map +1 -0
- package/lib/mass/core/nearestPeak.d.ts +75 -0
- package/lib/mass/core/nearestPeak.d.ts.map +1 -0
- package/lib/mass/core/nearestPeak.js +99 -0
- package/lib/mass/core/nearestPeak.js.map +1 -0
- package/lib/mass/core/peakLabelLines.d.ts +77 -0
- package/lib/mass/core/peakLabelLines.d.ts.map +1 -0
- package/lib/mass/core/peakLabelLines.js +54 -0
- package/lib/mass/core/peakLabelLines.js.map +1 -0
- package/lib/mass/core/peakLabelPlan.d.ts +109 -0
- package/lib/mass/core/peakLabelPlan.d.ts.map +1 -0
- package/lib/mass/core/peakLabelPlan.js +143 -0
- package/lib/mass/core/peakLabelPlan.js.map +1 -0
- package/lib/mass/core/peakTable.d.ts +54 -0
- package/lib/mass/core/peakTable.d.ts.map +1 -0
- package/lib/mass/core/peakTable.js +53 -0
- package/lib/mass/core/peakTable.js.map +1 -0
- package/lib/mass/core/resolutionOf.d.ts +60 -0
- package/lib/mass/core/resolutionOf.d.ts.map +1 -0
- package/lib/mass/core/resolutionOf.js +84 -0
- package/lib/mass/core/resolutionOf.js.map +1 -0
- package/lib/mass/core/scanFilter.d.ts +25 -0
- package/lib/mass/core/scanFilter.d.ts.map +1 -0
- package/lib/mass/core/scanFilter.js +107 -0
- package/lib/mass/core/scanFilter.js.map +1 -0
- package/lib/mass/core/spectrumJcamp.d.ts +47 -0
- package/lib/mass/core/spectrumJcamp.d.ts.map +1 -0
- package/lib/mass/core/spectrumJcamp.js +167 -0
- package/lib/mass/core/spectrumJcamp.js.map +1 -0
- package/lib/mass/core/toMassSpectrum.d.ts +67 -0
- package/lib/mass/core/toMassSpectrum.d.ts.map +1 -0
- package/lib/mass/core/toMassSpectrum.js +78 -0
- package/lib/mass/core/toMassSpectrum.js.map +1 -0
- package/lib/mass/core/traceIcon.d.ts +82 -0
- package/lib/mass/core/traceIcon.d.ts.map +1 -0
- package/lib/mass/core/traceIcon.js +66 -0
- package/lib/mass/core/traceIcon.js.map +1 -0
- package/lib/mass/core/writtenResolution.d.ts +40 -0
- package/lib/mass/core/writtenResolution.d.ts.map +1 -0
- package/lib/mass/core/writtenResolution.js +77 -0
- package/lib/mass/core/writtenResolution.js.map +1 -0
- package/lib/mass/ui/MassAboutDialog.d.ts +16 -0
- package/lib/mass/ui/MassAboutDialog.d.ts.map +1 -0
- package/lib/mass/ui/MassAboutDialog.js +44 -0
- package/lib/mass/ui/MassAboutDialog.js.map +1 -0
- package/lib/mass/ui/MassCanvas.d.ts +46 -0
- package/lib/mass/ui/MassCanvas.d.ts.map +1 -0
- package/lib/mass/ui/MassCanvas.js +84 -0
- package/lib/mass/ui/MassCanvas.js.map +1 -0
- package/lib/mass/ui/MassChart.d.ts +21 -0
- package/lib/mass/ui/MassChart.d.ts.map +1 -0
- package/lib/mass/ui/MassChart.js +139 -0
- package/lib/mass/ui/MassChart.js.map +1 -0
- package/lib/mass/ui/MassCommandProvider.d.ts +15 -0
- package/lib/mass/ui/MassCommandProvider.d.ts.map +1 -0
- package/lib/mass/ui/MassCommandProvider.js +14 -0
- package/lib/mass/ui/MassCommandProvider.js.map +1 -0
- package/lib/mass/ui/MassCommandTooltip.d.ts +16 -0
- package/lib/mass/ui/MassCommandTooltip.d.ts.map +1 -0
- package/lib/mass/ui/MassCommandTooltip.js +22 -0
- package/lib/mass/ui/MassCommandTooltip.js.map +1 -0
- package/lib/mass/ui/MassDocumentationDialog.d.ts +18 -0
- package/lib/mass/ui/MassDocumentationDialog.d.ts.map +1 -0
- package/lib/mass/ui/MassDocumentationDialog.js +70 -0
- package/lib/mass/ui/MassDocumentationDialog.js.map +1 -0
- package/lib/mass/ui/MassEditor.d.ts +78 -0
- package/lib/mass/ui/MassEditor.d.ts.map +1 -0
- package/lib/mass/ui/MassEditor.js +42 -0
- package/lib/mass/ui/MassEditor.js.map +1 -0
- package/lib/mass/ui/MassHeader.d.ts +12 -0
- package/lib/mass/ui/MassHeader.d.ts.map +1 -0
- package/lib/mass/ui/MassHeader.js +20 -0
- package/lib/mass/ui/MassHeader.js.map +1 -0
- package/lib/mass/ui/MassLogo.d.ts +21 -0
- package/lib/mass/ui/MassLogo.d.ts.map +1 -0
- package/lib/mass/ui/MassLogo.js +36 -0
- package/lib/mass/ui/MassLogo.js.map +1 -0
- package/lib/mass/ui/MassPointerTracker.d.ts +44 -0
- package/lib/mass/ui/MassPointerTracker.d.ts.map +1 -0
- package/lib/mass/ui/MassPointerTracker.js +29 -0
- package/lib/mass/ui/MassPointerTracker.js.map +1 -0
- package/lib/mass/ui/MassShell.d.ts +29 -0
- package/lib/mass/ui/MassShell.d.ts.map +1 -0
- package/lib/mass/ui/MassShell.js +133 -0
- package/lib/mass/ui/MassShell.js.map +1 -0
- package/lib/mass/ui/MassSidePanel.d.ts +32 -0
- package/lib/mass/ui/MassSidePanel.d.ts.map +1 -0
- package/lib/mass/ui/MassSidePanel.js +44 -0
- package/lib/mass/ui/MassSidePanel.js.map +1 -0
- package/lib/mass/ui/MassStateProvider.d.ts +19 -0
- package/lib/mass/ui/MassStateProvider.d.ts.map +1 -0
- package/lib/mass/ui/MassStateProvider.js +16 -0
- package/lib/mass/ui/MassStateProvider.js.map +1 -0
- package/lib/mass/ui/MassStatusBar.d.ts +15 -0
- package/lib/mass/ui/MassStatusBar.d.ts.map +1 -0
- package/lib/mass/ui/MassStatusBar.js +50 -0
- package/lib/mass/ui/MassStatusBar.js.map +1 -0
- package/lib/mass/ui/MassToolbar.d.ts +24 -0
- package/lib/mass/ui/MassToolbar.d.ts.map +1 -0
- package/lib/mass/ui/MassToolbar.js +36 -0
- package/lib/mass/ui/MassToolbar.js.map +1 -0
- package/lib/mass/ui/MetadataPanel.d.ts +35 -0
- package/lib/mass/ui/MetadataPanel.d.ts.map +1 -0
- package/lib/mass/ui/MetadataPanel.js +100 -0
- package/lib/mass/ui/MetadataPanel.js.map +1 -0
- package/lib/mass/ui/MzDecimalsMenu.d.ts +28 -0
- package/lib/mass/ui/MzDecimalsMenu.d.ts.map +1 -0
- package/lib/mass/ui/MzDecimalsMenu.js +40 -0
- package/lib/mass/ui/MzDecimalsMenu.js.map +1 -0
- package/lib/mass/ui/PeakLabels.d.ts +93 -0
- package/lib/mass/ui/PeakLabels.d.ts.map +1 -0
- package/lib/mass/ui/PeakLabels.js +91 -0
- package/lib/mass/ui/PeakLabels.js.map +1 -0
- package/lib/mass/ui/PeakTable.d.ts +34 -0
- package/lib/mass/ui/PeakTable.d.ts.map +1 -0
- package/lib/mass/ui/PeakTable.js +49 -0
- package/lib/mass/ui/PeakTable.js.map +1 -0
- package/lib/mass/ui/PeaksPanel.d.ts +31 -0
- package/lib/mass/ui/PeaksPanel.d.ts.map +1 -0
- package/lib/mass/ui/PeaksPanel.js +53 -0
- package/lib/mass/ui/PeaksPanel.js.map +1 -0
- package/lib/mass/ui/SpectraPanel.d.ts +17 -0
- package/lib/mass/ui/SpectraPanel.d.ts.map +1 -0
- package/lib/mass/ui/SpectraPanel.js +76 -0
- package/lib/mass/ui/SpectraPanel.js.map +1 -0
- package/lib/mass/ui/SpectrumRow.d.ts +26 -0
- package/lib/mass/ui/SpectrumRow.d.ts.map +1 -0
- package/lib/mass/ui/SpectrumRow.js +141 -0
- package/lib/mass/ui/SpectrumRow.js.map +1 -0
- package/lib/mass/ui/SpectrumTrace.d.ts +46 -0
- package/lib/mass/ui/SpectrumTrace.d.ts.map +1 -0
- package/lib/mass/ui/SpectrumTrace.js +68 -0
- package/lib/mass/ui/SpectrumTrace.js.map +1 -0
- package/lib/mass/ui/index.d.ts +69 -0
- package/lib/mass/ui/index.d.ts.map +1 -0
- package/lib/mass/ui/index.js +42 -0
- package/lib/mass/ui/index.js.map +1 -0
- package/lib/mass/ui/massActions.d.ts +52 -0
- package/lib/mass/ui/massActions.d.ts.map +1 -0
- package/lib/mass/ui/massActions.js +62 -0
- package/lib/mass/ui/massActions.js.map +1 -0
- package/lib/mass/ui/massChartProps.d.ts +128 -0
- package/lib/mass/ui/massChartProps.d.ts.map +1 -0
- package/lib/mass/ui/massChartProps.js +14 -0
- package/lib/mass/ui/massChartProps.js.map +1 -0
- package/lib/mass/ui/massCommandContext.d.ts +36 -0
- package/lib/mass/ui/massCommandContext.d.ts.map +1 -0
- package/lib/mass/ui/massCommandContext.js +45 -0
- package/lib/mass/ui/massCommandContext.js.map +1 -0
- package/lib/mass/ui/massHostPanels.d.ts +48 -0
- package/lib/mass/ui/massHostPanels.d.ts.map +1 -0
- package/lib/mass/ui/massHostPanels.js +41 -0
- package/lib/mass/ui/massHostPanels.js.map +1 -0
- package/lib/mass/ui/massStateContext.d.ts +26 -0
- package/lib/mass/ui/massStateContext.d.ts.map +1 -0
- package/lib/mass/ui/massStateContext.js +37 -0
- package/lib/mass/ui/massStateContext.js.map +1 -0
- package/lib/mass/ui/useIntensityZoom.d.ts +20 -0
- package/lib/mass/ui/useIntensityZoom.d.ts.map +1 -0
- package/lib/mass/ui/useIntensityZoom.js +42 -0
- package/lib/mass/ui/useIntensityZoom.js.map +1 -0
- package/lib/mass/ui/useMassEditor.d.ts +52 -0
- package/lib/mass/ui/useMassEditor.d.ts.map +1 -0
- package/lib/mass/ui/useMassEditor.js +93 -0
- package/lib/mass/ui/useMassEditor.js.map +1 -0
- package/lib/mass/ui/useMassFiles.d.ts +22 -0
- package/lib/mass/ui/useMassFiles.d.ts.map +1 -0
- package/lib/mass/ui/useMassFiles.js +71 -0
- package/lib/mass/ui/useMassFiles.js.map +1 -0
- package/lib/mass/ui/useMassHandle.d.ts +15 -0
- package/lib/mass/ui/useMassHandle.d.ts.map +1 -0
- package/lib/mass/ui/useMassHandle.js +35 -0
- package/lib/mass/ui/useMassHandle.js.map +1 -0
- package/lib/mass/ui/useMassPointer.d.ts +70 -0
- package/lib/mass/ui/useMassPointer.d.ts.map +1 -0
- package/lib/mass/ui/useMassPointer.js +57 -0
- package/lib/mass/ui/useMassPointer.js.map +1 -0
- package/lib/mass/ui/useMassShortcuts.d.ts +21 -0
- package/lib/mass/ui/useMassShortcuts.d.ts.map +1 -0
- package/lib/mass/ui/useMassShortcuts.js +66 -0
- package/lib/mass/ui/useMassShortcuts.js.map +1 -0
- package/lib/mass/ui/useMassSide.d.ts +27 -0
- package/lib/mass/ui/useMassSide.d.ts.map +1 -0
- package/lib/mass/ui/useMassSide.js +45 -0
- package/lib/mass/ui/useMassSide.js.map +1 -0
- package/lib/mass/ui/useMassZoom.d.ts +92 -0
- package/lib/mass/ui/useMassZoom.d.ts.map +1 -0
- package/lib/mass/ui/useMassZoom.js +65 -0
- package/lib/mass/ui/useMassZoom.js.map +1 -0
- package/lib/mass.d.ts +16 -0
- package/lib/mass.d.ts.map +1 -0
- package/lib/mass.js +16 -0
- package/lib/mass.js.map +1 -0
- package/lib/panel/ui/PanelRail.d.ts.map +1 -1
- package/lib/panel/ui/PanelRail.js +6 -1
- package/lib/panel/ui/PanelRail.js.map +1 -1
- package/lib/slides/ui/slideSanitizeSchema.d.ts +3 -2
- package/lib/slides/ui/slideSanitizeSchema.d.ts.map +1 -1
- package/lib/slides/ui/slideSanitizeSchema.js +82 -2
- package/lib/slides/ui/slideSanitizeSchema.js.map +1 -1
- package/package.json +6 -1
- package/src/about/core/providers.ts +7 -0
- package/src/about/ui/AboutProvidedBy.tsx +49 -0
- package/src/chart/ui/useChartPointer.ts +18 -4
- package/src/credits/core/credits.ts +53 -0
- package/src/download/core/drawingMarkup.ts +18 -1
- package/src/download/core/figurePng.ts +21 -8
- package/src/download/core/figureSvg.ts +5 -2
- package/src/download/core/figureTarget.ts +28 -3
- package/src/download/core/svgBounds.ts +21 -0
- package/src/download/core/svgToPng.ts +3 -4
- package/src/format/core/relativeTime.ts +29 -7
- package/src/host/core/connectHost.ts +77 -120
- package/src/host/core/hostOutputs.ts +197 -0
- package/src/host/core/index.ts +13 -7
- package/src/host/core/irKinds.ts +92 -0
- package/src/host/core/kinds.ts +16 -6
- package/src/host/core/protocol.ts +50 -8
- package/src/host/core/selectInputs.ts +145 -0
- package/src/host/testing/sciPeaks.ts +140 -0
- package/src/host/testing/standInHost.ts +30 -5
- package/src/host/ui/useHostConnection.ts +17 -8
- package/src/host-testing.ts +4 -0
- package/src/ir/core/handPicking.ts +154 -0
- package/src/ir/core/index.ts +14 -0
- package/src/ir/core/irBandState.ts +155 -0
- package/src/ir/core/irCommands.ts +7 -0
- package/src/ir/core/irPeaks.ts +79 -0
- package/src/ir/core/irReducer.ts +27 -34
- package/src/ir/core/irSpectrum.ts +16 -0
- package/src/ir/core/irState.ts +15 -8
- package/src/ir/core/pickBands.ts +46 -39
- package/src/ir/core/ramanBands.ts +2 -2
- package/src/ir/core/spectrumBands.ts +113 -0
- package/src/ir/ui/BandRow.tsx +20 -2
- package/src/ir/ui/BandsPanel.tsx +46 -88
- package/src/ir/ui/BandsToolbar.tsx +152 -0
- package/src/ir/ui/IrCanvas.tsx +22 -11
- package/src/ir/ui/IrChart.tsx +10 -1
- package/src/ir/ui/IrDocumentationDialog.tsx +7 -0
- package/src/ir/ui/IrEditor.tsx +4 -2
- package/src/ir/ui/IrShell.tsx +5 -0
- package/src/ir/ui/IrStatusBar.tsx +4 -1
- package/src/ir/ui/IrToolbar.tsx +14 -5
- package/src/ir/ui/VibrationalEditor.tsx +2 -1
- package/src/ir/ui/irActions.ts +11 -0
- package/src/ir/ui/irChartProps.ts +4 -1
- package/src/ir/ui/useIrEditor.ts +21 -21
- package/src/locales/de.json +63 -0
- package/src/locales/en.json +63 -0
- package/src/locales/es.json +63 -0
- package/src/locales/fr.json +63 -0
- package/src/locales/it.json +63 -0
- package/src/mass/core/analyseSpectrum.ts +191 -0
- package/src/mass/core/ascendingTrace.ts +62 -0
- package/src/mass/core/centroidPeaks.ts +114 -0
- package/src/mass/core/detectMassFormat.ts +113 -0
- package/src/mass/core/downloadSpectra.ts +52 -0
- package/src/mass/core/fromJcamp.ts +151 -0
- package/src/mass/core/fromText.ts +58 -0
- package/src/mass/core/index.ts +194 -0
- package/src/mass/core/jcampTechnique.ts +87 -0
- package/src/mass/core/labelStackBox.ts +75 -0
- package/src/mass/core/labelledPeaks.ts +135 -0
- package/src/mass/core/loadMassSpectra.ts +86 -0
- package/src/mass/core/loadedMassSpectrum.ts +43 -0
- package/src/mass/core/massCommands.ts +156 -0
- package/src/mass/core/massDomain.ts +229 -0
- package/src/mass/core/massEditorApi.ts +68 -0
- package/src/mass/core/massFormat.ts +187 -0
- package/src/mass/core/massMeta.ts +239 -0
- package/src/mass/core/massReducer.ts +232 -0
- package/src/mass/core/massResolution.ts +169 -0
- package/src/mass/core/massSidePanels.ts +27 -0
- package/src/mass/core/massSpectrum.ts +220 -0
- package/src/mass/core/massState.ts +206 -0
- package/src/mass/core/massStateEdits.ts +104 -0
- package/src/mass/core/massSummary.ts +213 -0
- package/src/mass/core/mzDecimalsSetting.ts +52 -0
- package/src/mass/core/nearestPeak.ts +130 -0
- package/src/mass/core/peakLabelLines.ts +112 -0
- package/src/mass/core/peakLabelPlan.ts +246 -0
- package/src/mass/core/peakTable.ts +82 -0
- package/src/mass/core/resolutionOf.ts +100 -0
- package/src/mass/core/scanFilter.ts +119 -0
- package/src/mass/core/spectrumJcamp.ts +186 -0
- package/src/mass/core/toMassSpectrum.ts +126 -0
- package/src/mass/core/traceIcon.ts +105 -0
- package/src/mass/core/writtenResolution.ts +81 -0
- package/src/mass/ui/MassAboutDialog.tsx +89 -0
- package/src/mass/ui/MassCanvas.tsx +170 -0
- package/src/mass/ui/MassChart.tsx +266 -0
- package/src/mass/ui/MassCommandProvider.tsx +34 -0
- package/src/mass/ui/MassCommandTooltip.tsx +36 -0
- package/src/mass/ui/MassDocumentationDialog.tsx +136 -0
- package/src/mass/ui/MassEditor.tsx +130 -0
- package/src/mass/ui/MassHeader.tsx +38 -0
- package/src/mass/ui/MassLogo.tsx +84 -0
- package/src/mass/ui/MassPointerTracker.tsx +72 -0
- package/src/mass/ui/MassShell.tsx +237 -0
- package/src/mass/ui/MassSidePanel.tsx +107 -0
- package/src/mass/ui/MassStateProvider.tsx +32 -0
- package/src/mass/ui/MassStatusBar.tsx +108 -0
- package/src/mass/ui/MassToolbar.tsx +120 -0
- package/src/mass/ui/MetadataPanel.tsx +201 -0
- package/src/mass/ui/MzDecimalsMenu.tsx +86 -0
- package/src/mass/ui/PeakLabels.tsx +242 -0
- package/src/mass/ui/PeakTable.tsx +199 -0
- package/src/mass/ui/PeaksPanel.tsx +182 -0
- package/src/mass/ui/SpectraPanel.tsx +153 -0
- package/src/mass/ui/SpectrumRow.tsx +246 -0
- package/src/mass/ui/SpectrumTrace.tsx +119 -0
- package/src/mass/ui/index.ts +69 -0
- package/src/mass/ui/massActions.ts +109 -0
- package/src/mass/ui/massChartProps.ts +130 -0
- package/src/mass/ui/massCommandContext.tsx +65 -0
- package/src/mass/ui/massHostPanels.ts +71 -0
- package/src/mass/ui/massStateContext.ts +48 -0
- package/src/mass/ui/useIntensityZoom.ts +55 -0
- package/src/mass/ui/useMassEditor.ts +156 -0
- package/src/mass/ui/useMassFiles.ts +91 -0
- package/src/mass/ui/useMassHandle.ts +58 -0
- package/src/mass/ui/useMassPointer.ts +120 -0
- package/src/mass/ui/useMassShortcuts.ts +85 -0
- package/src/mass/ui/useMassSide.ts +63 -0
- package/src/mass/ui/useMassZoom.ts +157 -0
- package/src/mass.ts +16 -0
- package/src/panel/ui/PanelRail.tsx +5 -1
- package/src/slides/ui/slideSanitizeSchema.ts +86 -2
- package/styles/chrome.css +7 -0
- package/styles/slides.css +47 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows the peak table lists, and the text they are copied out as.
|
|
3
|
+
*
|
|
4
|
+
* The rows are the centroid's own peaks, read through `selectCentroidPeaks` —
|
|
5
|
+
* the same windowing the chart is read through — so the table and the chart
|
|
6
|
+
* can never disagree about which peaks exist.
|
|
7
|
+
*/
|
|
8
|
+
import { selectCentroidPeaks } from "./centroidPeaks.js";
|
|
9
|
+
import { formatIntensity, formatMz } from "./massFormat.js";
|
|
10
|
+
/**
|
|
11
|
+
* How many rows the table lists at most, the most intense kept.
|
|
12
|
+
*
|
|
13
|
+
* Far more than anybody reads, and few enough that a centroid of fifty
|
|
14
|
+
* thousand peaks does not lay out fifty thousand rows under a pointer move.
|
|
15
|
+
*/
|
|
16
|
+
export const PEAK_TABLE_LIMIT = 1000;
|
|
17
|
+
/**
|
|
18
|
+
* The floor the table starts at, as a fraction of the base peak: where a
|
|
19
|
+
* chemist's own peak list starts, and where everything under it is the
|
|
20
|
+
* baseline the compound sits on.
|
|
21
|
+
*/
|
|
22
|
+
export const PEAK_TABLE_THRESHOLD = 0.01;
|
|
23
|
+
/**
|
|
24
|
+
* The peaks the table lists for one spectrum, in increasing m/z.
|
|
25
|
+
* @param spectrum - The spectrum the table is about.
|
|
26
|
+
* @param options - The window, and the floor.
|
|
27
|
+
* @returns The peaks, shared with the centroid's cache — read, never written.
|
|
28
|
+
*/
|
|
29
|
+
export function peakTableRows(spectrum, options = {}) {
|
|
30
|
+
const { domain = null, threshold = PEAK_TABLE_THRESHOLD } = options;
|
|
31
|
+
return selectCentroidPeaks(spectrum.centroid, {
|
|
32
|
+
...(domain === null ? {} : { from: domain.x[0], to: domain.x[1] }),
|
|
33
|
+
threshold,
|
|
34
|
+
limit: PEAK_TABLE_LIMIT,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The rows as tab-separated text, the way a spreadsheet takes a paste.
|
|
39
|
+
*
|
|
40
|
+
* Written to the decimals the table shows rather than as the doubles are held,
|
|
41
|
+
* so what is pasted is what was read on screen.
|
|
42
|
+
* @param peaks - The rows, in the order they are listed.
|
|
43
|
+
* @param mzDecimals - How many decimals the masses are written with.
|
|
44
|
+
* @returns A header line and one line per peak.
|
|
45
|
+
*/
|
|
46
|
+
export function peakTableToTsv(peaks, mzDecimals) {
|
|
47
|
+
const lines = ['m/z\tintensity\tcharge'];
|
|
48
|
+
for (const peak of peaks) {
|
|
49
|
+
lines.push(`${formatMz(peak.x, mzDecimals)}\t${formatIntensity(peak.y, mzDecimals)}\t${peak.charge === 0 ? '' : peak.charge}`);
|
|
50
|
+
}
|
|
51
|
+
return `${lines.join('\n')}\n`;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=peakTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peakTable.js","sourceRoot":"","sources":["../../../src/mass/core/peakTable.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAiBzC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAsB,EACtB,UAA4B,EAAE;IAE9B,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,GAAG,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACpE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,EAAE;QAC5C,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,SAAS;QACT,KAAK,EAAE,gBAAgB;KACxB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAgC,EAChC,UAAkB;IAElB,MAAM,KAAK,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CACR,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CACnH,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resolution of a spectrum as everything downstream asks for it, and the
|
|
3
|
+
* decimals every number on screen is written with.
|
|
4
|
+
*/
|
|
5
|
+
import type { MassResolution } from './massResolution.ts';
|
|
6
|
+
import type { MassMeta, MassSpectrum } from './massSpectrum.ts';
|
|
7
|
+
/** The evidence a verdict is decided on. */
|
|
8
|
+
export interface DecideResolutionOptions {
|
|
9
|
+
/** What the peak widths measured, `null` for a peak table. */
|
|
10
|
+
measured: MassResolution | null;
|
|
11
|
+
/** What the file said about the acquisition. */
|
|
12
|
+
meta: MassMeta | null;
|
|
13
|
+
/** The m/z of every picked peak. */
|
|
14
|
+
masses: Float64Array;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The strongest verdict there is evidence for.
|
|
18
|
+
*
|
|
19
|
+
* A measurement wins outright. Otherwise the instrument the file names decides
|
|
20
|
+
* the kind, but never the decimals beyond what the masses were written with:
|
|
21
|
+
* an ion trap exporting four decimals resolves one, and a table of whole
|
|
22
|
+
* numbers stays whole whatever instrument it came off — writing `330.0` claims
|
|
23
|
+
* a decimal nobody wrote.
|
|
24
|
+
* @param options - The measurement, the file's records and the masses.
|
|
25
|
+
* @returns The verdict.
|
|
26
|
+
*/
|
|
27
|
+
export declare function decideResolution(options: DecideResolutionOptions): MassResolution;
|
|
28
|
+
/**
|
|
29
|
+
* The verdict on a spectrum: the one it was read with, or else the one its file
|
|
30
|
+
* and its masses imply.
|
|
31
|
+
*
|
|
32
|
+
* A spectrum a host built itself carries no verdict, and has no peak widths to
|
|
33
|
+
* measure one from either, so what the file named and what the masses were
|
|
34
|
+
* written with are all there is. Cached per centroid, since the verdict is
|
|
35
|
+
* asked of every drawn spectrum on every change of what is drawn, and a
|
|
36
|
+
* centroid is replaced rather than written into.
|
|
37
|
+
* @param spectrum - The spectrum.
|
|
38
|
+
* @returns How finely it resolves masses.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolutionOf(spectrum: MassSpectrum): MassResolution;
|
|
41
|
+
/**
|
|
42
|
+
* How many decimals the masses of spectra drawn together are written with when
|
|
43
|
+
* nobody chose: high-resolution masses or nominal ones, nothing in between.
|
|
44
|
+
*
|
|
45
|
+
* A high-resolution spectrum is written to the decimals its verdict allows —
|
|
46
|
+
* four, or fewer where the file wrote fewer, since padding `330.12` out to
|
|
47
|
+
* `330.1200` claims digits nobody measured. Anything else is written as the
|
|
48
|
+
* nominal mass: a low-resolution instrument's decimals are where its noise
|
|
49
|
+
* lives, and a reader who wants them chooses a number of decimals instead.
|
|
50
|
+
*
|
|
51
|
+
* Asked of all of them at once rather than of each, so one table and one axis
|
|
52
|
+
* never disagree about how wide a number is — and the most precise spectrum
|
|
53
|
+
* wins: put a calculated isotopic pattern beside a nominal peak table and the
|
|
54
|
+
* masses go back to four decimals, because rounding the pattern to match would
|
|
55
|
+
* hide the very difference the comparison was made to show.
|
|
56
|
+
* @param spectra - The spectra being shown together.
|
|
57
|
+
* @returns The decimals; four when none of them holds a peak.
|
|
58
|
+
*/
|
|
59
|
+
export declare function mzDecimalsOf(spectra: readonly MassSpectrum[]): number;
|
|
60
|
+
//# sourceMappingURL=resolutionOf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolutionOf.d.ts","sourceRoot":"","sources":["../../../src/mass/core/resolutionOf.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGhE,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,gDAAgD;IAChD,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,oCAAoC;IACpC,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,GAC/B,cAAc,CAOhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,cAAc,CAWnE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAWrE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resolution of a spectrum as everything downstream asks for it, and the
|
|
3
|
+
* decimals every number on screen is written with.
|
|
4
|
+
*/
|
|
5
|
+
import { MZ_DECIMALS, statedResolution } from "./massResolution.js";
|
|
6
|
+
import { writtenResolution } from "./writtenResolution.js";
|
|
7
|
+
/**
|
|
8
|
+
* The strongest verdict there is evidence for.
|
|
9
|
+
*
|
|
10
|
+
* A measurement wins outright. Otherwise the instrument the file names decides
|
|
11
|
+
* the kind, but never the decimals beyond what the masses were written with:
|
|
12
|
+
* an ion trap exporting four decimals resolves one, and a table of whole
|
|
13
|
+
* numbers stays whole whatever instrument it came off — writing `330.0` claims
|
|
14
|
+
* a decimal nobody wrote.
|
|
15
|
+
* @param options - The measurement, the file's records and the masses.
|
|
16
|
+
* @returns The verdict.
|
|
17
|
+
*/
|
|
18
|
+
export function decideResolution(options) {
|
|
19
|
+
const { measured, meta, masses } = options;
|
|
20
|
+
if (measured !== null)
|
|
21
|
+
return measured;
|
|
22
|
+
const written = writtenResolution(masses);
|
|
23
|
+
const stated = statedResolution(meta);
|
|
24
|
+
if (stated === null || written.kind === 'nominal')
|
|
25
|
+
return written;
|
|
26
|
+
return { ...stated, decimals: Math.min(stated.decimals, written.decimals) };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The verdict on a spectrum: the one it was read with, or else the one its file
|
|
30
|
+
* and its masses imply.
|
|
31
|
+
*
|
|
32
|
+
* A spectrum a host built itself carries no verdict, and has no peak widths to
|
|
33
|
+
* measure one from either, so what the file named and what the masses were
|
|
34
|
+
* written with are all there is. Cached per centroid, since the verdict is
|
|
35
|
+
* asked of every drawn spectrum on every change of what is drawn, and a
|
|
36
|
+
* centroid is replaced rather than written into.
|
|
37
|
+
* @param spectrum - The spectrum.
|
|
38
|
+
* @returns How finely it resolves masses.
|
|
39
|
+
*/
|
|
40
|
+
export function resolutionOf(spectrum) {
|
|
41
|
+
if (spectrum.resolution !== undefined)
|
|
42
|
+
return spectrum.resolution;
|
|
43
|
+
const cached = decidedCache.get(spectrum.centroid.x);
|
|
44
|
+
if (cached !== undefined)
|
|
45
|
+
return cached;
|
|
46
|
+
const resolution = decideResolution({
|
|
47
|
+
measured: null,
|
|
48
|
+
meta: spectrum.meta,
|
|
49
|
+
masses: spectrum.centroid.x,
|
|
50
|
+
});
|
|
51
|
+
decidedCache.set(spectrum.centroid.x, resolution);
|
|
52
|
+
return resolution;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* How many decimals the masses of spectra drawn together are written with when
|
|
56
|
+
* nobody chose: high-resolution masses or nominal ones, nothing in between.
|
|
57
|
+
*
|
|
58
|
+
* A high-resolution spectrum is written to the decimals its verdict allows —
|
|
59
|
+
* four, or fewer where the file wrote fewer, since padding `330.12` out to
|
|
60
|
+
* `330.1200` claims digits nobody measured. Anything else is written as the
|
|
61
|
+
* nominal mass: a low-resolution instrument's decimals are where its noise
|
|
62
|
+
* lives, and a reader who wants them chooses a number of decimals instead.
|
|
63
|
+
*
|
|
64
|
+
* Asked of all of them at once rather than of each, so one table and one axis
|
|
65
|
+
* never disagree about how wide a number is — and the most precise spectrum
|
|
66
|
+
* wins: put a calculated isotopic pattern beside a nominal peak table and the
|
|
67
|
+
* masses go back to four decimals, because rounding the pattern to match would
|
|
68
|
+
* hide the very difference the comparison was made to show.
|
|
69
|
+
* @param spectra - The spectra being shown together.
|
|
70
|
+
* @returns The decimals; four when none of them holds a peak.
|
|
71
|
+
*/
|
|
72
|
+
export function mzDecimalsOf(spectra) {
|
|
73
|
+
let decimals = -1;
|
|
74
|
+
for (const spectrum of spectra) {
|
|
75
|
+
if (spectrum.centroid.x.length === 0)
|
|
76
|
+
continue;
|
|
77
|
+
const resolution = resolutionOf(spectrum);
|
|
78
|
+
decimals = Math.max(decimals, resolution.kind === 'high' ? resolution.decimals : MZ_DECIMALS.nominal);
|
|
79
|
+
}
|
|
80
|
+
return decimals === -1 ? MZ_DECIMALS.high : decimals;
|
|
81
|
+
}
|
|
82
|
+
/** The verdicts already decided, keyed by the masses they were decided on. */
|
|
83
|
+
const decidedCache = new WeakMap();
|
|
84
|
+
//# sourceMappingURL=resolutionOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolutionOf.js","sourceRoot":"","sources":["../../../src/mass/core/resolutionOf.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAY3D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAgC;IAEhC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3C,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IACvC,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IAClE,OAAO,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,QAAsB;IACjD,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,UAAU,CAAC;IAClE,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,MAAM,UAAU,GAAG,gBAAgB,CAAC;QAClC,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC5B,CAAC,CAAC;IACH,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAClD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAAC,OAAgC;IAC3D,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;IAClB,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAC/C,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC1C,QAAQ,GAAG,IAAI,CAAC,GAAG,CACjB,QAAQ,EACR,UAAU,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CACvE,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC;AAED,8EAA8E;AAC9E,MAAM,YAAY,GAAG,IAAI,OAAO,EAAgC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Thermo scan filter states, mined for the fields the records left blank.
|
|
3
|
+
*
|
|
4
|
+
* The structured `##$` records are the polite answer and the scan filter is the
|
|
5
|
+
* honest one: a real Exploris export writes `##$IONISATION=` with nothing after
|
|
6
|
+
* the equals sign and then names `NSI` in the middle of the conditions block
|
|
7
|
+
* two lines later. So every field falls back to this, per field and never
|
|
8
|
+
* wholesale — an explicit record always wins, because the exporter that wrote
|
|
9
|
+
* it knew something the filter line does not say.
|
|
10
|
+
*
|
|
11
|
+
* A filter reads like
|
|
12
|
+
* `FTMS + p NSI Full ms2 194.5000@hcd50.00 [44.0860-220.4300]`, preceded by the
|
|
13
|
+
* raw file name and followed by `Scan #:` and `RT:` lines.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Read every field a conditions block states.
|
|
17
|
+
*
|
|
18
|
+
* Keyed by the same labels the metadata table uses, so a caller only has to
|
|
19
|
+
* look up the label it failed to fill — nothing here has to know which fields
|
|
20
|
+
* exist or what order they are shown in.
|
|
21
|
+
* @param conditions - The instrument's own scan description, verbatim.
|
|
22
|
+
* @returns The fields it states, by label; empty when it states none.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseScanFilter(conditions: string): Record<string, string>;
|
|
25
|
+
//# sourceMappingURL=scanFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanFilter.d.ts","sourceRoot":"","sources":["../../../src/mass/core/scanFilter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAqC1E"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Thermo scan filter states, mined for the fields the records left blank.
|
|
3
|
+
*
|
|
4
|
+
* The structured `##$` records are the polite answer and the scan filter is the
|
|
5
|
+
* honest one: a real Exploris export writes `##$IONISATION=` with nothing after
|
|
6
|
+
* the equals sign and then names `NSI` in the middle of the conditions block
|
|
7
|
+
* two lines later. So every field falls back to this, per field and never
|
|
8
|
+
* wholesale — an explicit record always wins, because the exporter that wrote
|
|
9
|
+
* it knew something the filter line does not say.
|
|
10
|
+
*
|
|
11
|
+
* A filter reads like
|
|
12
|
+
* `FTMS + p NSI Full ms2 194.5000@hcd50.00 [44.0860-220.4300]`, preceded by the
|
|
13
|
+
* raw file name and followed by `Scan #:` and `RT:` lines.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Read every field a conditions block states.
|
|
17
|
+
*
|
|
18
|
+
* Keyed by the same labels the metadata table uses, so a caller only has to
|
|
19
|
+
* look up the label it failed to fill — nothing here has to know which fields
|
|
20
|
+
* exist or what order they are shown in.
|
|
21
|
+
* @param conditions - The instrument's own scan description, verbatim.
|
|
22
|
+
* @returns The fields it states, by label; empty when it states none.
|
|
23
|
+
*/
|
|
24
|
+
export function parseScanFilter(conditions) {
|
|
25
|
+
if (!conditions)
|
|
26
|
+
return {};
|
|
27
|
+
const derived = {};
|
|
28
|
+
const analyser = group(/^(?<value>FTMS|ITMS|TOFMS)\b/m, conditions);
|
|
29
|
+
if (analyser)
|
|
30
|
+
derived.Analyser = analyser;
|
|
31
|
+
const ionisation = group(/\b(?<value>ESI|NSI|APCI|MALDI)\b/, conditions);
|
|
32
|
+
if (ionisation)
|
|
33
|
+
derived.Ionization = ionisation;
|
|
34
|
+
// The sign is read between the analyser and the ion source rather than on its
|
|
35
|
+
// own, because a bare `-` also separates the two ends of the scan range.
|
|
36
|
+
if (/(?:FTMS|ITMS|TOFMS) \+ /.test(conditions)) {
|
|
37
|
+
derived.Polarity = 'positive';
|
|
38
|
+
}
|
|
39
|
+
else if (/(?:FTMS|ITMS|TOFMS) - /.test(conditions)) {
|
|
40
|
+
derived.Polarity = 'negative';
|
|
41
|
+
}
|
|
42
|
+
readFragmentation(conditions, derived);
|
|
43
|
+
const range = /\[(?<from>[\d.]+)-(?<to>[\d.]+)\]/.exec(conditions);
|
|
44
|
+
const from = range?.groups?.from;
|
|
45
|
+
const to = range?.groups?.to;
|
|
46
|
+
if (from !== undefined && to !== undefined) {
|
|
47
|
+
derived['Scan range'] = `${Number(from)}–${Number(to)} m/z`;
|
|
48
|
+
}
|
|
49
|
+
const retentionTime = group(/^RT:\s*(?<value>.+)$/m, conditions);
|
|
50
|
+
if (retentionTime)
|
|
51
|
+
derived['Retention time'] = `${retentionTime} min`;
|
|
52
|
+
const scans = group(/^Scan #:\s*(?<value>.+)$/m, conditions);
|
|
53
|
+
if (scans)
|
|
54
|
+
derived.Scans = scans;
|
|
55
|
+
const rawFile = group(/^(?<value>\S+\.raw)$/m, conditions);
|
|
56
|
+
if (rawFile)
|
|
57
|
+
derived['Raw file'] = rawFile;
|
|
58
|
+
return derived;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Read the level a scan was taken at, and what it isolated to get there.
|
|
62
|
+
*
|
|
63
|
+
* The level is read first and everything else only under it, because the
|
|
64
|
+
* isolation and the energy are the level's own clause: a survey scan that
|
|
65
|
+
* happens to be described one line below a product scan states no level of its
|
|
66
|
+
* own, and reading its `@hcd50.00` anyway would report a collision energy for a
|
|
67
|
+
* spectrum nothing was ever fragmented into.
|
|
68
|
+
*
|
|
69
|
+
* The level is not tied to the shape of that clause, though — `Full ms2
|
|
70
|
+
* 194.5000@etd` and `SIM ms [190.0000-200.0000]` are both real filters, and an
|
|
71
|
+
* MS2 that loses its level because the activation was spelled unusually loses
|
|
72
|
+
* the precursor the annotator would have searched for.
|
|
73
|
+
* @param conditions - The instrument's own scan description.
|
|
74
|
+
* @param derived - The fields read so far, added to in place.
|
|
75
|
+
*/
|
|
76
|
+
function readFragmentation(conditions, derived) {
|
|
77
|
+
const level = /\b(?:Full|SIM|SRM) ms(?<level>\d*)\b/.exec(conditions)?.groups
|
|
78
|
+
?.level;
|
|
79
|
+
if (level === undefined)
|
|
80
|
+
return;
|
|
81
|
+
if (level === '') {
|
|
82
|
+
derived['MS level'] = 'MS1';
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
derived['MS level'] = `MS${level}`;
|
|
86
|
+
// The isolation is anchored to the level the filter just stated, so an MS3
|
|
87
|
+
// reports the window it was isolated at rather than the one before it.
|
|
88
|
+
const isolation = group(new RegExp(String.raw ` ms${level} (?<value>\d+(?:\.\d+)?)`), conditions);
|
|
89
|
+
if (isolation)
|
|
90
|
+
derived['Isolation m/z'] = isolation;
|
|
91
|
+
const clause = /@(?<activation>[a-z]+)(?<energy>\d+(?:\.\d+)?)/.exec(conditions);
|
|
92
|
+
const activation = clause?.groups?.activation;
|
|
93
|
+
const energy = clause?.groups?.energy;
|
|
94
|
+
if (activation !== undefined && energy !== undefined) {
|
|
95
|
+
derived['Collision energy'] = `${activation.toUpperCase()} ${energy}`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The `value` capture of a pattern, trimmed.
|
|
100
|
+
* @param pattern - A regular expression carrying a `value` named group.
|
|
101
|
+
* @param conditions - The text to read it out of.
|
|
102
|
+
* @returns The capture, or `''` when the pattern does not match.
|
|
103
|
+
*/
|
|
104
|
+
function group(pattern, conditions) {
|
|
105
|
+
return pattern.exec(conditions)?.groups?.value?.trim() ?? '';
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=scanFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanFilter.js","sourceRoot":"","sources":["../../../src/mass/core/scanFilter.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing spectra back out as JCAMP-DX, so what was loaded can be taken away.
|
|
3
|
+
*
|
|
4
|
+
* JCAMP is the format to write rather than two columns of text because it
|
|
5
|
+
* carries the acquisition records beside the points, so a spectrum that came in
|
|
6
|
+
* knowing it was an MS2 scan at 3.2 minutes goes out still knowing it — and
|
|
7
|
+
* comes back into this viewer, or into any other reader of the format, with its
|
|
8
|
+
* acquisition table intact.
|
|
9
|
+
*
|
|
10
|
+
* The points are written as an `##PEAK TABLE=` of explicit `x y` pairs rather
|
|
11
|
+
* than as a compressed `##XYDATA=` record, and that is a correctness choice. An
|
|
12
|
+
* XYDATA record states a first x and an increment and lets the reader rebuild
|
|
13
|
+
* the axis, which is exact only for an evenly sampled trace; a TOF or an FT scan
|
|
14
|
+
* is not evenly sampled, and writing one that way moves every m/z. Explicit
|
|
15
|
+
* pairs round trip bit for bit, at about 16 bytes a point.
|
|
16
|
+
*/
|
|
17
|
+
import type { MassSpectrum } from './massSpectrum.ts';
|
|
18
|
+
/** The extension a written spectrum is saved under. */
|
|
19
|
+
export declare const JCAMP_EXTENSION = ".jdx";
|
|
20
|
+
/** What a JCAMP-DX file is served as. */
|
|
21
|
+
export declare const JCAMP_MIME_TYPE = "chemical/x-jcamp-dx";
|
|
22
|
+
/**
|
|
23
|
+
* Write one spectrum as a JCAMP-DX block.
|
|
24
|
+
*
|
|
25
|
+
* The trace written is the one the spectrum is the record of: the continuous
|
|
26
|
+
* profile where the file held one, and the centroid otherwise. Both are never
|
|
27
|
+
* written, because a reader — this one included — picks the peaks of a profile
|
|
28
|
+
* as it loads it, so a file carrying the sticks as well would come back as two
|
|
29
|
+
* spectra of the same acquisition.
|
|
30
|
+
* @param spectrum - The spectrum.
|
|
31
|
+
* @returns The block, `##TITLE=` through `##END=`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function massSpectrumToJcamp(spectrum: MassSpectrum): string;
|
|
34
|
+
/**
|
|
35
|
+
* Write every spectrum of a list as one JCAMP-DX file.
|
|
36
|
+
*
|
|
37
|
+
* One file rather than one download per spectrum: a browser asked for eleven
|
|
38
|
+
* files in a row blocks all but the first. The blocks go inside a `LINK` block,
|
|
39
|
+
* which is what JCAMP has for a container, so dropping the file back on the
|
|
40
|
+
* chart brings the whole list back. A list of one is written as that block
|
|
41
|
+
* alone: wrapping a single spectrum in a container gains nothing.
|
|
42
|
+
* @param spectra - The spectra, in the order the list holds them.
|
|
43
|
+
* @param title - What to call the file's own outer block.
|
|
44
|
+
* @returns The file.
|
|
45
|
+
*/
|
|
46
|
+
export declare function massSpectraToJcamp(spectra: readonly MassSpectrum[], title?: string): string;
|
|
47
|
+
//# sourceMappingURL=spectrumJcamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spectrumJcamp.d.ts","sourceRoot":"","sources":["../../../src/mass/core/spectrumJcamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,uDAAuD;AACvD,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC,yCAAyC;AACzC,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAMlE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,KAAK,SAAmC,GACvC,MAAM,CAaR"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing spectra back out as JCAMP-DX, so what was loaded can be taken away.
|
|
3
|
+
*
|
|
4
|
+
* JCAMP is the format to write rather than two columns of text because it
|
|
5
|
+
* carries the acquisition records beside the points, so a spectrum that came in
|
|
6
|
+
* knowing it was an MS2 scan at 3.2 minutes goes out still knowing it — and
|
|
7
|
+
* comes back into this viewer, or into any other reader of the format, with its
|
|
8
|
+
* acquisition table intact.
|
|
9
|
+
*
|
|
10
|
+
* The points are written as an `##PEAK TABLE=` of explicit `x y` pairs rather
|
|
11
|
+
* than as a compressed `##XYDATA=` record, and that is a correctness choice. An
|
|
12
|
+
* XYDATA record states a first x and an increment and lets the reader rebuild
|
|
13
|
+
* the axis, which is exact only for an evenly sampled trace; a TOF or an FT scan
|
|
14
|
+
* is not evenly sampled, and writing one that way moves every m/z. Explicit
|
|
15
|
+
* pairs round trip bit for bit, at about 16 bytes a point.
|
|
16
|
+
*/
|
|
17
|
+
import { fromJSON } from 'convert-to-jcamp';
|
|
18
|
+
import { metaRecord } from "./massMeta.js";
|
|
19
|
+
/** The extension a written spectrum is saved under. */
|
|
20
|
+
export const JCAMP_EXTENSION = '.jdx';
|
|
21
|
+
/** What a JCAMP-DX file is served as. */
|
|
22
|
+
export const JCAMP_MIME_TYPE = 'chemical/x-jcamp-dx';
|
|
23
|
+
/**
|
|
24
|
+
* Write one spectrum as a JCAMP-DX block.
|
|
25
|
+
*
|
|
26
|
+
* The trace written is the one the spectrum is the record of: the continuous
|
|
27
|
+
* profile where the file held one, and the centroid otherwise. Both are never
|
|
28
|
+
* written, because a reader — this one included — picks the peaks of a profile
|
|
29
|
+
* as it loads it, so a file carrying the sticks as well would come back as two
|
|
30
|
+
* spectra of the same acquisition.
|
|
31
|
+
* @param spectrum - The spectrum.
|
|
32
|
+
* @returns The block, `##TITLE=` through `##END=`.
|
|
33
|
+
*/
|
|
34
|
+
export function massSpectrumToJcamp(spectrum) {
|
|
35
|
+
const trace = spectrum.profile ?? spectrum.centroid;
|
|
36
|
+
return fromJSON({ x: trace.x, y: trace.y }, { info: infoRecords(spectrum), meta: metaRecords(spectrum) });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Write every spectrum of a list as one JCAMP-DX file.
|
|
40
|
+
*
|
|
41
|
+
* One file rather than one download per spectrum: a browser asked for eleven
|
|
42
|
+
* files in a row blocks all but the first. The blocks go inside a `LINK` block,
|
|
43
|
+
* which is what JCAMP has for a container, so dropping the file back on the
|
|
44
|
+
* chart brings the whole list back. A list of one is written as that block
|
|
45
|
+
* alone: wrapping a single spectrum in a container gains nothing.
|
|
46
|
+
* @param spectra - The spectra, in the order the list holds them.
|
|
47
|
+
* @param title - What to call the file's own outer block.
|
|
48
|
+
* @returns The file.
|
|
49
|
+
*/
|
|
50
|
+
export function massSpectraToJcamp(spectra, title = `${spectra.length} mass spectra`) {
|
|
51
|
+
const only = spectra.length === 1 ? spectra[0] : undefined;
|
|
52
|
+
if (only !== undefined)
|
|
53
|
+
return massSpectrumToJcamp(only);
|
|
54
|
+
const blocks = [];
|
|
55
|
+
for (const spectrum of spectra)
|
|
56
|
+
blocks.push(massSpectrumToJcamp(spectrum));
|
|
57
|
+
return `##TITLE=${recordValue(title)}
|
|
58
|
+
##JCAMP-DX=4.24
|
|
59
|
+
##DATA TYPE=LINK
|
|
60
|
+
##BLOCKS=${blocks.length}
|
|
61
|
+
${blocks.join('\n')}
|
|
62
|
+
##END=
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The standard records of a block: what it is called, and what its axes are.
|
|
67
|
+
* @param spectrum - The spectrum.
|
|
68
|
+
* @returns The records, as `convert-to-jcamp` takes them.
|
|
69
|
+
*/
|
|
70
|
+
function infoRecords(spectrum) {
|
|
71
|
+
const info = {
|
|
72
|
+
title: recordValue(spectrum.name),
|
|
73
|
+
dataType: 'MASS SPECTRUM',
|
|
74
|
+
xUnits: 'M/Z',
|
|
75
|
+
yUnits: 'RELATIVE ABUNDANCE',
|
|
76
|
+
};
|
|
77
|
+
const { meta } = spectrum;
|
|
78
|
+
if (meta === null)
|
|
79
|
+
return info;
|
|
80
|
+
for (const field of meta.fields) {
|
|
81
|
+
const record = metaRecord(field.label);
|
|
82
|
+
if (record?.info === true)
|
|
83
|
+
info[record.key] = recordValue(field.value);
|
|
84
|
+
}
|
|
85
|
+
if (meta.molecularFormula !== null) {
|
|
86
|
+
info.MOLFORM = recordValue(meta.molecularFormula);
|
|
87
|
+
}
|
|
88
|
+
// `origin` is the one standard record `fromJSON` writes from a lowercase key,
|
|
89
|
+
// and the reader shows it as the source, so it goes through that key or not at
|
|
90
|
+
// all: an `##ORIGIN=` written twice is a file two readers disagree about.
|
|
91
|
+
const source = info.ORIGIN;
|
|
92
|
+
if (source !== undefined) {
|
|
93
|
+
info.origin = source;
|
|
94
|
+
delete info.ORIGIN;
|
|
95
|
+
}
|
|
96
|
+
return info;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The `$`-prefixed records of a block: the acquisition, as far as it is known.
|
|
100
|
+
*
|
|
101
|
+
* Everything the acquisition table holds, plus whatever the origin knows that
|
|
102
|
+
* the table does not — an mzML or a netCDF states the MS level and the polarity
|
|
103
|
+
* in its own structures rather than in a record, and those facts would otherwise
|
|
104
|
+
* be the one thing a round trip through JCAMP lost.
|
|
105
|
+
*
|
|
106
|
+
* The formula is written here as well as into the standard `##MOLFORM=`, which
|
|
107
|
+
* looks like the same fact stated twice and is: a reader that keeps only the
|
|
108
|
+
* `$` records — `common-spectrum` is one — would otherwise lose it, and it
|
|
109
|
+
* drives which masses an annotator looks for.
|
|
110
|
+
* @param spectrum - The spectrum.
|
|
111
|
+
* @returns The records, keyed without their `##$`.
|
|
112
|
+
*/
|
|
113
|
+
function metaRecords(spectrum) {
|
|
114
|
+
const records = {};
|
|
115
|
+
const { meta, origin } = spectrum;
|
|
116
|
+
if (meta !== null) {
|
|
117
|
+
for (const field of meta.fields) {
|
|
118
|
+
const record = metaRecord(field.label);
|
|
119
|
+
if (record !== null && !record.info) {
|
|
120
|
+
records[record.key] = recordValue(field.value);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (meta.conditions !== null) {
|
|
124
|
+
records.CONDITIONS = recordValue(meta.conditions);
|
|
125
|
+
}
|
|
126
|
+
if (meta.molecularFormula !== null) {
|
|
127
|
+
records.ACCURATE_MF = recordValue(meta.molecularFormula);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
fill(records, 'MSLEVEL', origin.msLevel);
|
|
131
|
+
fill(records, 'MODE', origin.polarity);
|
|
132
|
+
fill(records, 'ISOLATION', origin.precursorMz);
|
|
133
|
+
if (origin.retentionTime !== undefined) {
|
|
134
|
+
fill(records, 'RETENTIONTIME', `${origin.retentionTime} min`);
|
|
135
|
+
}
|
|
136
|
+
return records;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Write a fact the origin knows, unless the table already stated it.
|
|
140
|
+
*
|
|
141
|
+
* The table wins because it is what the file itself said, whereas the origin is
|
|
142
|
+
* what was derived from it — and a value shown in the panel that changed on the
|
|
143
|
+
* way out is worse than a value written in a slightly different spelling.
|
|
144
|
+
* @param records - The records being built.
|
|
145
|
+
* @param key - The record to write.
|
|
146
|
+
* @param value - What it says, absent when nothing is known.
|
|
147
|
+
*/
|
|
148
|
+
function fill(records, key, value) {
|
|
149
|
+
if (value === undefined || records[key] !== undefined)
|
|
150
|
+
return;
|
|
151
|
+
records[key] = recordValue(String(value));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A value put where a JCAMP record's value goes.
|
|
155
|
+
*
|
|
156
|
+
* A record is one line and `$$` opens a comment that runs to the end of it, so
|
|
157
|
+
* an instrument's scan description — which arrives with newlines in it as often
|
|
158
|
+
* as not — would otherwise either break the file in two or lose its tail. Both
|
|
159
|
+
* failures are silent on the way back in, which is why this is done to every
|
|
160
|
+
* value rather than to the ones known to be long.
|
|
161
|
+
* @param value - The value as it is held.
|
|
162
|
+
* @returns The value as one line, with no comment marker in it.
|
|
163
|
+
*/
|
|
164
|
+
function recordValue(value) {
|
|
165
|
+
return value.replaceAll(/\s+/g, ' ').replaceAll('$$', '$').trim();
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=spectrumJcamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spectrumJcamp.js","sourceRoot":"","sources":["../../../src/mass/core/spectrumJcamp.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning what a reader produced into what the viewer holds.
|
|
3
|
+
*
|
|
4
|
+
* A reader answers about a file and knows nothing about the session it is being
|
|
5
|
+
* read into — which spectra are already open, what colours they took, what this
|
|
6
|
+
* one should be called. That is the gap this closes: the peaks are picked here,
|
|
7
|
+
* the resolution decided, and it is the only place an identity or a colour is
|
|
8
|
+
* invented.
|
|
9
|
+
*/
|
|
10
|
+
import type { AnalyseSpectrumOptions } from './analyseSpectrum.ts';
|
|
11
|
+
import type { LoadedMassSpectrum } from './loadedMassSpectrum.ts';
|
|
12
|
+
import type { MassSpectrum } from './massSpectrum.ts';
|
|
13
|
+
/** What has to be decided for a loaded spectrum to become a held one. */
|
|
14
|
+
export interface ToMassSpectrumOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Identity, which every later edit and selection is keyed on.
|
|
17
|
+
* @default a fresh UUID
|
|
18
|
+
*/
|
|
19
|
+
id?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The colour to draw it in.
|
|
22
|
+
* @default the lowest hue not in `taken`
|
|
23
|
+
*/
|
|
24
|
+
color?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The colours the spectra already open have taken, so a new one is told apart
|
|
27
|
+
* from them. Ignored when `color` says outright.
|
|
28
|
+
* @default no colours taken
|
|
29
|
+
*/
|
|
30
|
+
taken?: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* What to call it, overriding the file's own title.
|
|
33
|
+
* @default the file's title, then its name, then `Spectrum`
|
|
34
|
+
*/
|
|
35
|
+
name?: string;
|
|
36
|
+
/**
|
|
37
|
+
* How the peaks are picked, beyond what the file itself said.
|
|
38
|
+
* @default the analysis's own defaults
|
|
39
|
+
*/
|
|
40
|
+
analysis?: Omit<AnalyseSpectrumOptions, 'continuous'>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Make a held spectrum out of a read one.
|
|
44
|
+
*
|
|
45
|
+
* The resolution is the strongest verdict there is evidence for, as
|
|
46
|
+
* `decideResolution` weighs it: measured on the peak widths when the trace is a
|
|
47
|
+
* profile, otherwise what the file says the instrument was, and only failing
|
|
48
|
+
* both what the decimals of the masses imply.
|
|
49
|
+
* @param loaded - What the reader produced.
|
|
50
|
+
* @param options - The identity, colour and name to give it.
|
|
51
|
+
* @returns The spectrum as the viewer holds it, its peaks picked.
|
|
52
|
+
* @throws {Error} Whatever the peak picking refuses the trace with.
|
|
53
|
+
*/
|
|
54
|
+
export declare function toMassSpectrum(loaded: LoadedMassSpectrum, options?: ToMassSpectrumOptions): MassSpectrum;
|
|
55
|
+
/**
|
|
56
|
+
* Make held spectra out of everything one file held.
|
|
57
|
+
*
|
|
58
|
+
* The colours are handed out one at a time against a growing list, so a file
|
|
59
|
+
* carrying three scans gives three spectra of three colours rather than three
|
|
60
|
+
* of the same — `nextSpectrumColor` can only answer that if it is told what the
|
|
61
|
+
* previous call took.
|
|
62
|
+
* @param loaded - What the reader produced, in file order.
|
|
63
|
+
* @param options - The colours already taken, and how the peaks are picked.
|
|
64
|
+
* @returns The spectra, in the same order.
|
|
65
|
+
*/
|
|
66
|
+
export declare function toMassSpectra(loaded: readonly LoadedMassSpectrum[], options?: Pick<ToMassSpectrumOptions, 'taken' | 'analysis'>): MassSpectrum[];
|
|
67
|
+
//# sourceMappingURL=toMassSpectrum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toMassSpectrum.d.ts","sourceRoot":"","sources":["../../../src/mass/core/toMassSpectrum.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;CACvD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,kBAAkB,EAC1B,OAAO,GAAE,qBAA0B,GAClC,YAAY,CAiCd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,kBAAkB,EAAE,EACrC,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,GAAG,UAAU,CAAM,GAC9D,YAAY,EAAE,CAahB"}
|