otargenpy
Tidy Python interface to the Open Targets Platform GraphQL API.
Query genes, diseases, drugs, variants, and genetic evidence directly from Python and receive analysis-ready pandas DataFrames — no manual JSON wrangling required.
Sister package of otargen (R).
Installation
PyPI (stable)
pip install otargenpy
GitHub (recommended — latest features and bug fixes)
pip install git+https://github.com/amirfeizi/otargenpy.git
Quick start
Every function takes a single identifier and returns a pandas DataFrame.
Drug queries (by ChEMBL ID)
import otargenpy as ot
# Adverse events for imatinib
ae = ot.adverse_events_query("CHEMBL941")
# Mechanism of action
moa = ot.mechanisms_of_action_query("CHEMBL941")
# Drug indications with clinical stage
ind = ot.indications_query("CHEMBL941")
Gene queries (by Ensembl ID)
# Known drugs targeting TP53
drugs = ot.known_drugs_gene_query("ENSG00000141510")
# Cancer hallmarks for TP53
hall = ot.hallmarks_query("ENSG00000141510")
# Protein-protein interactions from IntAct
inter = ot.interactions_query("ENSG00000141510", source_database="intact", size=25)
# DepMap essentiality for EGFR
dep = ot.depmap_query("ENSG00000146648")
# Safety liabilities
safe = ot.safety_query("ENSG00000146648")
Gene + disease evidence (by Ensembl ID + EFO ID)
# ChEMBL evidence linking PARP1 to breast cancer
ev = ot.chembl_query("ENSG00000143799", "EFO_0000305")
# GWAS credible sets for PCSK9 and hyperlipidemia
gwas = ot.gwas_credible_sets_query("ENSG00000169174", "EFO_0004911")
# ClinVar evidence for BRCA1 and ovarian cancer
cv = ot.clinvar_query("ENSG00000012048", "EFO_0001075")
Pharmacogenomics & variants
# Pharmacogenomics for a drug
pgx = ot.pharmacogenomics_chembl_query("CHEMBL1016")
# Variant effect predictions
vep = ot.variant_effect_predictor_query("1_154453788_C_T")
Genetics & colocalisation
# Locus-to-gene predictions
l2g = ot.locus2gene_query("fa375739ca2a6b825ce5cc69d117e84b")
# GWAS colocalisation
coloc = ot.gwas_colocalisation("5a86bfd40d2ebecf6ce97bbe8a737512")
Visualization
Built-in plotting functions turn query results into publication-ready figures.
import otargenpy as ot
ae = ot.adverse_events_query("CHEMBL941")
ot.plot_adverse_events(ae)
inter = ot.interactions_query("ENSG00000141510", source_database="intact", size=25)
ot.plot_interactions(inter)
l2g = ot.locus2gene_query("fa375739ca2a6b825ce5cc69d117e84b")
ot.plot_l2g(l2g)
coloc = ot.gwas_colocalisation("5a86bfd40d2ebecf6ce97bbe8a737512")
ot.plot_colocalisation(coloc)
ind = ot.indications_query("CHEMBL941")
ot.plot_indications(ind)
| Function | Input | Plot type |
|---|---|---|
plot_adverse_events |
adverse_events_query |
Lollipop chart with significance threshold |
plot_interactions |
interactions_query |
Circular network graph |
plot_l2g |
locus2gene_query |
Ranked bar chart of L2G scores |
plot_colocalisation |
gwas_colocalisation |
H4 vs variant count scatter |
plot_indications |
indications_query |
Faceted clinical stage chart |
Available functions (40)
| Category | Functions |
|---|---|
| Drug queries | adverse_events_query, indications_query, known_drugs_chembl_query, mechanisms_of_action_query, pharmacogenomics_chembl_query |
| Gene queries | comp_genomics_query, depmap_query, gene_ontology_query, genetic_constraint_query, hallmarks_query, interactions_query, known_drugs_gene_query, mouse_phenotypes_query, pathways_query, pharmacogenomics_gene_query, safety_query |
| Gene + disease | chembl_query, clinvar_query, europe_pmc_query, gene_burden_query, genomics_england_query, gwas_credible_sets_query, orphanet_query, uniprot_literature_query |
| Variant queries | pharmacogenomics_variant_query, qtl_credible_sets_query, uniprot_variants_query, variant_effect_predictor_query, variant_effect_query |
| Genetics / GWAS | gwas_colocalisation, gwas_credible_set, locus2gene_query, overlap_info_for_study, shared_trait_studies_query, variants_query |
| Visualization | plot_adverse_events, plot_colocalisation, plot_indications, plot_interactions, plot_l2g |
Citation
If you use otargenpy in your research, please cite:
Feizi A, Ray D (2023). otargen: an R package for accessing and visualizing Open Targets Genetics data. Bioinformatics, 39(7). https://doi.org/10.1093/bioinformatics/btad441
Contributing
Bug reports and feature requests: GitHub Issues
License
MIT
Metadata
Release files for otargenpy 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| otargenpy-2.0.1.tar.gz | 22.3 kB | Without provenance | Details for otargenpy-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| otargenpy-2.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for otargenpy-2.0.1-py2.py3-none-any.whl |
Total release size: 41.0 kB
Release files / otargenpy-2.0.1.tar.gz
| Download URL | otargenpy-2.0.1.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af8981e683e880fb654a4def3e33743e59743f5c7fab7c09ebaa27eeb6302203
|
|
BLAKE2b-256 checksum How to use checksums |
e7f77c00877f3f48f2acd5fc7c0509d9ebff2819d89bca4122a67a08534c08b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / otargenpy-2.0.1-py2.py3-none-any.whl
| Download URL | otargenpy-2.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
98e757467f35f73859b7a447238be90d5b370ac912f0ae2f85d2e3ad3d456acb
|
|
BLAKE2b-256 checksum How to use checksums |
66150f5568233c8b1c407979b200eca53dc90db9f0d36d843b1e876690f5695b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for otargenpy 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.