diff --git a/README.md b/README.md index 6732bd2..2ef2063 100644 --- a/README.md +++ b/README.md @@ -104,17 +104,15 @@ $ pip install jupyter-dash ``` ```python -from jupyter_dash import JupyterDash - -from dash import html +from dash import html, Dash, jupyter_dash from jbrowse_jupyter import create, create_component import jupyter_server_proxy -JupyterDash.infer_jupyter_proxy_config() -#JupyterDash()._server_proxy # true if the proxy works as expected -#JupyterDash().config # gives the proxy config +jupyter_dash.infer_jupyter_proxy_config() +#jupyter_dash._server_proxy # true if the proxy works as expected +#jupyter_dash.config # gives the proxy config -app = JupyterDash(__name__) +app = Dash(__name__) jbrowse_conf = create("LGV", genome="hg38") config = jbrowse_conf.get_config() @@ -147,12 +145,12 @@ You can find examples in the root of this repo or in the examples folder, - `browser.py` - uses the Dash library to create a python application with the Dash JBrowse LinearGenomeView component -- `browser.ipynb` - jupyter notebook using the JupyterDash library to embed a - Dash JBrowse LinearGenomeView component in a cell +- `browser.ipynb` - jupyter notebook using the Dash library to embed a Dash + JBrowse LinearGenomeView component in a cell - `examples/cgv_examples.py` - uses the Dash library to create a python application with the Dash JBrowse CircularGenomeView component -- `examples/cgv_examples.ipynb` - jupyter notebook using the JupyterDash library - to embed a Dash JBrowse CircularGenomeView component in a cell +- `examples/cgv_examples.ipynb` - jupyter notebook using the Dash library to + embed a Dash JBrowse CircularGenomeView component in a cell - `local_support.ipynb` - jupyter notebook with tutorial on using your local data and passing it to JBrowse views diff --git a/docs/requirements.txt b/docs/requirements.txt index 04a44d8..a7fe801 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,5 @@ dash==2.3.0 dash-jbrowse>=1.0.2 -jupyter_dash>=0.4.2 Werkzeug==2.0.3 pandas>=1.1.5 pytest>=6.2.5 diff --git a/docs/source/installation.md b/docs/source/installation.md index 2d1b9e0..65d66b2 100644 --- a/docs/source/installation.md +++ b/docs/source/installation.md @@ -28,11 +28,11 @@ You can find examples in the root of the directory. `browser.py` uses the Dash library to create a python application with the Dash JBrowse LinearGenomeView component and configured with the help of this package. -`browser.ipynb` is jupyter notebook using the JupyterDash library to embed a -Dash JBrowse LinearGenomeView component in a cell. `cgv_examples.py` a Dash +`browser.ipynb` is jupyter notebook using the Dash library to embed a Dash +JBrowse LinearGenomeView component in a cell. `cgv_examples.py` a Dash application using the Dash JBrowse CircularGenomeView component -`cgv_examples.ipynb` is jupyter notebook using the JupyterDash library to embed -a Dash JBrowse CircularGenomeView component in a cell. +`cgv_examples.ipynb` is jupyter notebook using the Dash library to embed a Dash +JBrowse CircularGenomeView component in a cell. To run the Python Dash application diff --git a/examples/dash_callbacks.ipynb b/examples/dash_callbacks.ipynb index a203449..5b76717 100644 --- a/examples/dash_callbacks.ipynb +++ b/examples/dash_callbacks.ipynb @@ -13,10 +13,8 @@ "metadata": {}, "outputs": [], "source": [ - "from dash import html, Dash\n", + "from dash import dcc, html, Dash\n", "from dash.dependencies import Input, Output\n", - "from dash import dcc\n", - "from jupyter_dash import JupyterDash\n", "from jbrowse_jupyter import create, create_component" ] }, @@ -27,7 +25,7 @@ "outputs": [], "source": [ "# Create a Jupyter dash app\n", - "app = JupyterDash(__name__)\n", + "app = Dash(__name__)\n", "server = app.server\n", "\n", "# Docs: https://github.com/plotly/jupyter-dash" diff --git a/jbrowse_jupyter/util.py b/jbrowse_jupyter/util.py index f8ce530..79ca96c 100644 --- a/jbrowse_jupyter/util.py +++ b/jbrowse_jupyter/util.py @@ -3,10 +3,8 @@ import json import pkg_resources import dash_jbrowse as jb -from dash import html +from dash import html, Dash from urllib.parse import urlparse -from jupyter_dash import JupyterDash - def is_url(filePath): """ @@ -128,7 +126,7 @@ def create_component(conf, **kwargs): def launch(conf, **kwargs): """ Launches a LinearGenomeView Dash JBrowse component in a - server with the help of JupyterDash. + server. e.g launch(conf, dash_comp="CGV",height=400, port=8002) @@ -141,11 +139,11 @@ def launch(conf, **kwargs): launch. Currently supporting LGV and CGV. defaults to `LGV` when no dash_comp= is specified :param int port: (optional) port to utilize when running - the JupyterDash app + the Dash app :param int height: (optional) the height to utilize for - the JupyterDash app + the Dash app """ - app = JupyterDash(__name__) + app = Dash(__name__) # could add other JBrowse view types e.g Circular, Dotplot supported = set({"LGV", "CGV"}) dash_comp = kwargs.get("dash_comp", "LGV") diff --git a/local_support.ipynb b/local_support.ipynb index 4cbeb7c..e9492f2 100644 --- a/local_support.ipynb +++ b/local_support.ipynb @@ -127,7 +127,7 @@ "outputs": [], "source": [ "from jbrowse_jupyter import launch, create, serve\n", - "from jupyter_dash import JupyterDash\n", + "from dash import jupyter_dash\n", "import requests" ] }, @@ -210,8 +210,8 @@ "source": [ "# Uncomment and run the next line if you are running this in jupyterlab/jupyternotebook\n", "\n", - "import jupyter_server_proxy\n", - "JupyterDash.infer_jupyter_proxy_config() " + "from dash import jupyter_dash\n", + "jupyter_dash.infer_jupyter_proxy_config() " ] }, { diff --git a/requirements.txt b/requirements.txt index 75b1c7a..06755de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ dash>=2.11.1 dash-jbrowse>=1.2.0 -jupyter_dash>=0.4.2 Werkzeug==2.0.3 pandas>=1.1.5 diff --git a/skbr3.ipynb b/skbr3.ipynb index 03144c3..034ec49 100644 --- a/skbr3.ipynb +++ b/skbr3.ipynb @@ -1,28 +1,10 @@ { - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "skbr3.ipynb", - "provenance": [], - "collapsed_sections": [], - "authorship_tag": "ABX9TyOMAEpCwyMSE0fN/WR6igCI", - "include_colab_link": true - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, "cells": [ { "cell_type": "markdown", "metadata": { - "id": "view-in-github", - "colab_type": "text" + "colab_type": "text", + "id": "view-in-github" }, "source": [ "\"Open" @@ -32,16 +14,16 @@ "cell_type": "code", "execution_count": null, "metadata": { - "id": "BYY-Eb9dKUIi", "colab": { "base_uri": "https://localhost:8080/" }, + "id": "BYY-Eb9dKUIi", "outputId": "41a3fc80-917f-4fa9-e98b-d0d56f9aa7f4" }, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "Collecting jbrowse-jupyter\n", " Downloading jbrowse_jupyter-1.2.1-py3-none-any.whl (22 kB)\n", @@ -168,32 +150,36 @@ }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "HetA2JAhKuf5" + }, + "outputs": [], "source": [ "from dash import html, Dash, dcc\n", "from dash.dependencies import Input, Output\n", - "from jupyter_dash import JupyterDash\n", "from jbrowse_jupyter import create, create_component" - ], - "metadata": { - "id": "HetA2JAhKuf5" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", - "source": [ - " app = JupyterDash(__name__)\n", - " server = app.server" - ], + "execution_count": null, "metadata": { "id": "QdWiYfiIKyHv" }, - "execution_count": null, - "outputs": [] + "outputs": [], + "source": [ + " app = Dash(__name__)\n", + " server = app.server" + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "XES1Tx0KK144" + }, + "outputs": [], "source": [ "# locations of interest and name\n", "# sources: \n", @@ -212,15 +198,15 @@ " {\"value\": \"8:125500735..125551329\", \"label\": \"TATDN1\"},\n", " {\"value\": \"8:128,806,779..129,113,499\", \"label\": \"PVT1\"}\n", "]" - ], - "metadata": { - "id": "XES1Tx0KK144" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "eMuOH8KBMSxJ" + }, + "outputs": [], "source": [ "# track data, track name, track id\n", "tracks = [\n", @@ -235,15 +221,15 @@ " (\"https://s3.amazonaws.com/jbrowse.org/genomes/hg19/reads_lr_skbr3.fa_ngmlr-0.2.3_mapped.bam\", \"SKBR3 pacbio (NGMLR)\",\"ngmlr\"),\n", " (\"https://s3.amazonaws.com/jbrowse.org/genomes/hg19/GRCh37_latest_genomic.sort.gff.gz\", \"NCBI RefSeq (GFF3Tabix)\",\"ncbi_gff_hg19\")\n", "]" - ], - "metadata": { - "id": "eMuOH8KBMSxJ" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "qxwK1FBHPpDr" + }, + "outputs": [], "source": [ "conf_lgv = create(\"LGV\", genome=\"hg19\")\n", "conf_cgv = create(\"CGV\", genome=\"hg19\")\n", @@ -261,15 +247,15 @@ "conf_cgv.add_track(\"https://s3.amazonaws.com/jbrowse.org/genomes/hg19/reads_lr_skbr3.fa_ngmlr-0.2.3_mapped.bam.sniffles1kb_auto_l8_s5_noalt.vcf.gz\",name=\"SKBR3 pacbio (sniffles VCF)\", track_id=\"breast_cancer_sniffles_hg19\")\n", "conf_cgv.set_default_session([\"breast_cancer_sniffles_hg19\"], False)\n", "component_test = create_component(conf_cgv.get_config(), id=\"cgv-test\", dash_comp=\"CGV\")" - ], - "metadata": { - "id": "qxwK1FBHPpDr" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "hyOYH1UjLdiS" + }, + "outputs": [], "source": [ "# Return the component with a specific location.\n", "@app.callback(\n", @@ -279,15 +265,15 @@ "def return_jbrowse(location):\n", " conf_lgv.set_location(location)\n", " return create_component(conf_lgv.get_config(), id=\"lgv-test\", dash_comp=\"LGV\")" - ], - "metadata": { - "id": "hyOYH1UjLdiS" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "gTz7jhH7P8z8" + }, + "outputs": [], "source": [ "app.layout = html.Div(\n", " [\n", @@ -301,18 +287,11 @@ " component_test\n", " ]\n", ")" - ], - "metadata": { - "id": "gTz7jhH7P8z8" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", - "source": [ - "app.run_server(mode=\"inline\", height=1000, use_reloader=False, debug=True, port=3031)\n" - ], + "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", @@ -321,33 +300,39 @@ "id": "rL8gnjaMQHeu", "outputId": "9758532d-fcdb-42c0-e527-61fb6c60eae8" }, - "execution_count": null, "outputs": [ { - "output_type": "display_data", "data": { - "application/javascript": [ - "(async (port, path, width, height, cache, element) => {\n", - " if (!google.colab.kernel.accessAllowed && !cache) {\n", - " return;\n", - " }\n", - " element.appendChild(document.createTextNode(''));\n", - " const url = await google.colab.kernel.proxyPort(port, {cache});\n", - " const iframe = document.createElement('iframe');\n", - " iframe.src = new URL(path, url).toString();\n", - " iframe.height = height;\n", - " iframe.width = width;\n", - " iframe.style.border = 0;\n", - " element.appendChild(iframe);\n", - " })(3031, \"/\", \"100%\", 1000, false, window.element)" - ], + "application/javascript": "(async (port, path, width, height, cache, element) => {\n if (!google.colab.kernel.accessAllowed && !cache) {\n return;\n }\n element.appendChild(document.createTextNode(''));\n const url = await google.colab.kernel.proxyPort(port, {cache});\n const iframe = document.createElement('iframe');\n iframe.src = new URL(path, url).toString();\n iframe.height = height;\n iframe.width = width;\n iframe.style.border = 0;\n element.appendChild(iframe);\n })(3031, \"/\", \"100%\", 1000, false, window.element)", "text/plain": [ "" ] }, - "metadata": {} + "metadata": {}, + "output_type": "display_data" } + ], + "source": [ + "app.run_server(mode=\"inline\", height=1000, use_reloader=False, debug=True, port=3031)\n" ] } - ] + ], + "metadata": { + "colab": { + "authorship_tag": "ABX9TyOMAEpCwyMSE0fN/WR6igCI", + "collapsed_sections": [], + "include_colab_link": true, + "name": "skbr3.ipynb", + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 }