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,19 @@
|
|
|
1
|
+
export { barGeometry } from "./barGeometry.js";
|
|
2
|
+
export { EMPTY_MOLECULE_MESSAGE, computeProperties, } from "./computeProperties.js";
|
|
3
|
+
export { DRUG_SCORE_RISK_FACTORS, NO_FRAGMENT_MATCHED, RISK_LABELS, RISK_LEVELS, RISK_LEVEL_LABELS, RISK_TYPE_CODES, UNKNOWN_NUMBER, UNKNOWN_SURFACE_AREA, riskCodeOf, riskLevelOf, } from "./constants.js";
|
|
4
|
+
export { propertyFitness, propertyPosition } from "./fitness.js";
|
|
5
|
+
export { MAX_POOL_SIZE, predictionPoolSize } from "./poolSize.js";
|
|
6
|
+
export { UNREADABLE_ID_CODE_MESSAGE, predictIdCode, riskDetailOfIdCode, } from "./predictIdCode.js";
|
|
7
|
+
export { isPredictRequest } from "./predictProtocol.js";
|
|
8
|
+
export { createPredictionPool } from "./predictionPool.js";
|
|
9
|
+
export { createPredictionQueue } from "./predictionQueue.js";
|
|
10
|
+
export { PredictorsUnavailableError, loadPredictors, resetPredictors, } from "./predictors.js";
|
|
11
|
+
export { PROPERTY_KEYS, isPropertyKey, propertyValue } from "./propertyKeys.js";
|
|
12
|
+
export { KNOWN_MOLECULE_NOTE, PENDING_RISK_LABEL, RISK_CAVEAT, riskAppearance, } from "./riskAppearance.js";
|
|
13
|
+
export { riskDetail } from "./riskDetail.js";
|
|
14
|
+
export { parseRiskFindings } from "./riskFindings.js";
|
|
15
|
+
export { runPredictionJob } from "./runPredictionJob.js";
|
|
16
|
+
export { PROPERTY_SCALES, propertyScale } from "./scales.js";
|
|
17
|
+
export { RISK_TYPES } from "./types.js";
|
|
18
|
+
export { getValuation } from "./valuation.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/osiris/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAQlE,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMzD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAU7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many workers to run.
|
|
3
|
+
*
|
|
4
|
+
* One fewer than the machine's cores, so the thread that draws the table keeps
|
|
5
|
+
* one to itself, and never more than eight: measured scaling is 2.45x on two
|
|
6
|
+
* workers and 4.57x on four, and each worker costs its own copy of OpenChemLib
|
|
7
|
+
* and of the 398 kB resource tables.
|
|
8
|
+
*/
|
|
9
|
+
/** The most workers the pool will ever run. */
|
|
10
|
+
export declare const MAX_POOL_SIZE = 8;
|
|
11
|
+
/**
|
|
12
|
+
* How many workers a pool should run here.
|
|
13
|
+
* @param requested - What the caller asked for, or `undefined` to read the machine.
|
|
14
|
+
* @returns A count between 1 and {@link MAX_POOL_SIZE}.
|
|
15
|
+
*/
|
|
16
|
+
export declare function predictionPoolSize(requested?: number): number;
|
|
17
|
+
//# sourceMappingURL=poolSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poolSize.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/poolSize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,+CAA+C;AAC/C,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAI7D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many workers to run.
|
|
3
|
+
*
|
|
4
|
+
* One fewer than the machine's cores, so the thread that draws the table keeps
|
|
5
|
+
* one to itself, and never more than eight: measured scaling is 2.45x on two
|
|
6
|
+
* workers and 4.57x on four, and each worker costs its own copy of OpenChemLib
|
|
7
|
+
* and of the 398 kB resource tables.
|
|
8
|
+
*/
|
|
9
|
+
import { clamp } from "../../format/core/clamp.js";
|
|
10
|
+
/** The most workers the pool will ever run. */
|
|
11
|
+
export const MAX_POOL_SIZE = 8;
|
|
12
|
+
/**
|
|
13
|
+
* How many workers a pool should run here.
|
|
14
|
+
* @param requested - What the caller asked for, or `undefined` to read the machine.
|
|
15
|
+
* @returns A count between 1 and {@link MAX_POOL_SIZE}.
|
|
16
|
+
*/
|
|
17
|
+
export function predictionPoolSize(requested) {
|
|
18
|
+
const cores = globalThis.navigator?.hardwareConcurrency;
|
|
19
|
+
const wanted = requested ?? (typeof cores === 'number' ? cores - 1 : 1);
|
|
20
|
+
return Math.trunc(clamp(wanted, 1, MAX_POOL_SIZE, 1));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=poolSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poolSize.js","sourceRoot":"","sources":["../../../src/osiris/core/poolSize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAkB;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxD,MAAM,MAAM,GAAG,SAAS,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a page asks the prediction pool, and what it hears back.
|
|
3
|
+
*
|
|
4
|
+
* A prediction costs 210 to 380 ms of one thread, so a set of any size is
|
|
5
|
+
* answered a molecule at a time rather than all at once: a row appears as soon
|
|
6
|
+
* as it is read and fills in when its worker returns. Everything here is shaped
|
|
7
|
+
* around that — a per-result callback rather than a promise over the set, a
|
|
8
|
+
* progress figure, a cancel that works, and a way to say which rows the reader
|
|
9
|
+
* can actually see so those are computed first.
|
|
10
|
+
*/
|
|
11
|
+
import type { WorkerLike } from '../../worker/core/messages.ts';
|
|
12
|
+
import type { PredictRequest, PredictResponse } from './predictProtocol.ts';
|
|
13
|
+
import type { ResourceSource } from './predictors.ts';
|
|
14
|
+
import type { OsirisProperties, RiskDetail, RiskType } from './types.ts';
|
|
15
|
+
/** One molecule to predict. */
|
|
16
|
+
export interface PredictionInput {
|
|
17
|
+
/**
|
|
18
|
+
* The caller's key for the row, echoed on the answer. It is the row's read
|
|
19
|
+
* position, never its idCode: a real list holds the same structure twice
|
|
20
|
+
* under two names, and both rows have to fill in.
|
|
21
|
+
*/
|
|
22
|
+
key: string;
|
|
23
|
+
/** The idCode, with the editor's atom coordinates after a space or without. */
|
|
24
|
+
idCode: string;
|
|
25
|
+
/**
|
|
26
|
+
* The name the source carried.
|
|
27
|
+
* @default the canonical SMILES
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
30
|
+
}
|
|
31
|
+
/** What came back for one molecule. */
|
|
32
|
+
export type PredictionOutcome = {
|
|
33
|
+
key: string;
|
|
34
|
+
ok: true;
|
|
35
|
+
properties: OsirisProperties;
|
|
36
|
+
} | {
|
|
37
|
+
key: string;
|
|
38
|
+
ok: false;
|
|
39
|
+
message: string;
|
|
40
|
+
};
|
|
41
|
+
/** How far the pool has got. */
|
|
42
|
+
export interface PredictionProgress {
|
|
43
|
+
/** Molecules answered, whether predicted or refused. */
|
|
44
|
+
done: number;
|
|
45
|
+
/** Molecules accepted since the run started. */
|
|
46
|
+
total: number;
|
|
47
|
+
/** Molecules still queued or still being worked on. */
|
|
48
|
+
pending: number;
|
|
49
|
+
/** Whether anything is still to come. */
|
|
50
|
+
running: boolean;
|
|
51
|
+
}
|
|
52
|
+
/** How a pool is built, and who it reports to. */
|
|
53
|
+
export interface PredictionPoolOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Where the workers register OpenChemLib's resources from — the absolute URL
|
|
56
|
+
* of the site's own `openchemlib-resources.json`, resolved on the main
|
|
57
|
+
* thread. See {@link ResourceSource}.
|
|
58
|
+
*/
|
|
59
|
+
resources: ResourceSource;
|
|
60
|
+
/**
|
|
61
|
+
* How many workers to run. Clamped to 1 to 8.
|
|
62
|
+
* @default one fewer than the machine's cores, which measured 2.45x on two workers and 4.57x on four
|
|
63
|
+
*/
|
|
64
|
+
size?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Makes one worker, which serves `runPredictionJob` for the requests
|
|
67
|
+
* `isPredictRequest` accepts. Only called where the page has a `Worker` at
|
|
68
|
+
* all. The site writes it because a bundler resolves a worker's address
|
|
69
|
+
* against the module naming it: written in this package, the URL would point
|
|
70
|
+
* inside `node_modules` rather than at a chunk the site's build emitted.
|
|
71
|
+
*/
|
|
72
|
+
createWorker: () => WorkerLike;
|
|
73
|
+
/**
|
|
74
|
+
* The same job on this thread, used where there is no `Worker` — Node, a
|
|
75
|
+
* unit test.
|
|
76
|
+
* @default `runPredictionJob`, the same function the worker serves
|
|
77
|
+
*/
|
|
78
|
+
runInProcess?: (request: PredictRequest) => Promise<PredictResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Called once per molecule, as each one comes back.
|
|
81
|
+
* @default undefined
|
|
82
|
+
*/
|
|
83
|
+
onResult?: (outcome: PredictionOutcome) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Called whenever the count of answered molecules changes.
|
|
86
|
+
* @default undefined
|
|
87
|
+
*/
|
|
88
|
+
onProgress?: (progress: PredictionProgress) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Called once when the resource tables did not load. Every answer from every
|
|
91
|
+
* worker would be `unknown`, so the run stops and nothing more is dispatched.
|
|
92
|
+
* @default undefined
|
|
93
|
+
*/
|
|
94
|
+
onUnavailable?: (message: string) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Milliseconds one molecule may take before it is given up on.
|
|
97
|
+
* @default 60000
|
|
98
|
+
*/
|
|
99
|
+
timeoutMs?: number;
|
|
100
|
+
}
|
|
101
|
+
/** A pool of workers answering one molecule at a time, each. */
|
|
102
|
+
export interface PredictionPool {
|
|
103
|
+
/** How many workers it runs. */
|
|
104
|
+
readonly size: number;
|
|
105
|
+
/** How far it has got. */
|
|
106
|
+
readonly progress: PredictionProgress;
|
|
107
|
+
/**
|
|
108
|
+
* Add molecules to predict. One already queued or in flight is ignored, so a
|
|
109
|
+
* page may resubmit its whole set whenever the set changes.
|
|
110
|
+
* @param molecules - The molecules.
|
|
111
|
+
*/
|
|
112
|
+
submit: (molecules: readonly PredictionInput[]) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Say which rows to answer first — the ones the reader can see. Molecules
|
|
115
|
+
* already being worked on are left alone; only what is still queued moves.
|
|
116
|
+
* @param keys - The keys, most wanted first.
|
|
117
|
+
*/
|
|
118
|
+
prioritize: (keys: readonly string[]) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Why one risk came back as it did. Jumps the queue, because it is a click.
|
|
121
|
+
* A {@link PredictionPool.cancel} is about the set, not about the click, so
|
|
122
|
+
* an explanation it drops is asked for again.
|
|
123
|
+
* @param idCode - The molecule, coordinates included or not.
|
|
124
|
+
* @param risk - Which of the four risks to explain.
|
|
125
|
+
* @returns The findings, with the matched atoms and bonds of every fragment.
|
|
126
|
+
* @throws {Error} When even the second ask was dropped, with a sentence to show the reader.
|
|
127
|
+
*/
|
|
128
|
+
riskDetail: (idCode: string, risk: RiskType) => Promise<RiskDetail>;
|
|
129
|
+
/**
|
|
130
|
+
* Drop everything queued and stop reporting. The molecule each worker is
|
|
131
|
+
* already on cannot be interrupted — the library call is synchronous — so it
|
|
132
|
+
* finishes and its answer is thrown away, within about 400 ms. A
|
|
133
|
+
* {@link PredictionPool.submit} made in the same turn is still dispatched, on
|
|
134
|
+
* the slots those abandoned answers free.
|
|
135
|
+
*/
|
|
136
|
+
cancel: () => void;
|
|
137
|
+
/** Cancel, and end every worker. */
|
|
138
|
+
terminate: () => void;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=poolTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poolTypes.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/poolTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzE,+BAA+B;AAC/B,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,uCAAuC;AACvC,MAAM,MAAM,iBAAiB,GACzB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,gBAAgB,CAAA;CAAE,GACvD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhD,gCAAgC;AAChC,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,SAAS,EAAE,cAAc,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,UAAU,CAAC;IAC/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACrE;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACpD;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0BAA0B;IAC1B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC;;;;OAIG;IACH,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,KAAK,IAAI,CAAC;IACxD;;;;OAIG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9C;;;;;;;;OAQG;IACH,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACpE;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,oCAAoC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a page asks the prediction pool, and what it hears back.
|
|
3
|
+
*
|
|
4
|
+
* A prediction costs 210 to 380 ms of one thread, so a set of any size is
|
|
5
|
+
* answered a molecule at a time rather than all at once: a row appears as soon
|
|
6
|
+
* as it is read and fills in when its worker returns. Everything here is shaped
|
|
7
|
+
* around that — a per-result callback rather than a promise over the set, a
|
|
8
|
+
* progress figure, a cancel that works, and a way to say which rows the reader
|
|
9
|
+
* can actually see so those are computed first.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=poolTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poolTypes.js","sourceRoot":"","sources":["../../../src/osiris/core/poolTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prediction from the only thing worth keeping per row.
|
|
3
|
+
*
|
|
4
|
+
* A row never holds an `OCL.Molecule` — ten thousand of them cost 198 MB — so
|
|
5
|
+
* what travels to a worker is the idCode, and the molecule is rebuilt there in
|
|
6
|
+
* a quarter of a millisecond against the 380 ms the prediction itself costs.
|
|
7
|
+
*/
|
|
8
|
+
import type { ComputePropertiesOptions } from './computeProperties.ts';
|
|
9
|
+
import type { OsirisPredictors } from './predictors.ts';
|
|
10
|
+
import type { OsirisProperties, RiskDetail, RiskType } from './types.ts';
|
|
11
|
+
/**
|
|
12
|
+
* What is said when an idCode cannot be read.
|
|
13
|
+
*
|
|
14
|
+
* An idCode is written by a program, not typed by a chemist, so there is no
|
|
15
|
+
* position to point at and no parser reason worth repeating: OpenChemLib
|
|
16
|
+
* answers a malformed one with `Cannot set properties of undefined`, which
|
|
17
|
+
* names nothing anyone can act on. Worse, it does not always throw — `zzzz`
|
|
18
|
+
* reads as a 117-atom molecule — so this is the floor, not the whole guard.
|
|
19
|
+
*/
|
|
20
|
+
export declare const UNREADABLE_ID_CODE_MESSAGE = "This structure could not be read.";
|
|
21
|
+
/**
|
|
22
|
+
* Predict everything the tool shows, from an idCode.
|
|
23
|
+
* @param value - The idCode, with the editor's atom coordinates after a space or without them.
|
|
24
|
+
* @param predictors - OpenChemLib with its resources registered and checked.
|
|
25
|
+
* @param options - See {@link ComputePropertiesOptions}.
|
|
26
|
+
* @returns The ten numbers, the four risks, and what to call the molecule.
|
|
27
|
+
* @throws {Error} When the idCode cannot be read, or describes no atoms.
|
|
28
|
+
*/
|
|
29
|
+
export declare function predictIdCode(value: string, predictors: OsirisPredictors, options?: ComputePropertiesOptions): OsirisProperties;
|
|
30
|
+
/**
|
|
31
|
+
* Why one risk came back as it did, from an idCode.
|
|
32
|
+
* @param value - The idCode, coordinates included or not.
|
|
33
|
+
* @param risk - Which of the four risks to explain.
|
|
34
|
+
* @param predictors - OpenChemLib with its resources registered and checked.
|
|
35
|
+
* @returns The findings, with the matched atoms and bonds of every fragment.
|
|
36
|
+
* @throws {Error} When the idCode cannot be read.
|
|
37
|
+
*/
|
|
38
|
+
export declare function riskDetailOfIdCode(value: string, risk: RiskType, predictors: OsirisPredictors): RiskDetail;
|
|
39
|
+
//# sourceMappingURL=predictIdCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predictIdCode.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/predictIdCode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzE;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,EAC5B,OAAO,GAAE,wBAA6B,GACrC,gBAAgB,CAElB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,gBAAgB,GAC3B,UAAU,CAEZ"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prediction from the only thing worth keeping per row.
|
|
3
|
+
*
|
|
4
|
+
* A row never holds an `OCL.Molecule` — ten thousand of them cost 198 MB — so
|
|
5
|
+
* what travels to a worker is the idCode, and the molecule is rebuilt there in
|
|
6
|
+
* a quarter of a millisecond against the 380 ms the prediction itself costs.
|
|
7
|
+
*/
|
|
8
|
+
import { splitIdCode } from "../../structure/core/editorValue.js";
|
|
9
|
+
import { computeProperties } from "./computeProperties.js";
|
|
10
|
+
import { riskDetail } from "./riskDetail.js";
|
|
11
|
+
/**
|
|
12
|
+
* What is said when an idCode cannot be read.
|
|
13
|
+
*
|
|
14
|
+
* An idCode is written by a program, not typed by a chemist, so there is no
|
|
15
|
+
* position to point at and no parser reason worth repeating: OpenChemLib
|
|
16
|
+
* answers a malformed one with `Cannot set properties of undefined`, which
|
|
17
|
+
* names nothing anyone can act on. Worse, it does not always throw — `zzzz`
|
|
18
|
+
* reads as a 117-atom molecule — so this is the floor, not the whole guard.
|
|
19
|
+
*/
|
|
20
|
+
export const UNREADABLE_ID_CODE_MESSAGE = 'This structure could not be read.';
|
|
21
|
+
/**
|
|
22
|
+
* Predict everything the tool shows, from an idCode.
|
|
23
|
+
* @param value - The idCode, with the editor's atom coordinates after a space or without them.
|
|
24
|
+
* @param predictors - OpenChemLib with its resources registered and checked.
|
|
25
|
+
* @param options - See {@link ComputePropertiesOptions}.
|
|
26
|
+
* @returns The ten numbers, the four risks, and what to call the molecule.
|
|
27
|
+
* @throws {Error} When the idCode cannot be read, or describes no atoms.
|
|
28
|
+
*/
|
|
29
|
+
export function predictIdCode(value, predictors, options = {}) {
|
|
30
|
+
return computeProperties(read(value, predictors), predictors, options);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Why one risk came back as it did, from an idCode.
|
|
34
|
+
* @param value - The idCode, coordinates included or not.
|
|
35
|
+
* @param risk - Which of the four risks to explain.
|
|
36
|
+
* @param predictors - OpenChemLib with its resources registered and checked.
|
|
37
|
+
* @returns The findings, with the matched atoms and bonds of every fragment.
|
|
38
|
+
* @throws {Error} When the idCode cannot be read.
|
|
39
|
+
*/
|
|
40
|
+
export function riskDetailOfIdCode(value, risk, predictors) {
|
|
41
|
+
return riskDetail(read(value, predictors), risk, predictors);
|
|
42
|
+
}
|
|
43
|
+
function read(value, predictors) {
|
|
44
|
+
const { idCode, coordinates } = splitIdCode(value);
|
|
45
|
+
try {
|
|
46
|
+
return coordinates === undefined
|
|
47
|
+
? predictors.Molecule.fromIDCode(idCode)
|
|
48
|
+
: predictors.Molecule.fromIDCode(idCode, coordinates);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw new Error(UNREADABLE_ID_CODE_MESSAGE, { cause: error });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=predictIdCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predictIdCode.js","sourceRoot":"","sources":["../../../src/osiris/core/predictIdCode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,mCAAmC,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAa,EACb,UAA4B,EAC5B,UAAoC,EAAE;IAEtC,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,IAAc,EACd,UAA4B;IAE5B,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,IAAI,CAAC,KAAa,EAAE,UAA4B;IACvD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,OAAO,WAAW,KAAK,SAAS;YAC9B,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC;YACxC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the page asks a prediction worker, and what it answers.
|
|
3
|
+
*
|
|
4
|
+
* One molecule per request. Two of the three answers are ordinary results; the
|
|
5
|
+
* third, `unavailable`, is how a worker says its resource tables did not load.
|
|
6
|
+
* That one travels as a *successful* answer on purpose: a rejection would be
|
|
7
|
+
* indistinguishable from the ordinary failure of one unreadable structure,
|
|
8
|
+
* whereas this one means every answer from every worker is worthless and the
|
|
9
|
+
* run must stop and say so.
|
|
10
|
+
*/
|
|
11
|
+
import type { ResourceSource } from './predictors.ts';
|
|
12
|
+
import type { OsirisProperties, RiskDetail, RiskType } from './types.ts';
|
|
13
|
+
/** What every request carries, whichever job it asks for. */
|
|
14
|
+
interface BaseRequest {
|
|
15
|
+
/**
|
|
16
|
+
* Where the worker registers OpenChemLib's resources from. In a browser this
|
|
17
|
+
* is always the absolute URL of the site's own `openchemlib-resources.json`,
|
|
18
|
+
* resolved on the main thread: a worker has no `document`, so it cannot read
|
|
19
|
+
* the deployment's mount path itself. The parsed tables are accepted as well,
|
|
20
|
+
* for the in-process fallback where there is no worker to post them to.
|
|
21
|
+
*/
|
|
22
|
+
resources: ResourceSource;
|
|
23
|
+
}
|
|
24
|
+
/** Predict everything the tool shows for one molecule. */
|
|
25
|
+
export interface PropertiesRequest extends BaseRequest {
|
|
26
|
+
kind: 'properties';
|
|
27
|
+
/** The caller's key for the row, echoed back so answers can arrive in any order. */
|
|
28
|
+
key: string;
|
|
29
|
+
/** The idCode, with the editor's atom coordinates after a space or without. */
|
|
30
|
+
idCode: string;
|
|
31
|
+
/**
|
|
32
|
+
* The name the source carried.
|
|
33
|
+
* @default the canonical SMILES
|
|
34
|
+
*/
|
|
35
|
+
label?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Explain why one risk came back as it did. */
|
|
38
|
+
export interface RiskDetailRequest extends BaseRequest {
|
|
39
|
+
kind: 'riskDetail';
|
|
40
|
+
/** The idCode, coordinates included or not. */
|
|
41
|
+
idCode: string;
|
|
42
|
+
/** Which of the four risks to explain. */
|
|
43
|
+
risk: RiskType;
|
|
44
|
+
}
|
|
45
|
+
/** One job for a prediction worker. */
|
|
46
|
+
export type PredictRequest = PropertiesRequest | RiskDetailRequest;
|
|
47
|
+
/** What a prediction worker answers. */
|
|
48
|
+
export type PredictResponse = {
|
|
49
|
+
kind: 'properties';
|
|
50
|
+
key: string;
|
|
51
|
+
properties: OsirisProperties;
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'riskDetail';
|
|
54
|
+
detail: RiskDetail;
|
|
55
|
+
} | {
|
|
56
|
+
kind: 'unavailable';
|
|
57
|
+
message: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Whether a message is a job this worker handles, so anything else is refused
|
|
61
|
+
* rather than read as one.
|
|
62
|
+
* @param value - Whatever was posted.
|
|
63
|
+
* @returns True when it is a well-formed request.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isPredictRequest(value: unknown): value is PredictRequest;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=predictProtocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predictProtocol.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/predictProtocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzE,6DAA6D;AAC7D,UAAU,WAAW;IACnB;;;;;;OAMG;IACH,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,0DAA0D;AAC1D,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,IAAI,EAAE,YAAY,CAAC;IACnB,oFAAoF;IACpF,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,gDAAgD;AAChD,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,IAAI,EAAE,YAAY,CAAC;IACnB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEnE,wCAAwC;AACxC,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,gBAAgB,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAaxE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the page asks a prediction worker, and what it answers.
|
|
3
|
+
*
|
|
4
|
+
* One molecule per request. Two of the three answers are ordinary results; the
|
|
5
|
+
* third, `unavailable`, is how a worker says its resource tables did not load.
|
|
6
|
+
* That one travels as a *successful* answer on purpose: a rejection would be
|
|
7
|
+
* indistinguishable from the ordinary failure of one unreadable structure,
|
|
8
|
+
* whereas this one means every answer from every worker is worthless and the
|
|
9
|
+
* run must stop and say so.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Whether a message is a job this worker handles, so anything else is refused
|
|
13
|
+
* rather than read as one.
|
|
14
|
+
* @param value - Whatever was posted.
|
|
15
|
+
* @returns True when it is a well-formed request.
|
|
16
|
+
*/
|
|
17
|
+
export function isPredictRequest(value) {
|
|
18
|
+
if (typeof value !== 'object' || value === null)
|
|
19
|
+
return false;
|
|
20
|
+
const request = value;
|
|
21
|
+
if (typeof request.idCode !== 'string')
|
|
22
|
+
return false;
|
|
23
|
+
if (request.resources === undefined)
|
|
24
|
+
return false;
|
|
25
|
+
if (request.kind === 'properties')
|
|
26
|
+
return typeof request.key === 'string';
|
|
27
|
+
return request.kind === 'riskDetail' && typeof request.risk === 'string';
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=predictProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predictProtocol.js","sourceRoot":"","sources":["../../../src/osiris/core/predictProtocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiDH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,OAAO,GAAG,KAMf,CAAC;IACF,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAClD,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,CAAC;IAC1E,OAAO,OAAO,CAAC,IAAI,KAAK,YAAY,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pool of prediction workers, answering one molecule at a time each.
|
|
3
|
+
*
|
|
4
|
+
* `createWorkerChannel` from `react-cheminfo/core` does the per-worker half —
|
|
5
|
+
* request identifiers so answers match callers whatever order they arrive in,
|
|
6
|
+
* timeouts, cancellation, and the in-process fallback where a page has no
|
|
7
|
+
* `Worker` at all. What it does not do is spread work over several workers, so
|
|
8
|
+
* that is what this adds: one channel per worker, a queue the pool owns, and at
|
|
9
|
+
* most one outstanding job per channel, which is what makes reordering possible
|
|
10
|
+
* at all. A channel asked for everything at once would post everything at once,
|
|
11
|
+
* and the row the reader is looking at would be answered forty-eighth.
|
|
12
|
+
*/
|
|
13
|
+
import type { PredictionPool, PredictionPoolOptions } from './poolTypes.ts';
|
|
14
|
+
/**
|
|
15
|
+
* Start a pool of prediction workers.
|
|
16
|
+
*
|
|
17
|
+
* Workers are created lazily by the channels, on their first job, so a page
|
|
18
|
+
* that never predicts anything never loads OpenChemLib.
|
|
19
|
+
* @param options - See {@link PredictionPoolOptions}.
|
|
20
|
+
* @returns The pool.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createPredictionPool(options: PredictionPoolOptions): PredictionPool;
|
|
23
|
+
//# sourceMappingURL=predictionPool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predictionPool.d.ts","sourceRoot":"","sources":["../../../src/osiris/core/predictionPool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,KAAK,EAEV,cAAc,EACd,qBAAqB,EAEtB,MAAM,gBAAgB,CAAC;AAexB;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CA2LhB"}
|