Difference between revisions of "Pharmacoracle"

(Pharmacoracle - a REST API based on the OWLAPI)
(Hints on how to use Pharmacoracle (version 1))
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Pharmacoracle - a REST API based on the OWLAPI==
+
==Pharmacoracle - a REST API==
The Pharmacoracle contains OWL ontologies that are based on CPIC recommendations provided by the [https://api.pharmgkb.org PharmGKB API], and which have been further adapted to the [http://www.anx.no needs of the Department of Pharmacology at Oslo University Hospital].  
+
The Pharmacoracle contains data from OWL ontologies that are based on CPIC recommendations provided by the [https://api.pharmgkb.org PharmGKB API], and which have been further curated to satisfy the [http://www.anx.no needs of the Department of Pharmacology at Oslo University Hospital].  
  
The Pharmacoracle was implemented as an attempt to understand the field of pharmacogenomics, based on data from PharmGKB, and solving the same problem as [https://github.com/PharmGKB/PharmCAT/wiki PharmGKBs PharmCAT software], but in the context of the technology and clinical recommendations of our clinic. It may be sensible to integrate PharmCAT in the Pharmacoracle, as soon as PharmCAT becomes the gold standard for VCF to PGx recommendations.
+
The Pharmacoracle was implemented as an attempt to understand the field of pharmacogenomics, based on data from PharmGKB, and solving the same problem as PharmGKB's PharmCAT software [https://github.com/PharmGKB/PharmCAT/wiki PharmCAT software], but in the context of the technology and clinical recommendations of our clinic.
  
Queries to Pharmacoracle are written in the [https://www.w3.org/TR/owl2-manchester-syntax/ Manchester syntax] in the same way as for the [https://protegewiki.stanford.edu/wiki/DLQueryTab DL Query Tab] of [https://protege.stanford.edu/ Stanford's desktop Protégé]. An advantage of this approach is that the queries replaces the need of a separate rules engine (rules are to some extent built into the OWL semantics). A disadvantage is that the performance in a production environment may be suboptimal (slow).
+
===Pharmacoracle version 1===
 +
The first version of the Pharmacoracle is based on the [http://owlcs.github.io/owlapi/ OWLAPI]
 +
Queries to Pharmacoracle have to be written in the [https://www.w3.org/TR/owl2-manchester-syntax/ Manchester syntax] in the same way as for the [https://protegewiki.stanford.edu/wiki/DLQueryTab DL Query Tab] of [https://protege.stanford.edu/ Stanford's desktop Protégé]. The choice of technology was inspired by the [https://doi.org/10.1371/journal.pone.0093769 Ontology-Based, Mobile-Optimized System for Pharmacogenomic Decision Support at the Point-of-Care] of the [http://upgx.eu UPGx] project. The [https://bioportal.bioontology.org/ontologies/GENE-CDS ontology of Mathias Samwald] is at the core of this system. They use the [http://trowl.org/ TrOWL reasoner] instead of the [http://www.hermit-reasoner.com/ HermIT] reasoner that is at the core of Pharmacoracle.
 +
 
 +
The Pharmacoracle infrastructure is written in Python, and the [http://owlcs.github.io/owlapi/ OWLAPI] is invoked from Python via [https://pexpect.readthedocs.io/en/stable/ Pexpect]. For curation, a link between OWL classes and Python is provided by [http://www.lesfleursdunormal.fr/static/_downloads/article_owlready_aim_2017.pdf Jean Baptiste Lamy's Owlready2], which we use to translate PharmGKB's JSON-LD to OWL.
  
 
The Pharmacoracle is used in our PGx analysis script [[Pharmacolyzer]], but can also be used directly.
 
The Pharmacoracle is used in our PGx analysis script [[Pharmacolyzer]], but can also be used directly.
  
===Hints on how to use it (see also example section below)===
+
===Hints on how to use Pharmacoracle (version 1)===
In order to write queries to an OWL ontology we need to know the names of the OWL elements, notably OWL Properties (e.g. has_haplotype) and and OWL Classes (e.g. TPMTstar3A). The Oslo University Hospital PGx OWL ontology is still work in progress, and therefore not publicly accessible, but PharmGKB nomenclature is kept where possible. In addition we need to know the Manchester expressions of cardinality that are used to connect OWL Properties and OWL Classes, in particular:
+
In order to write queries to an OWL ontology we need to know the names of the OWL elements, notably OWL Properties (e.g. has_haplotype) and and OWL Classes (e.g. TPMTstar3A) <ref>The Oslo University Hospital PGx OWL ontology that is used by the Pharmacoracle is still work in progress, but it is possible to have a closer, off-line look at the latest OWL version of the [https://www.pgx.no/farmakorakel/haplotypes.owl GRCh37 star allele definitions], which is best studied in [https://protegewiki.stanford.edu/wiki/Protege4UserDocs Stanford's Desktop Protégé]. For an introduction to PGx OWL ontology curation, have a look at our tutorial for [[WebProtege]]</ref>.
 +
 
 +
In addition we need to know the Manchester expressions of cardinality that are used to connect OWL Properties and OWL Classes, in particular:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 39: Line 45:
 
|}
 
|}
  
In order to query the Pharmacoracle automatically, we have made a Python script [[Pharmacolyzer]] that returns dosing recommendation based on a [[Pharmacotyper|pharmacotyped]] patient VCF.
+
In order to query the Pharmacoracle automatically, we have made a Python script [[Pharmacolyzer]] that returns dosing recommendation based on a [[Pharmacotyper|pharmacotyped]] patient.
  
 
===Examples of use===
 
===Examples of use===

Latest revision as of 13:10, 27 February 2019

Pharmacoracle - a REST API

The Pharmacoracle contains data from OWL ontologies that are based on CPIC recommendations provided by the PharmGKB API, and which have been further curated to satisfy the needs of the Department of Pharmacology at Oslo University Hospital.

The Pharmacoracle was implemented as an attempt to understand the field of pharmacogenomics, based on data from PharmGKB, and solving the same problem as PharmGKB's PharmCAT software PharmCAT software, but in the context of the technology and clinical recommendations of our clinic.

Pharmacoracle version 1

The first version of the Pharmacoracle is based on the OWLAPI Queries to Pharmacoracle have to be written in the Manchester syntax in the same way as for the DL Query Tab of Stanford's desktop Protégé. The choice of technology was inspired by the Ontology-Based, Mobile-Optimized System for Pharmacogenomic Decision Support at the Point-of-Care of the UPGx project. The ontology of Mathias Samwald is at the core of this system. They use the TrOWL reasoner instead of the HermIT reasoner that is at the core of Pharmacoracle.

The Pharmacoracle infrastructure is written in Python, and the OWLAPI is invoked from Python via Pexpect. For curation, a link between OWL classes and Python is provided by Jean Baptiste Lamy's Owlready2, which we use to translate PharmGKB's JSON-LD to OWL.

The Pharmacoracle is used in our PGx analysis script Pharmacolyzer, but can also be used directly.

Hints on how to use Pharmacoracle (version 1)

In order to write queries to an OWL ontology we need to know the names of the OWL elements, notably OWL Properties (e.g. has_haplotype) and and OWL Classes (e.g. TPMTstar3A) [1].

In addition we need to know the Manchester expressions of cardinality that are used to connect OWL Properties and OWL Classes, in particular:

Cardinality word Cardinality Explanation
some Connects a property to at least one class, e.g.
has_haplotype some TPMTstar3A
exactly number Connects a property to an exact number of classes, e.g.
has_haplotype exactly 1 TPMTstar3A
min number Connects a property to a minimum number of classes, e.g.
has_haplotype min 1 TPMTstar3A


For each query we add a code word to indicate the relationship between our query and the desired answer (cf. the DL Query tab in the desktop version of Stanford's Protégé), as explained in this table:

Code word Relationship
SubClasses Get elements that contain the query (but not equivalent to the query)
DirectSubClasses Get only the SubClasses that are closest to the query
EquivalentClasses Get only elements equivalent to the query
SuperClasses Get elements that contain parts of the query (but not the entire query and not equivalent)
DirectSuperClasses Get only the SuperClasses that are closest to the query

In order to query the Pharmacoracle automatically, we have made a Python script Pharmacolyzer that returns dosing recommendation based on a pharmacotyped patient.

Examples of use

Find the PGx alleles that contain the variant snpC>T at chr6:18139228

curl https://www.pgx.no/api/pharmacoracle -d "query=SubClasses:snpCtoT_at some chr6_18139228"

Find the PGx allele that is identical to the variants snpC>T at chr6:18139228 and snpT>C at chr6:18130918

curl https://www.pgx.no/api/pharmacoracle -d "query=EquivalentClasses:(snpCtoT_at some chr6_18139228) and (snpTtoC_at some chr6_18130918)"

Find the PGx alleles that contain either snpC>T at chr6:18139228 or snpT>C at chr6:18130918

curl https://www.pgx.no/api/pharmacoracle -d "query=DirectSuperClasses:(snpCtoT_at some chr6_18139228) and (snpTtoC_at some chr6_18130918)"

Find the Azathioprine TPMT functional status of the TPMT*3B allele:

curl https://www.pgx.no/api/pharmacoracle -d "drugs=azathioprine&query=SuperClasses:has_haplotype some TPMTstar3B"

Find the Azathioprine dosing recommendations for a patient with two Azathioprine TPMT No Function alleles:

curl https://www.pgx.no/api/pharmacoracle -d "drugs=azathioprine&query=EquivalentClasses:has_phenotype some (has_function exactly 2 AzathioprineTPMT_NoFunction)"
  1. The Oslo University Hospital PGx OWL ontology that is used by the Pharmacoracle is still work in progress, but it is possible to have a closer, off-line look at the latest OWL version of the GRCh37 star allele definitions, which is best studied in Stanford's Desktop Protégé. For an introduction to PGx OWL ontology curation, have a look at our tutorial for WebProtege