{"id":16393766,"url":"https://github.com/sbslee/pypgx","last_synced_at":"2026-01-04T07:15:29.135Z","repository":{"id":37638653,"uuid":"273645304","full_name":"sbslee/pypgx","owner":"sbslee","description":"A Python package for pharmacogenomics (PGx) research","archived":false,"fork":false,"pushed_at":"2025-11-12T00:38:04.000Z","size":234608,"stargazers_count":81,"open_issues_count":2,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-12-14T17:39:45.514Z","etag":null,"topics":["api","cli","cyp2d6","genotype","pgx","pharmacogenetics","pharmacogenomics","phenotype","star-alleles","stargazer","structural-variation"],"latest_commit_sha":null,"homepage":"https://pypgx.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbslee.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"sbslee"}},"created_at":"2020-06-20T05:34:23.000Z","updated_at":"2025-11-13T16:52:28.000Z","dependencies_parsed_at":"2023-02-09T09:00:54.067Z","dependency_job_id":"fcdc7a84-4985-43bd-845b-8cc6a5d0e12c","html_url":"https://github.com/sbslee/pypgx","commit_stats":{"total_commits":1072,"total_committers":10,"mean_commits":107.2,"dds":"0.11660447761194026","last_synced_commit":"decb65a9ff7b906ad7cf2a031d646a87e701fcd3"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/sbslee/pypgx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbslee%2Fpypgx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbslee%2Fpypgx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbslee%2Fpypgx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbslee%2Fpypgx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbslee","download_url":"https://codeload.github.com/sbslee/pypgx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbslee%2Fpypgx/sbom","scorecard":{"id":802876,"data":{"date":"2025-08-11","repo":{"name":"github.com/sbslee/pypgx","commit":"7bec840a03b54556feac9fb80351875c3a48d669"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/1 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: pypgx/api/beagle.22Jul22.46e.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2020-107 / GHSA-jjw5-xxj6-pcv5","Warn: Project is vulnerable to: PYSEC-2024-110 / GHSA-jw8x-6495-233v","Warn: Project is vulnerable to: PYSEC-2020-108"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T10:58:03.422Z","repository_id":37638653,"created_at":"2025-08-23T10:58:03.422Z","updated_at":"2025-08-23T10:58:03.422Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28198201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2026-01-04T02:00:06.065Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cli","cyp2d6","genotype","pgx","pharmacogenetics","pharmacogenomics","phenotype","star-alleles","stargazer","structural-variation"],"created_at":"2024-10-11T04:54:12.084Z","updated_at":"2026-01-04T07:15:29.120Z","avatar_url":"https://github.com/sbslee.png","language":"Python","funding_links":["https://github.com/sponsors/sbslee"],"categories":["Pharmacogenomics"],"sub_categories":["Mendelian randomization in _cis_"],"readme":"..\n   This file was automatically generated by docs/create.py.\n\nREADME\n******\n\n.. image:: https://badge.fury.io/py/pypgx.svg\n    :target: https://badge.fury.io/py/pypgx\n\n.. image:: https://readthedocs.org/projects/pypgx/badge/?version=latest\n    :target: https://pypgx.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://anaconda.org/bioconda/pypgx/badges/version.svg\n   :target: https://anaconda.org/bioconda/pypgx\n\n.. image:: https://anaconda.org/bioconda/pypgx/badges/license.svg\n   :target: https://github.com/sbslee/pypgx/blob/master/LICENSE\n\n.. image:: https://anaconda.org/bioconda/pypgx/badges/downloads.svg\n   :target: https://anaconda.org/bioconda/pypgx/files\n\nIntroduction\n============\n\nThe main purpose of the PyPGx package is to provide a unified platform for\npharmacogenomics (PGx) research. PyPGx is and always will be completely free\nand open source.\n\nThe package is written in Python, and supports both command line interface\n(CLI) and application programming interface (API) whose documentations are\navailable at the `Read the Docs \u003chttps://pypgx.readthedocs.io/en/latest/\u003e`_.\n\nQuick links:\n\n- `README \u003chttps://pypgx.readthedocs.io/en/latest/readme.html\u003e`__\n- `Genes \u003chttps://pypgx.readthedocs.io/en/latest/genes.html\u003e`__\n- `Glossary \u003chttps://pypgx.readthedocs.io/en/latest/glossary.html\u003e`__\n- `Tutorials \u003chttps://pypgx.readthedocs.io/en/latest/tutorials.html\u003e`__\n- `CLI \u003chttps://pypgx.readthedocs.io/en/latest/cli.html\u003e`__\n- `API \u003chttps://pypgx.readthedocs.io/en/latest/api.html\u003e`__\n- `SDK \u003chttps://pypgx.readthedocs.io/en/latest/sdk.html\u003e`__\n- `FAQ \u003chttps://pypgx.readthedocs.io/en/latest/faq.html\u003e`__\n- `Changelog \u003chttps://pypgx.readthedocs.io/en/latest/changelog.html\u003e`__\n\nPyPGx can predict PGx genotypes (e.g. ``*4/*5``) and phenotypes (e.g.\n``Poor Metabolizer``) using various genomic data, including data from\nnext-generation sequencing (NGS), single nucleotide polymorphism (SNP) array,\nand long-read sequencing. Importantly, for NGS data the package can detect\n`structural variation (SV) \u003chttps://pypgx.readthedocs.io/en/latest/\nglossary.html#structural-variation-sv\u003e`__ using a machine learning-based\napproach. Finally, note that PyPGx is compatible with both of the Genome\nReference Consortium Human (GRCh) builds, GRCh37 (hg19) and GRCh38 (hg38).\n\nThere are currently 88 pharmacogenes in PyPGx:\n\n.. list-table::\n\n   * - ABCB1\n     - ABCG2\n     - ACYP2\n     - ADRA2A\n     - ADRB2\n   * - ANKK1\n     - APOE\n     - ATM\n     - BCHE\n     - BDNF\n   * - CACNA1S\n     - CFTR\n     - COMT\n     - CYP1A1\n     - CYP1A2\n   * - CYP1B1\n     - CYP2A6/CYP2A7\n     - CYP2A13\n     - CYP2B6/CYP2B7\n     - CYP2C8\n   * - CYP2C9\n     - CYP2C19\n     - CYP2D6/CYP2D7\n     - CYP2E1\n     - CYP2F1\n   * - CYP2J2\n     - CYP2R1\n     - CYP2S1\n     - CYP2W1\n     - CYP3A4\n   * - CYP3A5\n     - CYP3A7\n     - CYP3A43\n     - CYP4A11\n     - CYP4A22\n   * - CYP4B1\n     - CYP4F2\n     - CYP17A1\n     - CYP19A1\n     - CYP26A1\n   * - DBH\n     - DPYD\n     - DRD2\n     - F2\n     - F5\n   * - G6PD\n     - GRIK1\n     - GRIK4\n     - GRIN2B\n     - GSTM1\n   * - GSTP1\n     - GSTT1\n     - HTR1A\n     - HTR2A\n     - IFNL3\n   * - IFNL3\n     - ITGB3\n     - ITPA\n     - MT-RNR1\n     - MTHFR\n   * - NAT1\n     - NAT2\n     - NUDT15\n     - OPRK1\n     - OPRM1\n   * - POR\n     - PTGIS\n     - RARG\n     - RYR1\n     - SLC6A4\n   * - SLC15A2\n     - SLC22A2\n     - SLC28A3\n     - SLC47A2\n     - SLCO1B1\n   * - SLCO1B3\n     - SLCO2B1\n     - SULT1A1\n     - TBXAS1\n     - TPMT\n   * - UGT1A1\n     - UGT1A4\n     - UGT1A6\n     - UGT2B7\n     - UGT2B15\n   * - UGT2B17\n     - VKORC1\n     - XPC\n     -\n     -\n\nYour contributions (e.g. feature ideas, pull requests) are most welcome.\n\n| Author: Seung-been \"Steven\" Lee\n| Email: sbstevenlee@gmail.com\n| License: MIT License\n\nCitation\n========\n\nIf you use PyPGx in a published analysis, please report the program version\nand cite the following article:\n\n- Lee et al., 2022. `ClinPharmSeq: A targeted sequencing panel for clinical pharmacogenetics implementation \u003chttps://doi.org/10.1371/journal.pone.0272129\u003e`__. PLOS ONE.\n\nIn this article, PyPGx was used to call star alleles for genomic DNA\nreference materials from the Centers for Disease Control and Prevention–based\n`Genetic Testing Reference Materials Coordination Program (GeT-RM)\n\u003chttps://pypgx.readthedocs.io/en/latest/glossary.html#\ngenetic-testing-reference-materials-coordination-program-get-rm\u003e`__, where it\nshowed almost 100% concordance with genotype results from previous works.\n\nThe development of PyPGx was heavily inspired by `Stargazer \u003chttps://\nstargazer.gs.washington.edu/stargazerweb/\u003e`__, another star-allele calling\ntool developed by Steven when he was in his PhD program at the University of\nWashington. Therefore, please also cite the following articles:\n\n- Lee et al., 2019. `Calling star alleles with Stargazer in 28 pharmacogenes with whole genome sequences \u003chttps://doi.org/10.1002/cpt.1552\u003e`__. Clinical Pharmacology \u0026 Therapeutics.\n- Lee et al., 2018. `Stargazer: a software tool for calling star alleles from next-generation sequencing data using CYP2D6 as a model \u003chttps://doi.org/10.1038/s41436-018-0054-0\u003e`__. Genetics in Medicine.\n\nBelow is an incomplete list of publications which have used PyPGx:\n\n- Wroblewski et al., 2022. `Pharmacogenetic variation in Neanderthals and Denisovans and implications for human health and response to medications \u003chttps://doi.org/10.1101/2021.11.27.470071\u003e`__. bioRxiv.\n- Botton et al., 2020. `Phased Haplotype Resolution of the SLC6A4 Promoter Using Long-Read Single Molecule Real-Time (SMRT) Sequencing \u003chttps://doi.org/10.3390/genes11111333\u003e`__. Genes.\n\nSupport PyPGx\n=============\n\nIf you find my work useful, please consider becoming a `sponsor \u003chttps://github.com/sponsors/sbslee\u003e`__.\n\nInstallation\n============\n\nFollowing packages are required to run PyPGx:\n\n.. list-table::\n   :header-rows: 1\n\n   * - Package\n     - Anaconda\n     - PyPI\n   * - ``fuc``\n     - ✅\n     - ✅\n   * - ``scikit-learn``\n     - ✅\n     - ✅\n   * - ``openjdk``\n     - ✅\n     - ❌\n\nThere are various ways you can install PyPGx. The recommended way is via\nconda (`Anaconda \u003chttps://www.anaconda.com/\u003e`__):\n\n.. code-block:: text\n\n   $ conda install -c bioconda pypgx\n\nAbove will automatically download and install all the dependencies as well.\nAlternatively, you can use pip (`PyPI \u003chttps://pypi.org/\u003e`__) to install\nPyPGx and all of its dependencies except ``openjdk`` (i.e. Java JDK must be\ninstalled separately):\n\n.. code-block:: text\n\n   $ pip install pypgx\n\nFinally, you can clone the GitHub repository and then install PyPGx locally:\n\n.. code-block:: text\n\n   $ git clone https://github.com/sbslee/pypgx\n   $ cd pypgx\n   $ pip install .\n\nThe nice thing about this approach is that you will have access to\ndevelopment versions that are not available in Anaconda or PyPI. For example,\nyou can access a development branch with the ``git checkout`` command. When\nyou do this, please make sure your environment already has all the\ndependencies installed.\n\n.. note::\n    `Beagle \u003chttps://faculty.washington.edu/browning/beagle/beagle.html\u003e`__\n    is one of the default software tools used by PyPGx for haplotype phasing\n    SNVs and indels. The program is freely available and published under the\n    `GNU General Public License \u003chttps://faculty.washington.edu/browning/\n    beagle/gpl_license\u003e`__. Users do not need to download Beagle separately\n    because a copy of the software (``beagle.22Jul22.46e.jar``) is already\n    included in PyPGx.\n\n.. warning::\n    You're not done yet! Keep scrolling down to obtain the resource bundle\n    for PyPGx, which is essential for running the package.\n\nResource bundle\n===============\n\nStarting with the 0.12.0 version, reference haplotype panel files and\nstructural variant classifier files in PyPGx are moved to the\n``pypgx-bundle`` `repository \u003chttps://github.com/sbslee/pypgx-bundle\u003e`__\n(only those files are moved; other files such as ``allele-table.csv`` and\n``variant-table.csv`` are intact). Therefore, the user must clone the\n``pypgx-bundle`` repository with matching PyPGx version to their home\ndirectory in order for PyPGx to correctly access the moved files (i.e. replace \n``x.x.x`` with the version number of PyPGx you're using, such as ``0.18.0``):\n\n.. code-block:: text\n\n   $ cd ~\n   $ git clone --branch x.x.x --depth 1 https://github.com/sbslee/pypgx-bundle\n\nThis is undoubtedly annoying, but absolutely necessary for portability\nreasons because PyPGx has been growing exponentially in file size due to the\nincreasing number of genes supported and their variation complexity, to the\npoint where it now exceeds upload size limit for PyPI (100 Mb). After removal\nof those files, the size of PyPGx has reduced from \u003e100 Mb to \u003c1 Mb.\n\nStarting with version 0.22.0, you can now specify a custom location for the \n``pypgx-bundle`` directory instead of using the home directory. This can be \nachieved by setting the bundle location using the ``PYPGX_BUNDLE`` environment \nvariable:\n\n.. code-block:: text\n\n   $ export PYPGX_BUNDLE=/path/to/pypgx-bundle\n\nStructural variation detection\n==============================\n\nMany pharmacogenes are known to have `structural variation (SV)\n\u003chttps://pypgx.readthedocs.io/en/latest/glossary.html#structural-variation-\nsv\u003e`__ such as gene deletions, duplications, and hybrids. You can visit the\n`Genes \u003chttps://pypgx.readthedocs.io/en/latest/genes.html\u003e`__ page to see the\nlist of genes with SV.\n\nSome of the SV events can be quite challenging to detect accurately with NGS\ndata due to misalignment of sequence reads caused by sequence homology with\nother gene family members (e.g. CYP2D6 and CYP2D7). PyPGx attempts to address\nthis issue by training a `support vector machine (SVM) \u003chttps://scikit-\nlearn.org/stable/modules/generated/sklearn.svm.SVC.html\u003e`__-based multiclass\nclassifier using the `one-vs-rest strategy \u003chttps://scikit-learn.org/stable\n/modules/generated/sklearn.multiclass.OneVsRestClassifier.html\u003e`__ for each\ngene for each GRCh build. Each classifier is trained using copy number\nprofiles of real NGS samples as well as simulated ones, including those from\n`1KGP \u003chttps://pypgx.readthedocs.io/en/latest/glossary.html#genomes-project-\n1kgp\u003e`__ and `GeT-RM \u003chttps://pypgx.readthedocs.io/en/latest/\nglossary.html#genetic-testing-reference-materials-coordination-program-get-rm\u003e`__.\n\nYou can plot copy number profile and allele fraction profile with PyPGx to\nvisually inspect SV calls. Below are CYP2D6 examples:\n\n.. list-table::\n   :header-rows: 1\n   :widths: 10 30 60\n\n   * - SV Name\n     - Gene Model\n     - Profile\n   * - Normal\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/gene-model-CYP2D6-1.png\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/GRCh37-CYP2D6-8.png\n   * - WholeDel1\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/gene-model-CYP2D6-2.png\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/GRCh37-CYP2D6-1.png\n   * - WholeDel1Hom\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/gene-model-CYP2D6-3.png\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/GRCh37-CYP2D6-6.png\n   * - WholeDup1\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/gene-model-CYP2D6-4.png\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/GRCh37-CYP2D6-2.png\n   * - Tandem3\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/gene-model-CYP2D6-11.png\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/GRCh37-CYP2D6-9.png\n   * - Tandem2C\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/gene-model-CYP2D6-10.png\n     - .. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/dpsv/GRCh37-CYP2D6-7.png\n\nPyPGx was recently applied to the entire high-coverage WGS dataset from 1KGP\n(N=2,504). Click `here \u003chttps://github.com/sbslee/1kgp-pgx-paper/tree/main/\nsv-tables\u003e`__ to see individual SV calls, and corresponding copy number\nprofiles and allele fraction profiles.\n\nGRCh37 vs. GRCh38\n=================\n\nWhen working with PGx data, it's not uncommon to encounter a situation\nwhere you are handling GRCh37 data in one project but GRCh38 in another. You\nmay be tempted to use tools like ``LiftOver`` to convert GRCh37 to GRCh38, or\nvice versa, but deep down you know it's going to be a mess (and please don't\ndo this). The good news is, PyPGx supports both of the builds!\n\nIn many PyPGx actions, you can simply indicate which genome build to use. For\nexample, for GRCh38 data you can use ``--assembly GRCh38`` in CLI and\n``assembly='GRCh38'`` in API. **Note that GRCh37 will always be the\ndefault.** Below is an example of using the API:\n\n.. code:: python3\n\n    \u003e\u003e\u003e import pypgx\n    \u003e\u003e\u003e pypgx.list_variants('CYP2D6', alleles=['*4'], assembly='GRCh37')\n    ['22-42524947-C-T']\n    \u003e\u003e\u003e pypgx.list_variants('CYP2D6', alleles=['*4'], assembly='GRCh38')\n    ['22-42128945-C-T']\n\nHowever, there is one important caveat to consider if your sequencing data is\nGRCh38. That is, sequence reads must be aligned only to the main contigs\n(i.e. ``chr1``, ``chr2``, ..., ``chrX``, ``chrY``), and not to the\nalternative (ALT) contigs such as ``chr1_KI270762v1_alt``. This is because\nthe presence of ALT contigs reduces the sensitivity of variant calling\nand many other analyses including SV detection. Therefore, if you have\nsequencing data in GRCh38, make sure it's aligned to the main contigs only.\n\nThe only exception to above rule is the GSTT1 gene, which is located on\n``chr22`` for GRCh37 but on ``chr22_KI270879v1_alt`` for GRCh38. This gene is\nknown to have an extremely high rate of gene deletion polymorphism in the\npopulation and thus requires SV analysis. Therefore, if you are interested in\ngenotyping this gene with GRCh38 data, then you must include that contig\nwhen performing read alignment. To this end, you can easily filter your\nreference FASTA file before read alignment so that it only contains the main\ncontigs plus the ALT contig. If you don't know how to do this, here's one way\nusing the ``fuc`` program (which should have already been installed along\nwith PyPGx):\n\n.. code-block:: text\n\n    $ cat contigs.list\n    chr1\n    chr2\n    ...\n    chrX\n    chrY\n    chr22_KI270879v1_alt\n    $ fuc fa-filter in.fa --contigs contigs.list \u003e out.fa\n\nArchive file, semantic type, and metadata\n=========================================\n\nIn order to efficiently store and transfer data, PyPGx uses the ZIP archive\nfile format (``.zip``) which supports lossless data compression. Each archive\nfile created by PyPGx has a metadata file (``metadata.txt``) and a data file\n(e.g. ``data.tsv``, ``data.vcf``). A metadata file contains important\ninformation about the data file within the same archive, which is expressed\nas pairs of ``=``-separated keys and values (e.g. ``Assembly=GRCh37``):\n\n.. list-table::\n    :widths: 20 40 40\n    :header-rows: 1\n\n    * - Metadata\n      - Description\n      - Examples\n    * - ``Assembly``\n      - Reference genome assembly.\n      - ``GRCh37``, ``GRCh38``\n    * - ``Control``\n      - Control gene.\n      - ``VDR``, ``chr1:10000-20000``\n    * - ``Gene``\n      - Target gene.\n      - ``CYP2D6``, ``GSTT1``\n    * - ``Platform``\n      - Genotyping platform.\n      - ``WGS``, ``Targeted``, ``Chip``, ``LongRead``\n    * - ``Program``\n      - Name of the phasing program.\n      - ``Beagle``, ``SHAPEIT``\n    * - ``Samples``\n      - Samples used for inter-sample normalization.\n      - ``NA07000,NA10854,NA11993``\n    * - ``SemanticType``\n      - Semantic type of the archive.\n      - ``CovFrame[CopyNumber]``, ``Model[CNV]``\n\nSemantic types\n--------------\n\nNotably, all archive files have defined semantic types, which allows us to\nensure that the data that is passed to a PyPGx command (CLI) or method (API)\nis meaningful for the operation that will be performed. Below is a list of\ncurrently defined semantic types:\n\n- ``CovFrame[CopyNumber]``\n    * CovFrame for storing target gene's per-base copy number which is computed from read depth with control statistics.\n    * Requires following metadata: ``Gene``, ``Assembly``, ``SemanticType``, ``Platform``, ``Control``, ``Samples``.\n- ``CovFrame[DepthOfCoverage]``\n    * CovFrame for storing read depth for all target genes with SV.\n    * Requires following metadata: ``Assembly``, ``SemanticType``, ``Platform``.\n- ``CovFrame[ReadDepth]``\n    * CovFrame for storing read depth for single target gene.\n    * Requires following metadata: ``Gene``, ``Assembly``, ``SemanticType``, ``Platform``.\n- ``Model[CNV]``\n    * Model for calling CNV in target gene.\n    * Requires following metadata: ``Gene``, ``Assembly``, ``SemanticType``, ``Control``.\n- ``SampleTable[Alleles]``\n    * TSV file for storing target gene's candidate star alleles for each sample.\n    * Requires following metadata: ``Platform``, ``Gene``, ``Assembly``, ``SemanticType``, ``Program``.\n- ``SampleTable[CNVCalls]``\n    * TSV file for storing target gene's CNV call for each sample.\n    * Requires following metadata: ``Gene``, ``Assembly``, ``SemanticType``, ``Control``.\n- ``SampleTable[Genotypes]``\n    * TSV file for storing target gene's genotype call for each sample.\n    * Requires following metadata: ``Gene``, ``Assembly``, ``SemanticType``.\n- ``SampleTable[Phenotypes]``\n    * TSV file for storing target gene's phenotype call for each sample.\n    * Requires following metadata: ``Gene``, ``SemanticType``.\n- ``SampleTable[Results]``\n    * TSV file for storing various results for each sample.\n    * Requires following metadata: ``Gene``, ``Assembly``, ``SemanticType``.\n- ``SampleTable[Statistics]``\n    * TSV file for storing control gene's various statistics on read depth for each sample. Used for converting target gene's read depth to copy number.\n    * Requires following metadata: ``Control``, ``Assembly``, ``SemanticType``, ``Platform``.\n- ``VcfFrame[Consolidated]``\n    * VcfFrame for storing target gene's consolidated variant data.\n    * Requires following metadata: ``Platform``, ``Gene``, ``Assembly``, ``SemanticType``, ``Program``.\n- ``VcfFrame[Imported]``\n    * VcfFrame for storing target gene's raw variant data.\n    * Requires following metadata: ``Platform``, ``Gene``, ``Assembly``, ``SemanticType``.\n- ``VcfFrame[Phased]``\n    * VcfFrame for storing target gene's phased variant data.\n    * Requires following metadata: ``Platform``, ``Gene``, ``Assembly``, ``SemanticType``, ``Program``.\n\nWorking with archive files\n--------------------------\n\nTo demonstrate how easy it is to work with PyPGx archive files, below we will\nshow some examples. First, download an archive to play with, which has\n``SampleTable[Results]`` as semantic type:\n\n.. code-block:: text\n\n    $ wget https://raw.githubusercontent.com/sbslee/pypgx-data/main/getrm-wgs-tutorial/grch37-CYP2D6-results.zip\n\nLet's print its metadata:\n\n.. code-block:: text\n\n    $ pypgx print-metadata grch37-CYP2D6-results.zip\n    Gene=CYP2D6\n    Assembly=GRCh37\n    SemanticType=SampleTable[Results]\n\nNow print its main data (but display first sample only):\n\n.. code-block:: text\n\n    $ pypgx print-data grch37-CYP2D6-results.zip | head -n 2\n    \tGenotype\tPhenotype\tHaplotype1\tHaplotype2\tAlternativePhase\tVariantData\tCNV\n    HG00276_PyPGx\t*4/*5\tPoor Metabolizer\t*4;*10;*74;*2;\t*10;*74;*2;\t;\t*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;\tDeletionHet\n\nWe can unzip it to extract files inside (note that ``tmpcty4c_cr`` is the\noriginal folder name):\n\n.. code-block:: text\n\n    $ unzip grch37-CYP2D6-results.zip\n    Archive:  grch37-CYP2D6-results.zip\n      inflating: tmpcty4c_cr/metadata.txt\n      inflating: tmpcty4c_cr/data.tsv\n\nWe can now directly interact with the files:\n\n.. code-block:: text\n\n    $ cat tmpcty4c_cr/metadata.txt\n    Gene=CYP2D6\n    Assembly=GRCh37\n    SemanticType=SampleTable[Results]\n    $ head -n 2 tmpcty4c_cr/data.tsv\n    \tGenotype\tPhenotype\tHaplotype1\tHaplotype2\tAlternativePhase\tVariantData\tCNV\n    HG00276_PyPGx\t*4/*5\tPoor Metabolizer\t*4;*10;*74;*2;\t*10;*74;*2;\t;\t*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;\tDeletionHet\n\nWe can easily create a new archive:\n\n.. code-block:: text\n\n    $ zip -r grch37-CYP2D6-results-new.zip tmpcty4c_cr\n      adding: tmpcty4c_cr/ (stored 0%)\n      adding: tmpcty4c_cr/metadata.txt (stored 0%)\n      adding: tmpcty4c_cr/data.tsv (deflated 84%)\n    $ pypgx print-metadata grch37-CYP2D6-results-new.zip\n    Gene=CYP2D6\n    Assembly=GRCh37\n    SemanticType=SampleTable[Results]\n\nPhenotype prediction\n====================\n\nMany genes in PyPGx have a genotype-phenotype table available from the\nClinical Pharmacogenetics Implementation Consortium (CPIC) or\nthe Pharmacogenomics Knowledge Base (PharmGKB). PyPGx uses these tables to\nperform phenotype prediction with one of the two methods:\n\n- Method 1. Simple diplotype-phenotype mapping: This method directly uses the\n  diplotype-phenotype mapping as defined by CPIC or PharmGKB. Using the\n  CYP2B6 gene as an example, the diplotypes \\*6/\\*6, \\*1/\\*29, \\*1/\\*2,\n  \\*1/\\*4, and \\*4/\\*4 correspond to Poor Metabolizer, Intermediate\n  Metabolizer, Normal Metabolizer, Rapid Metabolizer, and Ultrarapid\n  Metabolizer.\n- Method 2. Summation of haplotype activity scores: This method uses a\n  standard unit of enzyme activity known as an activity score. Using the\n  CYP2D6 gene as an example, the fully functional reference \\*1 allele is\n  assigned a value of 1, decreased-function alleles such as \\*9 and \\*17\n  receive a value of 0.5, and nonfunctional alleles including \\*4 and \\*5\n  have a value of 0. The sum of values assigned to both alleles constitutes\n  the activity score of a diplotype. Consequently, subjects with \\*1/\\*1,\n  \\*1/\\*4, and \\*4/\\*5 diplotypes have an activity score of 2 (Normal\n  Metabolizer), 1 (Intermediate Metabolizer), and 0 (Poor Metabolizer),\n  respectively.\n\nPlease visit the `Genes \u003chttps://pypgx.readthedocs.io/en/latest/\ngenes.html\u003e`__ page to see the list of genes with a genotype-phenotype\ntable and each of their prediction method.\n\nTo perform phenotype prediction with the API, you can use the\n``pypgx.predict_phenotype`` method:\n\n.. code:: python3\n\n    \u003e\u003e\u003e import pypgx\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*4', '*5')   # Both alleles have no function\n    'Poor Metabolizer'\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*5', '*4')   # The order of alleles does not matter\n    'Poor Metabolizer'\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*1', '*22')  # *22 has uncertain function\n    'Indeterminate'\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*1', '*1x2') # Gene duplication\n    'Ultrarapid Metabolizer'\n\nTo perform phenotype prediction with the CLI, you can use the\n``call-phenotypes`` command. It takes a ``SampleTable[Genotypes]`` file as\ninput and outputs a ``SampleTable[Phenotypes]`` file:\n\n.. code-block:: text\n\n   $ pypgx call-phenotypes genotypes.zip phenotypes.zip\n\nPipelines\n=========\n\nPyPGx currently provides three pipelines for performing PGx genotype analysis\nof single gene for one or multiple samples: NGS pipeline, chip pipeline, and\nlong-read pipeline. In additional to genotyping, each pipeline will perform\nphenotype prediction based on genotype results. All pipelines are compatible\nwith both GRCh37 and GRCh38 (e.g. for GRCh38 use ``--assembly GRCh38`` in CLI\nand ``assembly='GRCh38'`` in API).\n\nNGS pipeline\n------------\n\n.. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/flowchart-ngs-pipeline.png\n\nImplemented as ``pypgx run-ngs-pipeline`` in CLI and\n``pypgx.pipeline.run_ngs_pipeline`` in API, this pipeline is designed for\nprocessing short-read data (e.g. Illumina). Users must specify whether the\ninput data is from whole genome sequencing (WGS) or targeted sequencing\n(custom targeted panel sequencing or whole exome sequencing).\n\nThis pipeline supports SV detection based on copy number analysis for genes\nthat are known to have SV. Therefore, if the target gene is associated with\nSV (e.g. CYP2D6) it's strongly recommended to provide a\n``CovFrame[DepthOfCoverage]`` file and a ``SampleTable[Statistics]`` file in\naddtion to a VCF file containing SNVs/indels. If the target gene is not\nassociated with SV (e.g. CYP3A5) providing a VCF file alone is enough. You can\nvisit the `Genes \u003chttps://pypgx.readthedocs.io/en/latest/genes.html\u003e`__ page\nto see the full list of genes with SV. For details on SV detection algorithm,\nplease see the `Structural variation detection \u003chttps://pypgx.readthedocs.io/\nen/latest/readme.html#structural-variation-detection\u003e`__ section.\n\nWhen creating a VCF file (containing SNVs/indels) from BAM files, users have\na choice to either use the ``pypgx create-input-vcf`` command (strongly\nrecommended) or a variant caller of their choice (e.g. GATK4\nHaplotypeCaller). See the `Variant caller choice \u003chttps://pypgx.readthedocs.\nio/en/latest/faq.html#variant-caller-choice\u003e`__ section for detailed\ndiscussion on when to use either option.\n\nCheck out the `GeT-RM WGS tutorial \u003chttps://pypgx.readthedocs.io/en/latest/\ntutorials.html#get-rm-wgs-tutorial\u003e`__ to see this pipeline in action.\n\nChip pipeline\n-------------\n\n.. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/flowchart-chip-pipeline.png\n\nImplemented as ``pypgx run-chip-pipeline`` in CLI and\n``pypgx.pipeline.run_chip_pipeline`` in API, this pipeline is designed for\nDNA chip data (e.g. Global Screening Array from Illumina). It's recommended\nto perform variant imputation on the input VCF prior to feeding it to the\npipeline using a large reference haplotype panel (e.g. `TOPMed Imputation\nServer \u003chttps://imputation.biodatacatalyst.nhlbi.nih.gov/\u003e`__).\nAlternatively, it's possible to perform variant imputation with the 1000\nGenomes Project (1KGP) data as reference within PyPGx using ``--impute`` in\nCLI and ``impute=True`` in API.\n\nThe pipeline currently does not support SV detection. Please post a GitHub\nissue if you want to contribute your development skills and/or data for\ndevising an SV detection algorithm.\n\nCheck out the `Coriell Affy tutorial \u003chttps://pypgx.readthedocs.io/en/latest/\ntutorials.html#coriell-affy-tutorial\u003e`__ to see this pipeline in action.\n\nLong-read pipeline\n------------------\n\n.. image:: https://raw.githubusercontent.com/sbslee/pypgx-data/main/flowchart-long-read-pipeline.png\n\nImplemented as ``pypgx run-long-read-pipeline`` in CLI and\n``pypgx.pipeline.run_long_read_pipeline`` in API, this pipeline is designed\nfor long-read data (e.g. Pacific Biosciences and Oxford Nanopore\nTechnologies). The input VCF must be phased using a read-backed haplotype\nphasing tool such as `WhatsHap \u003chttps://github.com/whatshap/whatshap\u003e`__.\n\nThe pipeline currently does not support SV detection. Please post a GitHub\nissue if you want to contribute your development skills and/or data for\ndevising an SV detection algorithm.\n\nResults interpretation\n======================\n\nPyPGx outputs per-sample genotype results in a table, which is stored in an\narchive file with the semantic type ``SampleTable[Results]``. Below, we will\nuse the CYP2D6 gene with GRCh37 as an example to illustrate how to interpret\ngenotype results from PyPGx.\n\n.. list-table::\n   :header-rows: 1\n\n   * -\n     - Genotype\n     - Phenotype\n     - Haplotype1\n     - Haplotype2\n     - AlternativePhase\n     - VariantData\n     - CNV\n   * - NA11839\n     - \\*1/\\*2\n     - Normal Metabolizer\n     - \\*1;\n     - \\*2;\n     - ;\n     - \\*1:22-42522613-G-C,22-42523943-A-G:0.5,0.488;\\*2:default\n     - Normal\n   * - NA12006\n     - \\*4/\\*41\n     - Intermediate Metabolizer\n     - \\*41;\\*2;\n     - \\*4;\\*10;\\*2;\n     - \\*69;\n     - \\*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;\n     - Normal\n   * - HG00276\n     - \\*4/\\*5\n     - Poor Metabolizer\n     - \\*4;\\*10;\\*74;\\*2;\n     - \\*10;\\*74;\\*2;\n     - ;\n     - \\*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;\n     - WholeDel1\n   * - NA19207\n     - \\*2x2/\\*10\n     - Normal Metabolizer\n     - \\*10;\\*2;\n     - \\*2;\n     - ;\n     - \\*10:22-42523943-A-G,22-42526694-G-A:0.361,0.25;\\*2:default;\n     - WholeDup1\n\nThis list explains each of the columns in the example results.\n\n- **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 \u003chttps://pypgx.readthedocs.io/en/latest/api.html#pypgx.api.genotype.CYP2D6Genotyper\u003e`__).\n- **Phenotype**: Phenotype call.\n- **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 \u003chttps://pypgx.readthedocs.io/en/latest/api.html#pypgx.api.core.sort_alleles\u003e`__ for detailed implementation).\n- **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``.\n- **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).\n- **CNV**: Structural variation call. See the `Structural variation detection \u003chttps://pypgx.readthedocs.io/en/latest/readme.html#structural-variation-detection\u003e`__ section for more details.\n\nGetting help\n============\n\nFor detailed documentations on the CLI and API, please refer to the\n`Read the Docs \u003chttps://pypgx.readthedocs.io/en/latest/\u003e`_.\n\nFor getting help on the CLI:\n\n.. code-block:: text\n\n   $ pypgx -h\n\n   usage: pypgx [-h] [-v] COMMAND ...\n   \n   positional arguments:\n     COMMAND\n       call-genotypes      Call genotypes for target gene.\n       call-phenotypes     Call phenotypes for target gene.\n       combine-results     Combine various results for target gene.\n       compare-genotypes   Calculate concordance between two genotype results.\n       compute-control-statistics\n                           Compute summary statistics for control gene from BAM\n                           files.\n       compute-copy-number\n                           Compute copy number from read depth for target gene.\n       compute-target-depth\n                           Compute read depth for target gene from BAM files.\n       create-consolidated-vcf\n                           Create a consolidated VCF file.\n       create-input-vcf    Call SNVs/indels from BAM files for all target genes.\n       create-regions-bed  Create a BED file which contains all regions used by\n                           PyPGx.\n       estimate-phase-beagle\n                           Estimate haplotype phase of observed variants with\n                           the Beagle program.\n       filter-samples      Filter Archive file for specified samples.\n       import-read-depth   Import read depth data for target gene.\n       import-variants     Import SNV/indel data for target gene.\n       plot-bam-copy-number\n                           Plot copy number profile from CovFrame[CopyNumber].\n       plot-bam-read-depth\n                           Plot read depth profile with BAM data.\n       plot-cn-af          Plot both copy number profile and allele fraction\n                           profile in one figure.\n       plot-vcf-allele-fraction\n                           Plot allele fraction profile with VCF data.\n       plot-vcf-read-depth\n                           Plot read depth profile with VCF data.\n       predict-alleles     Predict candidate star alleles based on observed\n                           variants.\n       predict-cnv         Predict CNV from copy number data for target gene.\n       prepare-depth-of-coverage\n                           Prepare a depth of coverage file for all target\n                           genes with SV from BAM files.\n       print-data          Print the main data of specified archive.\n       print-metadata      Print the metadata of specified archive.\n       run-chip-pipeline   Run genotyping pipeline for chip data.\n       run-long-read-pipeline\n                           Run genotyping pipeline for long-read sequencing data.\n       run-ngs-pipeline    Run genotyping pipeline for NGS data.\n       slice-bam           Slice BAM file for all genes used by PyPGx.\n       test-cnv-caller     Test CNV caller for target gene.\n       train-cnv-caller    Train CNV caller for target gene.\n   \n   options:\n     -h, --help            Show this help message and exit.\n     -v, --version         Show the version number and exit.\n\nFor getting help on a specific command (e.g. call-genotypes):\n\n.. code-block:: text\n\n   $ pypgx call-genotypes -h\n\nBelow is the list of submodules available in the API:\n\n- **core** : The core submodule is the main suite of tools for PGx research.\n- **genotype** : The genotype submodule is primarily used to make final diplotype calls by interpreting candidate star alleles and/or detected structural variants.\n- **pipeline** : The pipeline submodule is used to provide convenient methods that combine multiple PyPGx actions and automatically handle semantic types.\n- **plot** : The plot submodule is used to plot various kinds of profiles such as read depth, copy number, and allele fraction.\n- **utils** : The utils submodule contains main actions of PyPGx.\n\nFor getting help on a specific submodule (e.g. ``utils``):\n\n.. code:: python3\n\n   \u003e\u003e\u003e from pypgx.api import utils\n   \u003e\u003e\u003e help(utils)\n\nFor getting help on a specific method (e.g. ``pypgx.predict_phenotype``):\n\n.. code:: python3\n\n   \u003e\u003e\u003e import pypgx\n   \u003e\u003e\u003e help(pypgx.predict_phenotype)\n\nIn Jupyter Notebook and Lab, you can see the documentation for a python\nfunction by hitting ``SHIFT + TAB``. Hit it twice to expand the view.\n\nCLI examples\n============\n\nWe can print the metadata of an archive file:\n\n.. code-block:: text\n\n    $ pypgx print-metadata grch37-depth-of-coverage.zip\n\nAbove will print:\n\n.. code-block:: text\n\n    Assembly=GRCh37\n    SemanticType=CovFrame[DepthOfCoverage]\n    Platform=WGS\n\nWe can run the NGS pipeline for the CYP2D6 gene:\n\n.. code-block:: text\n\n    $ pypgx run-ngs-pipeline \\\n    CYP2D6 \\\n    grch37-CYP2D6-pipeline \\\n    --variants grch37-variants.vcf.gz \\\n    --depth-of-coverage grch37-depth-of-coverage.zip \\\n    --control-statistics grch37-control-statistics-VDR.zip\n\nAbove will create a number of archive files:\n\n.. code-block:: text\n\n    Saved VcfFrame[Imported] to: grch37-CYP2D6-pipeline/imported-variants.zip\n    Saved VcfFrame[Phased] to: grch37-CYP2D6-pipeline/phased-variants.zip\n    Saved VcfFrame[Consolidated] to: grch37-CYP2D6-pipeline/consolidated-variants.zip\n    Saved SampleTable[Alleles] to: grch37-CYP2D6-pipeline/alleles.zip\n    Saved CovFrame[ReadDepth] to: grch37-CYP2D6-pipeline/read-depth.zip\n    Saved CovFrame[CopyNumber] to: grch37-CYP2D6-pipeline/copy-number.zip\n    Saved SampleTable[CNVCalls] to: grch37-CYP2D6-pipeline/cnv-calls.zip\n    Saved SampleTable[Genotypes] to: grch37-CYP2D6-pipeline/genotypes.zip\n    Saved SampleTable[Phenotypes] to: grch37-CYP2D6-pipeline/phenotypes.zip\n    Saved SampleTable[Results] to: grch37-CYP2D6-pipeline/results.zip\n\nAPI examples\n============\n\nWe can obtain allele function for the CYP2D6 gene:\n\n.. code:: python3\n\n    \u003e\u003e\u003e import pypgx\n    \u003e\u003e\u003e pypgx.get_function('CYP2D6', '*1')\n    'Normal Function'\n    \u003e\u003e\u003e pypgx.get_function('CYP2D6', '*4')\n    'No Function'\n    \u003e\u003e\u003e pypgx.get_function('CYP2D6', '*22')\n    'Uncertain Function'\n    \u003e\u003e\u003e pypgx.get_function('CYP2D6', '*140')\n    'Unknown Function'\n\nWe can predict phenotype for CYP2D6 based on two haplotype calls:\n\n.. code:: python3\n\n    \u003e\u003e\u003e import pypgx\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*4', '*5')   # Both alleles have no function\n    'Poor Metabolizer'\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*5', '*4')   # The order of alleles does not matter\n    'Poor Metabolizer'\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*1', '*22')  # *22 has uncertain function\n    'Indeterminate'\n    \u003e\u003e\u003e pypgx.predict_phenotype('CYP2D6', '*1', '*1x2') # Gene duplication\n    'Ultrarapid Metabolizer'\n\nWe can also obtain recommendation (e.g. CPIC) for certain drug-phenotype combination:\n\n.. code:: python3\n\n    \u003e\u003e\u003e import pypgx\n    \u003e\u003e\u003e # Codeine, an opiate and prodrug of morphine, is metabolized by CYP2D6\n    \u003e\u003e\u003e pypgx.get_recommendation('codeine', 'CYP2D6', 'Normal Metabolizer')\n    'Use codeine label recommended age- or weight-specific dosing.'\n    \u003e\u003e\u003e pypgx.get_recommendation('codeine', 'CYP2D6', 'Ultrarapid Metabolizer')\n    'Avoid codeine use because of potential for serious toxicity. If opioid use is warranted, consider a non-tramadol opioid.'\n    \u003e\u003e\u003e pypgx.get_recommendation('codeine', 'CYP2D6', 'Poor Metabolizer')\n    'Avoid codeine use because of possibility of diminished analgesia. If opioid use is warranted, consider a non-tramadol opioid.'\n    \u003e\u003e\u003e pypgx.get_recommendation('codeine', 'CYP2D6', 'Indeterminate')\n    'None'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbslee%2Fpypgx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbslee%2Fpypgx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbslee%2Fpypgx/lists"}