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,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How one risk reads on screen: the word for it, and the tone its square takes.
|
|
3
|
+
*
|
|
4
|
+
* Three levels, and they are exactly the three `DrugScoreCalculator` multiplies
|
|
5
|
+
* by — no risk ×1, medium ×0.8, high ×0.6 — so the colours say what the score
|
|
6
|
+
* already counted. A fourth tone exists for the state the library calls
|
|
7
|
+
* `RISK_UNKNOWN`, which means its tables did not load: it is grey, never green,
|
|
8
|
+
* because "nothing was assessed" and "nothing was found" are different answers
|
|
9
|
+
* and showing them alike is the one mistake that makes the panel dishonest.
|
|
10
|
+
*
|
|
11
|
+
* A fifth, `pending`, is ours: the prediction costs a fifth of a second and the
|
|
12
|
+
* square is on screen before it comes back.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { RISK_LEVEL_LABELS } from './constants.ts';
|
|
16
|
+
import type { RiskLevel } from './types.ts';
|
|
17
|
+
|
|
18
|
+
/** What a square is painted with, before the stylesheet turns it into a colour. */
|
|
19
|
+
export type RiskTone = 'pending' | 'unknown' | 'none' | 'low' | 'high';
|
|
20
|
+
|
|
21
|
+
/** How one risk is shown. */
|
|
22
|
+
export interface RiskAppearance {
|
|
23
|
+
/** The stylesheet's `data-level`, which picks the square's colour. */
|
|
24
|
+
tone: RiskTone;
|
|
25
|
+
/** What the square says next to the risk's name, e.g. `High risk`. */
|
|
26
|
+
label: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the level is worth opening: an explanation exists for an assessed
|
|
29
|
+
* risk and for nothing else.
|
|
30
|
+
*/
|
|
31
|
+
explainable: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** What a square says while its molecule is still being predicted. */
|
|
35
|
+
export const PENDING_RISK_LABEL = 'Predicting…';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* What a square says when there is no molecule to predict.
|
|
39
|
+
*
|
|
40
|
+
* The comparison page draws the panel before a row is picked, and a square that
|
|
41
|
+
* said `Predicting…` there would claim work nobody asked for — under a heading
|
|
42
|
+
* inviting the reader to pick a row, which is a plain contradiction.
|
|
43
|
+
*/
|
|
44
|
+
export const IDLE_RISK_LABEL = 'Not predicted yet';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* What the predictor's own page says about its alerts, word for word.
|
|
48
|
+
*
|
|
49
|
+
* Quoted rather than paraphrased: it is the sentence that stops a red square
|
|
50
|
+
* being read as a verdict, and rewriting it would put our words over his.
|
|
51
|
+
*/
|
|
52
|
+
export const RISK_CAVEAT =
|
|
53
|
+
'Toxicity risk alerts are by no means meant to be a fully reliable toxicity prediction. Nor should be concluded from the absence of risk alerts that a particular substance is completely free of any toxic effect.';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* What is said in place of a highlight when the compound's own idCode is on one
|
|
57
|
+
* of the RTECS-derived lists. There is no fragment to point at, and painting the
|
|
58
|
+
* whole molecule would call the compound its own toxicophore.
|
|
59
|
+
*/
|
|
60
|
+
export const KNOWN_MOLECULE_NOTE =
|
|
61
|
+
'This exact compound is on the list, so there is no fragment to point at.';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The tone and the word for one risk.
|
|
65
|
+
* @param level - How the risk came back, or `undefined` when there is none yet.
|
|
66
|
+
* @param pending - Whether a prediction is actually running for this molecule.
|
|
67
|
+
* @default false
|
|
68
|
+
* @returns See {@link RiskAppearance}.
|
|
69
|
+
*/
|
|
70
|
+
export function riskAppearance(
|
|
71
|
+
level: RiskLevel | undefined,
|
|
72
|
+
pending = false,
|
|
73
|
+
): RiskAppearance {
|
|
74
|
+
if (level === undefined) {
|
|
75
|
+
return {
|
|
76
|
+
tone: 'pending',
|
|
77
|
+
label: pending ? PENDING_RISK_LABEL : IDLE_RISK_LABEL,
|
|
78
|
+
explainable: false,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
tone: level,
|
|
83
|
+
label: RISK_LEVEL_LABELS[level],
|
|
84
|
+
explainable: level !== 'unknown',
|
|
85
|
+
};
|
|
86
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why one risk came back as it did, with the offending substructure located on
|
|
3
|
+
* the molecule.
|
|
4
|
+
*
|
|
5
|
+
* The match runs in the predictor's own mode —
|
|
6
|
+
* `new SSSearcher({ matchAtomCharge: true, matchAromDBondToDelocalized: false })`,
|
|
7
|
+
* which is OpenChemLib's mode 1. The JavaScript default is mode 8, and it can
|
|
8
|
+
* disagree with what `assessRisk` actually found, which would leave a risk
|
|
9
|
+
* reported with nothing highlighted and no way to tell why.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type * as OCL from 'openchemlib';
|
|
13
|
+
|
|
14
|
+
import { RISK_TYPE_CODES } from './constants.ts';
|
|
15
|
+
import type { OsirisPredictors } from './predictors.ts';
|
|
16
|
+
import { parseRiskFindings } from './riskFindings.ts';
|
|
17
|
+
import type {
|
|
18
|
+
DetailEntry,
|
|
19
|
+
RiskDetail,
|
|
20
|
+
RiskFinding,
|
|
21
|
+
RiskType,
|
|
22
|
+
} from './types.ts';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* What the predictor found, and where on the molecule it found it.
|
|
26
|
+
* @param molecule - The molecule the risk was assessed on. It is copied before being searched.
|
|
27
|
+
* @param risk - Which of the four risks to explain.
|
|
28
|
+
* @param predictors - OpenChemLib with its resources registered and checked.
|
|
29
|
+
* @returns One finding per sentence the predictor printed, and one per matched fragment.
|
|
30
|
+
*/
|
|
31
|
+
export function riskDetail(
|
|
32
|
+
molecule: OCL.Molecule,
|
|
33
|
+
risk: RiskType,
|
|
34
|
+
predictors: OsirisPredictors,
|
|
35
|
+
): RiskDetail {
|
|
36
|
+
const working = molecule.getCompactCopy();
|
|
37
|
+
const entries = predictors.toxicity.getDetail(
|
|
38
|
+
working,
|
|
39
|
+
RISK_TYPE_CODES[risk],
|
|
40
|
+
) as readonly DetailEntry[];
|
|
41
|
+
|
|
42
|
+
const findings: RiskFinding[] = [];
|
|
43
|
+
for (const finding of parseRiskFindings(entries)) {
|
|
44
|
+
findings.push(
|
|
45
|
+
finding.idCode === null
|
|
46
|
+
? finding
|
|
47
|
+
: { ...finding, ...locate(working, finding.idCode, predictors) },
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return { risk, findings };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface Match {
|
|
54
|
+
atoms: number[];
|
|
55
|
+
bonds: number[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function locate(
|
|
59
|
+
molecule: OCL.Molecule,
|
|
60
|
+
fragmentIdCode: string,
|
|
61
|
+
predictors: OsirisPredictors,
|
|
62
|
+
): Match {
|
|
63
|
+
let fragment: OCL.Molecule;
|
|
64
|
+
try {
|
|
65
|
+
fragment = predictors.Molecule.fromIDCode(fragmentIdCode);
|
|
66
|
+
} catch {
|
|
67
|
+
return { atoms: [], bonds: [] };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const searcher = new predictors.SSSearcher({
|
|
71
|
+
matchAtomCharge: true,
|
|
72
|
+
matchAromDBondToDelocalized: false,
|
|
73
|
+
});
|
|
74
|
+
searcher.setMol(fragment, molecule);
|
|
75
|
+
if (!searcher.isFragmentInMolecule()) return { atoms: [], bonds: [] };
|
|
76
|
+
searcher.findFragmentInMolecule({ countMode: 'overlapping' });
|
|
77
|
+
|
|
78
|
+
const atoms = new Set<number>();
|
|
79
|
+
const bonds = new Set<number>();
|
|
80
|
+
for (const match of searcher.getMatchList()) {
|
|
81
|
+
collect(molecule, fragment, match, atoms, bonds);
|
|
82
|
+
}
|
|
83
|
+
return { atoms: sorted(atoms), bonds: sorted(bonds) };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Add one match's atoms and bonds to the running sets.
|
|
88
|
+
*
|
|
89
|
+
* A fragment atom the query marked as an exclude group maps to -1, and a bond
|
|
90
|
+
* between two matched atoms may not exist in the molecule when the fragment
|
|
91
|
+
* matched through a bridge, so both are checked rather than assumed.
|
|
92
|
+
* @param molecule - The molecule searched.
|
|
93
|
+
* @param fragment - The fragment that matched.
|
|
94
|
+
* @param map - The molecule's atom for each of the fragment's, -1 for none.
|
|
95
|
+
* @param atoms - The matched atoms so far, added to.
|
|
96
|
+
* @param bonds - The matched bonds so far, added to.
|
|
97
|
+
*/
|
|
98
|
+
function collect(
|
|
99
|
+
molecule: OCL.Molecule,
|
|
100
|
+
fragment: OCL.Molecule,
|
|
101
|
+
map: readonly number[],
|
|
102
|
+
atoms: Set<number>,
|
|
103
|
+
bonds: Set<number>,
|
|
104
|
+
): void {
|
|
105
|
+
for (const atom of map) {
|
|
106
|
+
if (atom >= 0) atoms.add(atom);
|
|
107
|
+
}
|
|
108
|
+
for (let bond = 0; bond < fragment.getAllBonds(); bond++) {
|
|
109
|
+
const first = map[fragment.getBondAtom(0, bond)];
|
|
110
|
+
const second = map[fragment.getBondAtom(1, bond)];
|
|
111
|
+
if (first === undefined || second === undefined) continue;
|
|
112
|
+
if (first < 0 || second < 0) continue;
|
|
113
|
+
const found = molecule.getBond(first, second);
|
|
114
|
+
if (found !== -1) bonds.add(found);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function sorted(values: Set<number>): number[] {
|
|
119
|
+
return Array.from(values).toSorted((a, b) => a - b);
|
|
120
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asking a worker why one risk came back as it did, and asking again when the
|
|
3
|
+
* set's cancel took the question with it.
|
|
4
|
+
*
|
|
5
|
+
* An explanation travels on a properties channel, and `cancel` drops every
|
|
6
|
+
* request on every channel — the reader's click included, which then reads as
|
|
7
|
+
* the channel's own words in place of the findings. It is not part of the set
|
|
8
|
+
* being abandoned, so it is simply asked for again.
|
|
9
|
+
*
|
|
10
|
+
* A channel of its own would be the other way, and is worse here: a channel
|
|
11
|
+
* makes its worker on the first request, so the first click would wait for
|
|
12
|
+
* OpenChemLib and the 398 kB of resource tables to load in a cold worker,
|
|
13
|
+
* where the shared one is already warm. The retry costs one more message on a
|
|
14
|
+
* worker that is running anyway.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { CancelledRequestError } from '../../worker/core/errors.ts';
|
|
18
|
+
import type { WorkerChannel } from '../../worker/core/workerChannelTypes.ts';
|
|
19
|
+
|
|
20
|
+
import type {
|
|
21
|
+
PredictRequest,
|
|
22
|
+
PredictResponse,
|
|
23
|
+
RiskDetailRequest,
|
|
24
|
+
} from './predictProtocol.ts';
|
|
25
|
+
|
|
26
|
+
type Channel = WorkerChannel<PredictRequest, PredictResponse>;
|
|
27
|
+
|
|
28
|
+
/** What the reader is told when the second ask was dropped as well. */
|
|
29
|
+
export const RISK_DETAIL_DROPPED =
|
|
30
|
+
'That explanation was dropped when the run stopped. Close the risk square and open it again.';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Ask a worker to explain one risk, once more if a cancel dropped the ask.
|
|
34
|
+
* @param channelOf - Picks the channel to ask on, called again for the retry so it lands on whichever worker is least busy by then.
|
|
35
|
+
* @param request - The explanation to ask for.
|
|
36
|
+
* @param mayRetry - Whether asking again can still be answered: false once the pool is terminated, or once its resources are known not to have loaded.
|
|
37
|
+
* @returns Whatever the worker answered, including its `unavailable`.
|
|
38
|
+
* @throws {Error} When the ask was dropped and cannot be made again.
|
|
39
|
+
*/
|
|
40
|
+
export async function requestRiskDetail(
|
|
41
|
+
channelOf: () => Channel,
|
|
42
|
+
request: RiskDetailRequest,
|
|
43
|
+
mayRetry: () => boolean,
|
|
44
|
+
): Promise<PredictResponse> {
|
|
45
|
+
try {
|
|
46
|
+
return await channelOf().request(request);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if (!(error instanceof CancelledRequestError)) throw error;
|
|
49
|
+
if (!mayRetry()) throw new Error(RISK_DETAIL_DROPPED, { cause: error });
|
|
50
|
+
}
|
|
51
|
+
return askAgain(channelOf, request);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function askAgain(
|
|
55
|
+
channelOf: () => Channel,
|
|
56
|
+
request: RiskDetailRequest,
|
|
57
|
+
): Promise<PredictResponse> {
|
|
58
|
+
try {
|
|
59
|
+
return await channelOf().request(request);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (!(error instanceof CancelledRequestError)) throw error;
|
|
62
|
+
throw new Error(RISK_DETAIL_DROPPED, { cause: error });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading what the toxicity predictor printed.
|
|
3
|
+
*
|
|
4
|
+
* `getDetail` answers a flat list of typed strings — 1 is an idCode, 2 is text,
|
|
5
|
+
* 3 is a number — in which a text line heads the idCodes that follow it. Which
|
|
6
|
+
* text line it is matters more than anything else the tool shows: "This
|
|
7
|
+
* molecule is known to be mutagenic" means the compound's own idCode is in a
|
|
8
|
+
* list derived from RTECS, and the idCode that follows is **the molecule
|
|
9
|
+
* itself**; "High-risk fragments indicating Mutagenicity" means a substructure
|
|
10
|
+
* matched, and the idCodes that follow are the substructures.
|
|
11
|
+
*
|
|
12
|
+
* Telling them apart is what keeps the red square honest: aspirin, caffeine and
|
|
13
|
+
* paracetamol all come back high through the first branch, and highlighting the
|
|
14
|
+
* whole molecule there would call the compound its own toxicophore.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { DetailEntry, RiskFinding } from './types.ts';
|
|
18
|
+
|
|
19
|
+
/** An idCode, to be drawn as a structure. */
|
|
20
|
+
const ID_CODE = 1;
|
|
21
|
+
/** Plain text. */
|
|
22
|
+
const TEXT = 2;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Turn what the predictor printed into the lines a page shows.
|
|
26
|
+
*
|
|
27
|
+
* The matched atoms are left empty here: finding them needs the molecule and
|
|
28
|
+
* the predictor's own match mode, which `riskDetail` supplies.
|
|
29
|
+
* @param entries - What `ToxicityPredictor.getDetail` returned.
|
|
30
|
+
* @returns One finding per sentence, and one per matched fragment.
|
|
31
|
+
*/
|
|
32
|
+
export function parseRiskFindings(
|
|
33
|
+
entries: readonly DetailEntry[],
|
|
34
|
+
): RiskFinding[] {
|
|
35
|
+
const findings: RiskFinding[] = [];
|
|
36
|
+
let heading: Heading = { kind: 'note', description: '', severity: null };
|
|
37
|
+
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
if (entry.type === TEXT) {
|
|
40
|
+
heading = readHeading(entry.value);
|
|
41
|
+
// A fragment heading says nothing on its own; it is repeated on each of
|
|
42
|
+
// the fragments that follow it, so the page can draw one row per match.
|
|
43
|
+
if (heading.kind !== 'fragment') findings.push(line(heading));
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (entry.type !== ID_CODE) continue;
|
|
47
|
+
// The idCode under a known-molecule heading is the molecule itself.
|
|
48
|
+
if (heading.kind !== 'fragment') continue;
|
|
49
|
+
findings.push({ ...line(heading), idCode: entry.value });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return findings;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface Heading {
|
|
56
|
+
kind: RiskFinding['kind'];
|
|
57
|
+
description: string;
|
|
58
|
+
severity: RiskFinding['severity'];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function line(heading: Heading): RiskFinding {
|
|
62
|
+
return {
|
|
63
|
+
kind: heading.kind,
|
|
64
|
+
description: heading.description,
|
|
65
|
+
severity: heading.severity,
|
|
66
|
+
idCode: null,
|
|
67
|
+
atoms: [],
|
|
68
|
+
bonds: [],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** `This molecule is known to be mutagenic:` and its three siblings. */
|
|
73
|
+
const KNOWN = /^This molecule is known to be /i;
|
|
74
|
+
const HIGH_RISK = /^High-risk fragments/i;
|
|
75
|
+
const MEDIUM_RISK = /^Medium-risk fragments/i;
|
|
76
|
+
const NOTHING_FOUND = /^No indication for /i;
|
|
77
|
+
|
|
78
|
+
function readHeading(value: string): Heading {
|
|
79
|
+
if (KNOWN.test(value)) {
|
|
80
|
+
return { kind: 'known', description: value, severity: null };
|
|
81
|
+
}
|
|
82
|
+
if (HIGH_RISK.test(value)) {
|
|
83
|
+
return { kind: 'fragment', description: value, severity: 'high' };
|
|
84
|
+
}
|
|
85
|
+
if (MEDIUM_RISK.test(value)) {
|
|
86
|
+
return { kind: 'fragment', description: value, severity: 'medium' };
|
|
87
|
+
}
|
|
88
|
+
if (NOTHING_FOUND.test(value)) {
|
|
89
|
+
return { kind: 'none', description: value, severity: null };
|
|
90
|
+
}
|
|
91
|
+
return { kind: 'note', description: value, severity: null };
|
|
92
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
|
|
9
|
+
import { errorMessage } from '../../error/core/toError.ts';
|
|
10
|
+
|
|
11
|
+
import { predictIdCode, riskDetailOfIdCode } from './predictIdCode.ts';
|
|
12
|
+
import type { PredictRequest, PredictResponse } from './predictProtocol.ts';
|
|
13
|
+
import { loadPredictors } from './predictors.ts';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Answer one job.
|
|
17
|
+
*
|
|
18
|
+
* A structure that cannot be read, or that holds no atoms, throws: that is one
|
|
19
|
+
* bad row, and the run carries on without it. Resources that did not load
|
|
20
|
+
* return `unavailable` instead, because that is every row and the run must stop.
|
|
21
|
+
* @param request - The job.
|
|
22
|
+
* @returns The answer.
|
|
23
|
+
* @throws {Error} When the molecule itself could not be read or predicted.
|
|
24
|
+
*/
|
|
25
|
+
export async function runPredictionJob(
|
|
26
|
+
request: PredictRequest,
|
|
27
|
+
): Promise<PredictResponse> {
|
|
28
|
+
let predictors;
|
|
29
|
+
try {
|
|
30
|
+
predictors = await loadPredictors(request.resources);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
return { kind: 'unavailable', message: errorMessage(error) };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (request.kind === 'riskDetail') {
|
|
36
|
+
return {
|
|
37
|
+
kind: 'riskDetail',
|
|
38
|
+
detail: riskDetailOfIdCode(request.idCode, request.risk, predictors),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
kind: 'properties',
|
|
44
|
+
key: request.key,
|
|
45
|
+
properties: predictIdCode(request.idCode, predictors, {
|
|
46
|
+
...(request.label === undefined ? {} : { label: request.label }),
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
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
|
+
|
|
17
|
+
import type { PropertyKey } from './propertyKeys.ts';
|
|
18
|
+
|
|
19
|
+
/** A published rule of thumb, drawn on the bar as a labelled mark. */
|
|
20
|
+
export interface PropertyThreshold {
|
|
21
|
+
/** Where on the bar the mark goes. */
|
|
22
|
+
value: number;
|
|
23
|
+
/** How it reads, e.g. `≤ 5`. */
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Where a shared scale's numbers come from. */
|
|
28
|
+
export type ScaleSource = 'datawarrior' | 'legacy';
|
|
29
|
+
|
|
30
|
+
/** How one property is drawn, ranged and judged. */
|
|
31
|
+
export interface PropertyScale {
|
|
32
|
+
/** The field of `OsirisProperties` this describes. */
|
|
33
|
+
key: PropertyKey;
|
|
34
|
+
/** What the panel and the table column call it. */
|
|
35
|
+
label: string;
|
|
36
|
+
/** The unit, empty where the quantity is dimensionless. */
|
|
37
|
+
unit: string;
|
|
38
|
+
/** Decimals the value is shown to; `0` for a count. */
|
|
39
|
+
decimals: number;
|
|
40
|
+
/** The left end of the bar, and of the plot axis. */
|
|
41
|
+
rangeMin: number;
|
|
42
|
+
/** The right end of the bar, and of the plot axis. */
|
|
43
|
+
rangeMax: number;
|
|
44
|
+
/** The bottom of the preferred band, or `null` when it has no lower bound. */
|
|
45
|
+
preferredMin: number | null;
|
|
46
|
+
/** The top of the preferred band, or `null` when it has no upper bound. */
|
|
47
|
+
preferredMax: number | null;
|
|
48
|
+
/**
|
|
49
|
+
* How far outside the band the fitness takes to fall away. `null` for a
|
|
50
|
+
* quantity that is already a 0-to-1 fitness.
|
|
51
|
+
*/
|
|
52
|
+
halfWidth: number | null;
|
|
53
|
+
/**
|
|
54
|
+
* Whether a larger number is the better one. `null` where the property has a
|
|
55
|
+
* band rather than a direction — a molecule wants some stereocentres, not as
|
|
56
|
+
* many or as few as possible.
|
|
57
|
+
*/
|
|
58
|
+
higherIsBetter: boolean | null;
|
|
59
|
+
/** The published rule of thumb to mark, or `null` where there is none. */
|
|
60
|
+
threshold: PropertyThreshold | null;
|
|
61
|
+
/** Whether the bar grows from the middle rather than from the left. */
|
|
62
|
+
diverging: boolean;
|
|
63
|
+
/** Where the range and the band came from. */
|
|
64
|
+
source: ScaleSource;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** How each displayed property is drawn, ranged and judged. */
|
|
68
|
+
export const PROPERTY_SCALES: Record<PropertyKey, PropertyScale> = {
|
|
69
|
+
logP: {
|
|
70
|
+
key: 'logP',
|
|
71
|
+
label: 'cLogP',
|
|
72
|
+
unit: '',
|
|
73
|
+
decimals: 2,
|
|
74
|
+
rangeMin: 0,
|
|
75
|
+
rangeMax: 8,
|
|
76
|
+
preferredMin: null,
|
|
77
|
+
preferredMax: 4,
|
|
78
|
+
halfWidth: 0.5,
|
|
79
|
+
higherIsBetter: false,
|
|
80
|
+
threshold: { value: 5, label: '≤ 5' },
|
|
81
|
+
diverging: false,
|
|
82
|
+
source: 'datawarrior',
|
|
83
|
+
},
|
|
84
|
+
logS: {
|
|
85
|
+
key: 'logS',
|
|
86
|
+
label: 'Solubility',
|
|
87
|
+
unit: 'log(mol/L)',
|
|
88
|
+
decimals: 2,
|
|
89
|
+
rangeMin: -8,
|
|
90
|
+
rangeMax: 2,
|
|
91
|
+
preferredMin: -4,
|
|
92
|
+
preferredMax: null,
|
|
93
|
+
halfWidth: 0.5,
|
|
94
|
+
higherIsBetter: true,
|
|
95
|
+
threshold: { value: -4, label: '> −4' },
|
|
96
|
+
diverging: false,
|
|
97
|
+
source: 'datawarrior',
|
|
98
|
+
},
|
|
99
|
+
molecularWeight: {
|
|
100
|
+
key: 'molecularWeight',
|
|
101
|
+
label: 'Molweight',
|
|
102
|
+
unit: 'g/mol',
|
|
103
|
+
decimals: 2,
|
|
104
|
+
rangeMin: 0,
|
|
105
|
+
rangeMax: 800,
|
|
106
|
+
preferredMin: null,
|
|
107
|
+
preferredMax: 400,
|
|
108
|
+
halfWidth: 50,
|
|
109
|
+
higherIsBetter: false,
|
|
110
|
+
threshold: { value: 450, label: '< 450' },
|
|
111
|
+
diverging: false,
|
|
112
|
+
source: 'datawarrior',
|
|
113
|
+
},
|
|
114
|
+
polarSurfaceArea: {
|
|
115
|
+
key: 'polarSurfaceArea',
|
|
116
|
+
label: 'TPSA',
|
|
117
|
+
unit: 'Ų',
|
|
118
|
+
decimals: 2,
|
|
119
|
+
rangeMin: 0,
|
|
120
|
+
rangeMax: 250,
|
|
121
|
+
preferredMin: null,
|
|
122
|
+
preferredMax: 120,
|
|
123
|
+
halfWidth: 20,
|
|
124
|
+
higherIsBetter: false,
|
|
125
|
+
threshold: null,
|
|
126
|
+
diverging: false,
|
|
127
|
+
source: 'datawarrior',
|
|
128
|
+
},
|
|
129
|
+
druglikeness: {
|
|
130
|
+
key: 'druglikeness',
|
|
131
|
+
label: 'Druglikeness',
|
|
132
|
+
unit: '',
|
|
133
|
+
decimals: 2,
|
|
134
|
+
rangeMin: -10,
|
|
135
|
+
rangeMax: 10,
|
|
136
|
+
preferredMin: 0,
|
|
137
|
+
preferredMax: null,
|
|
138
|
+
// `DrugScoreCalculator` scores drug-likeness as 1/(1+e^-d), which is this
|
|
139
|
+
// same valuation with a lower bound of 0 and a half-width of 1. So the
|
|
140
|
+
// ramp behind the bar is the library's own term, not a second opinion.
|
|
141
|
+
halfWidth: 1,
|
|
142
|
+
higherIsBetter: true,
|
|
143
|
+
threshold: { value: 0, label: '> 0' },
|
|
144
|
+
diverging: true,
|
|
145
|
+
source: 'legacy',
|
|
146
|
+
},
|
|
147
|
+
acceptorCount: {
|
|
148
|
+
key: 'acceptorCount',
|
|
149
|
+
label: 'H-bond acceptors',
|
|
150
|
+
unit: '',
|
|
151
|
+
decimals: 0,
|
|
152
|
+
rangeMin: 0,
|
|
153
|
+
rangeMax: 16,
|
|
154
|
+
preferredMin: null,
|
|
155
|
+
preferredMax: 10,
|
|
156
|
+
halfWidth: 1,
|
|
157
|
+
higherIsBetter: false,
|
|
158
|
+
threshold: null,
|
|
159
|
+
diverging: false,
|
|
160
|
+
source: 'datawarrior',
|
|
161
|
+
},
|
|
162
|
+
donorCount: {
|
|
163
|
+
key: 'donorCount',
|
|
164
|
+
label: 'H-bond donors',
|
|
165
|
+
unit: '',
|
|
166
|
+
decimals: 0,
|
|
167
|
+
rangeMin: 0,
|
|
168
|
+
rangeMax: 8,
|
|
169
|
+
preferredMin: null,
|
|
170
|
+
preferredMax: 5,
|
|
171
|
+
halfWidth: 0.5,
|
|
172
|
+
higherIsBetter: false,
|
|
173
|
+
threshold: null,
|
|
174
|
+
diverging: false,
|
|
175
|
+
source: 'datawarrior',
|
|
176
|
+
},
|
|
177
|
+
stereoCenterCount: {
|
|
178
|
+
key: 'stereoCenterCount',
|
|
179
|
+
label: 'Stereocentres',
|
|
180
|
+
unit: '',
|
|
181
|
+
decimals: 0,
|
|
182
|
+
rangeMin: 0,
|
|
183
|
+
rangeMax: 8,
|
|
184
|
+
preferredMin: 1,
|
|
185
|
+
preferredMax: 3,
|
|
186
|
+
halfWidth: 2,
|
|
187
|
+
higherIsBetter: null,
|
|
188
|
+
threshold: null,
|
|
189
|
+
diverging: false,
|
|
190
|
+
source: 'datawarrior',
|
|
191
|
+
},
|
|
192
|
+
rotatableBondCount: {
|
|
193
|
+
key: 'rotatableBondCount',
|
|
194
|
+
label: 'Rotatable bonds',
|
|
195
|
+
unit: '',
|
|
196
|
+
decimals: 0,
|
|
197
|
+
rangeMin: 0,
|
|
198
|
+
rangeMax: 20,
|
|
199
|
+
preferredMin: null,
|
|
200
|
+
preferredMax: 4,
|
|
201
|
+
halfWidth: 5,
|
|
202
|
+
higherIsBetter: false,
|
|
203
|
+
threshold: null,
|
|
204
|
+
diverging: false,
|
|
205
|
+
source: 'datawarrior',
|
|
206
|
+
},
|
|
207
|
+
drugScore: {
|
|
208
|
+
key: 'drugScore',
|
|
209
|
+
label: 'Drug score',
|
|
210
|
+
unit: '',
|
|
211
|
+
decimals: 2,
|
|
212
|
+
// The legacy bar, kept: it grows from the middle and runs -1 to 1, so a
|
|
213
|
+
// score always sits in its right half. The quantity itself is a product of
|
|
214
|
+
// terms in (0.5, 1) and four risk factors, so it cannot leave (0, 1).
|
|
215
|
+
rangeMin: -1,
|
|
216
|
+
rangeMax: 1,
|
|
217
|
+
preferredMin: null,
|
|
218
|
+
preferredMax: null,
|
|
219
|
+
// Already a 0-to-1 fitness: it is the product of the four valuations
|
|
220
|
+
// `DrugScoreCalculator` computes, so valuing it again would square it.
|
|
221
|
+
halfWidth: null,
|
|
222
|
+
higherIsBetter: true,
|
|
223
|
+
threshold: null,
|
|
224
|
+
diverging: true,
|
|
225
|
+
source: 'legacy',
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* How one property is drawn, ranged and judged.
|
|
231
|
+
* @param key - Which of the ten.
|
|
232
|
+
* @returns Its scale.
|
|
233
|
+
*/
|
|
234
|
+
export function propertyScale(key: PropertyKey): PropertyScale {
|
|
235
|
+
return PROPERTY_SCALES[key];
|
|
236
|
+
}
|