Skip to content

Commit fa6b9f7

Browse files
authored
Merge pull request #164 from sbslee/0.26.0-dev
0.26.0 dev
2 parents 7bec840 + db2f754 commit fa6b9f7

16 files changed

Lines changed: 248 additions & 65 deletions

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.7"
12+
python: "3.10"
1313

1414
# Build documentation in the docs/ directory with Sphinx
1515
sphinx:

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
*********
33

4+
0.26.0 (2026-01-04)
5+
-------------------
6+
* :issue:`135`: Fix GRCh38 coordinate of a CYP17A1 variant (thanks `@NeiH4207 <https://github.com/NeiH4207>`__).
7+
* Add the ``fileformat`` field to the VCF header when writing VCF files.
8+
* :issue:`150`: Fix bug in :meth:`api.utils.estimate_phase_beagle` method when overlapping samples exist between the input VCF and reference panel, but the window contains only a single position (thanks `@toddknutson <https://github.com/toddknutson>`__).
9+
* Add new gene MT-RNR1.
10+
411
0.25.0 (2024-06-16)
512
-------------------
613

README.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ glossary.html#structural-variation-sv>`__ using a machine learning-based
5252
approach. Finally, note that PyPGx is compatible with both of the Genome
5353
Reference Consortium Human (GRCh) builds, GRCh37 (hg19) and GRCh38 (hg38).
5454

55-
There are currently 87 pharmacogenes in PyPGx:
55+
There are currently 88 pharmacogenes in PyPGx:
5656

5757
.. list-table::
5858

@@ -114,38 +114,38 @@ There are currently 87 pharmacogenes in PyPGx:
114114
* - IFNL3
115115
- ITGB3
116116
- ITPA
117+
- MT-RNR1
117118
- MTHFR
118-
- NAT1
119-
* - NAT2
119+
* - NAT1
120+
- NAT2
120121
- NUDT15
121122
- OPRK1
122123
- OPRM1
123-
- POR
124-
* - PTGIS
124+
* - POR
125+
- PTGIS
125126
- RARG
126127
- RYR1
127128
- SLC6A4
128-
- SLC15A2
129-
* - SLC22A2
129+
* - SLC15A2
130+
- SLC22A2
130131
- SLC28A3
131132
- SLC47A2
132133
- SLCO1B1
133-
- SLCO1B3
134-
* - SLCO2B1
134+
* - SLCO1B3
135+
- SLCO2B1
135136
- SULT1A1
136137
- TBXAS1
137138
- TPMT
138-
- UGT1A1
139-
* - UGT1A4
139+
* - UGT1A1
140+
- UGT1A4
140141
- UGT1A6
141142
- UGT2B7
142143
- UGT2B15
143-
- UGT2B17
144-
* - VKORC1
144+
* - UGT2B17
145+
- VKORC1
145146
- XPC
146147
-
147148
-
148-
-
149149

150150
Your contributions (e.g. feature ideas, pull requests) are most welcome.
151151

docs/create.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
approach. Finally, note that PyPGx is compatible with both of the Genome
8080
Reference Consortium Human (GRCh) builds, GRCh37 (hg19) and GRCh38 (hg38).
8181
82-
There are currently 87 pharmacogenes in PyPGx:
82+
There are currently 88 pharmacogenes in PyPGx:
8383
8484
.. list-table::
8585
@@ -141,38 +141,38 @@
141141
* - IFNL3
142142
- ITGB3
143143
- ITPA
144+
- MT-RNR1
144145
- MTHFR
145-
- NAT1
146-
* - NAT2
146+
* - NAT1
147+
- NAT2
147148
- NUDT15
148149
- OPRK1
149150
- OPRM1
150-
- POR
151-
* - PTGIS
151+
* - POR
152+
- PTGIS
152153
- RARG
153154
- RYR1
154155
- SLC6A4
155-
- SLC15A2
156-
* - SLC22A2
156+
* - SLC15A2
157+
- SLC22A2
157158
- SLC28A3
158159
- SLC47A2
159160
- SLCO1B1
160-
- SLCO1B3
161-
* - SLCO2B1
161+
* - SLCO1B3
162+
- SLCO2B1
162163
- SULT1A1
163164
- TBXAS1
164165
- TPMT
165-
- UGT1A1
166-
* - UGT1A4
166+
* - UGT1A1
167+
- UGT1A4
167168
- UGT1A6
168169
- UGT2B7
169170
- UGT2B15
170-
- UGT2B17
171-
* - VKORC1
171+
* - UGT2B17
172+
- VKORC1
172173
- XPC
173174
-
174175
-
175-
-
176176
177177
Your contributions (e.g. feature ideas, pull requests) are most welcome.
178178
@@ -577,18 +577,18 @@
577577
578578
- Method 1. Simple diplotype-phenotype mapping: This method directly uses the
579579
diplotype-phenotype mapping as defined by CPIC or PharmGKB. Using the
580-
CYP2B6 gene as an example, the diplotypes \*6/\*6, \*1/\*29, \*1/\*2,
581-
\*1/\*4, and \*4/\*4 correspond to Poor Metabolizer, Intermediate
580+
CYP2B6 gene as an example, the diplotypes \\*6/\\*6, \\*1/\\*29, \\*1/\\*2,
581+
\\*1/\\*4, and \\*4/\\*4 correspond to Poor Metabolizer, Intermediate
582582
Metabolizer, Normal Metabolizer, Rapid Metabolizer, and Ultrarapid
583583
Metabolizer.
584584
- Method 2. Summation of haplotype activity scores: This method uses a
585585
standard unit of enzyme activity known as an activity score. Using the
586-
CYP2D6 gene as an example, the fully functional reference \*1 allele is
587-
assigned a value of 1, decreased-function alleles such as \*9 and \*17
588-
receive a value of 0.5, and nonfunctional alleles including \*4 and \*5
586+
CYP2D6 gene as an example, the fully functional reference \\*1 allele is
587+
assigned a value of 1, decreased-function alleles such as \\*9 and \\*17
588+
receive a value of 0.5, and nonfunctional alleles including \\*4 and \\*5
589589
have a value of 0. The sum of values assigned to both alleles constitutes
590-
the activity score of a diplotype. Consequently, subjects with \*1/\*1,
591-
\*1/\*4, and \*4/\*5 diplotypes have an activity score of 2 (Normal
590+
the activity score of a diplotype. Consequently, subjects with \\*1/\\*1,
591+
\\*1/\\*4, and \\*4/\\*5 diplotypes have an activity score of 2 (Normal
592592
Metabolizer), 1 (Intermediate Metabolizer), and 0 (Poor Metabolizer),
593593
respectively.
594594
@@ -718,45 +718,45 @@
718718
- VariantData
719719
- CNV
720720
* - NA11839
721-
- \*1/\*2
721+
- \\*1/\\*2
722722
- Normal Metabolizer
723-
- \*1;
724-
- \*2;
723+
- \\*1;
724+
- \\*2;
725725
- ;
726-
- \*1:22-42522613-G-C,22-42523943-A-G:0.5,0.488;\*2:default
726+
- \\*1:22-42522613-G-C,22-42523943-A-G:0.5,0.488;\\*2:default
727727
- Normal
728728
* - NA12006
729-
- \*4/\*41
729+
- \\*4/\\*41
730730
- Intermediate Metabolizer
731-
- \*41;\*2;
732-
- \*4;\*10;\*2;
733-
- \*69;
734-
- \*69:22-42526694-G-A,22-42523805-C-T:0.5,0.551;\*4:22-42524947-C-T:0.444;\*10:22-42523943-A-G,22-42526694-G-A:0.55,0.5;\*41:22-42523805-C-T:0.551;\*2:default;
731+
- \\*41;\\*2;
732+
- \\*4;\\*10;\\*2;
733+
- \\*69;
734+
- \\*69:22-42526694-G-A,22-42523805-C-T:0.5,0.551;\\*4:22-42524947-C-T:0.444;\\*10:22-42523943-A-G,22-42526694-G-A:0.55,0.5;\\*41:22-42523805-C-T:0.551;\\*2:default;
735735
- Normal
736736
* - HG00276
737-
- \*4/\*5
737+
- \\*4/\\*5
738738
- Poor Metabolizer
739-
- \*4;\*10;\*74;\*2;
740-
- \*10;\*74;\*2;
739+
- \\*4;\\*10;\\*74;\\*2;
740+
- \\*10;\\*74;\\*2;
741741
- ;
742-
- \*4:22-42524947-C-T:0.913;\*10:22-42523943-A-G,22-42526694-G-A:1.0,1.0;\*74:22-42525821-G-T:1.0;\*2:default;
742+
- \\*4:22-42524947-C-T:0.913;\\*10:22-42523943-A-G,22-42526694-G-A:1.0,1.0;\\*74:22-42525821-G-T:1.0;\\*2:default;
743743
- WholeDel1
744744
* - NA19207
745-
- \*2x2/\*10
745+
- \\*2x2/\\*10
746746
- Normal Metabolizer
747-
- \*10;\*2;
748-
- \*2;
747+
- \\*10;\\*2;
748+
- \\*2;
749749
- ;
750-
- \*10:22-42523943-A-G,22-42526694-G-A:0.361,0.25;\*2:default;
750+
- \\*10:22-42523943-A-G,22-42526694-G-A:0.361,0.25;\\*2:default;
751751
- WholeDup1
752752
753753
This list explains each of the columns in the example results.
754754
755755
- **Genotype**: Diplotype call. When there is no SV this simply combines the two top-ranked star alleles from **Haplotype1** and **Haplotype2** with the delimiter '/'. In the presence of SV the final diplotype is determined using one of the genotypers in the ``pypgx.api.genotype`` module (e.g. `CYP2D6Genotyper <https://pypgx.readthedocs.io/en/latest/api.html#pypgx.api.genotype.CYP2D6Genotyper>`__).
756756
- **Phenotype**: Phenotype call.
757-
- **Haplotype1**, **Haplotype2**: List of candidate star alleles for each haplotype. For example, if a given haplotype contains three variants ``22-42523943-A-G``, ``22-42524947-C-T``, and ``22-42526694-G-A``, then it will get assigned ``*4;*10;`` because the haplotype pattern can fit both \*4 (``22-42524947-C-T``) and \*10 (``22-42523943-A-G`` and ``22-42526694-G-A``). Note that \*4 comes first before \*10 because it has higher priority for reporting purposes (see the ``pypgx.sort_alleles`` `method <https://pypgx.readthedocs.io/en/latest/api.html#pypgx.api.core.sort_alleles>`__ for detailed implementation).
758-
- **AlternativePhase**: List of star alleles that could be missed due to potentially incorrect statistical phasing. For example, let's assume that statistical phasing has put ``22-42526694-G-A`` for **Haplotype1** and ``22-42523805-C-T`` for **Haplotype2**. Even though the two variants are in trans orientation, PyPGx will also consider alternative phase in case the two variants are actually in cis orientation, resulting in ``*69;`` as **AlternativePhase** because \*69 is defined by ``22-42526694-G-A`` and ``22-42523805-C-T``.
759-
- **VariantData**: Information for SNVs/indels used to define observed star alleles, including allele fraction which is important for allelic decomposition after identifying CNV (e.g. the sample NA19207). In some situations, there will not be any variants for a given star allele because the allele itself is "default" allele for the selected reference assembly (e.g. GRCh37 has \*2 as default while GRCh38 has \*1).
757+
- **Haplotype1**, **Haplotype2**: List of candidate star alleles for each haplotype. For example, if a given haplotype contains three variants ``22-42523943-A-G``, ``22-42524947-C-T``, and ``22-42526694-G-A``, then it will get assigned ``*4;*10;`` because the haplotype pattern can fit both \\*4 (``22-42524947-C-T``) and \\*10 (``22-42523943-A-G`` and ``22-42526694-G-A``). Note that \\*4 comes first before \\*10 because it has higher priority for reporting purposes (see the ``pypgx.sort_alleles`` `method <https://pypgx.readthedocs.io/en/latest/api.html#pypgx.api.core.sort_alleles>`__ for detailed implementation).
758+
- **AlternativePhase**: List of star alleles that could be missed due to potentially incorrect statistical phasing. For example, let's assume that statistical phasing has put ``22-42526694-G-A`` for **Haplotype1** and ``22-42523805-C-T`` for **Haplotype2**. Even though the two variants are in trans orientation, PyPGx will also consider alternative phase in case the two variants are actually in cis orientation, resulting in ``*69;`` as **AlternativePhase** because \\*69 is defined by ``22-42526694-G-A`` and ``22-42523805-C-T``.
759+
- **VariantData**: Information for SNVs/indels used to define observed star alleles, including allele fraction which is important for allelic decomposition after identifying CNV (e.g. the sample NA19207). In some situations, there will not be any variants for a given star allele because the allele itself is "default" allele for the selected reference assembly (e.g. GRCh37 has \\*2 as default while GRCh38 has \\*1).
760760
- **CNV**: Structural variation call. See the `Structural variation detection <https://pypgx.readthedocs.io/en/latest/readme.html#structural-variation-detection>`__ section for more details.
761761
762762
Getting help

docs/genes.rst

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Genes
22
*****
33

44
This page describes gene-specific information. PyPGx currently supports
5-
genotyping of a total of 87 pharmacogenes.
5+
genotyping of a total of 88 pharmacogenes.
66

77
In order to provide the most accurate information, this page borrows heavily
88
from the works of the :ref:`glossary:Clinical Pharmacogenetics Implementation
@@ -616,6 +616,16 @@ Below is a summary table:
616616
- `chr20:3187143-3207506 <https://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19&lastVirtModeType=default&lastVirtModeExtraState=&virtModeType=default&virtMode=0&nonVirtPosition=&position=chr20%3A3187143%2D3207506&hgsid=2144291390_4bmNOa6wq7Mk8crO6QNojSla7rfr>`__
617617
- `chr20:3206497-3226860 <https://genome.ucsc.edu/cgi-bin/hgTracks?db=hg38&lastVirtModeType=default&lastVirtModeExtraState=&virtModeType=default&virtMode=0&nonVirtPosition=&position=chr20%3A3206497%2D3226860&hgsid=2144291444_9qcI5Mpt1r7ap1R1ceKlp0aFJjS3>`__
618618
- NM_033453.4 was used as the main transcript.
619+
* - :ref:`genes:MT-RNR1`
620+
- ✅
621+
-
622+
- ✅
623+
-
624+
-
625+
- Disease
626+
- `chrM:410-1840 <https://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19&lastVirtModeType=default&lastVirtModeExtraState=&virtModeType=default&virtMode=0&nonVirtPosition=&position=chrMT%3A410%2D1840&hgsid=3332880867_aVXAZCwJTtLSGNhbga0xleh3qxVY>`__
627+
- `chrM:410-1840 <https://genome.ucsc.edu/cgi-bin/hgTracks?db=hg38&lastVirtModeType=default&lastVirtModeExtraState=&virtModeType=default&virtMode=0&nonVirtPosition=&position=chrM%3A410%2D1840&hgsid=3332880867_aVXAZCwJTtLSGNhbga0xleh3qxVY>`__
628+
-
619629
* - MTHFR
620630
- ✅
621631
-
@@ -3296,6 +3306,30 @@ Resources for IFNL3
32963306
- `PharmGKB: Annotation of CPIC Guideline for peginterferon alfa-2a,peginterferon alfa-2b,ribavirin and IFNL3 <https://www.pharmgkb.org/guidelineAnnotation/PA166110235>`__
32973307
- `CPIC® Guideline for PEG Interferon-Alpha-Based Regimens and IFNL3 <https://cpicpgx.org/guidelines/guideline-for-peg-interferon-alpha-based-regimens-and-ifnl3/>`__
32983308

3309+
MT-RNR1
3310+
=======
3311+
3312+
Phenotype summary for MT-RNR1
3313+
-----------------------------
3314+
3315+
Diplotype-phenotype mapping is used for phenotype prediction.
3316+
3317+
.. list-table::
3318+
:header-rows: 1
3319+
3320+
* - Phenotype
3321+
- Example
3322+
- Priority
3323+
* - Normal Risk of Aminoglycoside-Induced Hearing Loss
3324+
- Reference/Reference
3325+
- None
3326+
* - Increased Risk of Aminoglycoside-Induced Hearing Loss
3327+
- m.1494C>T/m.1494C>T
3328+
- None
3329+
* - Uncertain Risk of Aminoglycoside-Induced Hearing Loss
3330+
- m.663A>G/m.663A>G
3331+
- None
3332+
32993333
NUDT15
33003334
======
33013335

docs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
autodocsumm
22
fuc
33
scikit-learn
4-
sphinx==4.1.2
5-
sphinx_rtd_theme==0.5.2
4+
sphinx
5+
sphinx_rtd_theme
66
sphinx_issues

docs/tutorials.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,66 @@ Now you have successfully genotyped CYP3A5 as well!
347347
gene requires SV analysis. In other words, users can provide the same
348348
input files for all target genes.
349349

350+
Genotyping with CRAM files
351+
--------------------------
352+
353+
PyPGx also supports CRAM files as input.
354+
355+
.. code-block:: text
356+
357+
$ mkdir grch37-cram
358+
$ wget -P grch37-cram https://storage.googleapis.com/sbslee-bucket/pypgx/getrm-wgs-tutorial/grch37-cram/HG00276_PyPGx.sorted.markdup.recal.cram.crai
359+
$ wget -P grch37-cram https://storage.googleapis.com/sbslee-bucket/pypgx/getrm-wgs-tutorial/grch37-cram/HG00276_PyPGx.sorted.markdup.recal.cram
360+
$ wget -P grch37-cram https://storage.googleapis.com/sbslee-bucket/pypgx/getrm-wgs-tutorial/grch37-cram/HG00436_PyPGx.sorted.markdup.recal.cram.crai
361+
$ wget -P grch37-cram https://storage.googleapis.com/sbslee-bucket/pypgx/getrm-wgs-tutorial/grch37-cram/HG00436_PyPGx.sorted.markdup.recal.cram
362+
363+
Similar to before, we will need the reference FASTA file used to create the CRAM files:
364+
365+
.. code-block:: text
366+
367+
$ wget https://storage.googleapis.com/sbslee-bucket/ref/grch37/genome.fa
368+
$ wget https://storage.googleapis.com/sbslee-bucket/ref/grch37/genome.fa.fai
369+
370+
We can create input files as usual:
371+
372+
.. code-block:: text
373+
374+
$ pypgx create-input-vcf \
375+
cram-variants.vcf.gz \
376+
genome.fa \
377+
grch37-cram/*.cram
378+
379+
.. code-block:: text
380+
381+
$ pypgx prepare-depth-of-coverage \
382+
cram-depth-of-coverage.zip \
383+
grch37-cram/*.cram
384+
385+
.. code-block:: text
386+
387+
$ pypgx compute-control-statistics \
388+
VDR \
389+
cram-control-statistics-VDR.zip \
390+
grch37-cram/*.cram
391+
392+
Finally, we can run the NGS pipeline:
393+
394+
.. code-block:: text
395+
396+
$ pypgx run-ngs-pipeline \
397+
CYP2D6 \
398+
cram-CYP2D6-pipeline \
399+
--variants cram-variants.vcf.gz \
400+
--depth-of-coverage cram-depth-of-coverage.zip \
401+
--control-statistics cram-control-statistics-VDR.zip
402+
403+
.. code-block:: text
404+
405+
$ pypgx print-data cram-CYP2D6/results.zip
406+
Genotype Phenotype Haplotype1 Haplotype2 AlternativePhase VariantData CNV
407+
HG00276_PyPGx *4/*5 Poor Metabolizer *4;*10;*74;*2; *4;*10;*74;*2; ; *4:22-42524947-C-T:0.87;*10:22-42523943-A-G,22-42526694-G-A:1.0,1.0;*74:22-42525821-G-T:1.0;*2:default; WholeDel1
408+
HG00436_PyPGx *2x2/*71 Indeterminate *71;*1; *2; ; *71:22-42526669-C-T:0.433;*1:22-42523943-A-G,22-42522613-G-C:0.353,0.462;*2:default; WholeDup1
409+
350410
Genotyping with GRCh38 data
351411
---------------------------
352412

pypgx/api/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,17 +1498,17 @@ def sort_alleles(
14981498
impact protein coding (e.g. two misssense variants > one missense variant
14991499
plus one intron variant), and 4. reference allele status (e.g.
15001500
non-reference allele with two SNVs > reference allele with two SNVs such
1501-
that CYP2D6\*46 > CYP2D6\*1 in GRCh37). Note that the priority of allele
1501+
that CYP2D6\\*46 > CYP2D6\\*1 in GRCh37). Note that the priority of allele
15021502
function decreases in the following order: 'No Function', 'Decreased
15031503
Function', 'Possible Decreased Function', 'Increased Function', 'Possible
15041504
Increased Function', 'Uncertain Function', 'Unknown Function', 'Normal
15051505
Function'.
15061506
15071507
When ``by='name'`` the method will report alleles with a smaller
1508-
number first. This means, for example, '\*4' will come before '\*10'
1508+
number first. This means, for example, '\\*4' will come before '\\*10'
15091509
whereas lexicographic sorting would produce the opposite result. This is
1510-
particularly useful when forming a diplotype (e.g. '\*4/\*10' vs.
1511-
'\*10/\*4').
1510+
particularly useful when forming a diplotype (e.g. '\\*4/\\*10' vs.
1511+
'\\*10/\\*4').
15121512
15131513
Parameters
15141514
----------

0 commit comments

Comments
 (0)