{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5c5e910d-3312-4d38-8b3a-986ba997f064",
   "metadata": {},
   "source": [
    "Testing some things"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "137f1647-1fd0-4e0e-a185-d0fcf61f2ede",
   "metadata": {},
   "outputs": [],
   "source": [
    "import TCT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "caab75a5-d666-40ba-80b4-ca35548edf06",
   "metadata": {},
   "outputs": [],
   "source": [
    "api_names = TCT.list_Translator_APIs()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8c967b74-c039-48da-917d-88914fa00d4c",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Automat-ctd(Trapi v1.4.0)': 'https://automat.transltr.io/ctd/1.4/query',\n",
       " 'BioThings Explorer (BTE) TRAPI': 'https://bte.transltr.io/v1/query',\n",
       " 'Biothings Therapeutic Target Database API': 'https://biothings.ncats.io/ttd/query',\n",
       " 'Aragorn(Trapi v1.4.0)': 'https://aragorn.transltr.io/aragorn/query',\n",
       " 'ARAX Translator Reasoner - TRAPI 1.4.0': 'https://arax.transltr.io/api/arax/v1.4/query',\n",
       " 'RTX KG2 - TRAPI 1.4.0': 'https://arax.ncats.io/api/rtxkg2/v1.4/query',\n",
       " 'SPOKE KP for TRAPI 1.4': 'https://spokekp.transltr.io/api/v1.4/query',\n",
       " 'Multiomics BigGIM-DrugResponse KP API': 'https://bte.test.transltr.io/v1/smartapi/adf20dd6ff23dfe18e8e012bde686e31/query',\n",
       " 'Multiomics ClinicalTrials KP': 'https://api.bte.ncats.io/v1/smartapi/d86a24f6027ffe778f84ba10a7a1861a/query',\n",
       " 'Multiomics Wellness KP API': 'https://api.bte.ncats.io/v1/smartapi/02af7d098ab304e80d6f4806c3527027/query',\n",
       " 'Multiomics EHR Risk KP API': 'https://api.bte.ncats.io/v1/smartapi/d86a24f6027ffe778f84ba10a7a1861a/query',\n",
       " 'Biothings Explorer (BTE)': 'https://bte.transltr.io/v1/query',\n",
       " 'Service Provider TRAPI': 'https://api.bte.ncats.io/v1/smartapi/978fe380a147a8641caf72320862697b/query',\n",
       " 'Explanatory-agent': 'https://explanatory-agent-creative.azurewebsites.net/ARA/v1.3/asyncquery',\n",
       " 'MolePro': 'https://translator.broadinstitute.org/molepro/trapi/v1.4/query',\n",
       " 'Genetics KP': 'https://genetics-kp.transltr.io/genetics_provider/trapi/v1.4/query',\n",
       " 'medikanren-unsecret': 'https://medikanren-trapi.transltr.io/query',\n",
       " 'Text Mined Cooccurrence API': 'https://api.bte.ncats.io/v1/smartapi/978fe380a147a8641caf72320862697b/query',\n",
       " 'OpenPredict API': 'https://openpredict.transltr.io/query',\n",
       " 'Agrkb(Trapi v1.4.0)': 'https://automat.transltr.io/genome-alliance/1.4/query',\n",
       " 'Automat-biolink(Trapi v1.4.0)': 'https://automat.renci.org/biolink/1.4/query',\n",
       " 'Automat-cam-kp(Trapi v1.4.0)': 'https://automat.ci.transltr.io/cam-kp/1.4/query?limit=100',\n",
       " 'Automat-drug-central(Trapi v1.4.0)': 'https://automat.ci.renci.org/drugcentral/1.4/query',\n",
       " 'Automat-gtex(Trapi v1.4.0)': 'https://automat.renci.org/gtex/1.4/query',\n",
       " 'Automat-gtopdb(Trapi v1.4.0)': 'https://automat.renci.org/gtopdb/1.4/query',\n",
       " 'Automat-gwas-catalog(Trapi v1.4.0)': 'https://automat.renci.org/gwas-catalog/1.4/query',\n",
       " 'Automat-hetio(Trapi v1.4.0)': 'https://automat.ci.transltr.io/hetio/1.4/query',\n",
       " 'Automat-hgnc(Trapi v1.4.0)': 'https://automat.renci.org/hgnc/1.4/query',\n",
       " 'Automat-hmdb(Trapi v1.4.0)': 'https://automat.renci.org/hmdb/1.4/query',\n",
       " 'Automat-human-goa(Trapi v1.4.0)': 'https://automat.renci.org/human-goa/1.4/query',\n",
       " 'Automat-icees-kg(Trapi v1.4.0)': 'https://automat.renci.org/icees-kg/1.4/query',\n",
       " 'Automat-intact(Trapi v1.4.0)': 'https://automat.renci.org/intact/1.4/query',\n",
       " 'Automat-panther(Trapi v1.4.0)': 'https://automat.renci.org/panther/1.4/query',\n",
       " 'Automat-pharos(Trapi v1.4.0)': 'https://automat.renci.org/pharos/1.4/query',\n",
       " 'Automat-robokop(Trapi v1.4.0)': 'https://ars-prod.transltr.io/ara-robokop/api/runquery',\n",
       " 'Automat-sri-reference-kp(Trapi v1.4.0)': 'https://automat.ci.transltr.io/sri-reference-kp/1.4/query',\n",
       " 'Automat-string-db(Trapi v1.4.0)': 'https://automat.ci.transltr.io/string-db/1.4/query',\n",
       " 'Automat-ubergraph(Trapi v1.4.0)': 'https://automat.ci.transltr.io/ubergraph/1.4/query',\n",
       " 'Automat-ubergraph-nonredundant(Trapi v1.4.0)': 'https://automat.ci.transltr.io/ubergraph-nonredundant/1.4/query',\n",
       " 'Automat-viral-proteome(Trapi v1.4.0)': 'https://automat.ci.transltr.io/viral-proteome/1.4/query',\n",
       " 'CTD API': 'https://automat.ci.transltr.io/ctd/1.4/query',\n",
       " 'Connections Hypothesis Provider API': 'https://chp-api.transltr.io/query',\n",
       " 'MyGene.info API': 'https://api.bte.ncats.io/v1/smartapi/59dce17363dce279d389100834e43648/query',\n",
       " 'MyDisease.info API': 'https://api.bte.ncats.io/v1/smartapi/671b45c0301c8624abbd26ae78449ca2/query',\n",
       " 'MyChem.info API': 'https://api.bte.ncats.io/v1/8f08d1446e0bb9c2b323713ce83e2bd3/query',\n",
       " 'MyVariant.info API': 'https://api.bte.ncats.io/v1/59dce17363dce279d389100834e43648/query',\n",
       " 'Ontology Lookup Service API': 'https://api.bte.ncats.io/v1/1c056ffc7ed0dd1229e71c4752239465/query',\n",
       " 'PharmGKB REST API': 'https://api.bte.ncats.io/v1/bde72db681ec0b8f9eeb67bb6b8dd72c/query',\n",
       " 'QuickGO API': 'https://api.bte.ncats.io/v1/1f277e1563fcfd124bfae2cc3c4bcdec/query',\n",
       " 'Text Mining Targeted Association API': 'https://api.bte.ncats.io/v1/smartapi/978fe380a147a8641caf72320862697b/query',\n",
       " 'BioThings BindingDB API': 'https://api.bte.ncats.io/v1/smartapi/38e9e5169a72aee3659c9ddba956790d/query',\n",
       " 'BioThings BioPlanet Pathway-Disease API': 'https://api.bte.ncats.io/v1/smartapi/55a223c6c6e0291dbd05f2faf27d16f4/query',\n",
       " 'BioThings DDinter API': 'https://api.bte.ncats.io/v1/smartapi/00fb85fc776279163199e6c50f6ddfc6/query',\n",
       " 'BioThings DGIdb API': 'https://api.bte.ncats.io/v1/smartapi/e3edd325c76f2992a111b43a907a4870/query',\n",
       " 'BioThings DISEASES API': 'https://api.bte.ncats.io/v1/smartapi/a7f784626a426d054885a5f33f17d3f8/query',\n",
       " 'BioThings EBIgene2phenotype API': 'https://api.bte.ncats.io/v1/smartapi/1f47552dabd67351d4c625adb0a10d00/query',\n",
       " 'BioThings Biological Process API': 'https://api.bte.ncats.io/v1/smartapi/cc857d5b7c8b7609b5bbb38ff990bfff/query',\n",
       " 'BioThings GO Cellular Component API': 'https://api.bte.ncats.io/v1/smartapi/f339b28426e7bf72028f60feefcd7465/query',\n",
       " 'BioThings GO Molecular Function API': 'https://api.bte.ncats.io/v1/smartapi/34bad236d77bea0a0ee6c6cba5be54a6/query',\n",
       " 'BioThings GTRx API': 'https://api.bte.ncats.io/v1/smartapi/316eab811fd9ef1097df98bcaa9f7361/query',\n",
       " 'BioThings HPO API': 'https://api.bte.ncats.io/v1/smartapi/d7d1cc9bbe04ad9936076ca5aea904fe/query',\n",
       " 'BioThings IDISK API': 'https://api.bte.ncats.io/v1/smartapi/32f36164fabed5d3abe6c2fd899c9418/query',\n",
       " 'BioThings MGIgene2phenotype API': 'https://api.bte.ncats.io/v1/smartapi/77ed27f111262d0289ed4f4071faa619/query',\n",
       " 'BioThings PFOCR API': 'https://api.bte.ncats.io/v1/smartapi/edeb26858bd27d0322af93e7a9e08761/query',\n",
       " 'Biothings RARe-SOURCE API': 'https://api.bte.ncats.io/v1/smartapi/b772ebfbfa536bba37764d7fddb11d6f/query',\n",
       " 'BioThings Rhea API': 'https://api.bte.ncats.io/v1/smartapi/03283cc2b21c077be6794e1704b1d230/query',\n",
       " 'BioThings SEMMEDDB API': 'https://api.bte.ncats.io/v1/smartapi/1d288b3a3caf75d541ffaae3aab386c8/query',\n",
       " 'BioThings SuppKG API': 'https://api.bte.ncats.io/v1/smartapi/b48c34df08d16311e3bca06b135b828d/query',\n",
       " 'BioThings UBERON API': 'https://api.bte.ncats.io/v1/smartapi/ec6d76016ef40f284359d17fbf78df20/query'}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "api_names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3c4260bd-9eeb-4f5f-b316-ca89c5955acd",
   "metadata": {},
   "outputs": [],
   "source": [
    "metaKG = TCT.get_KP_metadata(api_names)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "f8bb1431-cf1c-47d5-8ed7-0d9366eb4763",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['BioThings Explorer (BTE) TRAPI', 'Biothings Explorer (BTE)',\n",
       "       'Service Provider TRAPI', 'MolePro', 'BioThings SEMMEDDB API'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "metaKG[metaKG.Subject.str.contains('Drug')].API.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "2d7a0247-c42d-4a14-91b4-5a1ebab7ea48",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['BioThings Explorer (BTE) TRAPI',\n",
       "       'Biothings Therapeutic Target Database API',\n",
       "       'Multiomics BigGIM-DrugResponse KP API',\n",
       "       'Multiomics Wellness KP API', 'Multiomics EHR Risk KP API',\n",
       "       'Biothings Explorer (BTE)', 'Service Provider TRAPI', 'MolePro',\n",
       "       'Text Mined Cooccurrence API', 'CTD API', 'MyDisease.info API',\n",
       "       'MyChem.info API', 'PharmGKB REST API',\n",
       "       'Text Mining Targeted Association API', 'BioThings BindingDB API',\n",
       "       'BioThings DDinter API', 'BioThings DGIdb API',\n",
       "       'BioThings GTRx API', 'BioThings IDISK API', 'BioThings PFOCR API',\n",
       "       'BioThings Rhea API', 'BioThings SEMMEDDB API',\n",
       "       'BioThings SuppKG API'], dtype=object)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "metaKG[metaKG.Subject.str.contains('SmallMolecule')].API.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2b49847b-71cb-4b03-92b6-573391450710",
   "metadata": {},
   "outputs": [],
   "source": [
    "# TODO: try to find a specific thing... try to find drug-disease connections?"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
