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,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which peak the pointer is asking about.
|
|
3
|
+
*
|
|
4
|
+
* One question, asked by the crosshair, by the click that frames a peak and by
|
|
5
|
+
* the hover that lights a row of the peak table — so it is answered once, here,
|
|
6
|
+
* and all three agree about what is under the pointer.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChartScale } from '../../chart/core/chartScale.ts';
|
|
9
|
+
import type { MassSpectrum } from './massSpectrum.ts';
|
|
10
|
+
/**
|
|
11
|
+
* How far from a stick the pointer may be and still be on it, in screen pixels.
|
|
12
|
+
*
|
|
13
|
+
* A screen distance, not a mass one: it is the size of a pointing gesture and
|
|
14
|
+
* has nothing to say about how close two m/z values are. Six pixels is about the
|
|
15
|
+
* jitter of a hand resting on a trackpad, and narrow enough that two sticks a
|
|
16
|
+
* few tenths apart on a zoomed axis stay separately reachable.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PEAK_HIT_RADIUS = 6;
|
|
19
|
+
/** The peak under the pointer, and which spectrum it belongs to. */
|
|
20
|
+
export interface NearestPeak {
|
|
21
|
+
/** The spectrum whose centroid holds it. */
|
|
22
|
+
spectrumId: string;
|
|
23
|
+
/** Where it sits in that centroid, for looking its charge up. */
|
|
24
|
+
index: number;
|
|
25
|
+
/** Its m/z, exactly as the centroid records it. */
|
|
26
|
+
mz: number;
|
|
27
|
+
/** Its intensity. */
|
|
28
|
+
intensity: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The peak the pointer is on, tested on m/z alone.
|
|
32
|
+
*
|
|
33
|
+
* Only the horizontal distance is measured, so the whole column above a stick is
|
|
34
|
+
* within reach up to the top of the plot. Matching in two dimensions instead
|
|
35
|
+
* sounds more precise and is unusable: the target for a peak at one percent of
|
|
36
|
+
* the base peak would be the few pixels around its tip, so the smallest peaks —
|
|
37
|
+
* the ones worth interrogating — become the hardest to reach.
|
|
38
|
+
* @param spectra - What the chart draws; those with neither trace drawn are
|
|
39
|
+
* skipped. A spectrum drawn as its profile answers with its picked peaks all the
|
|
40
|
+
* same — they are what the pointer is really asking after.
|
|
41
|
+
* @param xScale - The m/z axis as it is currently zoomed.
|
|
42
|
+
* @param pixelX - Where the pointer is, in the same pixels the scale speaks.
|
|
43
|
+
* @param maxDistance - How far away a stick may be, in pixels; a stick exactly
|
|
44
|
+
* that far away misses. Defaults to `PEAK_HIT_RADIUS`.
|
|
45
|
+
* @returns The closest peak within that distance, `null` when there is none.
|
|
46
|
+
*/
|
|
47
|
+
export declare function nearestPeakMz(spectra: readonly MassSpectrum[], xScale: ChartScale, pixelX: number, maxDistance?: number): NearestPeak | null;
|
|
48
|
+
/**
|
|
49
|
+
* The peak a gesture landed on, given where it landed in m/z.
|
|
50
|
+
*
|
|
51
|
+
* A gesture is reported in the units the chart is measured in, while how near a
|
|
52
|
+
* stick has to be to be the one meant is a distance on the screen — so the mass
|
|
53
|
+
* goes back through the scale rather than the radius being turned into a mass,
|
|
54
|
+
* which would be a different tolerance at every zoom.
|
|
55
|
+
* @param spectra - What the chart draws.
|
|
56
|
+
* @param xScale - The m/z axis as it is currently zoomed.
|
|
57
|
+
* @param mz - Where the gesture landed, in m/z.
|
|
58
|
+
* @param maxDistance - How far away a stick may be, in pixels. Defaults to
|
|
59
|
+
* `PEAK_HIT_RADIUS`.
|
|
60
|
+
* @returns The closest peak within that distance, `null` when there is none.
|
|
61
|
+
*/
|
|
62
|
+
export declare function peakAtMz(spectra: readonly MassSpectrum[], xScale: ChartScale, mz: number, maxDistance?: number): NearestPeak | null;
|
|
63
|
+
/**
|
|
64
|
+
* Whether two answers about the peak under the pointer say the same thing.
|
|
65
|
+
*
|
|
66
|
+
* The m/z is compared exactly, and that is not an oversight: both numbers were
|
|
67
|
+
* read out of the same centroid by the same index, so either they are the very
|
|
68
|
+
* same measurement or they are two different peaks. A tolerance here would
|
|
69
|
+
* declare an isotopologue pair a millimass unit apart to be one peak.
|
|
70
|
+
* @param current - What was last reported.
|
|
71
|
+
* @param next - What would be reported now.
|
|
72
|
+
* @returns Whether the report can be skipped.
|
|
73
|
+
*/
|
|
74
|
+
export declare function sameNearestPeak(current: NearestPeak | null, next: NearestPeak | null): boolean;
|
|
75
|
+
//# sourceMappingURL=nearestPeak.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nearestPeak.d.ts","sourceRoot":"","sources":["../../../src/mass/core/nearestPeak.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,oEAAoE;AACpE,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,WAAW,SAAkB,GAC5B,WAAW,GAAG,IAAI,CAsBpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,MAAM,EAAE,UAAU,EAClB,EAAE,EAAE,MAAM,EACV,WAAW,SAAkB,GAC5B,WAAW,GAAG,IAAI,CAEpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,IAAI,EAAE,WAAW,GAAG,IAAI,GACvB,OAAO,CAQT"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which peak the pointer is asking about.
|
|
3
|
+
*
|
|
4
|
+
* One question, asked by the crosshair, by the click that frames a peak and by
|
|
5
|
+
* the hover that lights a row of the peak table — so it is answered once, here,
|
|
6
|
+
* and all three agree about what is under the pointer.
|
|
7
|
+
*/
|
|
8
|
+
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
9
|
+
import { chartPixel, chartValue } from "../../chart/core/chartScale.js";
|
|
10
|
+
import { isSpectrumDrawn } from "./massSpectrum.js";
|
|
11
|
+
/**
|
|
12
|
+
* How far from a stick the pointer may be and still be on it, in screen pixels.
|
|
13
|
+
*
|
|
14
|
+
* A screen distance, not a mass one: it is the size of a pointing gesture and
|
|
15
|
+
* has nothing to say about how close two m/z values are. Six pixels is about the
|
|
16
|
+
* jitter of a hand resting on a trackpad, and narrow enough that two sticks a
|
|
17
|
+
* few tenths apart on a zoomed axis stay separately reachable.
|
|
18
|
+
*/
|
|
19
|
+
export const PEAK_HIT_RADIUS = 6;
|
|
20
|
+
/**
|
|
21
|
+
* The peak the pointer is on, tested on m/z alone.
|
|
22
|
+
*
|
|
23
|
+
* Only the horizontal distance is measured, so the whole column above a stick is
|
|
24
|
+
* within reach up to the top of the plot. Matching in two dimensions instead
|
|
25
|
+
* sounds more precise and is unusable: the target for a peak at one percent of
|
|
26
|
+
* the base peak would be the few pixels around its tip, so the smallest peaks —
|
|
27
|
+
* the ones worth interrogating — become the hardest to reach.
|
|
28
|
+
* @param spectra - What the chart draws; those with neither trace drawn are
|
|
29
|
+
* skipped. A spectrum drawn as its profile answers with its picked peaks all the
|
|
30
|
+
* same — they are what the pointer is really asking after.
|
|
31
|
+
* @param xScale - The m/z axis as it is currently zoomed.
|
|
32
|
+
* @param pixelX - Where the pointer is, in the same pixels the scale speaks.
|
|
33
|
+
* @param maxDistance - How far away a stick may be, in pixels; a stick exactly
|
|
34
|
+
* that far away misses. Defaults to `PEAK_HIT_RADIUS`.
|
|
35
|
+
* @returns The closest peak within that distance, `null` when there is none.
|
|
36
|
+
*/
|
|
37
|
+
export function nearestPeakMz(spectra, xScale, pixelX, maxDistance = PEAK_HIT_RADIUS) {
|
|
38
|
+
const target = chartValue(xScale, pixelX);
|
|
39
|
+
let best = null;
|
|
40
|
+
let bestDistance = maxDistance;
|
|
41
|
+
for (const spectrum of spectra) {
|
|
42
|
+
if (!isSpectrumDrawn(spectrum))
|
|
43
|
+
continue;
|
|
44
|
+
const { x, y } = spectrum.centroid;
|
|
45
|
+
if (x.length === 0)
|
|
46
|
+
continue;
|
|
47
|
+
const index = xFindClosestIndex(x, target);
|
|
48
|
+
const mz = x[index];
|
|
49
|
+
const distance = Math.abs(chartPixel(xScale, mz) - pixelX);
|
|
50
|
+
if (distance < bestDistance) {
|
|
51
|
+
bestDistance = distance;
|
|
52
|
+
best = {
|
|
53
|
+
spectrumId: spectrum.id,
|
|
54
|
+
index,
|
|
55
|
+
mz,
|
|
56
|
+
intensity: y[index],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return best;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The peak a gesture landed on, given where it landed in m/z.
|
|
64
|
+
*
|
|
65
|
+
* A gesture is reported in the units the chart is measured in, while how near a
|
|
66
|
+
* stick has to be to be the one meant is a distance on the screen — so the mass
|
|
67
|
+
* goes back through the scale rather than the radius being turned into a mass,
|
|
68
|
+
* which would be a different tolerance at every zoom.
|
|
69
|
+
* @param spectra - What the chart draws.
|
|
70
|
+
* @param xScale - The m/z axis as it is currently zoomed.
|
|
71
|
+
* @param mz - Where the gesture landed, in m/z.
|
|
72
|
+
* @param maxDistance - How far away a stick may be, in pixels. Defaults to
|
|
73
|
+
* `PEAK_HIT_RADIUS`.
|
|
74
|
+
* @returns The closest peak within that distance, `null` when there is none.
|
|
75
|
+
*/
|
|
76
|
+
export function peakAtMz(spectra, xScale, mz, maxDistance = PEAK_HIT_RADIUS) {
|
|
77
|
+
return nearestPeakMz(spectra, xScale, chartPixel(xScale, mz), maxDistance);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether two answers about the peak under the pointer say the same thing.
|
|
81
|
+
*
|
|
82
|
+
* The m/z is compared exactly, and that is not an oversight: both numbers were
|
|
83
|
+
* read out of the same centroid by the same index, so either they are the very
|
|
84
|
+
* same measurement or they are two different peaks. A tolerance here would
|
|
85
|
+
* declare an isotopologue pair a millimass unit apart to be one peak.
|
|
86
|
+
* @param current - What was last reported.
|
|
87
|
+
* @param next - What would be reported now.
|
|
88
|
+
* @returns Whether the report can be skipped.
|
|
89
|
+
*/
|
|
90
|
+
export function sameNearestPeak(current, next) {
|
|
91
|
+
if (current === next)
|
|
92
|
+
return true;
|
|
93
|
+
if (current === null || next === null)
|
|
94
|
+
return false;
|
|
95
|
+
return (current.spectrumId === next.spectrumId &&
|
|
96
|
+
current.index === next.index &&
|
|
97
|
+
current.mz === next.mz);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=nearestPeak.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nearestPeak.js","sourceRoot":"","sources":["../../../src/mass/core/nearestPeak.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AAcjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAgC,EAChC,MAAkB,EAClB,MAAc,EACd,WAAW,GAAG,eAAe;IAE7B,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,IAAI,IAAI,GAAuB,IAAI,CAAC;IACpC,IAAI,YAAY,GAAG,WAAW,CAAC;IAC/B,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC;YAAE,SAAS;QACzC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACnC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAC7B,MAAM,KAAK,GAAG,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAW,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;QAC3D,IAAI,QAAQ,GAAG,YAAY,EAAE,CAAC;YAC5B,YAAY,GAAG,QAAQ,CAAC;YACxB,IAAI,GAAG;gBACL,UAAU,EAAE,QAAQ,CAAC,EAAE;gBACvB,KAAK;gBACL,EAAE;gBACF,SAAS,EAAE,CAAC,CAAC,KAAK,CAAW;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAgC,EAChC,MAAkB,EAClB,EAAU,EACV,WAAW,GAAG,eAAe;IAE7B,OAAO,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,OAA2B,EAC3B,IAAwB;IAExB,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,OAAO,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACpD,OAAO,CACL,OAAO,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU;QACtC,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;QAC5B,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CACvB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the stack of labels above a peak says.
|
|
3
|
+
*
|
|
4
|
+
* A label is never one line: a peak carries its m/z and its intensity always,
|
|
5
|
+
* its charge when one was established, and the name of whatever explains it
|
|
6
|
+
* when a host says something does. Which of those are present changes from peak
|
|
7
|
+
* to peak, so the stack is built as a list and measured from its length — **an
|
|
8
|
+
* absent line consumes no slot**, and a peak nothing explains is not drawn with
|
|
9
|
+
* a gap where its name would have been.
|
|
10
|
+
*
|
|
11
|
+
* The lines come back farthest-from-the-peak first, which for a stack standing
|
|
12
|
+
* over a stick is also top-to-bottom reading order. Where those lines are then
|
|
13
|
+
* written is `labelStackBaselines` in the shared chart, which is the same sum
|
|
14
|
+
* for every kind of spectrum.
|
|
15
|
+
*/
|
|
16
|
+
import type { MassPeakObject } from './centroidPeaks.ts';
|
|
17
|
+
/** What one line of a stack is about. */
|
|
18
|
+
export type PeakLabelLineKind = 'annotation' | 'charge' | 'mz' | 'intensity';
|
|
19
|
+
/** One line of the stack above a peak. */
|
|
20
|
+
export interface PeakLabelLine {
|
|
21
|
+
/** What it is about, which is also its key within the stack. */
|
|
22
|
+
kind: PeakLabelLineKind;
|
|
23
|
+
/** What it says. */
|
|
24
|
+
text: string;
|
|
25
|
+
}
|
|
26
|
+
/** What a stack is allowed to say about one peak. */
|
|
27
|
+
export interface PeakLabelLinesOptions {
|
|
28
|
+
/**
|
|
29
|
+
* How many decimals the masses on screen are written with, as `mzDecimalsOf`
|
|
30
|
+
* decides, so a nominal-mass table is not written out to four decimals it
|
|
31
|
+
* never measured.
|
|
32
|
+
* @default 4
|
|
33
|
+
*/
|
|
34
|
+
mzDecimals?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Whether a peak whose charge was established says so. A charge of `0` means
|
|
37
|
+
* none was established and is never written, whatever this says.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
showCharges?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The name of whatever explains this peak, absent when nothing does.
|
|
43
|
+
* @default undefined
|
|
44
|
+
*/
|
|
45
|
+
annotationLabel?: string;
|
|
46
|
+
/**
|
|
47
|
+
* What one unit of the measured intensity is written as.
|
|
48
|
+
*
|
|
49
|
+
* One for every spectrum on the 0–100 scale; a spectrum that kept the counts
|
|
50
|
+
* its instrument recorded — a pixel of an imaging run — is written through a
|
|
51
|
+
* factor its host settles for the whole chart, so the numbers over the peaks
|
|
52
|
+
* and the numbers up the axis cannot disagree.
|
|
53
|
+
* @default 1
|
|
54
|
+
*/
|
|
55
|
+
intensityScale?: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The lines the stack above one peak is made of.
|
|
59
|
+
*
|
|
60
|
+
* Ordered by how much of an answer each line is, the answer farthest from the
|
|
61
|
+
* stick and the measurement nearest it: the name of whatever explains the peak,
|
|
62
|
+
* then the charge, which qualifies the mass below it, then the m/z, which is
|
|
63
|
+
* what a chemist came to read, and the intensity last, sitting on the stick
|
|
64
|
+
* whose height already said it.
|
|
65
|
+
* @param peak - The peak being labelled.
|
|
66
|
+
* @param options - What the stack is allowed to say.
|
|
67
|
+
* @returns The lines, farthest from the peak first, never empty.
|
|
68
|
+
*/
|
|
69
|
+
export declare function peakLabelLines(peak: MassPeakObject, options?: PeakLabelLinesOptions): PeakLabelLine[];
|
|
70
|
+
/**
|
|
71
|
+
* How one peak of one spectrum is keyed, wherever something is said about it.
|
|
72
|
+
* @param spectrumId - Identity of the spectrum.
|
|
73
|
+
* @param index - Where the peak sits in that spectrum's centroid.
|
|
74
|
+
* @returns `${spectrumId}:${index}`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function peakKey(spectrumId: string, index: number): string;
|
|
77
|
+
//# sourceMappingURL=peakLabelLines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peakLabelLines.d.ts","sourceRoot":"","sources":["../../../src/mass/core/peakLabelLines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIzD,yCAAyC;AACzC,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,QAAQ,GAAG,IAAI,GAAG,WAAW,CAAC;AAE7E,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,IAAI,EAAE,iBAAiB,CAAC;IACxB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qDAAqD;AACrD,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,qBAA0B,GAClC,aAAa,EAAE,CAuBjB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the stack of labels above a peak says.
|
|
3
|
+
*
|
|
4
|
+
* A label is never one line: a peak carries its m/z and its intensity always,
|
|
5
|
+
* its charge when one was established, and the name of whatever explains it
|
|
6
|
+
* when a host says something does. Which of those are present changes from peak
|
|
7
|
+
* to peak, so the stack is built as a list and measured from its length — **an
|
|
8
|
+
* absent line consumes no slot**, and a peak nothing explains is not drawn with
|
|
9
|
+
* a gap where its name would have been.
|
|
10
|
+
*
|
|
11
|
+
* The lines come back farthest-from-the-peak first, which for a stack standing
|
|
12
|
+
* over a stick is also top-to-bottom reading order. Where those lines are then
|
|
13
|
+
* written is `labelStackBaselines` in the shared chart, which is the same sum
|
|
14
|
+
* for every kind of spectrum.
|
|
15
|
+
*/
|
|
16
|
+
import { formatIntensity, formatMz } from "./massFormat.js";
|
|
17
|
+
import { MZ_DECIMALS } from "./massResolution.js";
|
|
18
|
+
/**
|
|
19
|
+
* The lines the stack above one peak is made of.
|
|
20
|
+
*
|
|
21
|
+
* Ordered by how much of an answer each line is, the answer farthest from the
|
|
22
|
+
* stick and the measurement nearest it: the name of whatever explains the peak,
|
|
23
|
+
* then the charge, which qualifies the mass below it, then the m/z, which is
|
|
24
|
+
* what a chemist came to read, and the intensity last, sitting on the stick
|
|
25
|
+
* whose height already said it.
|
|
26
|
+
* @param peak - The peak being labelled.
|
|
27
|
+
* @param options - What the stack is allowed to say.
|
|
28
|
+
* @returns The lines, farthest from the peak first, never empty.
|
|
29
|
+
*/
|
|
30
|
+
export function peakLabelLines(peak, options = {}) {
|
|
31
|
+
const { mzDecimals = MZ_DECIMALS.high, showCharges = false, annotationLabel, intensityScale = 1, } = options;
|
|
32
|
+
const lines = [];
|
|
33
|
+
if (annotationLabel !== undefined && annotationLabel !== '') {
|
|
34
|
+
lines.push({ kind: 'annotation', text: annotationLabel });
|
|
35
|
+
}
|
|
36
|
+
if (showCharges && peak.charge !== 0) {
|
|
37
|
+
lines.push({ kind: 'charge', text: `z = ${peak.charge}` });
|
|
38
|
+
}
|
|
39
|
+
lines.push({ kind: 'mz', text: formatMz(peak.x, mzDecimals) }, {
|
|
40
|
+
kind: 'intensity',
|
|
41
|
+
text: formatIntensity(peak.y * intensityScale, mzDecimals),
|
|
42
|
+
});
|
|
43
|
+
return lines;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* How one peak of one spectrum is keyed, wherever something is said about it.
|
|
47
|
+
* @param spectrumId - Identity of the spectrum.
|
|
48
|
+
* @param index - Where the peak sits in that spectrum's centroid.
|
|
49
|
+
* @returns `${spectrumId}:${index}`.
|
|
50
|
+
*/
|
|
51
|
+
export function peakKey(spectrumId, index) {
|
|
52
|
+
return `${spectrumId}:${index}`;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=peakLabelLines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peakLabelLines.js","sourceRoot":"","sources":["../../../src/mass/core/peakLabelLines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA6ClD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAoB,EACpB,UAAiC,EAAE;IAEnC,MAAM,EACJ,UAAU,GAAG,WAAW,CAAC,IAAI,EAC7B,WAAW,GAAG,KAAK,EACnB,eAAe,EACf,cAAc,GAAG,CAAC,GACnB,GAAG,OAAO,CAAC;IAEZ,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,IAAI,eAAe,KAAK,SAAS,IAAI,eAAe,KAAK,EAAE,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,WAAW,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,KAAK,CAAC,IAAI,CACR,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,EAClD;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,cAAc,EAAE,UAAU,CAAC;KAC3D,CACF,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,UAAkB,EAAE,KAAa;IACvD,OAAO,GAAG,UAAU,IAAI,KAAK,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where every labelled peak's numbers go, worked out before anything is drawn.
|
|
3
|
+
*
|
|
4
|
+
* Which peaks are labelled is `selectLabelledPeaks`, and the slots it makes that
|
|
5
|
+
* choice with are cut from the *window*: ten of them, whatever the chart is. A
|
|
6
|
+
* label is not — it is a number set at a fixed size, and `527.1607` is fifty
|
|
7
|
+
* pixels wide on a plot of any width. So a chart narrow enough for its slots to
|
|
8
|
+
* be thinner than that hands back two peaks whose stacks are written one across
|
|
9
|
+
* the other, and the two masses that result are neither.
|
|
10
|
+
*
|
|
11
|
+
* What settles it: **the taller peak keeps the room, and the fainter one goes
|
|
12
|
+
* without**. Never a nudge sideways — on a chart, distance from a stick is the
|
|
13
|
+
* only thing saying which stick a number belongs to, and a mass slid clear of
|
|
14
|
+
* its neighbour is a mass now hanging over somebody else's peak. The peak that
|
|
15
|
+
* loses its numbers keeps the mark on its tip, so it is not read as a peak the
|
|
16
|
+
* spectrum lacks, and a zoom widens the room and brings its stack straight back.
|
|
17
|
+
*
|
|
18
|
+
* Kept out of the component so that which peak was labelled, and at what pixel,
|
|
19
|
+
* is worth a test that no browser has to stand by for.
|
|
20
|
+
*/
|
|
21
|
+
import type { PlotRect } from '../../chart/core/chartGeometry.ts';
|
|
22
|
+
import type { ChartScale } from '../../chart/core/chartScale.ts';
|
|
23
|
+
import type { StackBox } from './labelStackBox.ts';
|
|
24
|
+
import type { LabelledPeak } from './labelledPeaks.ts';
|
|
25
|
+
import type { MassSpectrum } from './massSpectrum.ts';
|
|
26
|
+
import type { PeakLabelLine } from './peakLabelLines.ts';
|
|
27
|
+
/** The clear space kept between two stacks standing side by side. */
|
|
28
|
+
export declare const LABEL_SPACING = 4;
|
|
29
|
+
/** One labelled peak: its stick, its numbers, and where both are drawn. */
|
|
30
|
+
export interface PeakLabelPlan {
|
|
31
|
+
/** The peak being labelled. */
|
|
32
|
+
peak: LabelledPeak;
|
|
33
|
+
/** `${spectrumId}:${index}`, which is how anything said about it is found. */
|
|
34
|
+
key: string;
|
|
35
|
+
/** Where its stick stands, in pixels across the SVG. */
|
|
36
|
+
tipX: number;
|
|
37
|
+
/** Where the tip of that stick is, in pixels down the SVG. */
|
|
38
|
+
tipY: number;
|
|
39
|
+
/**
|
|
40
|
+
* Where the stack is centred, which is over the tip unless the peak stands so
|
|
41
|
+
* near the edge of the plot that its numbers would be written half outside it.
|
|
42
|
+
* `NaN` for a peak crowded out of its numbers by a taller neighbour, which is
|
|
43
|
+
* still marked — it simply is not written.
|
|
44
|
+
*/
|
|
45
|
+
labelX: number;
|
|
46
|
+
/** What the stack says, farthest line from the peak first. */
|
|
47
|
+
lines: PeakLabelLine[];
|
|
48
|
+
/** Where each of those lines is written, in the order the lines are in. */
|
|
49
|
+
baselines: Float64Array;
|
|
50
|
+
/** The room the stack takes, which is what answers the pointer. */
|
|
51
|
+
box: StackBox;
|
|
52
|
+
}
|
|
53
|
+
/** What a set of stacks is planned against. */
|
|
54
|
+
export interface PlanPeakLabelsOptions {
|
|
55
|
+
/** The spectrum whose peaks are labelled, as it is drawn. */
|
|
56
|
+
spectrum: MassSpectrum;
|
|
57
|
+
/** Where the plot sits, which is what a stack may not be written outside of. */
|
|
58
|
+
plot: PlotRect;
|
|
59
|
+
/** The m/z axis as it is currently zoomed. */
|
|
60
|
+
xScale: ChartScale;
|
|
61
|
+
/** The intensity axis as it is currently zoomed. */
|
|
62
|
+
yScale: ChartScale;
|
|
63
|
+
/**
|
|
64
|
+
* How many peaks are labelled at most, the most intense first.
|
|
65
|
+
* @default the selection's own default
|
|
66
|
+
*/
|
|
67
|
+
limit?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Whether a peak whose charge was established says so.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
showCharges?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* How many decimals the masses on screen are written with.
|
|
75
|
+
* @default 4
|
|
76
|
+
*/
|
|
77
|
+
mzDecimals?: number;
|
|
78
|
+
/**
|
|
79
|
+
* What explains each peak, keyed as `peakKey` keys it.
|
|
80
|
+
* @default undefined
|
|
81
|
+
*/
|
|
82
|
+
annotationLabels?: ReadonlyMap<string, string>;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the stacks hang under the sticks rather than standing over them,
|
|
85
|
+
* which is what the lower half of a mirrored pair wants.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
below?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* What one unit of the measured intensity is written as.
|
|
91
|
+
* @default 1
|
|
92
|
+
*/
|
|
93
|
+
intensityScale?: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Plan the stacks for the window on screen.
|
|
97
|
+
*
|
|
98
|
+
* The crowding is settled before a single line is composed, and settled in
|
|
99
|
+
* descending intensity: the tallest peak of the window asks for its stretch of
|
|
100
|
+
* the axis first and keeps it, and every fainter peak standing closer than a
|
|
101
|
+
* label is wide loses its `labelX`. What comes back is in ascending m/z, so the
|
|
102
|
+
* drawing order is the axis order and a stack keeps its key from one render to
|
|
103
|
+
* the next.
|
|
104
|
+
* @param options - The spectrum, the axes, and what the stacks may say.
|
|
105
|
+
* @returns One plan per peak that earned a label, in ascending m/z, those
|
|
106
|
+
* crowded out among them.
|
|
107
|
+
*/
|
|
108
|
+
export declare function planPeakLabels(options: PlanPeakLabelsOptions): PeakLabelPlan[];
|
|
109
|
+
//# sourceMappingURL=peakLabelPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peakLabelPlan.d.ts","sourceRoot":"","sources":["../../../src/mass/core/peakLabelPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAKjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,qEAAqE;AACrE,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,2EAA2E;IAC3E,SAAS,EAAE,YAAY,CAAC;IACxB,mEAAmE;IACnE,GAAG,EAAE,QAAQ,CAAC;CACf;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,6DAA6D;IAC7D,QAAQ,EAAE,YAAY,CAAC;IACvB,gFAAgF;IAChF,IAAI,EAAE,QAAQ,CAAC;IACf,8CAA8C;IAC9C,MAAM,EAAE,UAAU,CAAC;IACnB,oDAAoD;IACpD,MAAM,EAAE,UAAU,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,qBAAqB,GAC7B,aAAa,EAAE,CAsDjB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where every labelled peak's numbers go, worked out before anything is drawn.
|
|
3
|
+
*
|
|
4
|
+
* Which peaks are labelled is `selectLabelledPeaks`, and the slots it makes that
|
|
5
|
+
* choice with are cut from the *window*: ten of them, whatever the chart is. A
|
|
6
|
+
* label is not — it is a number set at a fixed size, and `527.1607` is fifty
|
|
7
|
+
* pixels wide on a plot of any width. So a chart narrow enough for its slots to
|
|
8
|
+
* be thinner than that hands back two peaks whose stacks are written one across
|
|
9
|
+
* the other, and the two masses that result are neither.
|
|
10
|
+
*
|
|
11
|
+
* What settles it: **the taller peak keeps the room, and the fainter one goes
|
|
12
|
+
* without**. Never a nudge sideways — on a chart, distance from a stick is the
|
|
13
|
+
* only thing saying which stick a number belongs to, and a mass slid clear of
|
|
14
|
+
* its neighbour is a mass now hanging over somebody else's peak. The peak that
|
|
15
|
+
* loses its numbers keeps the mark on its tip, so it is not read as a peak the
|
|
16
|
+
* spectrum lacks, and a zoom widens the room and brings its stack straight back.
|
|
17
|
+
*
|
|
18
|
+
* Kept out of the component so that which peak was labelled, and at what pixel,
|
|
19
|
+
* is worth a test that no browser has to stand by for.
|
|
20
|
+
*/
|
|
21
|
+
import { chartPixel, chartValue } from "../../chart/core/chartScale.js";
|
|
22
|
+
import { PEAK_LABEL } from "../../chart/core/chartTheme.js";
|
|
23
|
+
import { labelStackBaselines } from "../../chart/core/labelStack.js";
|
|
24
|
+
import { labelStackBox } from "./labelStackBox.js";
|
|
25
|
+
import { selectLabelledPeaks } from "./labelledPeaks.js";
|
|
26
|
+
import { peakKey, peakLabelLines } from "./peakLabelLines.js";
|
|
27
|
+
/** The clear space kept between two stacks standing side by side. */
|
|
28
|
+
export const LABEL_SPACING = 4;
|
|
29
|
+
/**
|
|
30
|
+
* Plan the stacks for the window on screen.
|
|
31
|
+
*
|
|
32
|
+
* The crowding is settled before a single line is composed, and settled in
|
|
33
|
+
* descending intensity: the tallest peak of the window asks for its stretch of
|
|
34
|
+
* the axis first and keeps it, and every fainter peak standing closer than a
|
|
35
|
+
* label is wide loses its `labelX`. What comes back is in ascending m/z, so the
|
|
36
|
+
* drawing order is the axis order and a stack keeps its key from one render to
|
|
37
|
+
* the next.
|
|
38
|
+
* @param options - The spectrum, the axes, and what the stacks may say.
|
|
39
|
+
* @returns One plan per peak that earned a label, in ascending m/z, those
|
|
40
|
+
* crowded out among them.
|
|
41
|
+
*/
|
|
42
|
+
export function planPeakLabels(options) {
|
|
43
|
+
const { spectrum, plot, xScale, yScale, limit, showCharges = false, mzDecimals, annotationLabels, below = false, intensityScale = 1, } = options;
|
|
44
|
+
const peaks = selectLabelledPeaks(spectrum, {
|
|
45
|
+
from: chartValue(xScale, plot.left),
|
|
46
|
+
to: chartValue(xScale, plot.right),
|
|
47
|
+
// The far edge of the half this spectrum is drawn in: the top of the plot
|
|
48
|
+
// for an ordinary chart, its bottom for a half drawn through a reflected
|
|
49
|
+
// scale.
|
|
50
|
+
maxValue: chartValue(yScale, below ? plot.bottom : plot.top),
|
|
51
|
+
...(limit === undefined ? {} : { limit }),
|
|
52
|
+
});
|
|
53
|
+
if (peaks.length === 0)
|
|
54
|
+
return [];
|
|
55
|
+
const centres = placeStacks(peaks, plot, xScale);
|
|
56
|
+
const bounds = [plot.top, plot.bottom];
|
|
57
|
+
const plans = [];
|
|
58
|
+
for (let index = 0; index < peaks.length; index++) {
|
|
59
|
+
const peak = peaks[index];
|
|
60
|
+
const key = peakKey(spectrum.id, peak.index);
|
|
61
|
+
const lines = peakLabelLines(peak, {
|
|
62
|
+
...(mzDecimals === undefined ? {} : { mzDecimals }),
|
|
63
|
+
showCharges,
|
|
64
|
+
intensityScale,
|
|
65
|
+
...(annotationLabels === undefined
|
|
66
|
+
? {}
|
|
67
|
+
: { annotationLabel: annotationLabels.get(key) }),
|
|
68
|
+
});
|
|
69
|
+
const tipY = chartPixel(yScale, peak.y);
|
|
70
|
+
const labelX = centres[index];
|
|
71
|
+
const baselines = labelStackBaselines(tipY, lines.length, bounds, below);
|
|
72
|
+
plans.push({
|
|
73
|
+
peak,
|
|
74
|
+
key,
|
|
75
|
+
tipX: chartPixel(xScale, peak.x),
|
|
76
|
+
tipY,
|
|
77
|
+
labelX,
|
|
78
|
+
lines,
|
|
79
|
+
baselines,
|
|
80
|
+
box: labelStackBox(labelX, baselines),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return plans;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Where each stack may stand, `NaN` for one crowded out by a taller peak.
|
|
87
|
+
*
|
|
88
|
+
* A stack whose peak stands at the very edge of the plot is slid back inside it
|
|
89
|
+
* and never further, which is a different thing from clearing a neighbour: the
|
|
90
|
+
* mark stays on the stick, the number moves by a few pixels rather than by its
|
|
91
|
+
* own width, and what it avoids is being written half over the axis.
|
|
92
|
+
* @param peaks - The peaks that earned a label, in ascending m/z.
|
|
93
|
+
* @param plot - Where the plot sits inside the SVG.
|
|
94
|
+
* @param xScale - The m/z axis as it is currently zoomed.
|
|
95
|
+
* @returns The centre each stack was given, indexed as the peaks are.
|
|
96
|
+
*/
|
|
97
|
+
function placeStacks(peaks, plot, xScale) {
|
|
98
|
+
const half = PEAK_LABEL.hoverHalfWidth;
|
|
99
|
+
const step = half * 2 + LABEL_SPACING;
|
|
100
|
+
// A plot too narrow to hold one whole label has no inside to slide anything
|
|
101
|
+
// back into, and the clamp would put every stack in the same place.
|
|
102
|
+
const roomy = plot.width >= half * 2;
|
|
103
|
+
const centres = new Float64Array(peaks.length).fill(Number.NaN);
|
|
104
|
+
const placed = [];
|
|
105
|
+
for (const index of tallestFirst(peaks)) {
|
|
106
|
+
const wanted = chartPixel(xScale, peaks[index].x);
|
|
107
|
+
const centre = roomy
|
|
108
|
+
? Math.min(Math.max(wanted, plot.left + half), plot.right - half)
|
|
109
|
+
: wanted;
|
|
110
|
+
if (!clearOfPlaced(placed, centre, step))
|
|
111
|
+
continue;
|
|
112
|
+
placed.push(centre);
|
|
113
|
+
centres[index] = centre;
|
|
114
|
+
}
|
|
115
|
+
return centres;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The indices of the peaks, the tallest first — the order the room is handed
|
|
119
|
+
* out in, so that a base peak is labelled on every chart it appears on.
|
|
120
|
+
* @param peaks - The peaks that earned a label.
|
|
121
|
+
* @returns Their indices, descending by intensity.
|
|
122
|
+
*/
|
|
123
|
+
function tallestFirst(peaks) {
|
|
124
|
+
const order = new Uint32Array(peaks.length);
|
|
125
|
+
for (let index = 0; index < peaks.length; index++)
|
|
126
|
+
order[index] = index;
|
|
127
|
+
return order.toSorted((first, second) => peaks[second].y - peaks[first].y);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Whether a stack may stand where it wants to, given the ones already placed.
|
|
131
|
+
* @param placed - The centres already given out, in pixels.
|
|
132
|
+
* @param centre - The centre being asked for.
|
|
133
|
+
* @param step - How far apart two centres have to be for both to be readable.
|
|
134
|
+
* @returns Whether it clears every one of them.
|
|
135
|
+
*/
|
|
136
|
+
function clearOfPlaced(placed, centre, step) {
|
|
137
|
+
for (const taken of placed) {
|
|
138
|
+
if (Math.abs(taken - centre) < step)
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=peakLabelPlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peakLabelPlan.js","sourceRoot":"","sources":["../../../src/mass/core/peakLabelPlan.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 type { MassPeakObject } from './centroidPeaks.ts';
|
|
9
|
+
import type { MassDomain, MassSpectrum } from './massSpectrum.ts';
|
|
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 declare 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 declare const PEAK_TABLE_THRESHOLD = 0.01;
|
|
23
|
+
/** Which peaks the table lists. */
|
|
24
|
+
export interface PeakTableOptions {
|
|
25
|
+
/**
|
|
26
|
+
* The window the chart shows, when the table is to follow it; `null` for the
|
|
27
|
+
* whole spectrum.
|
|
28
|
+
* @default null
|
|
29
|
+
*/
|
|
30
|
+
domain?: MassDomain | null;
|
|
31
|
+
/**
|
|
32
|
+
* The floor, as a fraction of the base peak; `0` lists every peak.
|
|
33
|
+
* @default PEAK_TABLE_THRESHOLD
|
|
34
|
+
*/
|
|
35
|
+
threshold?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The peaks the table lists for one spectrum, in increasing m/z.
|
|
39
|
+
* @param spectrum - The spectrum the table is about.
|
|
40
|
+
* @param options - The window, and the floor.
|
|
41
|
+
* @returns The peaks, shared with the centroid's cache — read, never written.
|
|
42
|
+
*/
|
|
43
|
+
export declare function peakTableRows(spectrum: MassSpectrum, options?: PeakTableOptions): MassPeakObject[];
|
|
44
|
+
/**
|
|
45
|
+
* The rows as tab-separated text, the way a spreadsheet takes a paste.
|
|
46
|
+
*
|
|
47
|
+
* Written to the decimals the table shows rather than as the doubles are held,
|
|
48
|
+
* so what is pasted is what was read on screen.
|
|
49
|
+
* @param peaks - The rows, in the order they are listed.
|
|
50
|
+
* @param mzDecimals - How many decimals the masses are written with.
|
|
51
|
+
* @returns A header line and one line per peak.
|
|
52
|
+
*/
|
|
53
|
+
export declare function peakTableToTsv(peaks: readonly MassPeakObject[], mzDecimals: number): string;
|
|
54
|
+
//# sourceMappingURL=peakTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peakTable.d.ts","sourceRoot":"","sources":["../../../src/mass/core/peakTable.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,mCAAmC;AACnC,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,YAAY,EACtB,OAAO,GAAE,gBAAqB,GAC7B,cAAc,EAAE,CAOlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR"}
|