Skip to content

Commit bbac2c7

Browse files
authored
Merge pull request #55 from sbslee/0.14.0-dev
0.14.0 dev
2 parents d8ceee8 + f5e9e32 commit bbac2c7

25 files changed

Lines changed: 1130 additions & 127 deletions

CHANGELOG.rst

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

4+
0.14.0 (2022-04-03)
5+
-------------------
6+
7+
* :issue:`49`: Add new gene ABCG2.
8+
* :issue:`50`: Improve algorithm for whole gene duplication detection. This minor update will handle some rare edge cases.
9+
* :issue:`53`: Update CYP2B6\*17 variants to have synonyms. Update :meth:`api.core.get_variant_synonyms` and :meth:`api.utils.predict_alleles` methods to allow mapping of single variant to multiple synonyms.
10+
* :issue:`54`: Add new command :command:`create-input-vcf`.
11+
* Fix minor error in ``gene-table.csv``. Two control genes EGFR and VDR incorrectly had ``TRUE`` for ``Variants`` column. They were changed to ``FALSE``.
12+
* Change the three paralogs in ``gene-table.csv`` (CYP2A7, CYP2B7, and CYP2D7) to have ``FALSE`` for ``SV`` column.
13+
* Add new optional arguments to :command:`create-regions-bed` command: ``--target-genes``, ``--var-genes``, ``--genes``, ``--exclude``.
14+
* Improve CNV caller for CYP2A6, CYP2B6, CYP2D6, CYP2E1, GSTM1, SLC22A2, SULT1A1, UGT1A4, UGT2B15, UGT2B17.
15+
* Add new CNV calls for CYP2A6: ``Hybrid2Hom``, ``Hybrid4``, ``Tandem``.
16+
* Add new CNV calls for CYP2D6: ``Tandem4``, ``PseudogeneDownstreamDel``, ``Unknown2``.
17+
* Add a new CNV call for CYP2E1: ``Multiplication2``.
18+
* Add new CNV calls for GSTM1: ``PartialDuplication`` and ``DeletionHet,Deletion2``.
19+
* Add a new CNV call for SLC22A2: ``PartialDuplication``.
20+
* Add a new CNV call for SULT1A1: ``DeletionHom``.
21+
* Add new CNV calls for UGT2B15: ``Deletion2``, ``Duplication``, ``PartialDuplication``.
22+
* Add a new CNV call for UGT2B17: ``Normal,PartialDeletion3``.
23+
424
0.13.0 (2022-03-01)
525
-------------------
626

README.rst

Lines changed: 152 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,70 +39,70 @@ nucleotide polymorphism (SNP) array, and long-read sequencing. Importantly,
3939
PyPGx is compatible with both of the Genome Reference Consortium Human (GRCh)
4040
builds, GRCh37 (hg19) and GRCh38 (hg38).
4141

42-
There are currently 58 pharmacogenes in PyPGx:
42+
There are currently 59 pharmacogenes in PyPGx:
4343

4444
.. list-table::
4545

4646
* - ABCB1
47+
- ABCG2
4748
- CACNA1S
4849
- CFTR
4950
- CYP1A1
50-
- CYP1A2
51-
* - CYP1B1
51+
* - CYP1A2
52+
- CYP1B1
5253
- CYP2A6/CYP2A7
5354
- CYP2A13
5455
- CYP2B6/CYP2B7
55-
- CYP2C8
56-
* - CYP2C9
56+
* - CYP2C8
57+
- CYP2C9
5758
- CYP2C19
5859
- CYP2D6/CYP2D7
5960
- CYP2E1
60-
- CYP2F1
61-
* - CYP2J2
61+
* - CYP2F1
62+
- CYP2J2
6263
- CYP2R1
6364
- CYP2S1
6465
- CYP2W1
65-
- CYP3A4
66-
* - CYP3A5
66+
* - CYP3A4
67+
- CYP3A5
6768
- CYP3A7
6869
- CYP3A43
6970
- CYP4A11
70-
- CYP4A22
71-
* - CYP4B1
71+
* - CYP4A22
72+
- CYP4B1
7273
- CYP4F2
7374
- CYP17A1
7475
- CYP19A1
75-
- CYP26A1
76-
* - DPYD
76+
* - CYP26A1
77+
- DPYD
7778
- F5
7879
- G6PD
7980
- GSTM1
80-
- GSTP1
81-
* - GSTT1
81+
* - GSTP1
82+
- GSTT1
8283
- IFNL3
8384
- NAT1
8485
- NAT2
85-
- NUDT15
86-
* - POR
86+
* - NUDT15
87+
- POR
8788
- PTGIS
8889
- RYR1
8990
- SLC15A2
90-
- SLC22A2
91-
* - SLCO1B1
91+
* - SLC22A2
92+
- SLCO1B1
9293
- SLCO1B3
9394
- SLCO2B1
9495
- SULT1A1
95-
- TBXAS1
96-
* - TPMT
96+
* - TBXAS1
97+
- TPMT
9798
- UGT1A1
9899
- UGT1A4
99100
- UGT2B7
100-
- UGT2B15
101-
* - UGT2B17
101+
* - UGT2B15
102+
- UGT2B17
102103
- VKORC1
103104
- XPC
104105
-
105-
-
106106

107107
Your contributions (e.g. feature ideas, pull requests) are most welcome.
108108

@@ -175,7 +175,7 @@ directory in order for PyPGx to correctly access the moved files:
175175
.. code-block:: text
176176
177177
$ cd ~
178-
$ git clone --branch 0.13.0 --depth 1 https://github.com/sbslee/pypgx-bundle
178+
$ git clone --branch 0.12.0 --depth 1 https://github.com/sbslee/pypgx-bundle
179179
180180
This is undoubtedly annoying, but absolutely necessary for portability
181181
reasons because PyPGx has been growing exponentially in file size due to the
@@ -322,6 +322,9 @@ as pairs of ``=``-separated keys and values (e.g. ``Assembly=GRCh37``):
322322
- Semantic type of the archive.
323323
- ``CovFrame[CopyNumber]``, ``Model[CNV]``
324324

325+
Semantic types
326+
--------------
327+
325328
Notably, all archive files have defined semantic types, which allows us to
326329
ensure that the data that is passed to a PyPGx command (CLI) or method (API)
327330
is meaningful for the operation that will be performed. Below is a list of
@@ -367,6 +370,60 @@ currently defined semantic types:
367370
* VcfFrame for storing target gene's phased variant data.
368371
* Requires following metadata: ``Platform``, ``Gene``, ``Assembly``, ``SemanticType``, ``Program``.
369372

373+
Wroking with archive files
374+
--------------------------
375+
376+
To demonstrate how easy it is to work with PyPGx archive files, below we will
377+
show some examples. First, download an archive:
378+
379+
.. code-block:: text
380+
381+
$ wget https://raw.githubusercontent.com/sbslee/pypgx-data/main/getrm-wgs-tutorial/grch37-CYP2D6-results.zip
382+
383+
Let's print its metadata:
384+
385+
.. code-block:: text
386+
387+
$ pypgx print-metadata grch37-CYP2D6-results.zip
388+
Gene=CYP2D6
389+
Assembly=GRCh37
390+
SemanticType=SampleTable[Results]
391+
392+
We can unzip it to extract files inside (note that ``tmpcty4c_cr`` is the
393+
original folder name):
394+
395+
.. code-block:: text
396+
397+
$ unzip grch37-CYP2D6-results.zip
398+
Archive: grch37-CYP2D6-results.zip
399+
inflating: tmpcty4c_cr/metadata.txt
400+
inflating: tmpcty4c_cr/data.tsv
401+
402+
We can now directly interact with the files:
403+
404+
.. code-block:: text
405+
406+
$ cat tmpcty4c_cr/metadata.txt
407+
Gene=CYP2D6
408+
Assembly=GRCh37
409+
SemanticType=SampleTable[Results]
410+
$ head -n 2 tmpcty4c_cr/data.tsv
411+
Genotype Phenotype Haplotype1 Haplotype2 AlternativePhase VariantData CNV
412+
HG00276_PyPGx *4/*5 Poor Metabolizer *4;*10;*74;*2; *10;*74;*2; ; *4:22-42524947-C-T:0.913;*10:22-42526694-G-A,22-42523943-A-G:1.0,1.0;*74:22-42525821-G-T:1.0;*2:default; DeletionHet
413+
414+
We can easily create a new archive:
415+
416+
.. code-block:: text
417+
418+
$ zip -r grch37-CYP2D6-results-new.zip tmpcty4c_cr
419+
adding: tmpcty4c_cr/ (stored 0%)
420+
adding: tmpcty4c_cr/metadata.txt (stored 0%)
421+
adding: tmpcty4c_cr/data.tsv (deflated 84%)
422+
$ pypgx print-metadata grch37-CYP2D6-results-new.zip
423+
Gene=CYP2D6
424+
Assembly=GRCh37
425+
SemanticType=SampleTable[Results]
426+
370427
Phenotype prediction
371428
====================
372429

@@ -451,6 +508,13 @@ to see the full list of genes with SV. For details on SV detection algorithm,
451508
please see the `Structural variation detection <https://pypgx.readthedocs.io/
452509
en/latest/readme.html#structural-variation-detection>`__ section.
453510

511+
When creating a VCF file (containing SNVs/indels) from BAM files, users have
512+
a choice to either use the ``pypgx create-input-vcf`` command (strongly
513+
recommended) or a variant caller of their choice (e.g. GATK4
514+
HaplotypeCaller). See the `Variant caller choice <https://pypgx.readthedocs.
515+
io/en/latest/faq.html#variant-caller-choice>`__ section for detailed
516+
discussion on when to use either option.
517+
454518
Chip pipeline
455519
-------------
456520

@@ -485,6 +549,67 @@ The pipeline currently does not support SV detection. Please post a GitHub
485549
issue if you want to contribute your development skills and/or data for
486550
devising an SV detection algorithm.
487551

552+
Results interpretation
553+
======================
554+
555+
PyPGx outputs per-sample genotype results in a table, which is stored in an
556+
archive file with the semantic type ``SampleTable[Results]``. Below, we will
557+
use the CYP2D6 gene with GRCh37 as an example to illustrate how to interpret
558+
genotype results from PyPGx.
559+
560+
.. list-table::
561+
:header-rows: 1
562+
563+
* -
564+
- Genotype
565+
- Phenotype
566+
- Haplotype1
567+
- Haplotype2
568+
- AlternativePhase
569+
- VariantData
570+
- CNV
571+
* - NA11839
572+
- \*1/\*2
573+
- Normal Metabolizer
574+
- \*1;
575+
- \*2;
576+
- ;
577+
- \*1:22-42522613-G-C,22-42523943-A-G:0.5,0.488;\*2:default
578+
- Normal
579+
* - NA12006
580+
- \*4/\*41
581+
- Intermediate Metabolizer
582+
- \*41;\*2;
583+
- \*4;\*10;\*2;
584+
- \*69;
585+
- \*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;
586+
- Normal
587+
* - HG00276
588+
- \*4/\*5
589+
- Poor Metabolizer
590+
- \*4;\*10;\*74;\*2;
591+
- \*10;\*74;\*2;
592+
- ;
593+
- \*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;
594+
- DeletionHet
595+
* - NA19207
596+
- \*2x2/\*10
597+
- Normal Metabolizer
598+
- \*10;\*2;
599+
- \*2;
600+
- ;
601+
- \*10:22-42523943-A-G,22-42526694-G-A:0.361,0.25;\*2:default;
602+
- Duplication
603+
604+
This list explains each of the columns in the example results.
605+
606+
- **Genotype**: Diplotype call. This simply combines the two top-ranked star alleles from **Haplotype1** and **Haplotype2** with '/'.
607+
- **Phenotype**: Phenotype call.
608+
- **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).
609+
- **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.
610+
- **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).
611+
- **CNV**: Structural variation call. See the `Structural variation detection <https://pypgx.readthedocs.io/en/latest/readme.html#structural-variation-detection>`__ section for more details.
612+
488613
Getting help
489614
============
490615

@@ -514,6 +639,7 @@ For getting help on the CLI:
514639
Compute read depth for target gene from BAM files.
515640
create-consolidated-vcf
516641
Create a consolidated VCF file.
642+
create-input-vcf Call SNVs/indels from BAM files for all target genes.
517643
create-regions-bed Create a BED file which contains all regions used by
518644
PyPGx.
519645
estimate-phase-beagle
@@ -571,7 +697,7 @@ For getting help on a specific submodule (e.g. ``utils``):
571697
>>> from pypgx.api import utils
572698
>>> help(utils)
573699
574-
For getting help on a specific method (e.g. ``predict_phenotype``):
700+
For getting help on a specific method (e.g. ``pypgx.predict_phenotype``):
575701

576702
.. code:: python3
577703

docs/api.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
API
55
***
66

7-
Introduction
8-
============
9-
107
This page describes the application programming interface (API) for PyPGx.
118

129
Below is the list of submodules available in the API:

0 commit comments

Comments
 (0)