polygenic-pgx 2.6.2__tar.gz → 2.6.4__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 (119) hide show
  1. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/CHANGELOG.md +46 -2
  2. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/MANIFEST.in +4 -0
  3. {polygenic_pgx-2.6.2/polygenic_pgx.egg-info → polygenic_pgx-2.6.4}/PKG-INFO +47 -3
  4. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/README.md +46 -2
  5. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/data_accessor.py +8 -1
  6. polygenic_pgx-2.6.4/polygenic/model/core_variants.py +84 -0
  7. polygenic_pgx-2.6.4/polygenic/model/gene_defaults.json +33 -0
  8. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/model.py +602 -27
  9. polygenic_pgx-2.6.4/polygenic/model/registry.py +612 -0
  10. polygenic_pgx-2.6.4/polygenic/model/source_releases.json +32 -0
  11. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/summary.py +15 -3
  12. polygenic_pgx-2.6.4/polygenic/models/pgx/cyp2c19-pharmvar-5.1.8.yml +425 -0
  13. polygenic_pgx-2.6.4/polygenic/models/pgx/cyp4f2-pharmvar-6.2.29.yml +209 -0
  14. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/dpyd-clinpgx-1.0.0.yml +110 -1
  15. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/manifest.json +254 -34
  16. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/pgstk.py +30 -0
  17. polygenic_pgx-2.6.4/polygenic/tools/modellist.py +283 -0
  18. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/modelmanifest.py +62 -20
  19. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/pgscompute.py +13 -2
  20. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/version.py +1 -1
  21. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4/polygenic_pgx.egg-info}/PKG-INFO +47 -3
  22. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic_pgx.egg-info/SOURCES.txt +5 -1
  23. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/setup.py +3 -2
  24. polygenic_pgx-2.6.2/polygenic/model/registry.py +0 -255
  25. polygenic_pgx-2.6.2/polygenic/models/pgx/cyp4f2-pharmvar-5.1.8.yml +0 -28
  26. polygenic_pgx-2.6.2/polygenic/tools/modellist.py +0 -150
  27. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/LICENSE +0 -0
  28. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/__init__.py +0 -0
  29. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/__main__.py +0 -0
  30. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/__init__.py +0 -0
  31. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/csv_accessor.py +0 -0
  32. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/gwas.py +0 -0
  33. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/mobigen_utils.py +0 -0
  34. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/polars_frame.py +0 -0
  35. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/snp_data.py +0 -0
  36. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/vcf_accessor.py +0 -0
  37. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/data/vcf_record.py +0 -0
  38. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/error/__init__.py +0 -0
  39. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/error/polygenic_exception.py +0 -0
  40. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/__init__.py +0 -0
  41. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/cnv_depth.py +0 -0
  42. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/hgnc.json +0 -0
  43. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/indel_alignment.py +0 -0
  44. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/panel.py +0 -0
  45. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/model/utils.py +0 -0
  46. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/abcg2-pharmgkb-1.0.0.yml +0 -0
  47. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/apoe-1.0.0.yml +0 -0
  48. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/bche-1.0.0.yml +0 -0
  49. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cacna1s-pharmgkb-1.0.0.yml +0 -0
  50. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cftr-pharmgkb-1.0.0.yml +0 -0
  51. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/comt-1.0.0.yml +0 -0
  52. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp1a1-pharmgkb-1.0.0.yml +0 -0
  53. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp1a2-pharmvar-6.2.25.yml +0 -0
  54. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp26a1-pharmvar-5.1.8.yml +0 -0
  55. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2a13-pharmvar-6.2.29.yml +0 -0
  56. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2a6-pharmvar-6.2.29.yml +0 -0
  57. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2b6-pharmvar-6.2.29.yml +0 -0
  58. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2c19-pharmvar-6.2.29.yml +0 -0
  59. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2c8-pharmvar-5.1.8.yml +0 -0
  60. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2c9-pharmvar-6.2.29.yml +0 -0
  61. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2d6-pharmvar-5.1.8.yml +0 -0
  62. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2e1-pharmgkb-1.0.0.yml +0 -0
  63. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2f1-pharmvar-5.1.8.yml +0 -0
  64. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2j2-pharmvar-5.1.8.yml +0 -0
  65. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2r1-pharmvar-5.1.8.yml +0 -0
  66. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2s1-pharmvar-5.1.8.yml +0 -0
  67. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp2w1-pharmvar-5.1.8.yml +0 -0
  68. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp3a4-pharmvar-6.2.29.yml +0 -0
  69. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp3a43-pharmvar-5.1.8.yml +0 -0
  70. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp3a5-pharmvar-6.2.29.yml +0 -0
  71. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/cyp3a7-pharmvar-5.1.8.yml +0 -0
  72. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/dpyd-pharmvar-6.2.29.yml +0 -0
  73. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/f2-1.0.0.yml +0 -0
  74. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/f5-1.0.0.yml +0 -0
  75. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/g6pd-pharmgkb-1.0.0.yml +0 -0
  76. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/ifnl3-1.0.0.yml +0 -0
  77. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/ifnl4-1.0.0.yml +0 -0
  78. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/mthfr-1.0.0.yml +0 -0
  79. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/mtrnr1-cpic-1.0.0.yml +0 -0
  80. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/nat2-pharmvar-6.2.29.yml +0 -0
  81. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/nudt15-pharmvar-6.2.29.yml +0 -0
  82. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/oprm1-1.0.0.yml +0 -0
  83. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/ryr1-pharmgkb-1.0.0.yml +0 -0
  84. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/slco1b1-pharmvar-6.2.29.yml +0 -0
  85. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/tpmt-cpic-1.0.0.yml +0 -0
  86. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/ugt1a1-pharmgkb-1.0.0.yml +0 -0
  87. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/ugt2b15-pharmgkb-1.0.0.yml +0 -0
  88. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/models/pgx/vkorc1-1.0.0.yml +0 -0
  89. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/resources/chromsizes/hg38.chrom.sizes +0 -0
  90. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/rsidx/__init__.py +0 -0
  91. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/rsidx/__main__.py +0 -0
  92. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/rsidx/_version.py +0 -0
  93. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/rsidx/cli.py +0 -0
  94. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/rsidx/index.py +0 -0
  95. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/rsidx/search.py +0 -0
  96. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/templates/pgscompute-header.md +0 -0
  97. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/templates/pgscompute-model.md +0 -0
  98. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/__init__.py +0 -0
  99. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/data/__init__.py +0 -0
  100. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/data/chromsizes.py +0 -0
  101. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/data/colors.py +0 -0
  102. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/gwasfilecreate.py +0 -0
  103. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/modelbiobankuk.py +0 -0
  104. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/modeldiff.py +0 -0
  105. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/modelgwasfile.py +0 -0
  106. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/modelpgscat.py +0 -0
  107. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/plotmanhattan.py +0 -0
  108. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/tsvtovcf.py +0 -0
  109. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/utils.py +0 -0
  110. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/vcfimpute.py +0 -0
  111. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/vcfindex.py +0 -0
  112. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/vcfstatbaf.py +0 -0
  113. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic/tools/vcfstatzygosity.py +0 -0
  114. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic_pgx.egg-info/dependency_links.txt +0 -0
  115. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic_pgx.egg-info/entry_points.txt +0 -0
  116. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic_pgx.egg-info/requires.txt +0 -0
  117. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/polygenic_pgx.egg-info/top_level.txt +0 -0
  118. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/pyproject.toml +0 -0
  119. {polygenic_pgx-2.6.2 → polygenic_pgx-2.6.4}/setup.cfg +0 -0
@@ -3,6 +3,47 @@
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.4
7
+
8
+ **CYP2D6/CYP2D7 hybrids named by a structural caller are called as the caller reports them.** When
9
+ the structural record that carries the copy number also carries the caller's hybrid tags
10
+ (`HYBRID_CONFIDENCE` = `named` / `flagged-not-named`, with `HYBRID_ALLELE`, `HYBRID_TANDEM_WITH`,
11
+ `CNTOTAL`, `CNWHOLE`, `KCONV`), those tags decide the name, the tandem and the replaced allele,
12
+ instead of the model's first partial allele and the span of the record:
13
+
14
+ - a copy gain is a **tandem** whatever part of the gene the record spans, never an `xN`; it is
15
+ named from `HYBRID_ALLELE` (`*36x2+*10` when `KCONV` > 1), with the partner from phase or from
16
+ `HYBRID_TANDEM_WITH`. Before, every partial event was named `*68` and a record over >= 90 % of
17
+ the gene went the `xN` path;
18
+ - a hybrid **replacing a whole copy** (a partial `<DEL>`, `CN` = whole copies) replaces the base
19
+ allele its SNVs look like (`*36` -> `*10`, `*4N` -> `*4`): `*3/*4` becomes `*3/*4N`. `CN` 0 is
20
+ `*5/<hybrid>`. A survivor that cannot be told apart makes the call `Indeterminate`, with both
21
+ candidates in `possible_calls`;
22
+ - a hybrid the caller could **not name** stays unnamed (`hybrid_not_named`): it is never called
23
+ `*68`, and its slot is `Indeterminate` when it replaces a copy.
24
+
25
+ New `--hybrid-in-diplotype[=GENES]`, **default off**: a named tandem with a resolved partner
26
+ becomes the call itself (`CYP2D6*3/CYP2D6*68+CYP2D6*4.001`, flag `tandem_in_diplotype`) instead of
27
+ being listed under `copy_number.tandem` beside an unchanged `*3/*4`.
28
+
29
+ Records without `HYBRID_CONFIDENCE` take every earlier path unchanged, so no existing output
30
+ moves. Details: `docs/pgx-cnv.md`.
31
+
32
+ ### 2.6.3
33
+
34
+ **`cyp2c19-pharmvar-5.1.8` is back, as a second CYP2C19 model you select by name.** It is the
35
+ model that 2.5.33-2.5.36 shipped (and that pgx task 2.6.2 / 2.7.1 ran as the unversioned
36
+ `CYP2C19.yml`), restored byte-identical: sha256 `7a1bdd54...`, removed in `642b702` when
37
+ CYP2C19 was rebuilt from PharmVar 6.2.29. On a GenosMedica WES sample (BT-2440) 6.2.29 calls
38
+ `*2/*35` (Poor Metabolizer) where the earlier releases reported `*1/*2` (Intermediate
39
+ Metabolizer). The pipeline can now pin the earlier model with `-m cyp2c19-pharmvar-5.1.8`.
40
+ **`-m cyp2c19` and `--genes CYP2C19` still resolve to `cyp2c19-pharmvar-6.2.29`**: both models
41
+ come from PharmVar, so the newer version is the default and `gene_defaults.json` needs no entry.
42
+
43
+ This release also ships multi-version model support (several versions of one gene, a declared
44
+ per-gene default, versions in `model-list`) and the BT-2440 fixes to CYP4F2, CYP2C19, DPYD and
45
+ CYP2F1.
46
+
6
47
  ### 2.6.2
7
48
 
8
49
  **DPYD \*3 and \*7 are callable again, and six other models with them.** `3204249` (2.5.29)
@@ -30,8 +71,11 @@ defined by the GRCh38 reference base at `4-68670366`**, so without a `reference_
30
71
  declaration an unassayed sample reported a confident homozygous call instead of Indeterminate --
31
72
  declared and fixed. DPYD now also ships as `dpyd-clinpgx-1.0.0` (84 alleles, CPIC/HGVS names)
32
73
  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`.
74
+ `-m dpyd` was briefly ambiguous and raised; since the per-gene default table it resolves to
75
+ `dpyd-clinpgx-1.0.0`, which is what production runs -- the deployed `DPYD.yml` is content-identical
76
+ to it, and it is the only one of the two that joins the CPIC tables. Pass `-m dpyd-pharmvar` (or the
77
+ full name) for the other. A panel report still carries both: the nomenclatures are not
78
+ interchangeable.
35
79
 
36
80
  ### 2.6.1
37
81
 
@@ -7,5 +7,9 @@ recursive-include polygenic/models *.yml
7
7
  include polygenic/models/pgx/manifest.json
8
8
  # gene symbol -> HGNC id, read at runtime by registry.hgnc_id_for()
9
9
  include polygenic/model/hgnc.json
10
+ # upstream release dates we cannot derive from an export, read by registry.source_release_date()
11
+ include polygenic/model/source_releases.json
12
+ # which packaged model `-m <gene>` resolves to, for genes shipping more than one
13
+ include polygenic/model/gene_defaults.json
10
14
  # full release history (README keeps only the newest entries)
11
15
  include CHANGELOG.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polygenic-pgx
3
- Version: 2.6.2
3
+ Version: 2.6.4
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,47 @@ Proprietary (contact@intelliseq.pl)
555
555
 
556
556
  ## Updates
557
557
 
558
+ ### 2.6.4
559
+
560
+ **CYP2D6/CYP2D7 hybrids named by a structural caller are called as the caller reports them.** When
561
+ the structural record that carries the copy number also carries the caller's hybrid tags
562
+ (`HYBRID_CONFIDENCE` = `named` / `flagged-not-named`, with `HYBRID_ALLELE`, `HYBRID_TANDEM_WITH`,
563
+ `CNTOTAL`, `CNWHOLE`, `KCONV`), those tags decide the name, the tandem and the replaced allele,
564
+ instead of the model's first partial allele and the span of the record:
565
+
566
+ - a copy gain is a **tandem** whatever part of the gene the record spans, never an `xN`; it is
567
+ named from `HYBRID_ALLELE` (`*36x2+*10` when `KCONV` > 1), with the partner from phase or from
568
+ `HYBRID_TANDEM_WITH`. Before, every partial event was named `*68` and a record over >= 90 % of
569
+ the gene went the `xN` path;
570
+ - a hybrid **replacing a whole copy** (a partial `<DEL>`, `CN` = whole copies) replaces the base
571
+ allele its SNVs look like (`*36` -> `*10`, `*4N` -> `*4`): `*3/*4` becomes `*3/*4N`. `CN` 0 is
572
+ `*5/<hybrid>`. A survivor that cannot be told apart makes the call `Indeterminate`, with both
573
+ candidates in `possible_calls`;
574
+ - a hybrid the caller could **not name** stays unnamed (`hybrid_not_named`): it is never called
575
+ `*68`, and its slot is `Indeterminate` when it replaces a copy.
576
+
577
+ New `--hybrid-in-diplotype[=GENES]`, **default off**: a named tandem with a resolved partner
578
+ becomes the call itself (`CYP2D6*3/CYP2D6*68+CYP2D6*4.001`, flag `tandem_in_diplotype`) instead of
579
+ being listed under `copy_number.tandem` beside an unchanged `*3/*4`.
580
+
581
+ Records without `HYBRID_CONFIDENCE` take every earlier path unchanged, so no existing output
582
+ moves. Details: `docs/pgx-cnv.md`.
583
+
584
+ ### 2.6.3
585
+
586
+ **`cyp2c19-pharmvar-5.1.8` is back, as a second CYP2C19 model you select by name.** It is the
587
+ model that 2.5.33-2.5.36 shipped (and that pgx task 2.6.2 / 2.7.1 ran as the unversioned
588
+ `CYP2C19.yml`), restored byte-identical: sha256 `7a1bdd54...`, removed in `642b702` when
589
+ CYP2C19 was rebuilt from PharmVar 6.2.29. On a GenosMedica WES sample (BT-2440) 6.2.29 calls
590
+ `*2/*35` (Poor Metabolizer) where the earlier releases reported `*1/*2` (Intermediate
591
+ Metabolizer). The pipeline can now pin the earlier model with `-m cyp2c19-pharmvar-5.1.8`.
592
+ **`-m cyp2c19` and `--genes CYP2C19` still resolve to `cyp2c19-pharmvar-6.2.29`**: both models
593
+ come from PharmVar, so the newer version is the default and `gene_defaults.json` needs no entry.
594
+
595
+ This release also ships multi-version model support (several versions of one gene, a declared
596
+ per-gene default, versions in `model-list`) and the BT-2440 fixes to CYP4F2, CYP2C19, DPYD and
597
+ CYP2F1.
598
+
558
599
  ### 2.6.2
559
600
 
560
601
  **DPYD \*3 and \*7 are callable again, and six other models with them.** `3204249` (2.5.29)
@@ -582,8 +623,11 @@ defined by the GRCh38 reference base at `4-68670366`**, so without a `reference_
582
623
  declaration an unassayed sample reported a confident homozygous call instead of Indeterminate --
583
624
  declared and fixed. DPYD now also ships as `dpyd-clinpgx-1.0.0` (84 alleles, CPIC/HGVS names)
584
625
  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`.
626
+ `-m dpyd` was briefly ambiguous and raised; since the per-gene default table it resolves to
627
+ `dpyd-clinpgx-1.0.0`, which is what production runs -- the deployed `DPYD.yml` is content-identical
628
+ to it, and it is the only one of the two that joins the CPIC tables. Pass `-m dpyd-pharmvar` (or the
629
+ full name) for the other. A panel report still carries both: the nomenclatures are not
630
+ interchangeable.
587
631
 
588
632
  ### 2.6.1
589
633
 
@@ -509,6 +509,47 @@ Proprietary (contact@intelliseq.pl)
509
509
 
510
510
  ## Updates
511
511
 
512
+ ### 2.6.4
513
+
514
+ **CYP2D6/CYP2D7 hybrids named by a structural caller are called as the caller reports them.** When
515
+ the structural record that carries the copy number also carries the caller's hybrid tags
516
+ (`HYBRID_CONFIDENCE` = `named` / `flagged-not-named`, with `HYBRID_ALLELE`, `HYBRID_TANDEM_WITH`,
517
+ `CNTOTAL`, `CNWHOLE`, `KCONV`), those tags decide the name, the tandem and the replaced allele,
518
+ instead of the model's first partial allele and the span of the record:
519
+
520
+ - a copy gain is a **tandem** whatever part of the gene the record spans, never an `xN`; it is
521
+ named from `HYBRID_ALLELE` (`*36x2+*10` when `KCONV` > 1), with the partner from phase or from
522
+ `HYBRID_TANDEM_WITH`. Before, every partial event was named `*68` and a record over >= 90 % of
523
+ the gene went the `xN` path;
524
+ - a hybrid **replacing a whole copy** (a partial `<DEL>`, `CN` = whole copies) replaces the base
525
+ allele its SNVs look like (`*36` -> `*10`, `*4N` -> `*4`): `*3/*4` becomes `*3/*4N`. `CN` 0 is
526
+ `*5/<hybrid>`. A survivor that cannot be told apart makes the call `Indeterminate`, with both
527
+ candidates in `possible_calls`;
528
+ - a hybrid the caller could **not name** stays unnamed (`hybrid_not_named`): it is never called
529
+ `*68`, and its slot is `Indeterminate` when it replaces a copy.
530
+
531
+ New `--hybrid-in-diplotype[=GENES]`, **default off**: a named tandem with a resolved partner
532
+ becomes the call itself (`CYP2D6*3/CYP2D6*68+CYP2D6*4.001`, flag `tandem_in_diplotype`) instead of
533
+ being listed under `copy_number.tandem` beside an unchanged `*3/*4`.
534
+
535
+ Records without `HYBRID_CONFIDENCE` take every earlier path unchanged, so no existing output
536
+ moves. Details: `docs/pgx-cnv.md`.
537
+
538
+ ### 2.6.3
539
+
540
+ **`cyp2c19-pharmvar-5.1.8` is back, as a second CYP2C19 model you select by name.** It is the
541
+ model that 2.5.33-2.5.36 shipped (and that pgx task 2.6.2 / 2.7.1 ran as the unversioned
542
+ `CYP2C19.yml`), restored byte-identical: sha256 `7a1bdd54...`, removed in `642b702` when
543
+ CYP2C19 was rebuilt from PharmVar 6.2.29. On a GenosMedica WES sample (BT-2440) 6.2.29 calls
544
+ `*2/*35` (Poor Metabolizer) where the earlier releases reported `*1/*2` (Intermediate
545
+ Metabolizer). The pipeline can now pin the earlier model with `-m cyp2c19-pharmvar-5.1.8`.
546
+ **`-m cyp2c19` and `--genes CYP2C19` still resolve to `cyp2c19-pharmvar-6.2.29`**: both models
547
+ come from PharmVar, so the newer version is the default and `gene_defaults.json` needs no entry.
548
+
549
+ This release also ships multi-version model support (several versions of one gene, a declared
550
+ per-gene default, versions in `model-list`) and the BT-2440 fixes to CYP4F2, CYP2C19, DPYD and
551
+ CYP2F1.
552
+
512
553
  ### 2.6.2
513
554
 
514
555
  **DPYD \*3 and \*7 are callable again, and six other models with them.** `3204249` (2.5.29)
@@ -536,8 +577,11 @@ defined by the GRCh38 reference base at `4-68670366`**, so without a `reference_
536
577
  declaration an unassayed sample reported a confident homozygous call instead of Indeterminate --
537
578
  declared and fixed. DPYD now also ships as `dpyd-clinpgx-1.0.0` (84 alleles, CPIC/HGVS names)
538
579
  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`.
580
+ `-m dpyd` was briefly ambiguous and raised; since the per-gene default table it resolves to
581
+ `dpyd-clinpgx-1.0.0`, which is what production runs -- the deployed `DPYD.yml` is content-identical
582
+ to it, and it is the only one of the two that joins the CPIC tables. Pass `-m dpyd-pharmvar` (or the
583
+ full name) for the other. A panel report still carries both: the nomenclatures are not
584
+ interchangeable.
541
585
 
542
586
  ### 2.6.1
543
587
 
@@ -141,7 +141,14 @@ class DataAccessor(object):
141
141
  ("breakpoint", "HYBRID_BREAKPOINT"),
142
142
  ("evidence", "HYBRID_EVIDENCE"),
143
143
  ("confidence", "HYBRID_CONFIDENCE"),
144
- ("suppressed", "SUPPRESSED")):
144
+ ("suppressed", "SUPPRESSED"),
145
+ # BT-2787: copy-number shape of a hybrid caller's record (cyp2d6-hybrid-calling):
146
+ # which record it is (CALL / HYBRID), all gene copies, whole CYP2D6-type
147
+ # copies, converted copies. Read only when the caller wrote them.
148
+ ("record", "RECORD"),
149
+ ("cn_total", "CNTOTAL"),
150
+ ("cn_whole", "CNWHOLE"),
151
+ ("k_conv", "KCONV")):
145
152
  try:
146
153
  value = record.get_info_field(tag)
147
154
  except Exception:
@@ -0,0 +1,84 @@
1
+ """Which variants in a haplotype model come out CORE (function-level), and whether any does.
2
+
3
+ Why this exists: the engine decides whether a variant is "defining" by asking whether the allele
4
+ DECLARING it has a sub-allele name, and then applies a rescue — when nothing came out core, every
5
+ variant is promoted to core (`Haplotypes.compute_genotypes`). So a model that declares only
6
+ sub-alleles has its purely sub-allele-distinguishing intronic positions counted as function-level
7
+ by the Indeterminate verdict, and such a verdict means "the genotype for this gene is incomplete",
8
+ never "a function-level slot failed".
9
+
10
+ THE PREDICATE THAT MATTERS IS ABOUT VARIANTS, NOT ALLELES, and conflating the two produced a check
11
+ that could be silenced without fixing anything. An earlier cut of `check_core_alleles.py` tested
12
+ "does the model declare a bare core allele", which looks equivalent and is not: the eight packaged
13
+ zero-core models each hold exactly one empty haplotype named `*1.001`, and their deployed twins in
14
+ `task_pgx-polygenic-haplotype:1.7.4` name that same empty haplotype `*1`. Renaming `*1.001` -> `*1`
15
+ therefore adds a bare core allele and changes NOTHING — the allele declares no variants, so no
16
+ variant is marked core, the rescue still fires and `indeterminate.defining_total` is unchanged. The
17
+ deployed models would have passed that check while being equally broken.
18
+
19
+ So: a model has a core variant iff some haplotype whose name carries no trailing `.NNN` declares at
20
+ least one variant key. A `structural:`-only bare allele does not count, and must not — CYP2D6*5,
21
+ CYP2D6*68, CYP2C19*36, CYP2C19*37 and CYP2A6*4 produce no variant genotype, so they set no `core`
22
+ flag. That is the one place where "declares no variants" is not the same as "clinically empty"; do
23
+ not "fix" it.
24
+
25
+ Mirrors `polygenic.model.model.Haplotype`: the reserved metadata keys are the ones that method
26
+ excludes, so a new metadata key added there must be added here too or it is counted as a variant.
27
+ """
28
+ import re
29
+
30
+ # A trailing numeric suffix marks a SUB-allele (CYP2D6*1.001). A bare `.` is not enough: the
31
+ # PharmGKB/CPIC-derived models name haplotypes in HGVS ('c.10042C>T', 'm.1095T>C'), which always
32
+ # contains a dot and is function-level. Kept in step with model.is_suballele_name.
33
+ _SUBALLELE_SUFFIX = re.compile(r"\*\w+\.\d+$")
34
+
35
+ # Keys under a haplotype that are METADATA, not variant positions. `af`/`score` are
36
+ # Haplotype.RESERVED_KEYS; `structural` and `function` are consumed separately by the engine and
37
+ # produce no variant genotype. `copy_number` is a sibling of `haplotypes`, never a haplotype key,
38
+ # but is excluded defensively.
39
+ METADATA_KEYS = frozenset(("af", "score", "structural", "function", "copy_number", "note"))
40
+
41
+
42
+ def is_suballele_name(name) -> bool:
43
+ """True for a sub-allele name (CYP2D6*1.001); False for a bare core allele or an HGVS name."""
44
+ return any(_SUBALLELE_SUFFIX.search(token) for token in str(name).split("/"))
45
+
46
+
47
+ def variant_keys(entries) -> set:
48
+ """The variant keys one haplotype's entries declare, metadata excluded."""
49
+ if not isinstance(entries, dict):
50
+ return set()
51
+ return {key for key in entries if key not in METADATA_KEYS}
52
+
53
+
54
+ def core_variant_ids(haplotypes) -> set:
55
+ """Every variant key that the engine will mark `core`, for a {name: entries} haplotype map.
56
+
57
+ The union of the variant keys declared by bare-named (non-sub-allele) haplotypes — which is
58
+ exactly what `Haplotype.compute_genotypes` marks core, and therefore exactly what decides
59
+ whether the promotion rescue fires."""
60
+ found = set()
61
+ for name, entries in (haplotypes or {}).items():
62
+ if not is_suballele_name(name):
63
+ found |= variant_keys(entries)
64
+ return found
65
+
66
+
67
+ def core_alleles(haplotypes) -> list:
68
+ """Bare-named (non-sub-allele) haplotype names, sorted. Reported alongside the variant count
69
+ because a PharmVar core comparison needs the allele names, not just the predicate."""
70
+ return sorted(name for name in (haplotypes or {}) if not is_suballele_name(name))
71
+
72
+
73
+ def summarise(haplotypes) -> dict:
74
+ """{core_alleles, core_alleles_declaring_variants, core_variants, has_core_variant}.
75
+
76
+ `has_core_variant` is the engine's own condition: False means
77
+ `Haplotypes.compute_genotypes` promotes every variant to defining."""
78
+ bare = core_alleles(haplotypes)
79
+ declaring = [name for name in bare if variant_keys((haplotypes or {}).get(name))]
80
+ core = core_variant_ids(haplotypes)
81
+ return {"core_alleles": bare,
82
+ "core_alleles_declaring_variants": declaring,
83
+ "core_variants": core,
84
+ "has_core_variant": bool(core)}
@@ -0,0 +1,33 @@
1
+ {
2
+ "_comment": [
3
+ "Which packaged model `-m <gene>` resolves to, for the genes that ship more than one.",
4
+ "",
5
+ "A gene with a SINGLE model needs no entry: `registry._pick` returns immediately on one",
6
+ "candidate, so the sole model is already the default. Only a gene whose models would otherwise",
7
+ "be compared across sources - where '6.2.26 > 1.0.0' is arithmetic, not a fact about the",
8
+ "model - needs a human to decide, and this is where that decision is recorded.",
9
+ "",
10
+ "Why here and not in the model YAML: `preferred` answers 'among the models THIS PACKAGE ships",
11
+ "for this gene, which is the default', which is a property of the collection rather than of",
12
+ "any one file - a model copied to /tmp has no business claiming it is the package default. It",
13
+ "also keeps the decision in one reviewable place instead of scattered across 45 files, and it",
14
+ "avoids editing the vendored models, 11 of which assert `sha256(body below this header)` and",
15
+ "that nothing was hand-edited. A model may still declare `preferred: true` in its own",
16
+ "`description:` block and that wins, so an override directory (POLYGENIC_MODELS_DIR) can",
17
+ "carry its own default.",
18
+ "",
19
+ "Values are model stems, exactly as a filename spells them.",
20
+ "`panel` lists the models a panel report carries for that gene, which is a different question:",
21
+ "DPYD ships two nomenclatures a report wants side by side, while `-m dpyd` must still answer",
22
+ "with exactly one."
23
+ ],
24
+ "defaults": {
25
+ "dpyd": "dpyd-clinpgx-1.0.0"
26
+ },
27
+ "panel": {
28
+ "dpyd": ["dpyd-clinpgx-1.0.0", "dpyd-pharmvar-6.2.29"]
29
+ },
30
+ "rationale": {
31
+ "dpyd": "ClinPGx is what production runs: the deployed DPYD.yml in task_pgx-polygenic-haplotype:1.7.4 is CONTENT-IDENTICAL to dpyd-clinpgx-1.0.0 (84 alleles, 0 allele-set differences, 0 shared alleles with differing variant keys), and the PharmVar readme states DPYD is intentionally excluded from that package in favour of this one. It is also the only one of the two that joins the CPIC/DPWG/FDA function and recommendation tables - the PharmVar build names alleles DPYD*rs3918290 and joins none of them - so it is the only one that yields an actionable report. Both stay in the panel set because the two nomenclatures are not interchangeable."
32
+ }
33
+ }