polygenic-pgx 2.6.1__tar.gz → 2.6.2__tar.gz

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.
Files changed (113) hide show
  1. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/CHANGELOG.md +30 -0
  2. {polygenic_pgx-2.6.1/polygenic_pgx.egg-info → polygenic_pgx-2.6.2}/PKG-INFO +31 -1
  3. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/README.md +30 -0
  4. polygenic_pgx-2.6.2/polygenic/model/hgnc.json +46 -0
  5. polygenic_pgx-2.6.2/polygenic/model/indel_alignment.py +49 -0
  6. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/model/model.py +70 -3
  7. polygenic_pgx-2.6.2/polygenic/models/pgx/cyp1a1-pharmgkb-1.0.0.yml +82 -0
  8. polygenic_pgx-2.6.2/polygenic/models/pgx/cyp1a2-pharmvar-6.2.25.yml +396 -0
  9. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2a13-pharmvar-6.2.29.yml +3 -3
  10. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2a6-pharmvar-6.2.29.yml +80 -80
  11. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2c19-pharmvar-6.2.29.yml +5 -5
  12. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2c9-pharmvar-6.2.29.yml +8 -8
  13. polygenic_pgx-2.6.2/polygenic/models/pgx/cyp2e1-pharmgkb-1.0.0.yml +83 -0
  14. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp3a4-pharmvar-6.2.29.yml +5 -5
  15. polygenic_pgx-2.6.2/polygenic/models/pgx/dpyd-clinpgx-1.0.0.yml +441 -0
  16. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/dpyd-pharmvar-6.2.29.yml +4 -4
  17. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/manifest.json +210 -30
  18. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/nudt15-pharmvar-6.2.29.yml +12 -12
  19. polygenic_pgx-2.6.2/polygenic/models/pgx/ugt2b15-pharmgkb-1.0.0.yml +60 -0
  20. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/version.py +1 -1
  21. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2/polygenic_pgx.egg-info}/PKG-INFO +31 -1
  22. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic_pgx.egg-info/SOURCES.txt +6 -0
  23. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/setup.py +1 -1
  24. polygenic_pgx-2.6.1/polygenic/model/hgnc.json +0 -42
  25. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/LICENSE +0 -0
  26. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/MANIFEST.in +0 -0
  27. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/__init__.py +0 -0
  28. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/__main__.py +0 -0
  29. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/__init__.py +0 -0
  30. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/csv_accessor.py +0 -0
  31. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/data_accessor.py +0 -0
  32. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/gwas.py +0 -0
  33. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/mobigen_utils.py +0 -0
  34. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/polars_frame.py +0 -0
  35. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/snp_data.py +0 -0
  36. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/vcf_accessor.py +0 -0
  37. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/data/vcf_record.py +0 -0
  38. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/error/__init__.py +0 -0
  39. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/error/polygenic_exception.py +0 -0
  40. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/model/__init__.py +0 -0
  41. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/model/cnv_depth.py +0 -0
  42. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/model/panel.py +0 -0
  43. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/model/registry.py +0 -0
  44. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/model/summary.py +0 -0
  45. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/model/utils.py +0 -0
  46. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/abcg2-pharmgkb-1.0.0.yml +0 -0
  47. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/apoe-1.0.0.yml +0 -0
  48. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/bche-1.0.0.yml +0 -0
  49. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cacna1s-pharmgkb-1.0.0.yml +0 -0
  50. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cftr-pharmgkb-1.0.0.yml +0 -0
  51. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/comt-1.0.0.yml +0 -0
  52. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp26a1-pharmvar-5.1.8.yml +0 -0
  53. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2b6-pharmvar-6.2.29.yml +0 -0
  54. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2c8-pharmvar-5.1.8.yml +0 -0
  55. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2d6-pharmvar-5.1.8.yml +0 -0
  56. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2f1-pharmvar-5.1.8.yml +0 -0
  57. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2j2-pharmvar-5.1.8.yml +0 -0
  58. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2r1-pharmvar-5.1.8.yml +0 -0
  59. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2s1-pharmvar-5.1.8.yml +0 -0
  60. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp2w1-pharmvar-5.1.8.yml +0 -0
  61. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp3a43-pharmvar-5.1.8.yml +0 -0
  62. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp3a5-pharmvar-6.2.29.yml +0 -0
  63. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp3a7-pharmvar-5.1.8.yml +0 -0
  64. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/cyp4f2-pharmvar-5.1.8.yml +0 -0
  65. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/f2-1.0.0.yml +0 -0
  66. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/f5-1.0.0.yml +0 -0
  67. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/g6pd-pharmgkb-1.0.0.yml +0 -0
  68. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/ifnl3-1.0.0.yml +0 -0
  69. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/ifnl4-1.0.0.yml +0 -0
  70. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/mthfr-1.0.0.yml +0 -0
  71. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/mtrnr1-cpic-1.0.0.yml +0 -0
  72. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/nat2-pharmvar-6.2.29.yml +0 -0
  73. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/oprm1-1.0.0.yml +0 -0
  74. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/ryr1-pharmgkb-1.0.0.yml +0 -0
  75. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/slco1b1-pharmvar-6.2.29.yml +0 -0
  76. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/tpmt-cpic-1.0.0.yml +0 -0
  77. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/ugt1a1-pharmgkb-1.0.0.yml +0 -0
  78. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/models/pgx/vkorc1-1.0.0.yml +0 -0
  79. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/pgstk.py +0 -0
  80. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/resources/chromsizes/hg38.chrom.sizes +0 -0
  81. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/rsidx/__init__.py +0 -0
  82. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/rsidx/__main__.py +0 -0
  83. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/rsidx/_version.py +0 -0
  84. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/rsidx/cli.py +0 -0
  85. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/rsidx/index.py +0 -0
  86. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/rsidx/search.py +0 -0
  87. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/templates/pgscompute-header.md +0 -0
  88. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/templates/pgscompute-model.md +0 -0
  89. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/__init__.py +0 -0
  90. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/data/__init__.py +0 -0
  91. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/data/chromsizes.py +0 -0
  92. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/data/colors.py +0 -0
  93. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/gwasfilecreate.py +0 -0
  94. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/modelbiobankuk.py +0 -0
  95. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/modeldiff.py +0 -0
  96. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/modelgwasfile.py +0 -0
  97. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/modellist.py +0 -0
  98. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/modelmanifest.py +0 -0
  99. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/modelpgscat.py +0 -0
  100. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/pgscompute.py +0 -0
  101. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/plotmanhattan.py +0 -0
  102. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/tsvtovcf.py +0 -0
  103. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/utils.py +0 -0
  104. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/vcfimpute.py +0 -0
  105. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/vcfindex.py +0 -0
  106. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/vcfstatbaf.py +0 -0
  107. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic/tools/vcfstatzygosity.py +0 -0
  108. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic_pgx.egg-info/dependency_links.txt +0 -0
  109. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic_pgx.egg-info/entry_points.txt +0 -0
  110. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic_pgx.egg-info/requires.txt +0 -0
  111. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/polygenic_pgx.egg-info/top_level.txt +0 -0
  112. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/pyproject.toml +0 -0
  113. {polygenic_pgx-2.6.1 → polygenic_pgx-2.6.2}/setup.cfg +0 -0
@@ -3,6 +3,36 @@
3
3
  Release history for `polygenic-pgx`. Newest first. The three most recent entries are also
4
4
  repeated in `README.md` (which is the PyPI project page).
5
5
 
6
+ ### 2.6.2
7
+
8
+ **DPYD \*3 and \*7 are callable again, and six other models with them.** `3204249` (2.5.29)
9
+ left-aligned every model's indel keys; `642b702` regenerated 11 genes straight from the PharmVar
10
+ 6.2.29 export and silently reverted it, because the generator had no normalization step. Variants
11
+ are matched by the exact `chrom-pos-ref-alt` key, so a right-shifted key never matches a
12
+ `bcftools norm`-ed VCF -- and the miss is silent, since the Indeterminate verdict only considers
13
+ variants present in the VCF. DPYD \*3 and \*7 are each defined by their indel alone in 6.2.29,
14
+ so they were unreachable, not merely degraded; both are no-function for fluoropyrimidines.
15
+ 28 keys across cyp2a6, nudt15, cyp2c9, cyp2c19, dpyd, cyp3a4 and cyp2a13 are rebuilt and
16
+ left-aligned, with normalization now inside `rebuild_pharmvar.py` (`--ref` required) and enforced
17
+ by a reference-free CI check.
18
+
19
+ **Up to 10x faster, and bounded.** `compute_haplotype` deepcopied the whole genotype dict twice
20
+ per haplotype -- 92% of runtime on DPYD. One WGS sample went 33.8s -> 3.4s and the unit suite
21
+ 841s -> 229s, with byte-identical results. Separately, the tied-haplotype second round is now
22
+ bounded by `max_first_haplotypes` (default 200): dpyd-pharmvar over 20 samples went from not
23
+ finishing in 1200s to 26.9s. When the bound bites the engine returns a no-call
24
+ (`reason: too_many_tied_haplotypes`) rather than the best of a truncated search, because that is
25
+ how a performance bound otherwise becomes a wrong answer.
26
+
27
+ **Five more models (45 total).** CYP1A1, CYP1A2, CYP2E1 and UGT2B15 reach customer reports but had
28
+ never been packaged; they are now vendored verbatim from the deployed tree. **UGT2B15 \*2/\*5 are
29
+ defined by the GRCh38 reference base at `4-68670366`**, so without a `reference_defining_variants`
30
+ declaration an unassayed sample reported a confident homozygous call instead of Indeterminate --
31
+ declared and fixed. DPYD now also ships as `dpyd-clinpgx-1.0.0` (84 alleles, CPIC/HGVS names)
32
+ beside the PharmVar build, so the gene can be joined to the CPIC function tables again.
33
+ **Breaking:** `-m dpyd` is therefore ambiguous and raises -- pass `-m dpyd-clinpgx-1.0.0` or
34
+ `-m dpyd-pharmvar-6.2.29`.
35
+
6
36
  ### 2.6.1
7
37
 
8
38
  **Haplotype assembly no longer chains across `FORMAT/PS` phase sets.** The engine never read
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polygenic-pgx
3
- Version: 2.6.1
3
+ Version: 2.6.2
4
4
  Summary: Polygenic score toolkit
5
5
  Home-page: https://github.com/marpiech/polygenic
6
6
  Author: Marcin Piechota, Wojciech Galan
@@ -555,6 +555,36 @@ Proprietary (contact@intelliseq.pl)
555
555
 
556
556
  ## Updates
557
557
 
558
+ ### 2.6.2
559
+
560
+ **DPYD \*3 and \*7 are callable again, and six other models with them.** `3204249` (2.5.29)
561
+ left-aligned every model's indel keys; `642b702` regenerated 11 genes straight from the PharmVar
562
+ 6.2.29 export and silently reverted it, because the generator had no normalization step. Variants
563
+ are matched by the exact `chrom-pos-ref-alt` key, so a right-shifted key never matches a
564
+ `bcftools norm`-ed VCF -- and the miss is silent, since the Indeterminate verdict only considers
565
+ variants present in the VCF. DPYD \*3 and \*7 are each defined by their indel alone in 6.2.29,
566
+ so they were unreachable, not merely degraded; both are no-function for fluoropyrimidines.
567
+ 28 keys across cyp2a6, nudt15, cyp2c9, cyp2c19, dpyd, cyp3a4 and cyp2a13 are rebuilt and
568
+ left-aligned, with normalization now inside `rebuild_pharmvar.py` (`--ref` required) and enforced
569
+ by a reference-free CI check.
570
+
571
+ **Up to 10x faster, and bounded.** `compute_haplotype` deepcopied the whole genotype dict twice
572
+ per haplotype -- 92% of runtime on DPYD. One WGS sample went 33.8s -> 3.4s and the unit suite
573
+ 841s -> 229s, with byte-identical results. Separately, the tied-haplotype second round is now
574
+ bounded by `max_first_haplotypes` (default 200): dpyd-pharmvar over 20 samples went from not
575
+ finishing in 1200s to 26.9s. When the bound bites the engine returns a no-call
576
+ (`reason: too_many_tied_haplotypes`) rather than the best of a truncated search, because that is
577
+ how a performance bound otherwise becomes a wrong answer.
578
+
579
+ **Five more models (45 total).** CYP1A1, CYP1A2, CYP2E1 and UGT2B15 reach customer reports but had
580
+ never been packaged; they are now vendored verbatim from the deployed tree. **UGT2B15 \*2/\*5 are
581
+ defined by the GRCh38 reference base at `4-68670366`**, so without a `reference_defining_variants`
582
+ declaration an unassayed sample reported a confident homozygous call instead of Indeterminate --
583
+ declared and fixed. DPYD now also ships as `dpyd-clinpgx-1.0.0` (84 alleles, CPIC/HGVS names)
584
+ beside the PharmVar build, so the gene can be joined to the CPIC function tables again.
585
+ **Breaking:** `-m dpyd` is therefore ambiguous and raises -- pass `-m dpyd-clinpgx-1.0.0` or
586
+ `-m dpyd-pharmvar-6.2.29`.
587
+
558
588
  ### 2.6.1
559
589
 
560
590
  **Haplotype assembly no longer chains across `FORMAT/PS` phase sets.** The engine never read
@@ -509,6 +509,36 @@ Proprietary (contact@intelliseq.pl)
509
509
 
510
510
  ## Updates
511
511
 
512
+ ### 2.6.2
513
+
514
+ **DPYD \*3 and \*7 are callable again, and six other models with them.** `3204249` (2.5.29)
515
+ left-aligned every model's indel keys; `642b702` regenerated 11 genes straight from the PharmVar
516
+ 6.2.29 export and silently reverted it, because the generator had no normalization step. Variants
517
+ are matched by the exact `chrom-pos-ref-alt` key, so a right-shifted key never matches a
518
+ `bcftools norm`-ed VCF -- and the miss is silent, since the Indeterminate verdict only considers
519
+ variants present in the VCF. DPYD \*3 and \*7 are each defined by their indel alone in 6.2.29,
520
+ so they were unreachable, not merely degraded; both are no-function for fluoropyrimidines.
521
+ 28 keys across cyp2a6, nudt15, cyp2c9, cyp2c19, dpyd, cyp3a4 and cyp2a13 are rebuilt and
522
+ left-aligned, with normalization now inside `rebuild_pharmvar.py` (`--ref` required) and enforced
523
+ by a reference-free CI check.
524
+
525
+ **Up to 10x faster, and bounded.** `compute_haplotype` deepcopied the whole genotype dict twice
526
+ per haplotype -- 92% of runtime on DPYD. One WGS sample went 33.8s -> 3.4s and the unit suite
527
+ 841s -> 229s, with byte-identical results. Separately, the tied-haplotype second round is now
528
+ bounded by `max_first_haplotypes` (default 200): dpyd-pharmvar over 20 samples went from not
529
+ finishing in 1200s to 26.9s. When the bound bites the engine returns a no-call
530
+ (`reason: too_many_tied_haplotypes`) rather than the best of a truncated search, because that is
531
+ how a performance bound otherwise becomes a wrong answer.
532
+
533
+ **Five more models (45 total).** CYP1A1, CYP1A2, CYP2E1 and UGT2B15 reach customer reports but had
534
+ never been packaged; they are now vendored verbatim from the deployed tree. **UGT2B15 \*2/\*5 are
535
+ defined by the GRCh38 reference base at `4-68670366`**, so without a `reference_defining_variants`
536
+ declaration an unassayed sample reported a confident homozygous call instead of Indeterminate --
537
+ declared and fixed. DPYD now also ships as `dpyd-clinpgx-1.0.0` (84 alleles, CPIC/HGVS names)
538
+ beside the PharmVar build, so the gene can be joined to the CPIC function tables again.
539
+ **Breaking:** `-m dpyd` is therefore ambiguous and raises -- pass `-m dpyd-clinpgx-1.0.0` or
540
+ `-m dpyd-pharmvar-6.2.29`.
541
+
512
542
  ### 2.6.1
513
543
 
514
544
  **Haplotype assembly no longer chains across `FORMAT/PS` phase sets.** The engine never read
@@ -0,0 +1,46 @@
1
+ {
2
+ "ABCG2": "HGNC:74",
3
+ "APOE": "HGNC:613",
4
+ "BCHE": "HGNC:983",
5
+ "CACNA1S": "HGNC:1397",
6
+ "CFTR": "HGNC:1884",
7
+ "COMT": "HGNC:2228",
8
+ "CYP1A1": "HGNC:2595",
9
+ "CYP1A2": "HGNC:2596",
10
+ "CYP26A1": "HGNC:2603",
11
+ "CYP2A13": "HGNC:2608",
12
+ "CYP2A6": "HGNC:2610",
13
+ "CYP2B6": "HGNC:2615",
14
+ "CYP2C19": "HGNC:2621",
15
+ "CYP2C8": "HGNC:2622",
16
+ "CYP2C9": "HGNC:2623",
17
+ "CYP2D6": "HGNC:2625",
18
+ "CYP2E1": "HGNC:2631",
19
+ "CYP2F1": "HGNC:2632",
20
+ "CYP2J2": "HGNC:2634",
21
+ "CYP2R1": "HGNC:20580",
22
+ "CYP2S1": "HGNC:15654",
23
+ "CYP2W1": "HGNC:20243",
24
+ "CYP3A4": "HGNC:2637",
25
+ "CYP3A43": "HGNC:17450",
26
+ "CYP3A5": "HGNC:2638",
27
+ "CYP3A7": "HGNC:2640",
28
+ "CYP4F2": "HGNC:2645",
29
+ "DPYD": "HGNC:3012",
30
+ "F2": "HGNC:3535",
31
+ "F5": "HGNC:3542",
32
+ "G6PD": "HGNC:4057",
33
+ "IFNL3": "HGNC:18365",
34
+ "IFNL4": "HGNC:44480",
35
+ "MT-RNR1": "HGNC:7470",
36
+ "MTHFR": "HGNC:7436",
37
+ "NAT2": "HGNC:7646",
38
+ "NUDT15": "HGNC:23063",
39
+ "OPRM1": "HGNC:8156",
40
+ "RYR1": "HGNC:10483",
41
+ "SLCO1B1": "HGNC:10959",
42
+ "TPMT": "HGNC:12014",
43
+ "UGT1A1": "HGNC:12530",
44
+ "UGT2B15": "HGNC:12546",
45
+ "VKORC1": "HGNC:23663"
46
+ }
@@ -0,0 +1,49 @@
1
+ """Detect indel variant keys that are not left-aligned, without a reference FASTA.
2
+
3
+ Why this exists: variants are matched by the exact key `chrom-pos-ref-alt`, so a model key in a
4
+ different-but-equivalent indel representation silently never matches the VCF record. The sample is
5
+ not flagged either, because the Indeterminate verdict is computed from variants present in the VCF
6
+ — an unmatched key looks like a variant the model simply does not care about. A carrier of a
7
+ no-function allele then gets a call without it. That is how DPYD*3/*7 went missing after the
8
+ PharmVar 6.2.29 rebuild (`642b702`), which regenerated the models and thereby reverted the
9
+ one-off normalization done in 2.5.29 (`3204249`).
10
+
11
+ The reference-free trick: a simple anchored indel can be shifted one base LEFT exactly when the
12
+ base rotated out of the repeat matches the anchor base.
13
+
14
+ deletion REF = anchor + deleted, ALT = anchor -> shiftable iff REF[0] == REF[-1]
15
+ insertion REF = anchor, ALT = anchor + inserted -> shiftable iff ALT[0] == ALT[-1]
16
+
17
+ If it cannot shift left by one, it is already left-aligned. No genome sequence is needed, so this
18
+ runs in CI without shipping a 3 GB FASTA. Verified against `bcftools norm -f GRCh38` over the
19
+ packaged models: it flags the same 7 models, key for key.
20
+
21
+ This detects; it does not fix. Rewriting a key to its left-aligned form needs the real sequence —
22
+ use `getrm_validation/normalize_indels.py` (bcftools norm), which `rebuild_pharmvar.py` now calls.
23
+ """
24
+ import re
25
+
26
+ # chrom-pos-ref-alt, the variant-key grammar used throughout the model YAMLs.
27
+ VARIANT_KEY = re.compile(r"\b(\d+|X|Y|MT)-(\d+)-([ACGTN]+)-([ACGTN]+)\b")
28
+
29
+
30
+ def is_left_shiftable(ref, alt):
31
+ """True if this indel can still move left, i.e. it is NOT left-aligned.
32
+
33
+ Returns None for anything that is not a simple anchored indel (SNVs, MNPs, complex
34
+ substitutions) — those have no single canonical shift and are left alone.
35
+ """
36
+ if len(ref) > 1 and len(alt) == 1 and ref[0] == alt[0]:
37
+ return ref[0] == ref[-1]
38
+ if len(alt) > 1 and len(ref) == 1 and alt[0] == ref[0]:
39
+ return alt[0] == alt[-1]
40
+ return None
41
+
42
+
43
+ def find_shiftable_keys(text):
44
+ """Every distinct non-left-aligned indel key in a model YAML's text, sorted."""
45
+ found = set()
46
+ for chrom, pos, ref, alt in VARIANT_KEY.findall(text):
47
+ if is_left_shiftable(ref, alt):
48
+ found.add("{}-{}-{}-{}".format(chrom, pos, ref, alt))
49
+ return sorted(found)
@@ -517,7 +517,11 @@ class HaplotypeModel(SeqqlOperator):
517
517
  genotypes = self._entries["haplotypes"].compute_genotypes(data_accessor, genotypes)
518
518
  # caclualte match scores
519
519
  top_n = data_accessor.get_parameters().get('top_n', 15)
520
- haplotypes = self._entries["haplotypes"].compute_haplotypes(genotypes, top_n=top_n)
520
+ # Bound on how many tied first-round haplotypes enter the pairwise second round. 0 or
521
+ # None means unlimited, i.e. the pre-2.6.2 behaviour. See compute_haplotypes.
522
+ max_first = data_accessor.get_parameters().get('max_first_haplotypes', 200)
523
+ haplotypes = self._entries["haplotypes"].compute_haplotypes(
524
+ genotypes, top_n=top_n, max_first_haplotypes=max_first)
521
525
 
522
526
  result["haplotypes"] = haplotypes
523
527
  result["genotypes"] = genotypes
@@ -987,7 +991,8 @@ class Haplotypes(SeqqlOperator):
987
991
  for hid in self._entries
988
992
  if getattr(self._entries[hid], "structural", None) is not None}
989
993
 
990
- def compute_haplotypes(self, genotypes: dict, top_n: int = 15):
994
+ def compute_haplotypes(self, genotypes: dict, top_n: int = 15,
995
+ max_first_haplotypes: int = 200):
991
996
  # Early-out: with no covered slot (every panel variant missing or filtered) there is
992
997
  # no information to call a haplotype. Tie-scoring all candidates would be O(n^2) for no
993
998
  # gain and would pick a bogus reference-ish call from no data. Return a no-call; the
@@ -1021,9 +1026,58 @@ class Haplotypes(SeqqlOperator):
1021
1026
  HAPLOTYPE_IDX = 1 # haplotype is a tupple [ID, HAPLOTYPE]
1022
1027
 
1023
1028
  max_percent_match = sorted_haplotypes[FIRST_SORTED_ELEMENT][HAPLOTYPE_IDX]['max_percent_match']
1029
+ # The second round below is |best_matching| x |candidates| calls to compute_haplotype,
1030
+ # each iterating every model variant. `candidate_haplotypes` has always been capped at
1031
+ # 100 for exactly that reason, but `best_matching_haplotypes` was not capped at all: it
1032
+ # takes every haplotype within 0.02 of the top score, which on an UNINFORMATIVE sample is
1033
+ # most of the model, because haplotypes whose defining variants are all missing score
1034
+ # identically. Measured on DPYD (460 alleles) with two samples whose inputs are the same
1035
+ # size: 763 calls / 1.8 s for one, 43 789 calls / 89 s for the other. Twenty such samples
1036
+ # did not finish in 1200 s.
1037
+ #
1038
+ # The cap keeps the FIRST max_first_haplotypes in the established ranking, which is
1039
+ # already "best match first, ties broken by fewest missing genotypes" (the two sorts
1040
+ # above), so what gets dropped is the tail of equally-scoring alleles that the second
1041
+ # round would have re-ranked anyway. It bounds the work at max_first x ~100.
1042
+ #
1043
+ # 200 is chosen from the measured distribution over the GeT-RM fixture set, NOT picked
1044
+ # for symmetry with the candidate cap. |best_matching| per model, 20 samples each:
1045
+ #
1046
+ # cyp4f2 / tpmt / dpyd-clinpgx / nudt15 max 2-4
1047
+ # cyp2c8 / cyp2a6 / slco1b1 / cyp3a4/5 max 6-14
1048
+ # cyp2c19 17, cyp2d6 35
1049
+ # cyp2c9 median 140, MAX 153 <- scores 100% concordant; must not be clipped
1050
+ # dpyd-pharmvar median 427, max 429 (of 460 alleles) <- the degenerate case
1051
+ #
1052
+ # So a cap of 100 or 150 would have clipped CYP2C9, which is the gene with perfect
1053
+ # concordance; 200 sits above every non-degenerate observation and still bounds DPYD.
1054
+ # Equivalence was verified call-by-call, not assumed: 231 calls over 13 gene/model pairs
1055
+ # on the CI fixtures plus 120 over the full cached GeT-RM set, all identical to the
1056
+ # unbounded result. See docs/models-pgx-memory.md. Set `max_first_haplotypes` to 0 to restore the old
1057
+ # unbounded behaviour.
1024
1058
  for haplotype in sorted_haplotypes:
1025
1059
  if haplotype[1]['max_percent_match'] >= (max_percent_match - 0.02):
1026
1060
  best_matching_haplotypes[haplotype[ID_IDX]] = haplotype[HAPLOTYPE_IDX]
1061
+ self.last_best_matching_count = len(best_matching_haplotypes)
1062
+ if max_first_haplotypes and len(best_matching_haplotypes) > max_first_haplotypes:
1063
+ # The cap BIT, so the pairwise search below would only ever see a subset and its
1064
+ # winner is "best of what we looked at", not "best". Emitting that as a call is how
1065
+ # a bound turns into a wrong answer: measured on DPYD HG00185, truncating 429 ties
1066
+ # to the top 200 produced a confident `*1.001/*1.001` where the full search produced
1067
+ # no call -- and that sample carries rs3918290 (c.1905+1G>A, *2A) het, a NO-FUNCTION
1068
+ # allele for fluoropyrimidines. Reporting a normal metabolizer there is exactly the
1069
+ # failure this engine must not have.
1070
+ #
1071
+ # So when the cap bites we decline instead of guessing. A no-call surfaces as
1072
+ # Indeterminate downstream, which is the honest answer for a sample whose data does
1073
+ # not discriminate between hundreds of alleles. This never fires on a gene that
1074
+ # discriminates at all: over the GeT-RM fixture set the largest non-degenerate
1075
+ # |best_matching| is 153 (CYP2C9, 100% concordant), against DPYD's 427-429 of 460.
1076
+ return {"haplotype_id": None, "id": None,
1077
+ "matching_haplotypes": [], "unexcluded_haplotypes": [], "haplotypes": {},
1078
+ "reason": "too_many_tied_haplotypes",
1079
+ "tied_haplotypes": self.last_best_matching_count,
1080
+ "tied_haplotype_limit": max_first_haplotypes}
1027
1081
  counter = 0
1028
1082
  for haplotype in sorted_haplotypes:
1029
1083
  candidate_haplotypes[haplotype[ID_IDX]] = haplotype[HAPLOTYPE_IDX]
@@ -1249,7 +1303,20 @@ class Haplotype(SeqqlOperator):
1249
1303
  percent_weight_genotypes_missing = [0, 0] # percent of genotypes missing
1250
1304
  percent_weight_variants_missing = [0, 0] # percent of variants missing
1251
1305
 
1252
- leftover_genotypes = [copy.deepcopy(genotypes), copy.deepcopy(genotypes)] # genotypes left to match in econd round
1306
+ # Genotypes left to match in the second round, one per phase orientation.
1307
+ #
1308
+ # This was `copy.deepcopy(genotypes)` twice, which profiled at 92% of total runtime on
1309
+ # DPYD (31.2 s of 33.8 s; 19.8M deepcopy calls, because the dict is copied in full for
1310
+ # every one of 460 haplotypes). A deepcopy is far more than this needs: the ONLY thing
1311
+ # ever written on these copies is `["genotype"]["genotype"]`, and it is always REPLACED
1312
+ # with a fresh list rather than mutated in place (see the assignments below). So copying
1313
+ # two levels - the per-variant entry and its inner "genotype" dict - fully isolates the
1314
+ # writes, and everything deeper can be shared because it is read-only from here on.
1315
+ leftover_genotypes = [
1316
+ {variant_id: {**genotype, "genotype": {**genotype["genotype"]}}
1317
+ for variant_id, genotype in genotypes.items()}
1318
+ for _ in range(2)
1319
+ ]
1253
1320
 
1254
1321
  # iterate over genotypes
1255
1322
  for genotype_id in genotypes:
@@ -0,0 +1,82 @@
1
+ # CYP1A1 - vendored verbatim from the deployed tree on anakin, 2026-10-07.
2
+ # source: /projects/cromwell/resources/workflows/pgx/models-pharmgkb/06.2026/CYP1A1.yml
3
+ # sha256(body below this header): c03c5614dbda7e306c1a2198d0eb9e4e8bb439f7ac7e60d3ac19c8112e9e65ad
4
+ # Content is UNCHANGED; only this header was added. Do not reformat - the style
5
+ # differences between streams are deliberate (see docs/models-pgx-memory.md).
6
+ haplotype_model:
7
+ haplotypes:
8
+ 'CYP1A1*1': null
9
+ 'CYP1A1*10':
10
+ 15-74720599-G-A:
11
+ alt: A
12
+ effect_allele: A
13
+ ref: G
14
+ 'CYP1A1*11':
15
+ 15-74720553-G-C:
16
+ alt: C
17
+ effect_allele: C
18
+ ref: G
19
+ 'CYP1A1*12':
20
+ 15-74722914-C-G:
21
+ alt: G
22
+ effect_allele: G
23
+ ref: C
24
+ 'CYP1A1*13':
25
+ 15-74722964-C-T:
26
+ alt: T
27
+ effect_allele: T
28
+ ref: C
29
+ 'CYP1A1*2A':
30
+ 15-74719300-A-G:
31
+ alt: G
32
+ effect_allele: G
33
+ ref: A
34
+ 'CYP1A1*2B':
35
+ 15-74719300-A-G:
36
+ alt: G
37
+ effect_allele: G
38
+ ref: A
39
+ 15-74720644-T-C:
40
+ alt: C
41
+ effect_allele: C
42
+ ref: T
43
+ 'CYP1A1*2C':
44
+ 15-74720644-T-C:
45
+ alt: C
46
+ effect_allele: C
47
+ ref: T
48
+ 'CYP1A1*3':
49
+ 15-74719894-A-G:
50
+ alt: G
51
+ effect_allele: G
52
+ ref: A
53
+ 'CYP1A1*4':
54
+ 15-74720646-G-T:
55
+ alt: T
56
+ effect_allele: T
57
+ ref: G
58
+ 'CYP1A1*5':
59
+ 15-74720638-G-T:
60
+ alt: T
61
+ effect_allele: T
62
+ ref: G
63
+ 'CYP1A1*6':
64
+ 15-74721463-C-A:
65
+ alt: A
66
+ effect_allele: A
67
+ ref: C
68
+ 'CYP1A1*7':
69
+ 15-74720752-C-CA:
70
+ alt: CA
71
+ effect_allele: CA
72
+ ref: C
73
+ 'CYP1A1*8':
74
+ 15-74720685-A-T:
75
+ alt: T
76
+ effect_allele: T
77
+ ref: A
78
+ 'CYP1A1*9':
79
+ 15-74720638-G-A:
80
+ alt: A
81
+ effect_allele: A
82
+ ref: G