{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## This notebook can be used to rank a list of nodes from a category that connect to an entity such as a gene. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from TCT import node_normalizer\n",
    "from TCT import name_resolver\n",
    "from TCT import translator_metakg\n",
    "from TCT import translator_kpinfo\n",
    "from TCT import translator_query\n",
    "from TCT import TCT\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Load Translator resources\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "APInames, metaKG, Translator_KP_info= translator_metakg.load_translator_resources()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "All_predicates = list(set(metaKG['Predicate']))\n",
    "All_categories = list((set(list(set(metaKG['Subject']))+list(set(metaKG['Object'])))))\n",
    "API_withMetaKG = list(set(metaKG['API']))\n",
    "\n",
    "    # generate a dictionary of API and its predicates\n",
    "API_predicates = {}\n",
    "for api in API_withMetaKG:\n",
    "    API_predicates[api] = list(set(metaKG[metaKG['API'] == api]['Predicate']))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Find the neiborhood of an entity from a subset of APIs \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'COHD TRAPI': 'https://cohd-api.transltr.io/api/query/', 'Genetics Data Provider for NCATS Biomedical Translator Reasoners': 'https://genetics-kp.transltr.io/genetics_provider/trapi/v1.5/query/', 'Drug Approvals KP - TRAPI 1.5.0': 'https://multiomics.rtx.ai:9990/dakp/query', 'Cqs(Trapi v1.5.0)': 'https://cqs.ci.transltr.io/query/', 'BioThings Explorer (BTE) TRAPI': 'https://bte.transltr.io/v1/query/', 'Aragorn(Trapi v1.6.0)': 'https://aragorn.renci.org/aragorn/query/', 'CATRAX Pharmacogenomics KP - TRAPI 1.5.0': 'https://multiomics.rtx.ai:9990/PharmacogenomicsKG/query', 'mediKanren': 'https://medikanren-trapi.transltr.io/query/', 'CATRAX BigGIM DrugResponse Performance Phase KP - TRAPI 1.5.0': 'https://multiomics.rtx.ai:9990/BigGIM_DrugResponse_PerformancePhase/query', 'Text Mined Cooccurrence API': 'https://cooccurrence.ci.transltr.io/query/', 'Connections Hypothesis Provider API': 'https://chp-api.transltr.io/query/', 'RTX KG2 - TRAPI 1.5.0': 'https://kg2cploverdb.ci.transltr.io/kg2c/query', 'Microbiome KP - TRAPI 1.5.0': 'https://multiomics.rtx.ai:9990/mbkp/query', 'ARAX Translator Reasoner - TRAPI 1.5.0': 'https://arax.transltr.io/api/arax/v1.4/query/', 'Automat-cam-kp(Trapi v1.5.0)': 'https://automat.transltr.io/cam-kp/query/', 'Service Provider TRAPI': 'https://bte.transltr.io/v1/team/Service%20Provider/query/', 'imProving Agent for TRAPI 1.5': 'https://ia.transltr.io/api/v1.5/query/', 'SPOKE KP for TRAPI 1.5': 'https://spokekp.transltr.io/api/v1.5/query/', 'Gene-List Network Enrichment Analysis': 'https://translator.broadinstitute.org/gelinea-trapi/v1.5/query/', 'MolePro': 'https://molepro-trapi.transltr.io/molepro/trapi/v1.5/query/', 'Automat-ctd(Trapi v1.5.0)': 'https://automat.transltr.io/ctd/query/', 'Knowledge Collaboratory API': 'https://collaboratory-api.transltr.io/query/', 'Sri-node-normalizer(Trapi v1.5.0)': 'https://nodenorm.transltr.io/1.5/query/', 'Automat-icees-kg(Trapi v1.5.0)': 'https://automat.transltr.io/icees-kg/query/', 'Automat-ehr-may-treat-kp(Trapi v1.5.0)': 'https://automat.renci.org/ehr-may-treat-kp/query/', 'Automat-panther(Trapi v1.5.0)': 'https://automat.transltr.io/panther/query/', 'Autonomous Relay System (ARS) TRAPI': 'https://ars-prod.transltr.io/ars/api/submit/', 'Clinical Trials KP - TRAPI 1.5.0': 'https://multiomics.rtx.ai:9990/ctkp/query', 'Automat-human-goa(Trapi v1.5.0)': 'https://automat.transltr.io/human-goa/query/', 'Automat-reactome(Trapi v1.5.0)': 'https://automat.transltr.io/reactome/query/', 'OpenPredict API': 'https://openpredict.transltr.io/query/', 'Automat-ehr-clinical-connections-kp(Trapi v1.5.0)': 'https://automat.renci.org/ehr-clinical-connections-kp/query/', 'Automat-hetionet(Trapi v1.5.0)': 'https://automat.transltr.io/hetio/query/', 'Automat-viral-proteome(Trapi v1.5.0)': 'https://automat.transltr.io/viral-proteome/query/', 'Automat-gwas-catalog(Trapi v1.5.0)': 'https://automat.transltr.io/gwas-catalog/query/', 'Automat-intact(Trapi v1.5.0)': 'https://automat.transltr.io/intact/query/', 'Automat-drug-central(Trapi v1.5.0)': 'https://automat.transltr.io/drugcentral/query/', 'Automat-binding-db(Trapi v1.5.0)': 'https://automat.transltr.io/binding-db/query/', 'Workflow-runner(Trapi v1.5.0)': 'https://translator-workflow-runner.transltr.io/query/', 'Automat-hmdb(Trapi v1.5.0)': 'https://automat.transltr.io/hmdb/query/', 'Automat-hgnc(Trapi v1.5.0)': 'https://automat.transltr.io/hgnc/query/', 'Automat-gtex(Trapi v1.5.0)': 'https://automat.transltr.io/gtex/query/', 'Automat-robokop(Trapi v1.5.0)': 'https://automat.transltr.io/robokopkg/query/', 'Automat-ubergraph(Trapi v1.5.0)': 'https://automat.transltr.io/ubergraph/query/', 'Sri-answer-appraiser(Trapi v1.5.0)': 'https://answerappraiser.transltr.io/query/', 'Automat-genome-alliance(Trapi v1.5.0)': 'https://automat.transltr.io/genome-alliance/query/', 'Automat-gtopdb(Trapi v1.5.0)': 'https://automat.transltr.io/gtopdb/query/', 'Automat-pharos(Trapi v1.5.0)': 'https://automat.transltr.io/pharos/query/', 'Automat-monarchinitiative(Trapi v1.5.0)': 'https://automat.transltr.io/monarch-kg/query/', 'Automat-string-db(Trapi v1.5.0)': 'https://automat.transltr.io/string-db/query/', 'Shepherd Aragorn': 'https://shepherd.renci.org/aragorn/query/', 'Answer-coalesce(Trapi v1.5.0)': 'https://answer-coalesce.transltr.io/query/', 'Multiomics KP - TRAPI 1.5.0': 'https://multiomics.rtx.ai:9990/multiomics/query'}\n",
      "(22137, 5)\n"
     ]
    }
   ],
   "source": [
    "# select a list of APIs to use and a list of predicates to use\n",
    "selected_APIlist = []\n",
    "\n",
    "if len(selected_APIlist) == 0:\n",
    "    select_APIs = APInames\n",
    "else:\n",
    "    select_APIs = {k: APInames[k] for k in selected_APIlist if k in APInames}\n",
    "\n",
    "selected_metaKG = metaKG[metaKG['API'].isin(select_APIs.keys())]\n",
    "print(select_APIs)\n",
    "print(selected_metaKG.shape)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MONDO:0018874\n",
      "Automat-monarchinitiative(Trapi v1.5.0): Success!Automat-hetionet(Trapi v1.5.0): Success!\n",
      "\n",
      "Automat-ctd(Trapi v1.5.0): Success!\n",
      "Drug Approvals KP - TRAPI 1.5.0: Success!\n",
      "Automat-drug-central(Trapi v1.5.0): Success!\n",
      "RTX KG2 - TRAPI 1.5.0: Success!\n",
      "Clinical Trials KP - TRAPI 1.5.0: Success!\n",
      "Automat-robokop(Trapi v1.5.0): Success!\n",
      "BioThings Explorer (BTE) TRAPI: Success!\n",
      "NodeNorm does not know about these identifiers: DRUGBANK:DB15060,REACT:R-ALL-9692345,DRUGBANK:DB19304,UMLS:C5907983,UMLS:C5908001,DRUGBANK:DB19070,GTOPDB:13607,UMLS:C5907931,DRUGBANK:DB18753,UMLS:C5908989,CHEMBL.COMPOUND:CHEMBL5483015,UMLS:C5888788,UMLS:C5907992,CHEBI:232584,DRUGBANK:DB18980,CHEBI:232616,CHEBI:232328,UNII:ET4JC4S66E,UNII:Y8DGL9885E,UNII:3D2KVS9K7P,UNII:OEN4982XNW,UNII:PVH8394DLN,UNII:FR89SC8CT4,UNII:Q805XO2F7C,UNII:E6349B696W,UNII:VS12X225PL,UNII:IZR558KO53,UNII:475247QF1Z,UNII:L4D9X59F34,UNII:O5V0F26RUW,UNII:RXG7T6RB8K,RXCUI:1791496,RXCUI:1736582,RXCUI:1722942,UMLS:DC0003818,UMLS:DC0012155,UMLS:DC0037549,UMLS:DC0041411,MESH:C059764,MESH:D000596,MESH:C081693,UNII:7EV65EAW6H,UMLS:C0596087,UMLS:C0002073,UMLS:C0062128,UMLS:C0597573,RXCUI:1433769,RXCUI:1795154,RXCUI:1662281,RXCUI:1362058,RXCUI:1860240,RXCUI:1807509,RXCUI:1665191,RXCUI:1362049,RXCUI:1656667,RXCUI:1362054,RXCUI:1723777,RXCUI:379454,RXCUI:1860464,RXCUI:1658260,RXCUI:1795608,RXCUI:1666799,RXCUI:1729198,RXCUI:1360104,RXCUI:1719287,RXCUI:900963\n"
     ]
    }
   ],
   "source": [
    "input_node_id, result, result_parsed, result_ranked_by_primary_infores = Neiborhood_finder('AML',\n",
    "                                                                                            node2_categories = ['biolink:SmallMolecule', 'biolink:Drug', 'biolink:ChemicalEntity'],\n",
    "                                                                                            APInames = select_APIs,\n",
    "                                                                                            metaKG = selected_metaKG,\n",
    "                                                                                            API_predicates = API_predicates)     "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NodeNorm does not know about these identifiers: UNII:ET4JC4S66E,UNII:Y8DGL9885E,UNII:O5V0F26RUW,UNII:E6349B696W,UNII:FR89SC8CT4,UNII:PVH8394DLN,UMLS:DC0003818,UMLS:DC0012155,UNII:IZR558KO53,UNII:7EV65EAW6H,MESH:D000596,MESH:C059764,UNII:L4D9X59F34,UNII:475247QF1Z,UMLS:DC0041411,UNII:RXG7T6RB8K,UMLS:DC0037549,RXCUI:1722942,RXCUI:1736582,RXCUI:1791496,UMLS:C0596087,UMLS:C0002073,UMLS:C0597573,UMLS:C0062128,RXCUI:1658260,RXCUI:1666799,RXCUI:1729198,RXCUI:1360104,RXCUI:1719287,RXCUI:900963,RXCUI:1795608,RXCUI:1860464,RXCUI:379454,RXCUI:1362058,RXCUI:1860240,RXCUI:1807509,RXCUI:1665191,RXCUI:1362049,RXCUI:1656667,RXCUI:1362054,RXCUI:1723777,MESH:C081693,RXCUI:1662281,RXCUI:1433769,RXCUI:1795154,UMLS:C5908001,DRUGBANK:DB19070,UMLS:C5907983,CHEMBL.COMPOUND:CHEMBL5483015,UMLS:C5908989,GTOPDB:13607,DRUGBANK:DB18753,UMLS:C5907931,DRUGBANK:DB15060,REACT:R-ALL-9692345,DRUGBANK:DB19304,UNII:VS12X225PL,UNII:Q805XO2F7C,UNII:OEN4982XNW,UNII:3D2KVS9K7P,UMLS:C5888788,CHEBI:232328,CHEBI:232584,UMLS:C5907992,CHEBI:232616,DRUGBANK:DB18980\n",
      "[Text(0.5, 0, 'Doxorubicin'), Text(2.5, 0, 'Tretinoin'), Text(4.5, 0, 'Etoposide'), Text(6.5, 0, 'Decitabine'), Text(8.5, 0, 'Daunorubicin hydrochloride'), Text(10.5, 0, 'Gilteritinib'), Text(12.5, 0, 'Lenalidomide'), Text(14.5, 0, 'vincristine'), Text(16.5, 0, 'Fludarabine'), Text(18.5, 0, 'Tioguanine'), Text(20.5, 0, 'Ivosidenib'), Text(22.5, 0, 'Cholecalciferol'), Text(24.5, 0, 'Idarubicin hydrochloride'), Text(26.5, 0, 'Allopurinol'), Text(28.5, 0, 'Rituximab'), Text(30.5, 0, 'Posaconazole'), Text(32.5, 0, 'imatinib methanesulfonate'), Text(34.5, 0, 'Voriconazole'), Text(36.5, 0, 'Aclarubicin'), Text(38.5, 0, 'Cyclosporine'), Text(40.5, 0, 'dexamethasone sodium phosphate'), Text(42.5, 0, 'Paclitaxel'), Text(44.5, 0, 'Mycophenolate mofetil'), Text(46.5, 0, 'Topotecan'), Text(48.5, 0, 'Carboplatin')]\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 225680 characters]",
      "text/plain": [
       "<Figure size 1890x1050 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Text(0.5, 0, 'Doxorubicin'), Text(2.5, 0, 'Tretinoin'), Text(4.5, 0, 'Etoposide'), Text(6.5, 0, 'Decitabine'), Text(8.5, 0, 'Daunorubicin hydrochloride'), Text(10.5, 0, 'Gilteritinib'), Text(12.5, 0, 'Lenalidomide'), Text(14.5, 0, 'vincristine'), Text(16.5, 0, 'Fludarabine'), Text(18.5, 0, 'Tioguanine'), Text(20.5, 0, 'Ivosidenib'), Text(22.5, 0, 'Cholecalciferol'), Text(24.5, 0, 'Idarubicin hydrochloride'), Text(26.5, 0, 'Allopurinol'), Text(28.5, 0, 'Rituximab'), Text(30.5, 0, 'Posaconazole'), Text(32.5, 0, 'imatinib methanesulfonate'), Text(34.5, 0, 'Voriconazole'), Text(36.5, 0, 'Aclarubicin'), Text(38.5, 0, 'Cyclosporine'), Text(40.5, 0, 'dexamethasone sodium phosphate'), Text(42.5, 0, 'Paclitaxel'), Text(44.5, 0, 'Mycophenolate mofetil'), Text(46.5, 0, 'Topotecan'), Text(48.5, 0, 'Carboplatin')]\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 242008 characters]",
      "text/plain": [
       "<Figure size 1890x1050 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Doxorubicin</th>\n",
       "      <th>Azacitidine</th>\n",
       "      <th>Tretinoin</th>\n",
       "      <th>Cytarabine</th>\n",
       "      <th>Etoposide</th>\n",
       "      <th>Midostaurin</th>\n",
       "      <th>Decitabine</th>\n",
       "      <th>Methotrexate</th>\n",
       "      <th>Daunorubicin hydrochloride</th>\n",
       "      <th>Quizartinib</th>\n",
       "      <th>...</th>\n",
       "      <th>LEVITIRACETAM</th>\n",
       "      <th>bexmarilimab</th>\n",
       "      <th>MEK162</th>\n",
       "      <th>DRUGBANK:DB18980</th>\n",
       "      <th>Minnelide</th>\n",
       "      <th>Cobicistat</th>\n",
       "      <th>Mivavotinib</th>\n",
       "      <th>pinometostat</th>\n",
       "      <th>Letermovir</th>\n",
       "      <th>LB-100</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>biolink:causes</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:produced_by</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:location_of</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:has_adverse_event</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:studied_to_treat</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:positively_correlated_with</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:applied_to_treat</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:predisposes_to_condition</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:disrupts</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:in_clinical_trials_for</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:affects</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:occurs_together_in_literature_with</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:treats_or_applied_or_studied_to_treat</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:contributes_to</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:subclass_of</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:related_to</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:treats</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>biolink:associated_with</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>18 rows × 2906 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               Doxorubicin  Azacitidine  \\\n",
       "biolink:causes                                           1            0   \n",
       "biolink:produced_by                                      0            0   \n",
       "biolink:location_of                                      0            0   \n",
       "biolink:has_adverse_event                                1            1   \n",
       "biolink:studied_to_treat                                 0            1   \n",
       "biolink:positively_correlated_with                       1            1   \n",
       "biolink:applied_to_treat                                 1            1   \n",
       "biolink:predisposes_to_condition                         0            0   \n",
       "biolink:disrupts                                         0            0   \n",
       "biolink:in_clinical_trials_for                           1            1   \n",
       "biolink:affects                                          0            0   \n",
       "biolink:occurs_together_in_literature_with               1            1   \n",
       "biolink:treats_or_applied_or_studied_to_treat            1            1   \n",
       "biolink:contributes_to                                   1            0   \n",
       "biolink:subclass_of                                      0            0   \n",
       "biolink:related_to                                       1            1   \n",
       "biolink:treats                                           1            1   \n",
       "biolink:associated_with                                  1            0   \n",
       "\n",
       "                                               Tretinoin  Cytarabine  \\\n",
       "biolink:causes                                         1           1   \n",
       "biolink:produced_by                                    0           0   \n",
       "biolink:location_of                                    0           0   \n",
       "biolink:has_adverse_event                              1           1   \n",
       "biolink:studied_to_treat                               1           0   \n",
       "biolink:positively_correlated_with                     1           1   \n",
       "biolink:applied_to_treat                               0           1   \n",
       "biolink:predisposes_to_condition                       0           0   \n",
       "biolink:disrupts                                       0           0   \n",
       "biolink:in_clinical_trials_for                         1           1   \n",
       "biolink:affects                                        1           1   \n",
       "biolink:occurs_together_in_literature_with             1           1   \n",
       "biolink:treats_or_applied_or_studied_to_treat          1           1   \n",
       "biolink:contributes_to                                 1           0   \n",
       "biolink:subclass_of                                    0           0   \n",
       "biolink:related_to                                     1           1   \n",
       "biolink:treats                                         1           1   \n",
       "biolink:associated_with                                1           0   \n",
       "\n",
       "                                               Etoposide  Midostaurin  \\\n",
       "biolink:causes                                         1            0   \n",
       "biolink:produced_by                                    0            0   \n",
       "biolink:location_of                                    0            0   \n",
       "biolink:has_adverse_event                              1            0   \n",
       "biolink:studied_to_treat                               0            1   \n",
       "biolink:positively_correlated_with                     1            0   \n",
       "biolink:applied_to_treat                               1            1   \n",
       "biolink:predisposes_to_condition                       0            0   \n",
       "biolink:disrupts                                       0            0   \n",
       "biolink:in_clinical_trials_for                         1            1   \n",
       "biolink:affects                                        0            0   \n",
       "biolink:occurs_together_in_literature_with             1            1   \n",
       "biolink:treats_or_applied_or_studied_to_treat          1            1   \n",
       "biolink:contributes_to                                 1            0   \n",
       "biolink:subclass_of                                    0            0   \n",
       "biolink:related_to                                     1            1   \n",
       "biolink:treats                                         0            1   \n",
       "biolink:associated_with                                0            0   \n",
       "\n",
       "                                               Decitabine  Methotrexate  \\\n",
       "biolink:causes                                          0             0   \n",
       "biolink:produced_by                                     0             0   \n",
       "biolink:location_of                                     0             0   \n",
       "biolink:has_adverse_event                               1             1   \n",
       "biolink:studied_to_treat                                1             0   \n",
       "biolink:positively_correlated_with                      1             1   \n",
       "biolink:applied_to_treat                                1             1   \n",
       "biolink:predisposes_to_condition                        0             0   \n",
       "biolink:disrupts                                        0             0   \n",
       "biolink:in_clinical_trials_for                          1             1   \n",
       "biolink:affects                                         1             0   \n",
       "biolink:occurs_together_in_literature_with              0             0   \n",
       "biolink:treats_or_applied_or_studied_to_treat           1             1   \n",
       "biolink:contributes_to                                  0             1   \n",
       "biolink:subclass_of                                     0             0   \n",
       "biolink:related_to                                      0             0   \n",
       "biolink:treats                                          1             0   \n",
       "biolink:associated_with                                 0             1   \n",
       "\n",
       "                                               Daunorubicin hydrochloride  \\\n",
       "biolink:causes                                                          1   \n",
       "biolink:produced_by                                                     0   \n",
       "biolink:location_of                                                     0   \n",
       "biolink:has_adverse_event                                               1   \n",
       "biolink:studied_to_treat                                                0   \n",
       "biolink:positively_correlated_with                                      1   \n",
       "biolink:applied_to_treat                                                1   \n",
       "biolink:predisposes_to_condition                                        0   \n",
       "biolink:disrupts                                                        0   \n",
       "biolink:in_clinical_trials_for                                          1   \n",
       "biolink:affects                                                         1   \n",
       "biolink:occurs_together_in_literature_with                              0   \n",
       "biolink:treats_or_applied_or_studied_to_treat                           1   \n",
       "biolink:contributes_to                                                  0   \n",
       "biolink:subclass_of                                                     0   \n",
       "biolink:related_to                                                      1   \n",
       "biolink:treats                                                          1   \n",
       "biolink:associated_with                                                 0   \n",
       "\n",
       "                                               Quizartinib  ...  \\\n",
       "biolink:causes                                           0  ...   \n",
       "biolink:produced_by                                      0  ...   \n",
       "biolink:location_of                                      0  ...   \n",
       "biolink:has_adverse_event                                0  ...   \n",
       "biolink:studied_to_treat                                 1  ...   \n",
       "biolink:positively_correlated_with                       0  ...   \n",
       "biolink:applied_to_treat                                 1  ...   \n",
       "biolink:predisposes_to_condition                         0  ...   \n",
       "biolink:disrupts                                         0  ...   \n",
       "biolink:in_clinical_trials_for                           1  ...   \n",
       "biolink:affects                                          0  ...   \n",
       "biolink:occurs_together_in_literature_with               1  ...   \n",
       "biolink:treats_or_applied_or_studied_to_treat            1  ...   \n",
       "biolink:contributes_to                                   0  ...   \n",
       "biolink:subclass_of                                      0  ...   \n",
       "biolink:related_to                                       0  ...   \n",
       "biolink:treats                                           1  ...   \n",
       "biolink:associated_with                                  0  ...   \n",
       "\n",
       "                                               LEVITIRACETAM  bexmarilimab  \\\n",
       "biolink:causes                                             0             0   \n",
       "biolink:produced_by                                        0             0   \n",
       "biolink:location_of                                        0             0   \n",
       "biolink:has_adverse_event                                  0             0   \n",
       "biolink:studied_to_treat                                   0             0   \n",
       "biolink:positively_correlated_with                         0             0   \n",
       "biolink:applied_to_treat                                   0             0   \n",
       "biolink:predisposes_to_condition                           0             0   \n",
       "biolink:disrupts                                           0             0   \n",
       "biolink:in_clinical_trials_for                             1             1   \n",
       "biolink:affects                                            0             0   \n",
       "biolink:occurs_together_in_literature_with                 0             0   \n",
       "biolink:treats_or_applied_or_studied_to_treat              0             0   \n",
       "biolink:contributes_to                                     0             0   \n",
       "biolink:subclass_of                                        0             0   \n",
       "biolink:related_to                                         0             0   \n",
       "biolink:treats                                             0             0   \n",
       "biolink:associated_with                                    0             0   \n",
       "\n",
       "                                               MEK162  DRUGBANK:DB18980  \\\n",
       "biolink:causes                                      0                 0   \n",
       "biolink:produced_by                                 0                 0   \n",
       "biolink:location_of                                 0                 0   \n",
       "biolink:has_adverse_event                           0                 0   \n",
       "biolink:studied_to_treat                            0                 0   \n",
       "biolink:positively_correlated_with                  0                 0   \n",
       "biolink:applied_to_treat                            0                 0   \n",
       "biolink:predisposes_to_condition                    0                 0   \n",
       "biolink:disrupts                                    0                 0   \n",
       "biolink:in_clinical_trials_for                      1                 1   \n",
       "biolink:affects                                     0                 0   \n",
       "biolink:occurs_together_in_literature_with          0                 0   \n",
       "biolink:treats_or_applied_or_studied_to_treat       0                 0   \n",
       "biolink:contributes_to                              0                 0   \n",
       "biolink:subclass_of                                 0                 0   \n",
       "biolink:related_to                                  0                 0   \n",
       "biolink:treats                                      0                 0   \n",
       "biolink:associated_with                             0                 0   \n",
       "\n",
       "                                               Minnelide  Cobicistat  \\\n",
       "biolink:causes                                         0           0   \n",
       "biolink:produced_by                                    0           0   \n",
       "biolink:location_of                                    0           0   \n",
       "biolink:has_adverse_event                              0           0   \n",
       "biolink:studied_to_treat                               0           0   \n",
       "biolink:positively_correlated_with                     0           0   \n",
       "biolink:applied_to_treat                               0           0   \n",
       "biolink:predisposes_to_condition                       0           0   \n",
       "biolink:disrupts                                       0           0   \n",
       "biolink:in_clinical_trials_for                         1           1   \n",
       "biolink:affects                                        0           0   \n",
       "biolink:occurs_together_in_literature_with             0           0   \n",
       "biolink:treats_or_applied_or_studied_to_treat          0           0   \n",
       "biolink:contributes_to                                 0           0   \n",
       "biolink:subclass_of                                    0           0   \n",
       "biolink:related_to                                     0           0   \n",
       "biolink:treats                                         0           0   \n",
       "biolink:associated_with                                0           0   \n",
       "\n",
       "                                               Mivavotinib  pinometostat  \\\n",
       "biolink:causes                                           0             0   \n",
       "biolink:produced_by                                      0             0   \n",
       "biolink:location_of                                      0             0   \n",
       "biolink:has_adverse_event                                0             0   \n",
       "biolink:studied_to_treat                                 0             0   \n",
       "biolink:positively_correlated_with                       0             0   \n",
       "biolink:applied_to_treat                                 0             0   \n",
       "biolink:predisposes_to_condition                         0             0   \n",
       "biolink:disrupts                                         0             0   \n",
       "biolink:in_clinical_trials_for                           1             1   \n",
       "biolink:affects                                          0             0   \n",
       "biolink:occurs_together_in_literature_with               0             0   \n",
       "biolink:treats_or_applied_or_studied_to_treat            0             0   \n",
       "biolink:contributes_to                                   0             0   \n",
       "biolink:subclass_of                                      0             0   \n",
       "biolink:related_to                                       0             0   \n",
       "biolink:treats                                           0             0   \n",
       "biolink:associated_with                                  0             0   \n",
       "\n",
       "                                               Letermovir  LB-100  \n",
       "biolink:causes                                          0       0  \n",
       "biolink:produced_by                                     0       0  \n",
       "biolink:location_of                                     0       0  \n",
       "biolink:has_adverse_event                               0       0  \n",
       "biolink:studied_to_treat                                0       0  \n",
       "biolink:positively_correlated_with                      0       0  \n",
       "biolink:applied_to_treat                                0       0  \n",
       "biolink:predisposes_to_condition                        0       0  \n",
       "biolink:disrupts                                        0       0  \n",
       "biolink:in_clinical_trials_for                          1       0  \n",
       "biolink:affects                                         0       0  \n",
       "biolink:occurs_together_in_literature_with              0       0  \n",
       "biolink:treats_or_applied_or_studied_to_treat           0       1  \n",
       "biolink:contributes_to                                  0       0  \n",
       "biolink:subclass_of                                     0       0  \n",
       "biolink:related_to                                      0       0  \n",
       "biolink:treats                                          0       0  \n",
       "biolink:associated_with                                 0       0  \n",
       "\n",
       "[18 rows x 2906 columns]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Step 8: Visualize the results\n",
    "TCT.visulization_one_hop_ranking(result_ranked_by_primary_infores, result_parsed, \n",
    "                                num_of_nodes = 50, input_query = input_node_id, \n",
    "                                fontsize = 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>output_node</th>\n",
       "      <th>Name</th>\n",
       "      <th>Num_of_primary_infores</th>\n",
       "      <th>type_of_nodes</th>\n",
       "      <th>unique_predicates</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>CHEBI:28748</td>\n",
       "      <td>Doxorubicin</td>\n",
       "      <td>13</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:treats_or_applied_or_studied_to_treat...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>CHEBI:2038</td>\n",
       "      <td>Azacitidine</td>\n",
       "      <td>12</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:treats_or_applied_or_studied_to_treat...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>256</th>\n",
       "      <td>CHEBI:15367</td>\n",
       "      <td>Tretinoin</td>\n",
       "      <td>11</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:affects, biolink:related_to, biolink:...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>CHEBI:28680</td>\n",
       "      <td>Cytarabine</td>\n",
       "      <td>11</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:treats_or_applied_or_studied_to_treat...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>CHEBI:4911</td>\n",
       "      <td>Etoposide</td>\n",
       "      <td>10</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:treats_or_applied_or_studied_to_treat...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1086</th>\n",
       "      <td>PUBCHEM.COMPOUND:24950485</td>\n",
       "      <td>Cobicistat</td>\n",
       "      <td>1</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:in_clinical_trials_for]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1085</th>\n",
       "      <td>MESH:C000620859</td>\n",
       "      <td>Mivavotinib</td>\n",
       "      <td>1</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:in_clinical_trials_for]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1084</th>\n",
       "      <td>CHEBI:230493</td>\n",
       "      <td>pinometostat</td>\n",
       "      <td>1</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:in_clinical_trials_for]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1083</th>\n",
       "      <td>PUBCHEM.COMPOUND:9916099</td>\n",
       "      <td>Letermovir</td>\n",
       "      <td>1</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:in_clinical_trials_for]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2905</th>\n",
       "      <td>UNII:0C1JUU9S0L</td>\n",
       "      <td>LB-100</td>\n",
       "      <td>1</td>\n",
       "      <td>subject</td>\n",
       "      <td>[biolink:treats_or_applied_or_studied_to_treat]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2906 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                    output_node          Name  Num_of_primary_infores  \\\n",
       "21                  CHEBI:28748   Doxorubicin                      13   \n",
       "29                   CHEBI:2038   Azacitidine                      12   \n",
       "256                 CHEBI:15367     Tretinoin                      11   \n",
       "23                  CHEBI:28680    Cytarabine                      11   \n",
       "20                   CHEBI:4911     Etoposide                      10   \n",
       "...                         ...           ...                     ...   \n",
       "1086  PUBCHEM.COMPOUND:24950485    Cobicistat                       1   \n",
       "1085            MESH:C000620859   Mivavotinib                       1   \n",
       "1084               CHEBI:230493  pinometostat                       1   \n",
       "1083   PUBCHEM.COMPOUND:9916099    Letermovir                       1   \n",
       "2905            UNII:0C1JUU9S0L        LB-100                       1   \n",
       "\n",
       "     type_of_nodes                                  unique_predicates  \n",
       "21         subject  [biolink:treats_or_applied_or_studied_to_treat...  \n",
       "29         subject  [biolink:treats_or_applied_or_studied_to_treat...  \n",
       "256        subject  [biolink:affects, biolink:related_to, biolink:...  \n",
       "23         subject  [biolink:treats_or_applied_or_studied_to_treat...  \n",
       "20         subject  [biolink:treats_or_applied_or_studied_to_treat...  \n",
       "...            ...                                                ...  \n",
       "1086       subject                   [biolink:in_clinical_trials_for]  \n",
       "1085       subject                   [biolink:in_clinical_trials_for]  \n",
       "1084       subject                   [biolink:in_clinical_trials_for]  \n",
       "1083       subject                   [biolink:in_clinical_trials_for]  \n",
       "2905       subject    [biolink:treats_or_applied_or_studied_to_treat]  \n",
       "\n",
       "[2906 rows x 5 columns]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result_ranked_by_primary_infores"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "# End of the example\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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.13.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
