diff --git a/appyters/KEA3_Appyter/KEA3-Appyter.ipynb b/appyters/KEA3_Appyter/KEA3-Appyter.ipynb index 101a0e5aa..a828501cb 100644 --- a/appyters/KEA3_Appyter/KEA3-Appyter.ipynb +++ b/appyters/KEA3_Appyter/KEA3-Appyter.ipynb @@ -53,7 +53,8 @@ "from IPython.display import HTML, display, Image, FileLink, Markdown\n", "import plotly.graph_objects as go\n", "import kaleido\n", - "import os " + "import os \n", + "import html" ] }, { @@ -197,19 +198,19 @@ " k_libs_palette = {'BioGRID': 'rgb(196, 8, 8)', 'ChengKSIN': 'rgb(244, 109, 67)', 'ChengPPI': 'rgb(242, 172, 68)',\n", " 'HIPPIE': 'rgb(236, 252, 68)', 'mentha': 'rgb(165, 242, 162)', 'MINT': 'rgb(92, 217, 78)',\n", " 'PhosDAll': 'rgb(0, 138, 64)', 'prePPI': 'rgb(96, 191, 235)', 'PTMsigDB': 'rgb(14, 130, 201)',\n", - " 'STRING': 'rgb(58, 50, 168)', 'STRING.bind': 'rgb(158, 50, 168)'}\n", + " 'STRING': 'rgb(58, 50, 168)', 'STRING.bind': 'rgb(158, 50, 168)', 'The_Kinase_Library': 'rgb(235, 0, 235)'}\n", " \n", " k_libs_means = {'STRING.bind': [0] * 10, 'ChengPPI': [0] * 10, 'PhosDAll': [0] * 10, 'BioGRID': [0] * 10,\n", " 'HIPPIE': [0] * 10, 'ChengKSIN': [0] * 10,\n", " 'STRING': [0] * 10, 'MINT': [0] * 10, 'mentha': [0] * 10, 'prePPI': [0] * 10,\n", - " 'PTMsigDB': [0] * 10}\n", + " 'PTMsigDB': [0] * 10, 'The_Kinase_Library': [0] * 10}\n", + "\n", + " libs_sorted = ['BioGRID', 'ChengKSIN', 'ChengPPI', 'HIPPIE', 'mentha', 'MINT', 'PhosDAll', 'prePPI', 'PTMsigDB', 'STRING', 'STRING.bind', 'The_Kinase_Library']\n", "\n", - " libs_sorted = ['BioGRID', 'ChengKSIN', 'ChengPPI', 'HIPPIE', 'mentha', 'MINT', 'PhosDAll', 'prePPI', 'PTMsigDB', 'STRING', 'STRING.bind']\n", - " \n", " results_mr_t = [r for r in results['Integrated--meanRank'] if len(r['Library'].split(';')) >= threshold][:num_kinases]\n", " # results_mr_t.sort(key=lambda kin: sum([int(k.split(',')[1]) for k in kin['Library'].split(';')]))\n", " results_mr_t = results_mr_t[::-1]\n", - " sorted_kinases = [k['TF'] for k in results_mr_t[:num_kinases]]\n", + " sorted_kinases = [k['TF'] for k in results_mr_t[:num_kinases]] \n", "\n", " for i, kin in enumerate(results_mr_t[:num_kinases]):\n", " scores = kin['Library'].split(';')\n", @@ -237,12 +238,17 @@ " )\n", " )\n", "\n", + " html_str = fig.to_html(include_plotlyjs='cdn')\n", + " escaped_html = html.escape(html_str)\n", + " iframe = f\"\"\"\n", + " \n", + " \"\"\"\n", + " display(HTML(iframe))\n", " display(HTML(\n", " '

This interactive bar chart summarizes the ranks of the top kinases from the different libraries.

'))\n", " display(HTML(\n", " f'Kinases are sorted by MeanRank. Only kinases with at least {threshold} contributed libraries are shown. ' +\n", - " 'To download the file as a PNG, click the camera button in the upper right corner of the chart.'))\n", - " fig.show()" + " 'To download the file as a PNG, click the camera button in the upper right corner of the chart.'))" ] }, { @@ -271,7 +277,7 @@ "\n", " display(HTML('

The following tables display the rankings of the top kinases from each library.

'))\n", "\n", - " display_tables(['ChengKSIN', 'PTMsigDB', 'PhosDAll'], 'Kinase-substrate interaction')\n", + " display_tables(['ChengKSIN', 'PTMsigDB', 'PhosDAll', 'The_Kinase_Library'], 'Kinase-substrate interaction')\n", " display_tables(['prePPI', 'BioGRID', 'mentha', 'MINT','HIPPIE', 'STRING.bind', 'ChengPPI'], 'Protein-protein interaction')\n", " display_tables(['STRING'], 'All associations')" ]