Skip to content

Commit

Permalink
Merge pull request #332 from eweitz/update-jupyter-example
Browse files Browse the repository at this point in the history
Update Jupyter example to fix deprecations
  • Loading branch information
eweitz committed Dec 14, 2022
2 parents 933728d + 607ce7b commit 9001144
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
78 changes: 42 additions & 36 deletions examples/jupyter/ideogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,74 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": [
"const script = document.createElement('script');\n",
"script.type = 'text/javascript';\n",
"script.src = 'https://cdn.jsdelivr.net/npm/ideogram/dist/js/ideogram.min.js';\n",
"document.head.appendChild(script);\n"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%javascript\n",
"const script = document.createElement('script');\n",
"script.type = 'text/javascript';\n",
"script.src = 'https://cdn.jsdelivr.net/npm/ideogram/dist/js/ideogram.min.js';\n",
"document.head.appendChild(script);"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<script>brca1_gene = {'name': 'BRCA1', 'chr': '17', 'start': 43044294, 'stop': 43125482};apoe_gene = {'name': 'APOE', 'chr': '19', 'start': 44905749, 'stop': 44909395};</script><div id=\"ideo-container\" style=\"height: 200px\"></div>"
"<div id=\"ideo-container\"></div>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
"from IPython.display import HTML\n",
"\n",
"brca1_gene = {'name': 'BRCA1', 'chr': '17', 'start': 43044294, 'stop': 43125482}\n",
"apoe_gene = {'name': 'APOE', 'chr': '19', 'start': 44905749, 'stop': 44909395}\n",
"\n",
"HTML(\n",
" '<script>' +\n",
" 'brca1_gene = ' + str(brca1_gene) + ';' +\n",
" 'apoe_gene = ' + str(apoe_gene) + ';' +\n",
" '</script>' +\n",
" '<div id=\"ideo-container\" style=\"height: 200px\"></div>'\n",
")"
"%%html\n",
"<div id=\"ideo-container\"></div>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": [
"require.config({\n",
" paths: {\n",
" Ideogram: 'https://unpkg.com/ideogram/dist/js/ideogram.min'\n",
" }\n",
"});\n",
"require(['Ideogram'], function(Ideogram) {\n",
" window.Ideogram = Ideogram.default;\n",
"});\n",
"const brca1_gene = {'name': 'BRCA1', 'chr': '17', 'start': 43044294, 'stop': 43125482}\n",
"const apoe_gene = {'name': 'APOE', 'chr': '19', 'start': 44905749, 'stop': 44909395}\n",
"\n",
"var ideogram = new Ideogram({\n",
"const ideogram = new Ideogram({\n",
" organism: 'human',\n",
" container: '#ideo-container',\n",
" resolution: 550, // proxy for number of cytobands\n",
" chrHeight: 175,\n",
" chrMargin: 3,\n",
" annotationHeight: 4,\n",
" annotations: [brca1_gene, apoe_gene]\n",
"})"
"})\n"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
Expand All @@ -71,16 +83,10 @@
],
"source": [
"%%javascript\n",
"require.config({\n",
" paths: {\n",
" Ideogram: 'https://unpkg.com/ideogram/dist/js/ideogram.min'\n",
" }\n",
"});\n",
"require(['Ideogram'], function(Ideogram) {\n",
" window.Ideogram = Ideogram.default;\n",
"});\n",
"const brca1_gene = {'name': 'BRCA1', 'chr': '17', 'start': 43044294, 'stop': 43125482}\n",
"const apoe_gene = {'name': 'APOE', 'chr': '19', 'start': 44905749, 'stop': 44909395}\n",
"\n",
"var ideogram = new Ideogram({\n",
"const ideogram = new Ideogram({\n",
" organism: 'human',\n",
" container: '#ideo-container',\n",
" resolution: 550, // proxy for number of cytobands\n",
Expand Down Expand Up @@ -115,7 +121,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
"version": "3.8.9"
}
},
"nbformat": 4,
Expand Down
Binary file modified examples/jupyter/ideogram_jupyter_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9001144

Please sign in to comment.