Samad14 commited on
Commit
fe8fda4
·
1 Parent(s): b3640c4

feat: ADMET 3a/3b split — mark RDKit descriptors as production, toxicity/ADMET as rule-based heuristic

Browse files
bioai-platform/backend/app/tools/admet.py CHANGED
@@ -355,6 +355,15 @@ def compute_descriptors(smiles: str) -> dict:
355
  return {
356
  "smiles": smiles,
357
  "formula": formula,
 
 
 
 
 
 
 
 
 
358
  "heavy_atoms": heavy_atoms,
359
  "molecular_weight": mw,
360
  "logp": logp,
@@ -424,6 +433,7 @@ def compute_descriptors(smiles: str) -> dict:
424
  "lipophilic_efficiency": lipe,
425
  },
426
  "toxicity": {
 
427
  "ames_mutagenicity": ames_prediction,
428
  "ames_alerts": ames_alerts,
429
  "herg_liability": herg_risk,
 
355
  return {
356
  "smiles": smiles,
357
  "formula": formula,
358
+ "_methodology": {
359
+ "core_descriptors": {"tier": "3a", "confidence": "high", "method": "RDKit descriptors", "note": "Computed directly from molecular graph — production-ready"},
360
+ "drug_likeness": {"tier": "3a", "confidence": "high", "method": "RDKit + Lipinski/Veber/Ghose/Egan rules", "note": "Validated pharma filters — production-ready"},
361
+ "structural_alerts": {"tier": "3a", "confidence": "high", "method": "PAINS/Brenk SMARTS patterns", "note": "Well-established substructure filters — production-ready"},
362
+ "functional_groups": {"tier": "3a", "confidence": "high", "method": "RDKit Fragments module", "note": "Deterministic fragment counts — production-ready"},
363
+ "absorption_distribution_metabolism": {"tier": "3b", "confidence": "approximate", "method": "Rule-based heuristics on top of RDKit descriptors", "note": "Educational estimates — for research use, not clinical decisions. Replace with validated QSAR models for production."},
364
+ "toxicity": {"tier": "3b", "confidence": "approximate", "method": "Rule-based heuristics (LogP/MW/TPSA thresholds, structural alerts)", "note": "No ML classifiers — these are simplified heuristics. Real toxicity prediction requires trained models (e.g. ProTox, Tox21). For research use only."},
365
+ "clearance": {"tier": "3b", "confidence": "approximate", "method": "LogP/TPSA heuristic", "note": "Very rough estimate — real clearance depends on CYP metabolism kinetics"},
366
+ },
367
  "heavy_atoms": heavy_atoms,
368
  "molecular_weight": mw,
369
  "logp": logp,
 
433
  "lipophilic_efficiency": lipe,
434
  },
435
  "toxicity": {
436
+ "_disclaimer": "Rule-based heuristics only — no ML classifiers. For research screening, not clinical/ regulatory use.",
437
  "ames_mutagenicity": ames_prediction,
438
  "ames_alerts": ames_alerts,
439
  "herg_liability": herg_risk,
bioai-platform/frontend/src/app/(dashboard)/analyze/admet/page.tsx CHANGED
@@ -163,6 +163,15 @@ export default function ADMETPage() {
163
  </div>
164
  </div>
165
 
 
 
 
 
 
 
 
 
 
166
  {/* Tabs */}
167
  <div className="flex gap-1 p-1 bg-surface-1 rounded-lg overflow-x-auto">
168
  {TABS.map((tab) => {
@@ -212,11 +221,11 @@ export default function ADMETPage() {
212
  { label: "Oral Bioavailability", value: `${(result.absorption.oral_bioavailability * 100).toFixed(0)}%` },
213
  { label: "BBB Permeability", value: result.distribution.bbb_permeability },
214
  { label: "CYP Inhibition", value: result.metabolism.cyp_substrate_risk },
215
- { label: "AMES Mutagenicity", value: result.toxicity.ames_mutagenicity },
216
- { label: "hERG Risk", value: result.toxicity.herg_liability },
217
  ].map((p) => (
218
  <div key={p.label} className="bg-surface-1 rounded-lg p-3 text-center">
219
- <div className="text-xs text-text-muted mb-1">{p.label}</div>
220
  <RiskBadge level={p.value} />
221
  </div>
222
  ))}
@@ -359,7 +368,7 @@ export default function ADMETPage() {
359
  {activeTab === "admet" && (
360
  <motion.div key="admet" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} className="space-y-4">
361
  {/* Absorption */}
362
- <SectionCard title="Absorption">
363
  <div className="space-y-0">
364
  <PropRow label="Oral Bioavailability" value={`${(result.absorption.oral_bioavailability * 100).toFixed(0)}%`} note={result.absorption.oral_bioavailability > 0.7 ? "Good" : result.absorption.oral_bioavailability > 0.4 ? "Moderate" : "Poor"} />
365
  <PropRow label="Caco-2 Permeability" value="" />
@@ -382,7 +391,7 @@ export default function ADMETPage() {
382
  </SectionCard>
383
 
384
  {/* Distribution */}
385
- <SectionCard title="Distribution">
386
  <div className="space-y-0">
387
  <PropRow label="Volume of Distribution (Vd)" value={result.distribution.volume_of_distribution} unit="L/kg" />
388
  <PropRow label="BBB Permeability" value="" />
@@ -401,7 +410,7 @@ export default function ADMETPage() {
401
  </SectionCard>
402
 
403
  {/* Metabolism */}
404
- <SectionCard title="Metabolism">
405
  <div className="space-y-0">
406
  <PropRow label="CYP Substrate Risk" value="" />
407
  <div className="flex items-center gap-2 py-1.5 border-b border-surface-3">
@@ -426,8 +435,9 @@ export default function ADMETPage() {
426
  </div>
427
  </SectionCard>
428
 
429
- {/* Toxicity */}
430
- <SectionCard title="Toxicity">
 
431
  <div className="space-y-0">
432
  <PropRow label="AMES Mutagenicity" value="" />
433
  <div className="flex items-center gap-2 py-1.5 border-b border-surface-3">
@@ -544,7 +554,7 @@ export default function ADMETPage() {
544
  <div className="flex items-center justify-between">
545
  <div>
546
  <p className="text-sm font-medium text-text-primary">Overall ADMET Risk</p>
547
- <p className="text-xs text-text-muted mt-0.5">Composite of AMES, hERG, DILI, skin sensitization</p>
548
  </div>
549
  <div className={`text-2xl font-bold ${result.toxicity.risk_score <= 2 ? "text-green-400" : result.toxicity.risk_score <= 5 ? "text-amber-400" : "text-red-400"}`}>
550
  {result.toxicity.risk_score}<span className="text-sm text-text-muted">/10</span>
 
163
  </div>
164
  </div>
165
 
166
+ {/* Methodology banner */}
167
+ <div className="glass-card p-3 border-l-2 border-accent-cyan/50">
168
+ <p className="text-xs text-text-muted">
169
+ <span className="text-accent-cyan font-semibold">3a</span> Core descriptors & drug-likeness — RDKit, production-ready.
170
+ <span className="mx-2 text-surface-3">|</span>
171
+ <span className="text-amber-400 font-semibold">3b</span> ADMET & toxicity — rule-based heuristics, research screening only (no ML classifiers).
172
+ </p>
173
+ </div>
174
+
175
  {/* Tabs */}
176
  <div className="flex gap-1 p-1 bg-surface-1 rounded-lg overflow-x-auto">
177
  {TABS.map((tab) => {
 
221
  { label: "Oral Bioavailability", value: `${(result.absorption.oral_bioavailability * 100).toFixed(0)}%` },
222
  { label: "BBB Permeability", value: result.distribution.bbb_permeability },
223
  { label: "CYP Inhibition", value: result.metabolism.cyp_substrate_risk },
224
+ { label: "AMES Mutagenicity", value: result.toxicity.ames_mutagenicity, rule: true },
225
+ { label: "hERG Risk", value: result.toxicity.herg_liability, rule: true },
226
  ].map((p) => (
227
  <div key={p.label} className="bg-surface-1 rounded-lg p-3 text-center">
228
+ <div className="text-xs text-text-muted mb-1">{p.label}{(p as any).rule && <span className="text-amber-400/50 ml-1 text-[10px]">(rule)</span>}</div>
229
  <RiskBadge level={p.value} />
230
  </div>
231
  ))}
 
368
  {activeTab === "admet" && (
369
  <motion.div key="admet" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} className="space-y-4">
370
  {/* Absorption */}
371
+ <SectionCard title="Absorption (Rule-based)">
372
  <div className="space-y-0">
373
  <PropRow label="Oral Bioavailability" value={`${(result.absorption.oral_bioavailability * 100).toFixed(0)}%`} note={result.absorption.oral_bioavailability > 0.7 ? "Good" : result.absorption.oral_bioavailability > 0.4 ? "Moderate" : "Poor"} />
374
  <PropRow label="Caco-2 Permeability" value="" />
 
391
  </SectionCard>
392
 
393
  {/* Distribution */}
394
+ <SectionCard title="Distribution (Rule-based)">
395
  <div className="space-y-0">
396
  <PropRow label="Volume of Distribution (Vd)" value={result.distribution.volume_of_distribution} unit="L/kg" />
397
  <PropRow label="BBB Permeability" value="" />
 
410
  </SectionCard>
411
 
412
  {/* Metabolism */}
413
+ <SectionCard title="Metabolism (Rule-based)">
414
  <div className="space-y-0">
415
  <PropRow label="CYP Substrate Risk" value="" />
416
  <div className="flex items-center gap-2 py-1.5 border-b border-surface-3">
 
435
  </div>
436
  </SectionCard>
437
 
438
+ {/* Toxicity — 3b: Rule-based heuristics */}
439
+ <SectionCard title="Toxicity (Rule-based Estimation)">
440
+ <p className="text-xs text-amber-400/70 mb-3 -mt-1">Simplified heuristics — no ML classifiers. For research screening only.</p>
441
  <div className="space-y-0">
442
  <PropRow label="AMES Mutagenicity" value="" />
443
  <div className="flex items-center gap-2 py-1.5 border-b border-surface-3">
 
554
  <div className="flex items-center justify-between">
555
  <div>
556
  <p className="text-sm font-medium text-text-primary">Overall ADMET Risk</p>
557
+ <p className="text-xs text-text-muted mt-0.5">Composite of AMES, hERG, DILI, skin sensitization <span className="text-amber-400/60">(rule-based)</span></p>
558
  </div>
559
  <div className={`text-2xl font-bold ${result.toxicity.risk_score <= 2 ? "text-green-400" : result.toxicity.risk_score <= 5 ? "text-amber-400" : "text-red-400"}`}>
560
  {result.toxicity.risk_score}<span className="text-sm text-text-muted">/10</span>
bioai-platform/frontend/src/lib/api.ts CHANGED
@@ -480,6 +480,7 @@ export type ADMETResult = {
480
  num_atom_stereocenters: number;
481
  num_unspecified_stereocenters: number;
482
  functional_groups: Record<string, number>;
 
483
  drug_likeness: {
484
  overall_score: number;
485
  qed_score: number;
@@ -514,6 +515,7 @@ export type ADMETResult = {
514
  lipophilic_efficiency: number;
515
  };
516
  toxicity: {
 
517
  ames_mutagenicity: string;
518
  ames_alerts: string[];
519
  herg_liability: string;
 
480
  num_atom_stereocenters: number;
481
  num_unspecified_stereocenters: number;
482
  functional_groups: Record<string, number>;
483
+ _methodology?: Record<string, { tier: string; confidence: string; method: string; note: string }>;
484
  drug_likeness: {
485
  overall_score: number;
486
  qed_score: number;
 
515
  lipophilic_efficiency: number;
516
  };
517
  toxicity: {
518
+ _disclaimer?: string;
519
  ames_mutagenicity: string;
520
  ames_alerts: string[];
521
  herg_liability: string;