Skip to main content

Tidy Python interface to the Open Targets Platform GraphQL API

Project description

PyPI version GitHub stars License: MIT Open In Colab

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otargenpy-2.0.1.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otargenpy-2.0.1-py2.py3-none-any.whl (18.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file otargenpy-2.0.1.tar.gz.

File metadata

  • Download URL: otargenpy-2.0.1.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for otargenpy-2.0.1.tar.gz
Algorithm Hash digest
SHA256 af8981e683e880fb654a4def3e33743e59743f5c7fab7c09ebaa27eeb6302203
MD5 3eb34b29ebbea7e25f4a4e5986b3c5e4
BLAKE2b-256 e7f77c00877f3f48f2acd5fc7c0509d9ebff2819d89bca4122a67a08534c08b5

See more details on using hashes here.

File details

Details for the file otargenpy-2.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: otargenpy-2.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for otargenpy-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 98e757467f35f73859b7a447238be90d5b370ac912f0ae2f85d2e3ad3d456acb
MD5 da6e23558c2f7d9208628f2ea9691688
BLAKE2b-256 66150f5568233c8b1c407979b200eca53dc90db9f0d36d843b1e876690f5695b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page