react-cheminfo 0.76.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/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 +4 -1
- package/lib/download/core/index.d.ts.map +1 -1
- package/lib/download/core/index.js +3 -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/locales/de.json +30 -1
- package/lib/locales/en.json +30 -1
- package/lib/locales/es.json +30 -1
- package/lib/locales/fr.json +30 -1
- package/lib/locales/it.json +30 -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/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/index.d.ts +1 -0
- package/lib/structure/ui/index.d.ts.map +1 -1
- 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/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 +13 -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/locales/de.json +30 -1
- package/src/locales/en.json +30 -1
- package/src/locales/es.json +30 -1
- package/src/locales/fr.json +30 -1
- package/src/locales/it.json +30 -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/StructureExportPanel.tsx +23 -4
- package/src/structure/ui/index.ts +4 -0
- package/styles/osiris.css +339 -0
|
@@ -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,iBAAiB;QACtB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,GAAG;QACb,YAAY,EAAE,IAAI;QAClB,YAA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,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,UAAU,mEAKb,CAAC;AAEX,6BAA6B;AAC7B,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG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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.js","sourceRoot":"","sources":["../../../src/osiris/ui/PropertyBar.tsx"],"names":[],"mappings":";AAwBA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC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,CAAC,GAAG,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything OSIRIS predicts about one molecule: the four toxicity risks, then
|
|
3
|
+
* the ten numbers, in the order the original panel showed them.
|
|
4
|
+
*
|
|
5
|
+
* One panel wherever a molecule is predicted — beside an editor's canvas, for
|
|
6
|
+
* the row of a table the reader focused, beside a drawing — because a second
|
|
7
|
+
* panel would be a second place for the same ten rows to drift apart.
|
|
8
|
+
*
|
|
9
|
+
* The sections stand whether or not there is anything in them. A prediction
|
|
10
|
+
* costs a fifth of a second, and a panel that appeared only once it was ready
|
|
11
|
+
* would move the page under the reader's eye every time they drew a bond.
|
|
12
|
+
*
|
|
13
|
+
* Which explanation is open is the caller's state — it belongs to the page, and
|
|
14
|
+
* on the explorer it is what a click on a square changes — but *fetching* it is
|
|
15
|
+
* the panel's own business, so no page repeats the dance.
|
|
16
|
+
*/
|
|
17
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
18
|
+
import type { PropertyKey } from '../core/propertyKeys.ts';
|
|
19
|
+
import type { OsirisProperties, RiskDetail, RiskType } from '../core/types.ts';
|
|
20
|
+
/** What {@link PropertyPanel} needs. */
|
|
21
|
+
export interface PropertyPanelProps {
|
|
22
|
+
/**
|
|
23
|
+
* What was predicted, or `null` when there is nothing to show yet.
|
|
24
|
+
* @default null
|
|
25
|
+
*/
|
|
26
|
+
properties?: OsirisProperties | null;
|
|
27
|
+
/**
|
|
28
|
+
* The atom layout to draw the molecule with, in an explanation. Empty leaves
|
|
29
|
+
* openchemlib to invent one.
|
|
30
|
+
* @default ''
|
|
31
|
+
*/
|
|
32
|
+
coordinates?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Whether a prediction is running for the molecule the panel is showing.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
pending?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* What went wrong with this structure, in one sentence, or `null`.
|
|
40
|
+
* @default null
|
|
41
|
+
*/
|
|
42
|
+
problem?: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to open on the molecule's formula and name. Off for a host that
|
|
45
|
+
* already shows the formula beside the panel, such as a structure editor's
|
|
46
|
+
* side panel.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
head?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to draw the four risks, and the explanation a square opens. Off
|
|
52
|
+
* for a page answering a question about the numbers alone.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
risks?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The property rows to draw, in the panel's order whatever order they are
|
|
58
|
+
* given in. Empty leaves the section out, for a page answering a question
|
|
59
|
+
* about the risks alone.
|
|
60
|
+
* @default PROPERTY_KEYS
|
|
61
|
+
*/
|
|
62
|
+
rows?: readonly PropertyKey[];
|
|
63
|
+
/**
|
|
64
|
+
* What is said when there is nothing predicted and nothing running.
|
|
65
|
+
* @default 'Nothing to predict yet.'
|
|
66
|
+
*/
|
|
67
|
+
emptyMessage?: ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Which risk has its explanation open.
|
|
70
|
+
* @default null
|
|
71
|
+
*/
|
|
72
|
+
openRisk?: RiskType | null;
|
|
73
|
+
/**
|
|
74
|
+
* Called with the risk to open, or `null` to close it. Without it the squares
|
|
75
|
+
* are not clickable.
|
|
76
|
+
* @default undefined
|
|
77
|
+
*/
|
|
78
|
+
onOpenRisk?: (risk: RiskType | null) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Why a risk came back as it did. Without it no explanation is offered.
|
|
81
|
+
* @default undefined
|
|
82
|
+
*/
|
|
83
|
+
loadDetail?: (structure: string, risk: RiskType) => Promise<RiskDetail>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The risks and the properties of one molecule.
|
|
87
|
+
* @param props - See {@link PropertyPanelProps}.
|
|
88
|
+
* @returns The two panels, and the open explanation between them.
|
|
89
|
+
*/
|
|
90
|
+
export declare function PropertyPanel(props: PropertyPanelProps): ReactElement;
|
|
91
|
+
//# sourceMappingURL=PropertyPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyPanel.d.ts","sourceRoot":"","sources":["../../../src/osiris/ui/PropertyPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAM/E,wCAAwC;AACxC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACzE;AASD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CA2ErE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Everything OSIRIS predicts about one molecule: the four toxicity risks, then
|
|
4
|
+
* the ten numbers, in the order the original panel showed them.
|
|
5
|
+
*
|
|
6
|
+
* One panel wherever a molecule is predicted — beside an editor's canvas, for
|
|
7
|
+
* the row of a table the reader focused, beside a drawing — because a second
|
|
8
|
+
* panel would be a second place for the same ten rows to drift apart.
|
|
9
|
+
*
|
|
10
|
+
* The sections stand whether or not there is anything in them. A prediction
|
|
11
|
+
* costs a fifth of a second, and a panel that appeared only once it was ready
|
|
12
|
+
* would move the page under the reader's eye every time they drew a bond.
|
|
13
|
+
*
|
|
14
|
+
* Which explanation is open is the caller's state — it belongs to the page, and
|
|
15
|
+
* on the explorer it is what a click on a square changes — but *fetching* it is
|
|
16
|
+
* the panel's own business, so no page repeats the dance.
|
|
17
|
+
*/
|
|
18
|
+
import { Callout, H5 } from '@blueprintjs/core';
|
|
19
|
+
import { useEffect, useState } from 'react';
|
|
20
|
+
import { MF } from 'react-mf';
|
|
21
|
+
import { errorMessage } from "../../error/core/toError.js";
|
|
22
|
+
import { PagePart } from "../../share/ui/PagePart.js";
|
|
23
|
+
import { PROPERTY_KEYS } from "../core/propertyKeys.js";
|
|
24
|
+
import { PropertyRows } from "./PropertyRows.js";
|
|
25
|
+
import { RiskFindings } from "./RiskFindings.js";
|
|
26
|
+
import { RiskPanel } from "./RiskPanel.js";
|
|
27
|
+
/**
|
|
28
|
+
* The risks and the properties of one molecule.
|
|
29
|
+
* @param props - See {@link PropertyPanelProps}.
|
|
30
|
+
* @returns The two panels, and the open explanation between them.
|
|
31
|
+
*/
|
|
32
|
+
export function PropertyPanel(props) {
|
|
33
|
+
const { properties = null, coordinates = '', pending = false, problem = null, head = true, risks = true, rows = PROPERTY_KEYS, emptyMessage = 'Nothing to predict yet.', openRisk = null, onOpenRisk, loadDetail, } = props;
|
|
34
|
+
const structure = properties === null
|
|
35
|
+
? ''
|
|
36
|
+
: coordinates === ''
|
|
37
|
+
? properties.idCode
|
|
38
|
+
: `${properties.idCode} ${coordinates}`;
|
|
39
|
+
const answer = useRiskDetail(structure, openRisk, loadDetail);
|
|
40
|
+
return (_jsxs("div", { className: "property-panel", children: [problem === null ? null : (_jsx(Callout, { intent: "warning", compact: true, children: problem })), properties === null ? (_jsx("p", { className: "osiris-note", children: pending ? 'Predicting…' : emptyMessage })) : head ? (_jsxs("header", { className: "property-panel__head", children: [_jsx(MF, { mf: properties.molecularFormula }), _jsx("span", { className: "property-panel__label", children: properties.label })] })) : null, risks ? (_jsx(PagePart, { part: "risks", children: _jsx(RiskPanel, { risks: properties?.risks ?? null, pending: pending, openRisk: openRisk, onOpenRisk: onOpenRisk }) })) : null, !risks ||
|
|
41
|
+
openRisk === null ||
|
|
42
|
+
structure === '' ||
|
|
43
|
+
loadDetail === undefined ? null : (_jsx(PagePart, { part: "detail", children: _jsx(RiskFindings, { risk: openRisk, structure: structure, detail: answer?.detail ?? null, error: answer?.error ?? null }) })), rows.length === 0 ? null : (_jsx(PagePart, { part: "properties", children: _jsxs("section", { className: "property-section", children: [_jsx(H5, { children: "Predicted properties" }), _jsx(PropertyRows, { properties: properties, keys: rows })] }) }))] }));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Fetch the open risk's explanation, and answer only about the request that is
|
|
47
|
+
* open now.
|
|
48
|
+
*
|
|
49
|
+
* The answer carries the request it belongs to rather than being cleared when a
|
|
50
|
+
* new one starts: clearing would mean writing state from inside the effect, and
|
|
51
|
+
* comparing keys says the same thing without the extra render.
|
|
52
|
+
* @param structure - The molecule: an idCode, with its coordinates after a space.
|
|
53
|
+
* @param openRisk - Which risk is open, or `null`.
|
|
54
|
+
* @param loadDetail - What answers the question, or `undefined` when nothing does.
|
|
55
|
+
* @returns The answer to the open request, or `null` while it is being worked out.
|
|
56
|
+
*/
|
|
57
|
+
function useRiskDetail(structure, openRisk, loadDetail) {
|
|
58
|
+
const key = openRisk === null || structure === '' ? '' : `${structure} ${openRisk}`;
|
|
59
|
+
const [answer, setAnswer] = useState(null);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (key === '' || openRisk === null || loadDetail === undefined)
|
|
62
|
+
return;
|
|
63
|
+
let live = true;
|
|
64
|
+
loadDetail(structure, openRisk).then((detail) => {
|
|
65
|
+
if (live)
|
|
66
|
+
setAnswer({ key, detail, error: null });
|
|
67
|
+
}, (error) => {
|
|
68
|
+
if (live)
|
|
69
|
+
setAnswer({ key, detail: null, error: errorMessage(error) });
|
|
70
|
+
});
|
|
71
|
+
return () => {
|
|
72
|
+
live = false;
|
|
73
|
+
};
|
|
74
|
+
}, [key, structure, openRisk, loadDetail]);
|
|
75
|
+
return answer !== null && answer.key === key ? answer : null;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=PropertyPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyPanel.js","sourceRoot":"","sources":["../../../src/osiris/ui/PropertyPanel.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA6B,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAA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