fix(science): stop scoring evidence that was never looked up
A review of the ranking's arithmetic found four things wrong, all of which made the score look better informed than it was. Measurements below are from this repo, not estimates. **Components now abstain instead of inventing a number.** A run without a VEP cache returns no allele frequencies, and rarity_score(None) read that as "absent from gnomAD, therefore maximally rare" and awarded every variant a free 0.25. jobs.has_frequencies / has_effect_scores record what the run actually produced, absent components are dropped from the weighted mean, and the remaining weights are renormalised so the score keeps its meaning. The UI shows "not looked up" rather than a bar, and the funnel stops calling a step "rare" when nothing was filtered. **Allele frequency is no longer a model feature.** It dominated: the same missense variant scored 0.887 at AF 0 and 0.0003 at AF 0.01. That double- counted, because the ranking already scores frequency explicitly, putting ~45% of every rank on one measurement; and it was circular, because ACMG assigns ClinVar's benign labels using frequency (BA1/BS1). Retraining without it moves missense AUROC from 0.872 to 0.500 — exactly random. The old figure was allele frequency, not variant-effect knowledge. The model therefore abstains unless CADD or AlphaMissense is present, since otherwise it only restates the consequence class. **Phenotype matching is weighted by information content** and HPO annotations are propagated up the ontology. Counting terms alike let "global developmental delay" (IC 0.93) count as much as "dilated left subclavian artery" (IC 7.88). **A real bug in the propagation, found by checking it.** The ancestor walk read a pre-order DFS backwards, which on a DAG lets a term resolve before one of its parents and inherit that parent alone instead of its lineage. It dropped 399 terms out of the phenotype branch, Camptodactyly and Chiari malformation among them. Now a true post-order, tested against a reference transitive closure. The ontology arithmetic moved to rarelens_ml.hpo so it is covered by tests, and rarelens_ml.benchmark measures the whole thing: across 10,178 published cases the causal gene ranks first 45.9-81.0% of the time against 5,269 genes, versus 0.02% for chance. docs/data.md reports that with its contamination (HPO's annotations come from these same case reports), and includes the measurement showing information-content weighting earns its place while propagation does not - kept anyway, for a reason the docs argue rather than assume.
This commit is contained in:
+15
-7
@@ -29,15 +29,23 @@ variants could explain *this* phenotype.
|
||||
|
||||
Rarity (<0.1% in gnomAD) and consequence (HIGH or MODERATE) *filter*, which is the usual first
|
||||
pass. Phenotype only *ranks*: a real diagnosis can sit in a gene nobody has annotated yet, and
|
||||
filtering on phenotype would hide exactly that case. The rank is a weighted sum whose parts are
|
||||
filtering on phenotype would hide exactly that case. The rank is a weighted mean whose parts are
|
||||
shown next to every candidate (`app/services/triage.py`):
|
||||
|
||||
| Component | Weight |
|
||||
|---|---|
|
||||
| phenotype terms of this patient annotated to the gene | 0.35 |
|
||||
| rarity in gnomAD | 0.25 |
|
||||
| consequence severity | 0.20 |
|
||||
| model P(pathogenic) | 0.20 |
|
||||
| Component | Weight | Scores when |
|
||||
|---|---|---|
|
||||
| share of this patient's phenotype annotated to the gene, weighted by term specificity | 0.35 | always |
|
||||
| rarity in gnomAD | 0.25 | the run looked up frequencies |
|
||||
| consequence severity | 0.20 | always |
|
||||
| model P(pathogenic) | 0.20 | the run has CADD or AlphaMissense |
|
||||
|
||||
**A component with no evidence abstains** rather than scoring zero or, worse, full marks. A run
|
||||
without a VEP cache returns no allele frequencies, and scoring every variant 1.0 for rarity because
|
||||
nobody consulted gnomAD is a guess wearing the costume of a measurement. The job records what the
|
||||
run produced, absent components are dropped, and the remaining weights are renormalised so the
|
||||
score still means the same thing. The model abstains without CADD or AlphaMissense for a related
|
||||
reason: with only the consequence class it achieves AUROC 0.500 on missense variants, so it would
|
||||
be restating the consequence component rather than adding evidence. See docs/data.md.
|
||||
|
||||
**ClinVar is deliberately not an input.** It sits beside the result as independent confirmation, so
|
||||
the demo never ranks a variant highly merely because ClinVar already called it pathogenic. On the
|
||||
|
||||
Reference in New Issue
Block a user