Introduction

This notebook demonstrates basic usage of BioThings Explorer, an engine for autonomously querying a distributed knowledge graph. BioThings Explorer can answer two classes of queries -- "PREDICT" and "EXPLAIN". PREDICT queries are described in PREDICT_demo.ipynb. Here, we describe EXPLAIN queries and how to use BioThings Explorer to execute them. A more detailed overview of the BioThings Explorer systems is provided in these slides.

EXPLAIN queries are designed to identify plausible reasoning chains to explain the relationship between two entities. For example, in this notebook, we explore the question:

         "Why does hydroxychloroquine have an effect on ACE2?"

To experiment with an executable version of this notebook, .

Step 0: Load BioThings Explorer modules

First, install the biothings_explorer and biothings_schema packages, as described in this README. This only needs to be done once (but including it here for compability with ).


In [1]:
!pip install git+https://github.com/biothings/biothings_explorer#egg=biothings_explorer


Collecting biothings_explorer from git+https://github.com/biothings/biothings_explorer#egg=biothings_explorer
  Cloning https://github.com/biothings/biothings_explorer to /private/var/folders/59/w2v_bg_d2rj_hg69468vdxzw0000gn/T/pip-install-87l7sgk0/biothings-explorer
  Running command git clone -q https://github.com/biothings/biothings_explorer /private/var/folders/59/w2v_bg_d2rj_hg69468vdxzw0000gn/T/pip-install-87l7sgk0/biothings-explorer
  Running command git submodule update --init --recursive -q
Requirement already satisfied: jupyter in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (1.0.0)
Requirement already satisfied: notebook==5.7.5 in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (5.7.5)
Requirement already satisfied: tornado==4.5.3 in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (4.5.3)
Requirement already satisfied: jsonschema>=3.0.1 in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (3.0.1)
Requirement already satisfied: networkx==2.3 in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (2.3)
Requirement already satisfied: jsonpath-rw>=1.4.0 in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (1.4.0)
Requirement already satisfied: requests>=2.21.0 in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (2.22.0)
Requirement already satisfied: graphviz>=0.11.1 in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (0.11.1)
Requirement already satisfied: aiohttp in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (3.5.4)
Requirement already satisfied: pandas in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (0.25.1)
Requirement already satisfied: biothings_schema@ git+https://github.com/biothings/biothings_schema.py from git+https://github.com/biothings/biothings_schema.py in ./ENV/lib/python3.7/site-packages (from biothings_explorer) (0.0.1)
Requirement already satisfied: ipykernel in ./ENV/lib/python3.7/site-packages (from jupyter->biothings_explorer) (5.1.1)
Requirement already satisfied: nbconvert in ./ENV/lib/python3.7/site-packages (from jupyter->biothings_explorer) (5.5.0)
Requirement already satisfied: ipywidgets in ./ENV/lib/python3.7/site-packages (from jupyter->biothings_explorer) (7.4.2)
Requirement already satisfied: qtconsole in ./ENV/lib/python3.7/site-packages (from jupyter->biothings_explorer) (4.5.1)
Requirement already satisfied: jupyter-console in ./ENV/lib/python3.7/site-packages (from jupyter->biothings_explorer) (6.0.0)
Requirement already satisfied: prometheus-client in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (0.7.0)
Requirement already satisfied: jupyter-core>=4.4.0 in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (4.4.0)
Requirement already satisfied: pyzmq>=17 in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (18.0.1)
Requirement already satisfied: traitlets>=4.2.1 in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (4.3.2)
Requirement already satisfied: jinja2 in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (2.10.1)
Requirement already satisfied: nbformat in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (4.4.0)
Requirement already satisfied: terminado>=0.8.1 in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (0.8.2)
Requirement already satisfied: ipython-genutils in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (0.2.0)
Requirement already satisfied: Send2Trash in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (1.5.0)
Requirement already satisfied: jupyter-client>=5.2.0 in ./ENV/lib/python3.7/site-packages (from notebook==5.7.5->biothings_explorer) (5.2.4)
Requirement already satisfied: attrs>=17.4.0 in ./ENV/lib/python3.7/site-packages (from jsonschema>=3.0.1->biothings_explorer) (19.1.0)
Requirement already satisfied: setuptools in ./ENV/lib/python3.7/site-packages (from jsonschema>=3.0.1->biothings_explorer) (41.0.1)
Requirement already satisfied: six>=1.11.0 in ./ENV/lib/python3.7/site-packages (from jsonschema>=3.0.1->biothings_explorer) (1.12.0)
Requirement already satisfied: pyrsistent>=0.14.0 in ./ENV/lib/python3.7/site-packages (from jsonschema>=3.0.1->biothings_explorer) (0.15.2)
Requirement already satisfied: decorator>=4.3.0 in ./ENV/lib/python3.7/site-packages (from networkx==2.3->biothings_explorer) (4.4.0)
Requirement already satisfied: ply in ./ENV/lib/python3.7/site-packages (from jsonpath-rw>=1.4.0->biothings_explorer) (3.11)
Requirement already satisfied: idna<2.9,>=2.5 in ./ENV/lib/python3.7/site-packages (from requests>=2.21.0->biothings_explorer) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in ./ENV/lib/python3.7/site-packages (from requests>=2.21.0->biothings_explorer) (2019.3.9)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./ENV/lib/python3.7/site-packages (from requests>=2.21.0->biothings_explorer) (1.25.3)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./ENV/lib/python3.7/site-packages (from requests>=2.21.0->biothings_explorer) (3.0.4)
Requirement already satisfied: async-timeout<4.0,>=3.0 in ./ENV/lib/python3.7/site-packages (from aiohttp->biothings_explorer) (3.0.1)
Requirement already satisfied: yarl<2.0,>=1.0 in ./ENV/lib/python3.7/site-packages (from aiohttp->biothings_explorer) (1.3.0)
Requirement already satisfied: multidict<5.0,>=4.0 in ./ENV/lib/python3.7/site-packages (from aiohttp->biothings_explorer) (4.5.2)
Requirement already satisfied: numpy>=1.13.3 in ./ENV/lib/python3.7/site-packages (from pandas->biothings_explorer) (1.17.0)
Requirement already satisfied: python-dateutil>=2.6.1 in ./ENV/lib/python3.7/site-packages (from pandas->biothings_explorer) (2.8.0)
Requirement already satisfied: pytz>=2017.2 in ./ENV/lib/python3.7/site-packages (from pandas->biothings_explorer) (2019.2)
Requirement already satisfied: PyYAML>=5.1 in ./ENV/lib/python3.7/site-packages (from biothings_schema@ git+https://github.com/biothings/biothings_schema.py->biothings_explorer) (5.1.1)
Requirement already satisfied: strict-rfc3339 in ./ENV/lib/python3.7/site-packages (from biothings_schema@ git+https://github.com/biothings/biothings_schema.py->biothings_explorer) (0.7)
Requirement already satisfied: ipython>=5.0.0 in ./ENV/lib/python3.7/site-packages (from ipykernel->jupyter->biothings_explorer) (7.5.0)
Requirement already satisfied: entrypoints>=0.2.2 in ./ENV/lib/python3.7/site-packages (from nbconvert->jupyter->biothings_explorer) (0.3)
Requirement already satisfied: defusedxml in ./ENV/lib/python3.7/site-packages (from nbconvert->jupyter->biothings_explorer) (0.6.0)
Requirement already satisfied: pandocfilters>=1.4.1 in ./ENV/lib/python3.7/site-packages (from nbconvert->jupyter->biothings_explorer) (1.4.2)
Requirement already satisfied: testpath in ./ENV/lib/python3.7/site-packages (from nbconvert->jupyter->biothings_explorer) (0.4.2)
Requirement already satisfied: pygments in ./ENV/lib/python3.7/site-packages (from nbconvert->jupyter->biothings_explorer) (2.4.2)
Requirement already satisfied: bleach in ./ENV/lib/python3.7/site-packages (from nbconvert->jupyter->biothings_explorer) (3.1.0)
Requirement already satisfied: mistune>=0.8.1 in ./ENV/lib/python3.7/site-packages (from nbconvert->jupyter->biothings_explorer) (0.8.4)
Requirement already satisfied: widgetsnbextension~=3.4.0 in ./ENV/lib/python3.7/site-packages (from ipywidgets->jupyter->biothings_explorer) (3.4.2)
Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in ./ENV/lib/python3.7/site-packages (from jupyter-console->jupyter->biothings_explorer) (2.0.9)
Requirement already satisfied: MarkupSafe>=0.23 in ./ENV/lib/python3.7/site-packages (from jinja2->notebook==5.7.5->biothings_explorer) (1.1.1)
Requirement already satisfied: ptyprocess; os_name != "nt" in ./ENV/lib/python3.7/site-packages (from terminado>=0.8.1->notebook==5.7.5->biothings_explorer) (0.6.0)
Requirement already satisfied: appnope; sys_platform == "darwin" in ./ENV/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter->biothings_explorer) (0.1.0)
Requirement already satisfied: pexpect; sys_platform != "win32" in ./ENV/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter->biothings_explorer) (4.7.0)
Requirement already satisfied: pickleshare in ./ENV/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter->biothings_explorer) (0.7.5)
Requirement already satisfied: jedi>=0.10 in ./ENV/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter->biothings_explorer) (0.13.3)
Requirement already satisfied: backcall in ./ENV/lib/python3.7/site-packages (from ipython>=5.0.0->ipykernel->jupyter->biothings_explorer) (0.1.0)
Requirement already satisfied: webencodings in ./ENV/lib/python3.7/site-packages (from bleach->nbconvert->jupyter->biothings_explorer) (0.5.1)
Requirement already satisfied: wcwidth in ./ENV/lib/python3.7/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->jupyter-console->jupyter->biothings_explorer) (0.1.7)
Requirement already satisfied: parso>=0.3.0 in ./ENV/lib/python3.7/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel->jupyter->biothings_explorer) (0.4.0)
Building wheels for collected packages: biothings-explorer
  Building wheel for biothings-explorer (setup.py) ... done
  Stored in directory: /private/var/folders/59/w2v_bg_d2rj_hg69468vdxzw0000gn/T/pip-ephem-wheel-cache-mp83lp3v/wheels/61/44/e1/901cb798059240028e8e2b5d8ed46a47aafa11af30a20c465a
Successfully built biothings-explorer
Installing collected packages: biothings-explorer
Successfully installed biothings-explorer-0.0.1
WARNING: You are using pip version 19.1.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Next, import the relevant modules:

  • Hint: Find corresponding bio-entity representation used in BioThings Explorer based on user input (could be any database IDs, symbols, names)
  • FindConnection: Find intermediate bio-entities which connects user specified input and output

In [1]:
# import modules from biothings_explorer
from biothings_explorer.hint import Hint
from biothings_explorer.user_query_dispatcher import FindConnection

Step 1: Find representation of "ACE2" and "hydroxychloroquine" in BTE

In this step, BioThings Explorer translates our query strings "ACE2" and "hydroxychloroquine " into BioThings objects, which contain mappings to many common identifiers. Generally, the top result returned by the Hint module will be the correct item, but you should confirm that using the identifiers shown.

Search terms can correspond to any child of BiologicalEntity from the Biolink Model, including DiseaseOrPhenotypicFeature (e.g., "lupus"), ChemicalSubstance (e.g., "acetaminophen"), Gene (e.g., "CDK2"), BiologicalProcess (e.g., "T cell differentiation"), and Pathway (e.g., "Citric acid cycle").


In [2]:
ht = Hint()
# find all potential representations of ACE2
ace2_hint = ht.query("ACE2")
# select the correct representation of ACE2
ace2 = ace2_hint['Gene'][0]
ace2


Out[2]:
{'NCBIGene': '59272',
 'name': 'angiotensin I converting enzyme 2',
 'SYMBOL': 'ACE2',
 'UMLS': 'C1422064',
 'HGNC': '13557',
 'UNIPROTKB': 'Q9BYF1',
 'ENSEMBL': 'ENSG00000130234',
 'primary': {'identifier': 'NCBIGene', 'cls': 'Gene', 'value': '59272'},
 'display': 'NCBIGene(59272) ENSEMBL(ENSG00000130234) HGNC(13557) UMLS(C1422064) UNIPROTKB(Q9BYF1) SYMBOL(ACE2)',
 'type': 'Gene'}

In [3]:
# find all potential representations of hydroxychloroquine 
hydroxychloroquine_hint = ht.query("hydroxychloroquine")
# select the correct representation of hydroxychloroquine 
hydroxychloroquine = hydroxychloroquine_hint['ChemicalSubstance'][0]
hydroxychloroquine


Out[3]:
{'DRUGBANK': 'DB01611',
 'CHEBI': 'CHEBI:5801',
 'name': 'hydroxychloroquine',
 'primary': {'identifier': 'CHEBI',
  'cls': 'ChemicalSubstance',
  'value': 'CHEBI:5801'},
 'display': 'CHEBI(CHEBI:5801) DRUGBANK(DB01611) name(hydroxychloroquine)',
 'type': 'ChemicalSubstance'}

Step 2: Find intermediate nodes connecting ACE2 and hydroxychloroquine

In this section, we find all paths in the knowledge graph that connect ACE2 and hydroxychloroquine . To do that, we will use FindConnection. This class is a convenient wrapper around two advanced functions for query path planning and query path execution. More advanced features for both query path planning and query path execution are in development and will be documented in the coming months.

The parameters for FindConnection are described below:


In [5]:
help(FindConnection.__init__)


Help on function __init__ in module biothings_explorer.user_query_dispatcher:

__init__(self, input_obj, output_obj, intermediate_nodes, registry=None)
    Find relationships in the Knowledge Graph between an Input Object and an Output Object.
    
    Args:
        input_obj (required): must be an object returned from Hint corresponding to a specific biomedical entity.
                            Examples: 
                Hint().query("Fanconi anemia")['DiseaseOrPhenotypicFeature'][0]
                Hint().query("acetaminophen")['ChemicalSubstance'][0]
    
        output_obj (required): must EITHER be an object returned from Hint corresponding to a specific biomedical
                            entity, OR be a string or list of strings corresponding to Biolink Entity classes.
                            Examples:
                Hint().query("acetaminophen")['ChemicalSubstance'][0]
                'Gene'
                ['Gene','ChemicalSubstance']
    
        intermediate_nodes (required): the semantic type(s) of the intermediate node(s).  Examples:
                None                         : no intermediate node, find direct connections only
                []                           : no intermediate node, find direct connections only
                ['BiologicalEntity']         : one intermediate node of any semantic type
                ['Gene']                     : one intermediate node that must be a Gene
                [('Gene','Pathway')]         : one intermediate node that must be a Gene or a Pathway
                ['Gene','Pathway']           : two intermediate nodes, first must be a Gene, second must be a Pathway.
                ['Gene',('Pathway','Gene')]  : two intermediate nodes, first must be a Gene, second must be a Pathway or Gene.
                                                **NOTE**: queries with more than one intermediate node are currently not supported

Here, we formulate a FindConnection query with "CML" as the input_ojb, "imatinib" as the output_obj. We further specify with the intermediate_nodes parameter that we are looking for paths joining chronic myelogenous leukemia and imatinib with one intermediate node that is a Gene. (The ability to search for longer reasoning paths that include additional intermediate nodes will be added shortly.)


In [4]:
fc = FindConnection(input_obj=ace2, output_obj=hydroxychloroquine, intermediate_nodes=['BiologicalEntity'])

We next execute the connect method, which performs the query path planning and query path execution process. In short, BioThings Explorer is deconstructing the query into individual API calls, executing those API calls, then assembling the results.

A verbose log of this process is displayed below:


In [5]:
# set verbose=True will display all steps which BTE takes to find the connection
fc.connect(verbose=True)


==========
========== QUERY PARAMETER SUMMARY ==========
==========

BTE will find paths that join 'ACE2' and 'hydroxychloroquine'. Paths will have 1 intermediate node.

Intermediate node #1 will have these type constraints: BiologicalEntity


==========
========== QUERY #1 -- fetch all Biological Entities linked to 'ACE2' ==========
==========

==== Step #1: Query path planning ====

Because ACE2 is of type 'Gene', BTE will query our meta-KG for APIs that can take 'Gene' as input and 'None' as output

BTE found 17 apis:

API 1. hmdb(1 API call)
API 2. mychem(3 API calls)
API 3. dgidb(1 API call)
API 4. cord_gene(1 API call)
API 5. ebi_gene2phenotype(1 API call)
API 6. scibite(2 API calls)
API 7. chembio(1 API call)
API 8. mydisease(1 API call)
API 9. biolink(4 API calls)
API 10. semmed_gene(13 API calls)
API 11. mygene(9 API calls)
API 12. DISEASES(1 API call)
API 13. pharos(2 API calls)
API 14. opentarget(1 API call)
API 15. scigraph(2 API calls)
API 16. hetio(1 API call)
API 17. ctd(1 API call)


==== Step #2: Query path execution ====
NOTE: API requests are dispatched in parallel, so the list of APIs below is ordered by query time.

API 8.1: http://mydisease.info/v1/query?fields=disgenet.xrefs.umls&size=250 (POST -d q=59272&scopes=disgenet.genes_related_to_disease.gene_id)
API 11.3: https://mygene.info/v3/query?fields=ensembl.transcript (POST -d q=ENSG00000130234&scopes=ensembl.gene)
API 11.4: https://mygene.info/v3/query?fields=pathway.reactome&species=human (POST -d q=59272&scopes=entrezgene)
API 2.1: https://mychem.info/v1/query?fields=drugbank.id&size=250 (POST -d q=ACE2&scopes=drugbank.targets.gene_name)
API 9.1: https://api.monarchinitiative.org/api/bioentity/gene/NCBIGene:59272/phenotypes?rows=200
API 10.2: https://biothings.ncats.io/semmedgene/query?fields=related_to (POST -d q=C1422064&scopes=umls)
API 2.2: https://mychem.info/v1/query?fields=drugbank.id&size=250 (POST -d q=ACE2&scopes=drugbank.enzymes.gene_name)
API 10.12: https://biothings.ncats.io/semmedgene/query?fields=prevents (POST -d q=C1422064&scopes=umls)
API 11.1: https://mygene.info/v3/query?fields=ensembl.protein (POST -d q=ENSG00000130234&scopes=ensembl.gene)
API 10.3: https://biothings.ncats.io/semmedgene/query?fields=disrupts (POST -d q=C1422064&scopes=umls)
API 2.3: https://mychem.info/v1/query?fields=chembl.molecule_chembl_id&size=250 (POST -d q=ACE2&scopes=drugcentral.bioactivity.uniprot.gene_symbol)
API 11.9: https://mygene.info/v3/query?fields=pathway.wikipathways (POST -d q=59272&scopes=entrezgene)
API 10.9: https://biothings.ncats.io/semmedgene/query?fields=negatively_regulated_by (POST -d q=C1422064&scopes=umls)
API 10.7: https://biothings.ncats.io/semmedgene/query?fields=disrupted_by (POST -d q=C1422064&scopes=umls)
API 11.7: https://mygene.info/v3/query?fields=go.CC (POST -d q=59272&scopes=entrezgene)
API 9.2: https://api.monarchinitiative.org/api/bioentity/gene/NCBIGene:59272/diseases?rows=200
API 17.1: http://ctdbase.org/tools/batchQuery.go?inputType=gene&report=diseases_curated&format=json&inputTerms=59272
API 11.6: https://mygene.info/v3/query?fields=go.BP (POST -d q=59272&scopes=entrezgene)
API 11.8: https://mygene.info/v3/query?fields=pantherdb.ortholog (POST -d q=59272&scopes=entrezgene)
API 6.1: https://biothings.ncats.io/cord_gene/query?fields=associated_with (POST -d q=13557&scopes=hgnc)
API 11.2: https://mygene.info/v3/query?fields=uniprot.Swiss-Prot (POST -d q=ENSG00000130234&scopes=ensembl.gene)
API 7.1: https://pending.biothings.io/ebigene2phenotype/query?fields=gene2phenotype (POST -d q=13557&scopes=_id)
API 11.5: https://mygene.info/v3/query?fields=go.MF (POST -d q=59272&scopes=entrezgene)
API 10.4: https://biothings.ncats.io/semmedgene/query?fields=affected_by (POST -d q=C1422064&scopes=umls)
API 10.13: https://biothings.ncats.io/semmedgene/query?fields=treats (POST -d q=C1422064&scopes=umls)
API 10.8: https://biothings.ncats.io/semmedgene/query?fields=negatively_regulates (POST -d q=C1422064&scopes=umls)
API 10.1: https://biothings.ncats.io/semmedgene/query?fields=positively_regulates (POST -d q=C1422064&scopes=umls)
API 13.1: https://pending.biothings.io/DISEASES/query?fields=DISEASES.doid&size=250 (POST -d q=ACE2&scopes=DISEASES.associatedWith.symbol)
API 10.11: https://biothings.ncats.io/semmedgene/query?fields=positively_regulated_by (POST -d q=C1422064&scopes=umls)
API 10.6: https://biothings.ncats.io/semmedgene/query?fields=affects (POST -d q=C1422064&scopes=umls)
API 10.5: https://biothings.ncats.io/semmedgene/query?fields=physically_interacts_with (POST -d q=C1422064&scopes=umls)
API 10.10: https://biothings.ncats.io/semmedgene/query?fields=causes (POST -d q=C1422064&scopes=umls)
API 3.1: http://dgidb.genome.wustl.edu/api/v2/interactions.json?genes=ACE2
API 15.1: https://platform-api.opentargets.io/v3/platform/public/evidence/filter?target=ENSG00000130234&datasource=chembl&size=100&fields=drug
API 9.4: https://api.monarchinitiative.org/api/bioentity/gene/NCBIGene:59272/interactions?rows=200
API 9.3: https://api.monarchinitiative.org/api/bioentity/gene/NCBIGene:59272/anatomy?rows=200
API 4.2: https://automat.renci.org/cord19_scibite_v2/gene/disease/NCBIGene:59272
API 1.1: https://automat.renci.org/hmdb/gene/chemical_substance/NCBIGene:59272
API 14.1: https://automat.renci.org/cord19_scigraph_v2/gene/chemical_substance/NCBIGene:59272
API 14.2: https://automat.renci.org/cord19_scigraph_v2/gene/disease/NCBIGene:59272
API 12.2: https://automat.renci.org/pharos/gene/chemical_substance/NCBIGene:59272
API 12.1: https://automat.renci.org/pharos/gene/disease/NCBIGene:59272
API 16.1: https://automat.renci.org/hetio/gene/disease/NCBIGene:59272
API 4.1: https://automat.renci.org/cord19_scibite_v2/gene/chemical_substance/NCBIGene:59272
API 5.1: https://automat.renci.org/chembio/gene/chemical_substance/NCBIGene:59272


==== Step #3: Output normalization ====

API 10.1 semmed_gene: 31 hits
API 10.2 semmed_gene: 57 hits
API 10.3 semmed_gene: 16 hits
API 6.1 cord_gene: 123 hits
API 9.1 biolink: No hits
API 15.1 opentarget: 1 hits
API 10.4 semmed_gene: 2 hits
API 7.1 ebi_gene2phenotype: No hits
API 10.5 semmed_gene: 43 hits
API 10.6 semmed_gene: 46 hits
API 4.1 scibite: 45 hits
API 4.2 scibite: 44 hits
API 10.7 semmed_gene: No hits
API 11.1 mygene: 2 hits
API 13.1 DISEASES: 31 hits
API 10.8 semmed_gene: 19 hits
API 11.2 mygene: 1 hits
API 10.9 semmed_gene: 9 hits
API 11.3 mygene: 5 hits
API 10.10 semmed_gene: 21 hits
API 10.11 semmed_gene: 15 hits
API 11.4 mygene: 3 hits
API 11.5 mygene: 11 hits
API 11.6 mygene: 19 hits
API 14.1 scigraph: 57 hits
API 12.1 pharos: 4 hits
API 16.1 hetio: 5 hits
API 9.2 biolink: No hits
API 3.1 dgidb: 4 hits
API 9.3 biolink: 20 hits
API 2.1 mychem: 2 hits
API 8.1 mydisease: 7 hits
API 10.12 semmed_gene: 6 hits
API 10.13 semmed_gene: 12 hits
API 12.2 pharos: 52 hits
API 14.2 scigraph: 41 hits
API 9.4 biolink: 21 hits
API 5.1 chembio: No hits
API 2.2 mychem: No hits
API 1.1 hmdb: 5 hits
API 2.3 mychem: 2 hits
API 11.7 mygene: 12 hits
API 11.8 mygene: 1 hits
API 11.9 mygene: 1 hits
API 17.1 ctd: 17 hits

After id-to-object translation, BTE retrieved 624 unique objects.


==========
========== QUERY #2 -- fetch all Biological Entities linked to 'hydroxychloroquine' ==========
==========

==== Step #1: Query path planning ====

Because hydroxychloroquine is of type 'ChemicalSubstance', BTE will query our meta-KG for APIs that can take 'ChemicalSubstance' as input and 'None' as output

BTE found 11 apis:

API 1. hmdb(2 API calls)
API 2. mychem(5 API calls)
API 3. dgidb(2 API calls)
API 4. scibite(2 API calls)
API 5. chembio(1 API call)
API 6. mydisease(1 API call)
API 7. pharos(2 API calls)
API 8. cord_chemical(1 API call)
API 9. scigraph(2 API calls)
API 10. semmed_chemical(16 API calls)
API 11. ctd(1 API call)


==== Step #2: Query path execution ====
NOTE: API requests are dispatched in parallel, so the list of APIs below is ordered by query time.

API 6.1: http://mydisease.info/v1/query?fields=disgenet.xrefs.mesh&size=250 (POST -d q=D006886&scopes=ctd.chemical_related_to_disease.mesh_chemical_id)
API 11.1: http://ctdbase.org/tools/batchQuery.go?inputType=chem&report=genes_curated&format=json&inputTerms=D006886
API 2.4: https://mychem.info/v1/query?fields=drugcentral.drug_use.indication (POST -d q=CHEMBL1535,CHEMBL1690&scopes=chembl.molecule_chembl_id)
API 10.15: https://biothings.ncats.io/semmedchemical/query?fields=produces (POST -d q=C0020336&scopes=umls)
API 2.1: https://mychem.info/v1/query?fields=drugbank.targets (POST -d q=DB01611&scopes=drugbank.id)
API 10.3: https://biothings.ncats.io/semmedchemical/query?fields=related_to (POST -d q=C0020336&scopes=umls)
API 10.12: https://biothings.ncats.io/semmedchemical/query?fields=disrupts (POST -d q=C0020336&scopes=umls)
API 10.10: https://biothings.ncats.io/semmedchemical/query?fields=produced_by (POST -d q=C0020336&scopes=umls)
API 10.1: https://biothings.ncats.io/semmedchemical/query?fields=positively_regulates (POST -d q=C0020336&scopes=umls)
API 10.14: https://biothings.ncats.io/semmedchemical/query?fields=prevents (POST -d q=C0020336&scopes=umls)
API 10.16: https://biothings.ncats.io/semmedchemical/query?fields=affected_by (POST -d q=C0020336&scopes=umls)
API 2.3: https://mychem.info/v1/query?fields=drugbank.enzymes (POST -d q=DB01611&scopes=drugbank.id)
API 10.13: https://biothings.ncats.io/semmedchemical/query?fields=disrupted_by (POST -d q=C0020336&scopes=umls)
API 10.11: https://biothings.ncats.io/semmedchemical/query?fields=negatively_regulates (POST -d q=C0020336&scopes=umls)
API 2.5: https://mychem.info/v1/query?fields=drugcentral.drug_use.contraindication (POST -d q=CHEMBL1535,CHEMBL1690&scopes=chembl.molecule_chembl_id)
API 3.2: http://dgidb.genome.wustl.edu/api/v2/interactions.json?drugs=CHEMBL1690
API 10.7: https://biothings.ncats.io/semmedchemical/query?fields=positively_regulated_by (POST -d q=C0020336&scopes=umls)
API 10.4: https://biothings.ncats.io/semmedchemical/query?fields=coexists_with (POST -d q=C0020336&scopes=umls)
API 8.1: https://biothings.ncats.io/cord_chemical/query?fields=associated_with (POST -d q=CHEBI:5801&scopes=chebi)
API 10.6: https://biothings.ncats.io/semmedchemical/query?fields=negatively_regulated_by (POST -d q=C0020336&scopes=umls)
API 10.2: https://biothings.ncats.io/semmedchemical/query?fields=physically_interacts_with (POST -d q=C0020336&scopes=umls)
API 10.5: https://biothings.ncats.io/semmedchemical/query?fields=causes (POST -d q=C0020336&scopes=umls)
API 2.2: https://mychem.info/v1/query?fields=drugcentral.bioactivity (POST -d q=CHEMBL1535,CHEMBL1690&scopes=chembl.molecule_chembl_id)
API 10.9: https://biothings.ncats.io/semmedchemical/query?fields=affects (POST -d q=C0020336&scopes=umls)
API 10.8: https://biothings.ncats.io/semmedchemical/query?fields=treats (POST -d q=C0020336&scopes=umls)
API 3.1: http://dgidb.genome.wustl.edu/api/v2/interactions.json?drugs=CHEMBL1535
API 9.2: https://automat.renci.org/cord19_scigraph_v2/chemical_substance/gene/CHEBI:5801
API 7.1: https://automat.renci.org/pharos/chemical_substance/disease/CHEBI:5801
API 7.1 pharos failed
API 5.1: https://automat.renci.org/chembio/chemical_substance/gene/CHEBI:5801
API 1.2: https://automat.renci.org/hmdb/chemical_substance/gene/CHEBI:5801
API 1.1: https://automat.renci.org/hmdb/chemical_substance/disease/CHEBI:5801
API 7.2: https://automat.renci.org/pharos/chemical_substance/gene/CHEBI:5801
API 4.2: https://automat.renci.org/cord19_scibite_v2/chemical_substance/disease/CHEBI:5801
API 4.1: https://automat.renci.org/cord19_scibite_v2/chemical_substance/gene/CHEBI:5801
API 9.1: https://automat.renci.org/cord19_scigraph_v2/chemical_substance/disease/CHEBI:5801


==== Step #3: Output normalization ====

API 10.1 semmed_chemical: 28 hits
API 10.2 semmed_chemical: 57 hits
API 10.3 semmed_chemical: No hits
API 10.4 semmed_chemical: 42 hits
API 10.5 semmed_chemical: 62 hits
API 5.1 chembio: 2 hits
API 10.6 semmed_chemical: No hits
API 10.7 semmed_chemical: 6 hits
API 10.8 semmed_chemical: 231 hits
API 10.9 semmed_chemical: 89 hits
API 10.10 semmed_chemical: No hits
API 2.1 mychem: 2 hits
API 10.11 semmed_chemical: 53 hits
API 8.1 cord_chemical: 38 hits
API 1.1 hmdb: No hits
API 10.12 semmed_chemical: 40 hits
API 2.2 mychem: 6 hits
API 9.1 scigraph: 23 hits
API 2.3 mychem: 2 hits
API 10.13 semmed_chemical: No hits
API 10.14 semmed_chemical: 32 hits
API 4.1 scibite: No hits
API 10.15 semmed_chemical: No hits
API 7.2 pharos: 2 hits
API 10.16 semmed_chemical: No hits
API 2.4 mychem: 7 hits
API 9.2 scigraph: 2 hits
API 3.1 dgidb: 9 hits
API 3.2 dgidb: 2 hits
API 1.2 hmdb: 2 hits
API 4.2 scibite: 8 hits
API 11.1 ctd: 46 hits
API 6.1 mydisease: No hits
API 2.5 mychem: 13 hits

After id-to-object translation, BTE retrieved 597 unique objects.

==========
========== Final assembly of results ==========
==========


BTE found 69 unique intermediate nodes connecting 'ACE2' and 'hydroxychloroquine'

Step 3: Display and Filter results

This section demonstrates post-query filtering done in Python. Later, more advanced filtering functions will be added to the query path execution module for interleaved filtering, thereby enabling longer query paths. More details to come...

First, all matching paths can be exported to a data frame. Let's examine a sample of those results.


In [8]:
df = fc.display_table_view()

df.head()


Out[8]:
input input_type pred1 pred1_source pred1_api pred1_pubmed node1_type node1_name node1_id pred2 pred2_source pred2_api pred2_pubmed output_type output_name output_id
0 ACE2 Gene positively_regulates SEMMED SEMMED Gene API 18978194,18978194 Gene C3539645 UMLS:C3539645 positively_regulates SEMMED SEMMED Chemical API 10993122,10993122 Gene HYDROXYCHLOROQUINE name:HYDROXYCHLOROQUINE
1 ACE2 Gene negatively_regulates SEMMED SEMMED Gene API 18156169 Gene C1709136 UMLS:C1709136 physically_interacts_with SEMMED SEMMED Chemical API 27939463 Gene HYDROXYCHLOROQUINE name:HYDROXYCHLOROQUINE
2 ACE2 Gene physically_interacts_with SEMMED SEMMED Gene API 25875512 Gene C0014442 UMLS:C0014442 physically_interacts_with SEMMED SEMMED Chemical API 9001825 Gene HYDROXYCHLOROQUINE name:HYDROXYCHLOROQUINE
3 ACE2 Gene negatively_regulates SEMMED SEMMED Gene API 18156169 Gene C0669365 UMLS:C0669365 physically_interacts_with SEMMED SEMMED Chemical API 27939463 Gene HYDROXYCHLOROQUINE name:HYDROXYCHLOROQUINE
4 ACE2 Gene physically_interacts_with SEMMED SEMMED Gene API 19232015 ChemicalSubstance C0309049 UMLS:C0309049 physically_interacts_with SEMMED SEMMED Chemical API 24669876,26197707,26872459 ChemicalSubstance HYDROXYCHLOROQUINE name:HYDROXYCHLOROQUINE

While most results are based on edges from semmed, edges from DGIdb, biolink, disgenet, mydisease.info and drugcentral were also retrieved from their respective APIs.

Next, let's look to see which genes are mentioned the most.


In [9]:
df.node1_type.unique()


Out[9]:
array(['Gene', 'ChemicalSubstance', 'Disease', 'AnatomicalEntity',
       'GenomicEntity', 'BiologicalProcess', 'CellularComponent'],
      dtype=object)

In [ ]: