react-cheminfo 0.75.0 → 0.77.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 +141 -31
- package/lib/card/core/cardAddress.d.ts +19 -2
- package/lib/card/core/cardAddress.d.ts.map +1 -1
- package/lib/card/core/cardAddress.js +35 -2
- package/lib/card/core/cardAddress.js.map +1 -1
- package/lib/card/core/cardPageUrl.d.ts +7 -1
- package/lib/card/core/cardPageUrl.d.ts.map +1 -1
- package/lib/card/core/cardPageUrl.js +4 -2
- package/lib/card/core/cardPageUrl.js.map +1 -1
- package/lib/card/core/index.d.ts +1 -1
- package/lib/card/core/index.d.ts.map +1 -1
- package/lib/card/core/index.js +1 -1
- package/lib/card/core/index.js.map +1 -1
- package/lib/credits/core/credits.d.ts +30 -0
- package/lib/credits/core/credits.d.ts.map +1 -1
- package/lib/credits/core/credits.js +35 -0
- package/lib/credits/core/credits.js.map +1 -1
- package/lib/download/core/copySvg.d.ts +12 -0
- package/lib/download/core/copySvg.d.ts.map +1 -0
- package/lib/download/core/copySvg.js +38 -0
- package/lib/download/core/copySvg.js.map +1 -0
- package/lib/download/core/downloadFigure.d.ts +12 -1
- package/lib/download/core/downloadFigure.d.ts.map +1 -1
- package/lib/download/core/downloadFigure.js +21 -0
- package/lib/download/core/downloadFigure.js.map +1 -1
- package/lib/download/core/figureDpi.d.ts +59 -0
- package/lib/download/core/figureDpi.d.ts.map +1 -0
- package/lib/download/core/figureDpi.js +75 -0
- package/lib/download/core/figureDpi.js.map +1 -0
- package/lib/download/core/figurePng.d.ts +4 -1
- package/lib/download/core/figurePng.d.ts.map +1 -1
- package/lib/download/core/figurePng.js +11 -2
- package/lib/download/core/figurePng.js.map +1 -1
- package/lib/download/core/index.d.ts +5 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +4 -1
- package/lib/download/core/index.js.map +1 -1
- package/lib/download/core/pngDpi.d.ts +22 -0
- package/lib/download/core/pngDpi.d.ts.map +1 -0
- package/lib/download/core/pngDpi.js +79 -0
- package/lib/download/core/pngDpi.js.map +1 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts +13 -0
- package/lib/download/ui/FigureDownloadPanel.d.ts.map +1 -1
- package/lib/download/ui/FigureDownloadPanel.js +18 -34
- package/lib/download/ui/FigureDownloadPanel.js.map +1 -1
- package/lib/download/ui/figureDownloadHint.d.ts +5 -0
- package/lib/download/ui/figureDownloadHint.d.ts.map +1 -1
- package/lib/download/ui/figureDownloadHint.js +8 -0
- package/lib/download/ui/figureDownloadHint.js.map +1 -1
- package/lib/download/ui/figureDownloadOptions.d.ts +84 -0
- package/lib/download/ui/figureDownloadOptions.d.ts.map +1 -0
- package/lib/download/ui/figureDownloadOptions.js +2 -0
- package/lib/download/ui/figureDownloadOptions.js.map +1 -0
- package/lib/download/ui/resolutionChoices.d.ts +27 -0
- package/lib/download/ui/resolutionChoices.d.ts.map +1 -0
- package/lib/download/ui/resolutionChoices.js +48 -0
- package/lib/download/ui/resolutionChoices.js.map +1 -0
- package/lib/download/ui/useFigureActions.d.ts +4 -1
- package/lib/download/ui/useFigureActions.d.ts.map +1 -1
- package/lib/download/ui/useFigureActions.js +17 -8
- package/lib/download/ui/useFigureActions.js.map +1 -1
- package/lib/download/ui/useFigureDownload.d.ts +2 -55
- package/lib/download/ui/useFigureDownload.d.ts.map +1 -1
- package/lib/download/ui/useFigureDownload.js +45 -13
- package/lib/download/ui/useFigureDownload.js.map +1 -1
- package/lib/ecosystem/core/sites.d.ts.map +1 -1
- package/lib/ecosystem/core/sites.js +14 -0
- package/lib/ecosystem/core/sites.js.map +1 -1
- package/lib/ecosystem/core/types.d.ts +1 -1
- package/lib/ecosystem/core/types.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.d.ts.map +1 -1
- package/lib/ecosystem/ui/glyphs.js +3 -0
- package/lib/ecosystem/ui/glyphs.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/bandAssignments.d.ts.map +1 -1
- package/lib/ir/core/bandAssignments.js +27 -0
- package/lib/ir/core/bandAssignments.js.map +1 -1
- package/lib/ir/ui/BandRow.d.ts +4 -4
- package/lib/ir/ui/BandRow.d.ts.map +1 -1
- package/lib/ir/ui/BandRow.js +41 -14
- package/lib/ir/ui/BandRow.js.map +1 -1
- package/lib/locales/de.json +32 -1
- package/lib/locales/en.json +32 -1
- package/lib/locales/es.json +32 -1
- package/lib/locales/fr.json +32 -1
- package/lib/locales/it.json +32 -1
- package/lib/molecule3d/ui/Molecule3DStage.d.ts +4 -33
- package/lib/molecule3d/ui/Molecule3DStage.d.ts.map +1 -1
- package/lib/molecule3d/ui/Molecule3DStage.js +3 -37
- package/lib/molecule3d/ui/Molecule3DStage.js.map +1 -1
- package/lib/osiris/core/barGeometry.d.ts +42 -0
- package/lib/osiris/core/barGeometry.d.ts.map +1 -0
- package/lib/osiris/core/barGeometry.js +46 -0
- package/lib/osiris/core/barGeometry.js.map +1 -0
- package/lib/osiris/core/computeProperties.d.ts +42 -0
- package/lib/osiris/core/computeProperties.d.ts.map +1 -0
- package/lib/osiris/core/computeProperties.js +115 -0
- package/lib/osiris/core/computeProperties.js.map +1 -0
- package/lib/osiris/core/constants.d.ts +70 -0
- package/lib/osiris/core/constants.d.ts.map +1 -0
- package/lib/osiris/core/constants.js +99 -0
- package/lib/osiris/core/constants.js.map +1 -0
- package/lib/osiris/core/fitness.d.ts +32 -0
- package/lib/osiris/core/fitness.d.ts.map +1 -0
- package/lib/osiris/core/fitness.js +48 -0
- package/lib/osiris/core/fitness.js.map +1 -0
- package/lib/osiris/core/index.d.ts +29 -0
- package/lib/osiris/core/index.d.ts.map +1 -0
- package/lib/osiris/core/index.js +19 -0
- package/lib/osiris/core/index.js.map +1 -0
- package/lib/osiris/core/poolSize.d.ts +17 -0
- package/lib/osiris/core/poolSize.d.ts.map +1 -0
- package/lib/osiris/core/poolSize.js +22 -0
- package/lib/osiris/core/poolSize.js.map +1 -0
- package/lib/osiris/core/poolTypes.d.ts +140 -0
- package/lib/osiris/core/poolTypes.d.ts.map +1 -0
- package/lib/osiris/core/poolTypes.js +12 -0
- package/lib/osiris/core/poolTypes.js.map +1 -0
- package/lib/osiris/core/predictIdCode.d.ts +39 -0
- package/lib/osiris/core/predictIdCode.d.ts.map +1 -0
- package/lib/osiris/core/predictIdCode.js +54 -0
- package/lib/osiris/core/predictIdCode.js.map +1 -0
- package/lib/osiris/core/predictProtocol.d.ts +67 -0
- package/lib/osiris/core/predictProtocol.d.ts.map +1 -0
- package/lib/osiris/core/predictProtocol.js +29 -0
- package/lib/osiris/core/predictProtocol.js.map +1 -0
- package/lib/osiris/core/predictionPool.d.ts +23 -0
- package/lib/osiris/core/predictionPool.d.ts.map +1 -0
- package/lib/osiris/core/predictionPool.js +186 -0
- package/lib/osiris/core/predictionPool.js.map +1 -0
- package/lib/osiris/core/predictionQueue.d.ts +46 -0
- package/lib/osiris/core/predictionQueue.d.ts.map +1 -0
- package/lib/osiris/core/predictionQueue.js +57 -0
- package/lib/osiris/core/predictionQueue.js.map +1 -0
- package/lib/osiris/core/predictors.d.ts +62 -0
- package/lib/osiris/core/predictors.d.ts.map +1 -0
- package/lib/osiris/core/predictors.js +100 -0
- package/lib/osiris/core/predictors.js.map +1 -0
- package/lib/osiris/core/propertyKeys.d.ts +32 -0
- package/lib/osiris/core/propertyKeys.d.ts.map +1 -0
- package/lib/osiris/core/propertyKeys.js +44 -0
- package/lib/osiris/core/propertyKeys.js.map +1 -0
- package/lib/osiris/core/riskAppearance.d.ts +60 -0
- package/lib/osiris/core/riskAppearance.d.ts.map +1 -0
- package/lib/osiris/core/riskAppearance.js +59 -0
- package/lib/osiris/core/riskAppearance.js.map +1 -0
- package/lib/osiris/core/riskDetail.d.ts +22 -0
- package/lib/osiris/core/riskDetail.d.ts.map +1 -0
- package/lib/osiris/core/riskDetail.js +86 -0
- package/lib/osiris/core/riskDetail.js.map +1 -0
- package/lib/osiris/core/riskDetailRequest.d.ts +31 -0
- package/lib/osiris/core/riskDetailRequest.d.ts.map +1 -0
- package/lib/osiris/core/riskDetailRequest.js +49 -0
- package/lib/osiris/core/riskDetailRequest.js.map +1 -0
- package/lib/osiris/core/riskFindings.d.ts +26 -0
- package/lib/osiris/core/riskFindings.d.ts.map +1 -0
- package/lib/osiris/core/riskFindings.js +79 -0
- package/lib/osiris/core/riskFindings.js.map +1 -0
- package/lib/osiris/core/runPredictionJob.d.ts +20 -0
- package/lib/osiris/core/runPredictionJob.d.ts.map +1 -0
- package/lib/osiris/core/runPredictionJob.js +43 -0
- package/lib/osiris/core/runPredictionJob.js.map +1 -0
- package/lib/osiris/core/scales.d.ts +70 -0
- package/lib/osiris/core/scales.d.ts.map +1 -0
- package/lib/osiris/core/scales.js +185 -0
- package/lib/osiris/core/scales.js.map +1 -0
- package/lib/osiris/core/types.d.ts +91 -0
- package/lib/osiris/core/types.d.ts.map +1 -0
- package/lib/osiris/core/types.js +19 -0
- package/lib/osiris/core/types.js.map +1 -0
- package/lib/osiris/core/valuation.d.ts +28 -0
- package/lib/osiris/core/valuation.d.ts.map +1 -0
- package/lib/osiris/core/valuation.js +39 -0
- package/lib/osiris/core/valuation.js.map +1 -0
- package/lib/osiris/ui/PropertyBar.d.ts +27 -0
- package/lib/osiris/ui/PropertyBar.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyBar.js +27 -0
- package/lib/osiris/ui/PropertyBar.js.map +1 -0
- package/lib/osiris/ui/PropertyPanel.d.ts +91 -0
- package/lib/osiris/ui/PropertyPanel.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyPanel.js +77 -0
- package/lib/osiris/ui/PropertyPanel.js.map +1 -0
- package/lib/osiris/ui/PropertyRows.d.ts +40 -0
- package/lib/osiris/ui/PropertyRows.d.ts.map +1 -0
- package/lib/osiris/ui/PropertyRows.js +23 -0
- package/lib/osiris/ui/PropertyRows.js.map +1 -0
- package/lib/osiris/ui/RiskFindings.d.ts +43 -0
- package/lib/osiris/ui/RiskFindings.d.ts.map +1 -0
- package/lib/osiris/ui/RiskFindings.js +51 -0
- package/lib/osiris/ui/RiskFindings.js.map +1 -0
- package/lib/osiris/ui/RiskPanel.d.ts +46 -0
- package/lib/osiris/ui/RiskPanel.d.ts.map +1 -0
- package/lib/osiris/ui/RiskPanel.js +32 -0
- package/lib/osiris/ui/RiskPanel.js.map +1 -0
- package/lib/osiris/ui/RiskSquare.d.ts +51 -0
- package/lib/osiris/ui/RiskSquare.d.ts.map +1 -0
- package/lib/osiris/ui/RiskSquare.js +23 -0
- package/lib/osiris/ui/RiskSquare.js.map +1 -0
- package/lib/osiris/ui/index.d.ts +15 -0
- package/lib/osiris/ui/index.d.ts.map +1 -0
- package/lib/osiris/ui/index.js +8 -0
- package/lib/osiris/ui/index.js.map +1 -0
- package/lib/osiris/ui/usePredictions.d.ts +81 -0
- package/lib/osiris/ui/usePredictions.d.ts.map +1 -0
- package/lib/osiris/ui/usePredictions.js +102 -0
- package/lib/osiris/ui/usePredictions.js.map +1 -0
- package/lib/osiris-ui.d.ts +11 -0
- package/lib/osiris-ui.d.ts.map +1 -0
- package/lib/osiris-ui.js +11 -0
- package/lib/osiris-ui.js.map +1 -0
- package/lib/osiris.d.ts +17 -0
- package/lib/osiris.d.ts.map +1 -0
- package/lib/osiris.js +17 -0
- package/lib/osiris.js.map +1 -0
- package/lib/panel/ui/FilterInput.d.ts.map +1 -1
- package/lib/panel/ui/FilterInput.js +3 -1
- package/lib/panel/ui/FilterInput.js.map +1 -1
- package/lib/panel/ui/SidePanelItem.d.ts +39 -0
- package/lib/panel/ui/SidePanelItem.d.ts.map +1 -0
- package/lib/panel/ui/SidePanelItem.js +63 -0
- package/lib/panel/ui/SidePanelItem.js.map +1 -0
- package/lib/panel/ui/SidePanelStack.d.ts +11 -10
- package/lib/panel/ui/SidePanelStack.d.ts.map +1 -1
- package/lib/panel/ui/SidePanelStack.js +22 -15
- package/lib/panel/ui/SidePanelStack.js.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.d.ts.map +1 -1
- package/lib/panel/ui/SpectrumColorSwatch.js +4 -2
- package/lib/panel/ui/SpectrumColorSwatch.js.map +1 -1
- package/lib/panel/ui/usePanelFolds.d.ts +35 -0
- package/lib/panel/ui/usePanelFolds.d.ts.map +1 -0
- package/lib/panel/ui/usePanelFolds.js +73 -0
- package/lib/panel/ui/usePanelFolds.js.map +1 -0
- package/lib/shared/ui/FullscreenStage.d.ts +43 -0
- package/lib/shared/ui/FullscreenStage.d.ts.map +1 -0
- package/lib/shared/ui/FullscreenStage.js +38 -0
- package/lib/shared/ui/FullscreenStage.js.map +1 -0
- package/lib/shared/ui/canFillScreen.d.ts +7 -0
- package/lib/shared/ui/canFillScreen.d.ts.map +1 -0
- package/lib/shared/ui/canFillScreen.js +9 -0
- package/lib/shared/ui/canFillScreen.js.map +1 -0
- package/lib/shared/ui/index.d.ts +3 -0
- package/lib/shared/ui/index.d.ts.map +1 -1
- package/lib/shared/ui/index.js +2 -0
- package/lib/shared/ui/index.js.map +1 -1
- package/lib/split/ui/splitPanes.d.ts +3 -3
- package/lib/split/ui/splitPanes.js +1 -1
- package/lib/structure/core/structureNotations.d.ts +8 -1
- package/lib/structure/core/structureNotations.d.ts.map +1 -1
- package/lib/structure/core/structureNotations.js +14 -8
- package/lib/structure/core/structureNotations.js.map +1 -1
- package/lib/structure/ui/CardStructure.d.ts +43 -0
- package/lib/structure/ui/CardStructure.d.ts.map +1 -0
- package/lib/structure/ui/CardStructure.js +28 -0
- package/lib/structure/ui/CardStructure.js.map +1 -0
- package/lib/structure/ui/StructureExportPanel.d.ts +8 -0
- package/lib/structure/ui/StructureExportPanel.d.ts.map +1 -1
- package/lib/structure/ui/StructureExportPanel.js +9 -4
- package/lib/structure/ui/StructureExportPanel.js.map +1 -1
- package/lib/structure/ui/StructurePicturePane.d.ts +1 -1
- package/lib/structure/ui/StructurePicturePane.d.ts.map +1 -1
- package/lib/structure/ui/StructurePicturePane.js +5 -2
- package/lib/structure/ui/StructurePicturePane.js.map +1 -1
- package/lib/structure/ui/index.d.ts +3 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- package/lib/structure/ui/index.js +1 -0
- package/lib/structure/ui/index.js.map +1 -1
- package/package.json +4 -1
- package/src/card/core/cardAddress.ts +39 -3
- package/src/card/core/cardPageUrl.ts +10 -3
- package/src/card/core/index.ts +7 -1
- package/src/credits/core/credits.ts +40 -0
- package/src/download/core/copySvg.ts +40 -0
- package/src/download/core/downloadFigure.ts +26 -1
- package/src/download/core/figureDpi.ts +94 -0
- package/src/download/core/figurePng.ts +11 -2
- package/src/download/core/index.ts +14 -1
- package/src/download/core/pngDpi.ts +84 -0
- package/src/download/ui/FigureDownloadPanel.tsx +41 -51
- package/src/download/ui/figureDownloadHint.ts +13 -0
- package/src/download/ui/figureDownloadOptions.ts +85 -0
- package/src/download/ui/resolutionChoices.ts +67 -0
- package/src/download/ui/useFigureActions.ts +24 -9
- package/src/download/ui/useFigureDownload.tsx +57 -71
- package/src/ecosystem/core/sites.ts +14 -0
- package/src/ecosystem/core/types.ts +2 -1
- package/src/ecosystem/ui/glyphs.tsx +20 -0
- package/src/ir/core/bandAssignments.ts +27 -0
- package/src/ir/ui/BandRow.tsx +84 -26
- package/src/locales/de.json +32 -1
- package/src/locales/en.json +32 -1
- package/src/locales/es.json +32 -1
- package/src/locales/fr.json +32 -1
- package/src/locales/it.json +32 -1
- package/src/molecule3d/ui/Molecule3DStage.tsx +4 -88
- package/src/osiris/core/barGeometry.ts +74 -0
- package/src/osiris/core/computeProperties.ts +175 -0
- package/src/osiris/core/constants.ts +110 -0
- package/src/osiris/core/fitness.ts +59 -0
- package/src/osiris/core/index.ts +78 -0
- package/src/osiris/core/poolSize.ts +24 -0
- package/src/osiris/core/poolTypes.ts +140 -0
- package/src/osiris/core/predictIdCode.ts +69 -0
- package/src/osiris/core/predictProtocol.ts +78 -0
- package/src/osiris/core/predictionPool.ts +237 -0
- package/src/osiris/core/predictionQueue.ts +89 -0
- package/src/osiris/core/predictors.ts +142 -0
- package/src/osiris/core/propertyKeys.ts +54 -0
- package/src/osiris/core/riskAppearance.ts +86 -0
- package/src/osiris/core/riskDetail.ts +120 -0
- package/src/osiris/core/riskDetailRequest.ts +64 -0
- package/src/osiris/core/riskFindings.ts +92 -0
- package/src/osiris/core/runPredictionJob.ts +49 -0
- package/src/osiris/core/scales.ts +236 -0
- package/src/osiris/core/types.ts +103 -0
- package/src/osiris/core/valuation.ts +44 -0
- package/src/osiris/ui/PropertyBar.tsx +77 -0
- package/src/osiris/ui/PropertyPanel.tsx +227 -0
- package/src/osiris/ui/PropertyRows.tsx +92 -0
- package/src/osiris/ui/RiskFindings.tsx +137 -0
- package/src/osiris/ui/RiskPanel.tsx +81 -0
- package/src/osiris/ui/RiskSquare.tsx +108 -0
- package/src/osiris/ui/index.ts +17 -0
- package/src/osiris/ui/usePredictions.ts +194 -0
- package/src/osiris-ui.ts +11 -0
- package/src/osiris.ts +17 -0
- package/src/panel/ui/FilterInput.tsx +4 -1
- package/src/panel/ui/SidePanelItem.tsx +162 -0
- package/src/panel/ui/SidePanelStack.tsx +29 -36
- package/src/panel/ui/SpectrumColorSwatch.tsx +5 -3
- package/src/panel/ui/usePanelFolds.ts +103 -0
- package/src/shared/ui/FullscreenStage.tsx +96 -0
- package/src/shared/ui/canFillScreen.ts +8 -0
- package/src/shared/ui/index.ts +6 -0
- package/src/split/ui/splitPanes.tsx +4 -4
- package/src/structure/core/structureNotations.ts +25 -8
- package/src/structure/ui/CardStructure.tsx +76 -0
- package/src/structure/ui/StructureExportPanel.tsx +23 -4
- package/src/structure/ui/StructurePicturePane.tsx +14 -1
- package/src/structure/ui/index.ts +6 -0
- package/styles/chrome.css +3 -3
- package/styles/osiris.css +339 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One prediction, wherever it runs.
|
|
3
|
+
*
|
|
4
|
+
* The worker serves this, and a page with no `Worker` at all — a unit test,
|
|
5
|
+
* Node — runs the same function on its own thread. One code path, so what the
|
|
6
|
+
* tests prove is what the page does.
|
|
7
|
+
*/
|
|
8
|
+
import type { PredictRequest, PredictResponse } from './predictProtocol.ts';
|
|
9
|
+
/**
|
|
10
|
+
* Answer one job.
|
|
11
|
+
*
|
|
12
|
+
* A structure that cannot be read, or that holds no atoms, throws: that is one
|
|
13
|
+
* bad row, and the run carries on without it. Resources that did not load
|
|
14
|
+
* return `unavailable` instead, because that is every row and the run must stop.
|
|
15
|
+
* @param request - The job.
|
|
16
|
+
* @returns The answer.
|
|
17
|
+
* @throws {Error} When the molecule itself could not be read or predicted.
|
|
18
|
+
*/
|
|
19
|
+
export declare function runPredictionJob(request: PredictRequest): Promise<PredictResponse>;
|
|
20
|
+
//# sourceMappingURL=runPredictionJob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runPredictionJob.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/runPredictionJob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5E;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CAsB1B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One prediction, wherever it runs.
|
|
3
|
+
*
|
|
4
|
+
* The worker serves this, and a page with no `Worker` at all — a unit test,
|
|
5
|
+
* Node — runs the same function on its own thread. One code path, so what the
|
|
6
|
+
* tests prove is what the page does.
|
|
7
|
+
*/
|
|
8
|
+
import { errorMessage } from "../../error/core/toError.js";
|
|
9
|
+
import { predictIdCode, riskDetailOfIdCode } from "./predictIdCode.js";
|
|
10
|
+
import { loadPredictors } from "./predictors.js";
|
|
11
|
+
/**
|
|
12
|
+
* Answer one job.
|
|
13
|
+
*
|
|
14
|
+
* A structure that cannot be read, or that holds no atoms, throws: that is one
|
|
15
|
+
* bad row, and the run carries on without it. Resources that did not load
|
|
16
|
+
* return `unavailable` instead, because that is every row and the run must stop.
|
|
17
|
+
* @param request - The job.
|
|
18
|
+
* @returns The answer.
|
|
19
|
+
* @throws {Error} When the molecule itself could not be read or predicted.
|
|
20
|
+
*/
|
|
21
|
+
export async function runPredictionJob(request) {
|
|
22
|
+
let predictors;
|
|
23
|
+
try {
|
|
24
|
+
predictors = await loadPredictors(request.resources);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return { kind: 'unavailable', message: errorMessage(error) };
|
|
28
|
+
}
|
|
29
|
+
if (request.kind === 'riskDetail') {
|
|
30
|
+
return {
|
|
31
|
+
kind: 'riskDetail',
|
|
32
|
+
detail: riskDetailOfIdCode(request.idCode, request.risk, predictors),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
kind: 'properties',
|
|
37
|
+
key: request.key,
|
|
38
|
+
properties: predictIdCode(request.idCode, predictors, {
|
|
39
|
+
...(request.label === undefined ? {} : { label: request.label }),
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=runPredictionJob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runPredictionJob.js","sourceRoot":"","sources":["../../../src/osiris/core/runPredictionJob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAuB;IAEvB,IAAI,UAAU,CAAC;IACf,IAAI,CAAC;QACH,UAAU,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;IAC/D,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAClC,OAAO;YACL,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC;SACrE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE;YACpD,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;SACjE,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scale every displayed property is read on: how wide the bar is, where
|
|
3
|
+
* the good band sits, and which published number the labelled mark names.
|
|
4
|
+
*
|
|
5
|
+
* Eight of the ten come verbatim from DataWarrior's own `MolecularPropertyHelper.SPEC`
|
|
6
|
+
* table — the same ranges its own property views draw — so nothing here is a
|
|
7
|
+
* cut-off picked to look right. The two it has no entry for, drug-likeness and
|
|
8
|
+
* the drug score, keep the legacy explorer's ranges, and take their fitness
|
|
9
|
+
* from `DrugScoreCalculator`'s own terms rather than from a new guess.
|
|
10
|
+
*
|
|
11
|
+
* The preferred band and the published threshold are different numbers on
|
|
12
|
+
* purpose: cLogP's band closes at 4, where DataWarrior puts it, while the
|
|
13
|
+
* published rule of thumb the mark names is 5. The band draws the colour, the
|
|
14
|
+
* threshold draws the line.
|
|
15
|
+
*/
|
|
16
|
+
import type { PropertyKey } from './propertyKeys.ts';
|
|
17
|
+
/** A published rule of thumb, drawn on the bar as a labelled mark. */
|
|
18
|
+
export interface PropertyThreshold {
|
|
19
|
+
/** Where on the bar the mark goes. */
|
|
20
|
+
value: number;
|
|
21
|
+
/** How it reads, e.g. `≤ 5`. */
|
|
22
|
+
label: string;
|
|
23
|
+
}
|
|
24
|
+
/** Where a shared scale's numbers come from. */
|
|
25
|
+
export type ScaleSource = 'datawarrior' | 'legacy';
|
|
26
|
+
/** How one property is drawn, ranged and judged. */
|
|
27
|
+
export interface PropertyScale {
|
|
28
|
+
/** The field of `OsirisProperties` this describes. */
|
|
29
|
+
key: PropertyKey;
|
|
30
|
+
/** What the panel and the table column call it. */
|
|
31
|
+
label: string;
|
|
32
|
+
/** The unit, empty where the quantity is dimensionless. */
|
|
33
|
+
unit: string;
|
|
34
|
+
/** Decimals the value is shown to; `0` for a count. */
|
|
35
|
+
decimals: number;
|
|
36
|
+
/** The left end of the bar, and of the plot axis. */
|
|
37
|
+
rangeMin: number;
|
|
38
|
+
/** The right end of the bar, and of the plot axis. */
|
|
39
|
+
rangeMax: number;
|
|
40
|
+
/** The bottom of the preferred band, or `null` when it has no lower bound. */
|
|
41
|
+
preferredMin: number | null;
|
|
42
|
+
/** The top of the preferred band, or `null` when it has no upper bound. */
|
|
43
|
+
preferredMax: number | null;
|
|
44
|
+
/**
|
|
45
|
+
* How far outside the band the fitness takes to fall away. `null` for a
|
|
46
|
+
* quantity that is already a 0-to-1 fitness.
|
|
47
|
+
*/
|
|
48
|
+
halfWidth: number | null;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a larger number is the better one. `null` where the property has a
|
|
51
|
+
* band rather than a direction — a molecule wants some stereocentres, not as
|
|
52
|
+
* many or as few as possible.
|
|
53
|
+
*/
|
|
54
|
+
higherIsBetter: boolean | null;
|
|
55
|
+
/** The published rule of thumb to mark, or `null` where there is none. */
|
|
56
|
+
threshold: PropertyThreshold | null;
|
|
57
|
+
/** Whether the bar grows from the middle rather than from the left. */
|
|
58
|
+
diverging: boolean;
|
|
59
|
+
/** Where the range and the band came from. */
|
|
60
|
+
source: ScaleSource;
|
|
61
|
+
}
|
|
62
|
+
/** How each displayed property is drawn, ranged and judged. */
|
|
63
|
+
export declare const PROPERTY_SCALES: Record<PropertyKey, PropertyScale>;
|
|
64
|
+
/**
|
|
65
|
+
* How one property is drawn, ranged and judged.
|
|
66
|
+
* @param key - Which of the ten.
|
|
67
|
+
* @returns Its scale.
|
|
68
|
+
*/
|
|
69
|
+
export declare function propertyScale(key: PropertyKey): PropertyScale;
|
|
70
|
+
//# sourceMappingURL=scales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/scales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gDAAgD;AAChD,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEnD,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,GAAG,EAAE,WAAW,CAAC;IACjB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,2EAA2E;IAC3E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;;OAIG;IACH,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,0EAA0E;IAC1E,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,+DAA+D;AAC/D,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,aAAa,CA+J9D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,aAAa,CAE7D"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scale every displayed property is read on: how wide the bar is, where
|
|
3
|
+
* the good band sits, and which published number the labelled mark names.
|
|
4
|
+
*
|
|
5
|
+
* Eight of the ten come verbatim from DataWarrior's own `MolecularPropertyHelper.SPEC`
|
|
6
|
+
* table — the same ranges its own property views draw — so nothing here is a
|
|
7
|
+
* cut-off picked to look right. The two it has no entry for, drug-likeness and
|
|
8
|
+
* the drug score, keep the legacy explorer's ranges, and take their fitness
|
|
9
|
+
* from `DrugScoreCalculator`'s own terms rather than from a new guess.
|
|
10
|
+
*
|
|
11
|
+
* The preferred band and the published threshold are different numbers on
|
|
12
|
+
* purpose: cLogP's band closes at 4, where DataWarrior puts it, while the
|
|
13
|
+
* published rule of thumb the mark names is 5. The band draws the colour, the
|
|
14
|
+
* threshold draws the line.
|
|
15
|
+
*/
|
|
16
|
+
/** How each displayed property is drawn, ranged and judged. */
|
|
17
|
+
export const PROPERTY_SCALES = {
|
|
18
|
+
logP: {
|
|
19
|
+
key: 'logP',
|
|
20
|
+
label: 'cLogP',
|
|
21
|
+
unit: '',
|
|
22
|
+
decimals: 2,
|
|
23
|
+
rangeMin: 0,
|
|
24
|
+
rangeMax: 8,
|
|
25
|
+
preferredMin: null,
|
|
26
|
+
preferredMax: 4,
|
|
27
|
+
halfWidth: 0.5,
|
|
28
|
+
higherIsBetter: false,
|
|
29
|
+
threshold: { value: 5, label: '≤ 5' },
|
|
30
|
+
diverging: false,
|
|
31
|
+
source: 'datawarrior',
|
|
32
|
+
},
|
|
33
|
+
logS: {
|
|
34
|
+
key: 'logS',
|
|
35
|
+
label: 'Solubility',
|
|
36
|
+
unit: 'log(mol/L)',
|
|
37
|
+
decimals: 2,
|
|
38
|
+
rangeMin: -8,
|
|
39
|
+
rangeMax: 2,
|
|
40
|
+
preferredMin: -4,
|
|
41
|
+
preferredMax: null,
|
|
42
|
+
halfWidth: 0.5,
|
|
43
|
+
higherIsBetter: true,
|
|
44
|
+
threshold: { value: -4, label: '> −4' },
|
|
45
|
+
diverging: false,
|
|
46
|
+
source: 'datawarrior',
|
|
47
|
+
},
|
|
48
|
+
molecularWeight: {
|
|
49
|
+
key: 'molecularWeight',
|
|
50
|
+
label: 'Molweight',
|
|
51
|
+
unit: 'g/mol',
|
|
52
|
+
decimals: 2,
|
|
53
|
+
rangeMin: 0,
|
|
54
|
+
rangeMax: 800,
|
|
55
|
+
preferredMin: null,
|
|
56
|
+
preferredMax: 400,
|
|
57
|
+
halfWidth: 50,
|
|
58
|
+
higherIsBetter: false,
|
|
59
|
+
threshold: { value: 450, label: '< 450' },
|
|
60
|
+
diverging: false,
|
|
61
|
+
source: 'datawarrior',
|
|
62
|
+
},
|
|
63
|
+
polarSurfaceArea: {
|
|
64
|
+
key: 'polarSurfaceArea',
|
|
65
|
+
label: 'TPSA',
|
|
66
|
+
unit: 'Ų',
|
|
67
|
+
decimals: 2,
|
|
68
|
+
rangeMin: 0,
|
|
69
|
+
rangeMax: 250,
|
|
70
|
+
preferredMin: null,
|
|
71
|
+
preferredMax: 120,
|
|
72
|
+
halfWidth: 20,
|
|
73
|
+
higherIsBetter: false,
|
|
74
|
+
threshold: null,
|
|
75
|
+
diverging: false,
|
|
76
|
+
source: 'datawarrior',
|
|
77
|
+
},
|
|
78
|
+
druglikeness: {
|
|
79
|
+
key: 'druglikeness',
|
|
80
|
+
label: 'Druglikeness',
|
|
81
|
+
unit: '',
|
|
82
|
+
decimals: 2,
|
|
83
|
+
rangeMin: -10,
|
|
84
|
+
rangeMax: 10,
|
|
85
|
+
preferredMin: 0,
|
|
86
|
+
preferredMax: null,
|
|
87
|
+
// `DrugScoreCalculator` scores drug-likeness as 1/(1+e^-d), which is this
|
|
88
|
+
// same valuation with a lower bound of 0 and a half-width of 1. So the
|
|
89
|
+
// ramp behind the bar is the library's own term, not a second opinion.
|
|
90
|
+
halfWidth: 1,
|
|
91
|
+
higherIsBetter: true,
|
|
92
|
+
threshold: { value: 0, label: '> 0' },
|
|
93
|
+
diverging: true,
|
|
94
|
+
source: 'legacy',
|
|
95
|
+
},
|
|
96
|
+
acceptorCount: {
|
|
97
|
+
key: 'acceptorCount',
|
|
98
|
+
label: 'H-bond acceptors',
|
|
99
|
+
unit: '',
|
|
100
|
+
decimals: 0,
|
|
101
|
+
rangeMin: 0,
|
|
102
|
+
rangeMax: 16,
|
|
103
|
+
preferredMin: null,
|
|
104
|
+
preferredMax: 10,
|
|
105
|
+
halfWidth: 1,
|
|
106
|
+
higherIsBetter: false,
|
|
107
|
+
threshold: null,
|
|
108
|
+
diverging: false,
|
|
109
|
+
source: 'datawarrior',
|
|
110
|
+
},
|
|
111
|
+
donorCount: {
|
|
112
|
+
key: 'donorCount',
|
|
113
|
+
label: 'H-bond donors',
|
|
114
|
+
unit: '',
|
|
115
|
+
decimals: 0,
|
|
116
|
+
rangeMin: 0,
|
|
117
|
+
rangeMax: 8,
|
|
118
|
+
preferredMin: null,
|
|
119
|
+
preferredMax: 5,
|
|
120
|
+
halfWidth: 0.5,
|
|
121
|
+
higherIsBetter: false,
|
|
122
|
+
threshold: null,
|
|
123
|
+
diverging: false,
|
|
124
|
+
source: 'datawarrior',
|
|
125
|
+
},
|
|
126
|
+
stereoCenterCount: {
|
|
127
|
+
key: 'stereoCenterCount',
|
|
128
|
+
label: 'Stereocentres',
|
|
129
|
+
unit: '',
|
|
130
|
+
decimals: 0,
|
|
131
|
+
rangeMin: 0,
|
|
132
|
+
rangeMax: 8,
|
|
133
|
+
preferredMin: 1,
|
|
134
|
+
preferredMax: 3,
|
|
135
|
+
halfWidth: 2,
|
|
136
|
+
higherIsBetter: null,
|
|
137
|
+
threshold: null,
|
|
138
|
+
diverging: false,
|
|
139
|
+
source: 'datawarrior',
|
|
140
|
+
},
|
|
141
|
+
rotatableBondCount: {
|
|
142
|
+
key: 'rotatableBondCount',
|
|
143
|
+
label: 'Rotatable bonds',
|
|
144
|
+
unit: '',
|
|
145
|
+
decimals: 0,
|
|
146
|
+
rangeMin: 0,
|
|
147
|
+
rangeMax: 20,
|
|
148
|
+
preferredMin: null,
|
|
149
|
+
preferredMax: 4,
|
|
150
|
+
halfWidth: 5,
|
|
151
|
+
higherIsBetter: false,
|
|
152
|
+
threshold: null,
|
|
153
|
+
diverging: false,
|
|
154
|
+
source: 'datawarrior',
|
|
155
|
+
},
|
|
156
|
+
drugScore: {
|
|
157
|
+
key: 'drugScore',
|
|
158
|
+
label: 'Drug score',
|
|
159
|
+
unit: '',
|
|
160
|
+
decimals: 2,
|
|
161
|
+
// The legacy bar, kept: it grows from the middle and runs -1 to 1, so a
|
|
162
|
+
// score always sits in its right half. The quantity itself is a product of
|
|
163
|
+
// terms in (0.5, 1) and four risk factors, so it cannot leave (0, 1).
|
|
164
|
+
rangeMin: -1,
|
|
165
|
+
rangeMax: 1,
|
|
166
|
+
preferredMin: null,
|
|
167
|
+
preferredMax: null,
|
|
168
|
+
// Already a 0-to-1 fitness: it is the product of the four valuations
|
|
169
|
+
// `DrugScoreCalculator` computes, so valuing it again would square it.
|
|
170
|
+
halfWidth: null,
|
|
171
|
+
higherIsBetter: true,
|
|
172
|
+
threshold: null,
|
|
173
|
+
diverging: true,
|
|
174
|
+
source: 'legacy',
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* How one property is drawn, ranged and judged.
|
|
179
|
+
* @param key - Which of the ten.
|
|
180
|
+
* @returns Its scale.
|
|
181
|
+
*/
|
|
182
|
+
export function propertyScale(key) {
|
|
183
|
+
return PROPERTY_SCALES[key];
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=scales.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scales.js","sourceRoot":"","sources":["../../../src/osiris/core/scales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoDH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,eAAe,GAAuC;IACjE,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,GAAG;QACd,cAAc,EAAE,KAAK;QACrB,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;QACrC,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,aAAa;KACtB;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC,CAAC;QACZ,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,CAAC,CAAC;QAChB,YAAY,EAAE,IAAI;QAClB,SAAS,EAAE,GAAG;QACd,cAAc,EAAE,IAAI;QACpB,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE;QACvC,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,aAAa;KACtB;IACD,eAAe,EAAE;QACf,GAAG,EAAE,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SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,CAAC;QACX,wEAAwE;QACxE,2EAA2E;QAC3E,sEAAsE;QACtE,QAAQ,EAAE,CAAC,CAAC;QACZ,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,IAAI;QAClB,qEAAqE;QACrE,uEAAuE;QACvE,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,IAAI;QACpB,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAgB;IAC5C,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the tool predicts about one molecule, and how a risk is explained.
|
|
3
|
+
*
|
|
4
|
+
* Every quantity OpenChemLib can fail to compute is `number | null` here, never
|
|
5
|
+
* the library's own sentinel: cLogP and solubility answer `-999`, the polar
|
|
6
|
+
* surface area `-1`, drug-likeness `-999` when the tables did not load and `-1`
|
|
7
|
+
* when no fragment matched, and a risk `0`. None of them is `NaN`, and
|
|
8
|
+
* `DrugScoreCalculator` consumes every one of them and returns a plausible
|
|
9
|
+
* number, so a sentinel that leaves this module is a wrong value on screen with
|
|
10
|
+
* nothing to say it is wrong.
|
|
11
|
+
*/
|
|
12
|
+
/** The four risks OSIRIS assesses, in the order the library numbers them. */
|
|
13
|
+
export declare const RISK_TYPES: readonly ["mutagenic", "tumorigenic", "irritant", "reproductive"];
|
|
14
|
+
/** One of the four risks. */
|
|
15
|
+
export type RiskType = (typeof RISK_TYPES)[number];
|
|
16
|
+
/**
|
|
17
|
+
* How risky one type came back.
|
|
18
|
+
*
|
|
19
|
+
* `unknown` is the library's `RISK_UNKNOWN`, which it returns when its fragment
|
|
20
|
+
* tables did not load — never "nothing was found", which is `none`.
|
|
21
|
+
*/
|
|
22
|
+
export type RiskLevel = 'unknown' | 'none' | 'low' | 'high';
|
|
23
|
+
/** Everything the tool shows for one molecule. */
|
|
24
|
+
export interface OsirisProperties {
|
|
25
|
+
/** The canonical idCode, read before anything touched the molecule. */
|
|
26
|
+
idCode: string;
|
|
27
|
+
/** The canonical SMILES, for a link and for a download. */
|
|
28
|
+
smiles: string;
|
|
29
|
+
/** A name from the source, or the SMILES when it carried none. */
|
|
30
|
+
label: string;
|
|
31
|
+
/** e.g. `C6H6`. */
|
|
32
|
+
molecularFormula: string;
|
|
33
|
+
/** The relative molecular weight in g/mol — 78.11 for benzene, never the monoisotopic mass. */
|
|
34
|
+
molecularWeight: number;
|
|
35
|
+
/** cLogP, the octanol/water partition coefficient. */
|
|
36
|
+
logP: number | null;
|
|
37
|
+
/** Aqueous solubility, log10 of mol/L at 25 °C and pH 7.5. */
|
|
38
|
+
logS: number | null;
|
|
39
|
+
/** Topological polar surface area, in Ų. */
|
|
40
|
+
polarSurfaceArea: number | null;
|
|
41
|
+
/** Drug-likeness: positive is drug-like, negative is not. */
|
|
42
|
+
druglikeness: number | null;
|
|
43
|
+
/** The drug score, 0 to 1. `null` whenever any of its inputs was unknown. */
|
|
44
|
+
drugScore: number | null;
|
|
45
|
+
/** Every nitrogen and oxygen — the OSIRIS definition, not Lipinski's. */
|
|
46
|
+
acceptorCount: number;
|
|
47
|
+
/** Every nitrogen and oxygen carrying at least one hydrogen. */
|
|
48
|
+
donorCount: number;
|
|
49
|
+
/** Atoms with a real, non-pseudo parity. */
|
|
50
|
+
stereoCenterCount: number;
|
|
51
|
+
/** Single, non-ring, non-terminal, non-amide bonds. */
|
|
52
|
+
rotatableBondCount: number;
|
|
53
|
+
/** How the four risks came back. */
|
|
54
|
+
risks: Record<RiskType, RiskLevel>;
|
|
55
|
+
}
|
|
56
|
+
/** Which branch of the predictor produced one line of a risk explanation. */
|
|
57
|
+
export type RiskFindingKind = 'known' | 'fragment' | 'none' | 'note';
|
|
58
|
+
/** One line of why a risk came back as it did. */
|
|
59
|
+
export interface RiskFinding {
|
|
60
|
+
/**
|
|
61
|
+
* `known` — the molecule's own idCode is in the RTECS-derived list, so there
|
|
62
|
+
* is nothing to highlight. `fragment` — an alerting substructure matched.
|
|
63
|
+
* `none` — nothing was found. `note` — anything else the predictor printed.
|
|
64
|
+
*/
|
|
65
|
+
kind: RiskFindingKind;
|
|
66
|
+
/** The sentence the predictor printed, verbatim. */
|
|
67
|
+
description: string;
|
|
68
|
+
/** How alerting the matched fragment is, or `null` when this is not a fragment. */
|
|
69
|
+
severity: 'high' | 'medium' | null;
|
|
70
|
+
/** The fragment's idCode, or `null` — a known molecule carries no fragment. */
|
|
71
|
+
idCode: string | null;
|
|
72
|
+
/** The molecule's atoms the fragment matched, so the page can highlight them. */
|
|
73
|
+
atoms: readonly number[];
|
|
74
|
+
/** The molecule's bonds the fragment matched. */
|
|
75
|
+
bonds: readonly number[];
|
|
76
|
+
}
|
|
77
|
+
/** Why one risk came back as it did. */
|
|
78
|
+
export interface RiskDetail {
|
|
79
|
+
/** Which of the four risks this explains. */
|
|
80
|
+
risk: RiskType;
|
|
81
|
+
/** What the predictor printed, one entry per sentence or matched fragment. */
|
|
82
|
+
findings: readonly RiskFinding[];
|
|
83
|
+
}
|
|
84
|
+
/** One entry of a `ParameterizedString[]`, as OpenChemLib hands it over. */
|
|
85
|
+
export interface DetailEntry {
|
|
86
|
+
/** 1 is an idCode, 2 is text, 3 is a number written out. */
|
|
87
|
+
type: number;
|
|
88
|
+
/** The entry itself. */
|
|
89
|
+
value: string;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6EAA6E;AAC7E,eAAO,MAAM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D,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACnC,+EAA+E;IAC/E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iFAAiF;IACjF,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,iDAAiD;IACjD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,IAAI,EAAE,QAAQ,CAAC;IACf,8EAA8E;IAC9E,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;CAClC;AAED,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the tool predicts about one molecule, and how a risk is explained.
|
|
3
|
+
*
|
|
4
|
+
* Every quantity OpenChemLib can fail to compute is `number | null` here, never
|
|
5
|
+
* the library's own sentinel: cLogP and solubility answer `-999`, the polar
|
|
6
|
+
* surface area `-1`, drug-likeness `-999` when the tables did not load and `-1`
|
|
7
|
+
* when no fragment matched, and a risk `0`. None of them is `NaN`, and
|
|
8
|
+
* `DrugScoreCalculator` consumes every one of them and returns a plausible
|
|
9
|
+
* number, so a sentinel that leaves this module is a wrong value on screen with
|
|
10
|
+
* nothing to say it is wrong.
|
|
11
|
+
*/
|
|
12
|
+
/** The four risks OSIRIS assesses, in the order the library numbers them. */
|
|
13
|
+
export const RISK_TYPES = [
|
|
14
|
+
'mutagenic',
|
|
15
|
+
'tumorigenic',
|
|
16
|
+
'irritant',
|
|
17
|
+
'reproductive',
|
|
18
|
+
];
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/osiris/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,WAAW;IACX,aAAa;IACb,UAAU;IACV,cAAc;CACN,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataWarrior's own fuzzy fitness, ported from
|
|
3
|
+
* `com.actelion.research.chem.prediction.MolecularPropertyHelper`.
|
|
4
|
+
*
|
|
5
|
+
* It is what turns a predicted number into the green-to-red ramp behind it,
|
|
6
|
+
* and it is the library's arithmetic rather than a cut-off invented here: a
|
|
7
|
+
* property inside its preferred band scores 1, and the score falls away
|
|
8
|
+
* smoothly outside it over `halfWidth`. There is no cliff anywhere, so a cLogP
|
|
9
|
+
* of 4.01 does not look categorically worse than one of 3.99.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* How well one value sits in a preferred band, from 0 to 1.
|
|
13
|
+
*
|
|
14
|
+
* A bound given as `null` is simply not applied, which is how a property
|
|
15
|
+
* bounded on one side only — a solubility that must be high enough, a weight
|
|
16
|
+
* that must be low enough — scores against the one bound it has. The original
|
|
17
|
+
* passes `Double.NaN` for an absent bound and `NaN` is accepted here too.
|
|
18
|
+
*
|
|
19
|
+
* The Java comment claims the fitness at `max + halfWidth` is `1/e`; the
|
|
20
|
+
* arithmetic gives `1/(1+e)`, and the arithmetic is what was ported.
|
|
21
|
+
* @param value - The predicted number.
|
|
22
|
+
* @param min - The bottom of the preferred band, or `null` when there is none.
|
|
23
|
+
* @param max - The top of the preferred band, or `null` when there is none.
|
|
24
|
+
* @param halfWidth - How far outside the band the score takes to fall away.
|
|
25
|
+
* @returns The fitness, or `NaN` when the value is `NaN`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getValuation(value: number, min: number | null, max: number | null, halfWidth: number): number;
|
|
28
|
+
//# sourceMappingURL=valuation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valuation.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/valuation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,SAAS,EAAE,MAAM,GAChB,MAAM,CAWR"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataWarrior's own fuzzy fitness, ported from
|
|
3
|
+
* `com.actelion.research.chem.prediction.MolecularPropertyHelper`.
|
|
4
|
+
*
|
|
5
|
+
* It is what turns a predicted number into the green-to-red ramp behind it,
|
|
6
|
+
* and it is the library's arithmetic rather than a cut-off invented here: a
|
|
7
|
+
* property inside its preferred band scores 1, and the score falls away
|
|
8
|
+
* smoothly outside it over `halfWidth`. There is no cliff anywhere, so a cLogP
|
|
9
|
+
* of 4.01 does not look categorically worse than one of 3.99.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* How well one value sits in a preferred band, from 0 to 1.
|
|
13
|
+
*
|
|
14
|
+
* A bound given as `null` is simply not applied, which is how a property
|
|
15
|
+
* bounded on one side only — a solubility that must be high enough, a weight
|
|
16
|
+
* that must be low enough — scores against the one bound it has. The original
|
|
17
|
+
* passes `Double.NaN` for an absent bound and `NaN` is accepted here too.
|
|
18
|
+
*
|
|
19
|
+
* The Java comment claims the fitness at `max + halfWidth` is `1/e`; the
|
|
20
|
+
* arithmetic gives `1/(1+e)`, and the arithmetic is what was ported.
|
|
21
|
+
* @param value - The predicted number.
|
|
22
|
+
* @param min - The bottom of the preferred band, or `null` when there is none.
|
|
23
|
+
* @param max - The top of the preferred band, or `null` when there is none.
|
|
24
|
+
* @param halfWidth - How far outside the band the score takes to fall away.
|
|
25
|
+
* @returns The fitness, or `NaN` when the value is `NaN`.
|
|
26
|
+
*/
|
|
27
|
+
export function getValuation(value, min, max, halfWidth) {
|
|
28
|
+
if (Number.isNaN(value))
|
|
29
|
+
return Number.NaN;
|
|
30
|
+
let v = 1;
|
|
31
|
+
if (min !== null && !Number.isNaN(min)) {
|
|
32
|
+
v *= 1 / (1 + Math.exp((min - value) / halfWidth));
|
|
33
|
+
}
|
|
34
|
+
if (max !== null && !Number.isNaN(max)) {
|
|
35
|
+
v *= 1 / (1 + Math.exp((value - max) / halfWidth));
|
|
36
|
+
}
|
|
37
|
+
return v;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=valuation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valuation.js","sourceRoot":"","sources":["../../../src/osiris/core/valuation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAa,EACb,GAAkB,EAClB,GAAkB,EAClB,SAAiB;IAEjB,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC;IAE3C,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One property's bar: a track, a fill whose colour is how good the value is,
|
|
3
|
+
* and the published rule of thumb marked on it.
|
|
4
|
+
*
|
|
5
|
+
* The colour is handed to the stylesheet as a number rather than mixed here.
|
|
6
|
+
* A ramp computed in JavaScript would be a hex code in a component, which is
|
|
7
|
+
* the one thing a site of this family may not write: the green, the amber and
|
|
8
|
+
* the red are the shared status tokens, and `properties.css` mixes them.
|
|
9
|
+
*
|
|
10
|
+
* The bar carries no accessible text of its own. It draws the same number the
|
|
11
|
+
* row already prints beside it, so announcing it twice would only make the
|
|
12
|
+
* panel longer to listen to.
|
|
13
|
+
*/
|
|
14
|
+
import type { ReactElement } from 'react';
|
|
15
|
+
import type { BarGeometry } from '../core/barGeometry.ts';
|
|
16
|
+
/** What {@link PropertyBar} needs. */
|
|
17
|
+
export interface PropertyBarProps {
|
|
18
|
+
/** Where the fill and the mark go, from `barGeometry`. */
|
|
19
|
+
geometry: BarGeometry;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Draw one property's bar.
|
|
23
|
+
* @param props - See {@link PropertyBarProps}.
|
|
24
|
+
* @returns The track, its fill and its labelled mark.
|
|
25
|
+
*/
|
|
26
|
+
export declare function PropertyBar(props: PropertyBarProps): ReactElement;
|
|
27
|
+
//# sourceMappingURL=PropertyBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyBar.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/PropertyBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAsCjE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Draw one property's bar.
|
|
4
|
+
* @param props - See {@link PropertyBarProps}.
|
|
5
|
+
* @returns The track, its fill and its labelled mark.
|
|
6
|
+
*/
|
|
7
|
+
export function PropertyBar(props) {
|
|
8
|
+
const { geometry } = props;
|
|
9
|
+
// `--fitness` is a custom property, which React sets verbatim and
|
|
10
|
+
// `CSSProperties` has no name for; the stylesheet reads it in the `calc()`
|
|
11
|
+
// that mixes the ramp.
|
|
12
|
+
const fill = {
|
|
13
|
+
left: percent(geometry.start),
|
|
14
|
+
width: percent(geometry.length),
|
|
15
|
+
'--fitness': geometry.fitness.toFixed(4),
|
|
16
|
+
};
|
|
17
|
+
return (_jsxs("div", { className: "property-bar", "aria-hidden": "true", children: [_jsxs("div", { className: "property-bar__track", children: [geometry.origin === 0 ? null : (_jsx("div", { className: "property-bar__origin", style: { left: percent(geometry.origin) } })), _jsx("div", { className: "property-bar__fill", style: fill }), geometry.mark === null ? null : (_jsx("div", { className: "property-bar__mark", style: { left: percent(geometry.mark) } }))] }), geometry.mark === null || geometry.markLabel === null ? null : (_jsx("span", { className: "property-bar__threshold", style: { left: percent(geometry.mark) }, children: geometry.markLabel }))] }));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A fraction of the track, as a CSS length.
|
|
21
|
+
* @param fraction - 0 at the left end, 1 at the right.
|
|
22
|
+
* @returns The percentage, to two decimals.
|
|
23
|
+
*/
|
|
24
|
+
function percent(fraction) {
|
|
25
|
+
return `${(fraction * 100).toFixed(2)}%`;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=PropertyBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyBar.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