Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
teresam856 committed Feb 4, 2022
2 parents d865302 + 4322f18 commit 85639a7
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 8 deletions.
115 changes: 107 additions & 8 deletions browser.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,106 @@
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Collecting git+https://github.com/GMOD/jbrowse-jupyter.git@main\n",
" Cloning https://github.com/GMOD/jbrowse-jupyter.git (to revision main) to /private/var/folders/96/hq94_1qd3c9_q87bwqhg05s80000gn/T/pip-req-build-emfgm9s3\n",
" Running command git clone --filter=blob:none -q https://github.com/GMOD/jbrowse-jupyter.git /private/var/folders/96/hq94_1qd3c9_q87bwqhg05s80000gn/T/pip-req-build-emfgm9s3\n",
" Resolved https://github.com/GMOD/jbrowse-jupyter.git to commit 5a7a753cf3ada2d028992c67ed305e0ea575555b\n",
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25hCollecting dash==2.0.0\n",
" Using cached dash-2.0.0-py3-none-any.whl (7.3 MB)\n",
"Collecting dash-jbrowse>=1.0.1\n",
" Using cached dash_jbrowse-1.0.1-py3-none-any.whl (1.1 MB)\n",
"Requirement already satisfied: flake8>=4.0.1 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jbrowse-jupyter==1.2.1) (4.0.1)\n",
"Requirement already satisfied: jupyter_dash>=0.4.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jbrowse-jupyter==1.2.1) (0.4.0)\n",
"Requirement already satisfied: pandas>=1.1.5 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jbrowse-jupyter==1.2.1) (1.4.0)\n",
"Requirement already satisfied: pytest>=6.2.5 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jbrowse-jupyter==1.2.1) (6.2.5)\n",
"Requirement already satisfied: dash-table==5.0.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from dash==2.0.0->jbrowse-jupyter==1.2.1) (5.0.0)\n",
"Requirement already satisfied: flask-compress in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from dash==2.0.0->jbrowse-jupyter==1.2.1) (1.10.1)\n",
"Requirement already satisfied: dash-core-components==2.0.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from dash==2.0.0->jbrowse-jupyter==1.2.1) (2.0.0)\n",
"Requirement already satisfied: plotly>=5.0.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from dash==2.0.0->jbrowse-jupyter==1.2.1) (5.3.1)\n",
"Requirement already satisfied: dash-html-components==2.0.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from dash==2.0.0->jbrowse-jupyter==1.2.1) (2.0.0)\n",
"Requirement already satisfied: Flask>=1.0.4 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from dash==2.0.0->jbrowse-jupyter==1.2.1) (1.1.2)\n",
"Requirement already satisfied: pycodestyle<2.9.0,>=2.8.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from flake8>=4.0.1->jbrowse-jupyter==1.2.1) (2.8.0)\n",
"Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from flake8>=4.0.1->jbrowse-jupyter==1.2.1) (0.6.1)\n",
"Requirement already satisfied: pyflakes<2.5.0,>=2.4.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from flake8>=4.0.1->jbrowse-jupyter==1.2.1) (2.4.0)\n",
"Requirement already satisfied: ipykernel in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (5.3.4)\n",
"Requirement already satisfied: ansi2html in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (1.6.0)\n",
"Requirement already satisfied: retrying in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (1.3.3)\n",
"Requirement already satisfied: requests in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (2.24.0)\n",
"Requirement already satisfied: ipython in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (7.19.0)\n",
"Requirement already satisfied: python-dateutil>=2.8.1 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pandas>=1.1.5->jbrowse-jupyter==1.2.1) (2.8.1)\n",
"Requirement already satisfied: numpy>=1.18.5 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pandas>=1.1.5->jbrowse-jupyter==1.2.1) (1.19.2)\n",
"Requirement already satisfied: pytz>=2020.1 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pandas>=1.1.5->jbrowse-jupyter==1.2.1) (2020.1)\n",
"Requirement already satisfied: packaging in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pytest>=6.2.5->jbrowse-jupyter==1.2.1) (20.4)\n",
"Requirement already satisfied: iniconfig in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pytest>=6.2.5->jbrowse-jupyter==1.2.1) (1.1.1)\n",
"Requirement already satisfied: attrs>=19.2.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pytest>=6.2.5->jbrowse-jupyter==1.2.1) (20.3.0)\n",
"Requirement already satisfied: py>=1.8.2 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pytest>=6.2.5->jbrowse-jupyter==1.2.1) (1.9.0)\n",
"Requirement already satisfied: toml in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pytest>=6.2.5->jbrowse-jupyter==1.2.1) (0.10.1)\n",
"Requirement already satisfied: pluggy<2.0,>=0.12 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pytest>=6.2.5->jbrowse-jupyter==1.2.1) (0.13.1)\n",
"Requirement already satisfied: click>=5.1 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from Flask>=1.0.4->dash==2.0.0->jbrowse-jupyter==1.2.1) (7.1.2)\n",
"Requirement already satisfied: itsdangerous>=0.24 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from Flask>=1.0.4->dash==2.0.0->jbrowse-jupyter==1.2.1) (1.1.0)\n",
"Requirement already satisfied: Jinja2>=2.10.1 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from Flask>=1.0.4->dash==2.0.0->jbrowse-jupyter==1.2.1) (2.11.2)\n",
"Requirement already satisfied: Werkzeug>=0.15 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from Flask>=1.0.4->dash==2.0.0->jbrowse-jupyter==1.2.1) (2.0.2)\n",
"Requirement already satisfied: tenacity>=6.2.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from plotly>=5.0.0->dash==2.0.0->jbrowse-jupyter==1.2.1) (8.0.1)\n",
"Requirement already satisfied: six in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from plotly>=5.0.0->dash==2.0.0->jbrowse-jupyter==1.2.1) (1.16.0)\n",
"Requirement already satisfied: brotli in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from flask-compress->dash==2.0.0->jbrowse-jupyter==1.2.1) (1.0.9)\n",
"Requirement already satisfied: appnope in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipykernel->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (0.1.0)\n",
"Requirement already satisfied: tornado>=4.2 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipykernel->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (6.0.4)\n",
"Requirement already satisfied: jupyter-client in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipykernel->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (6.1.7)\n",
"Requirement already satisfied: traitlets>=4.1.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipykernel->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (5.1.1)\n",
"Requirement already satisfied: pygments in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (2.7.2)\n",
"Requirement already satisfied: decorator in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (4.4.2)\n",
"Requirement already satisfied: setuptools>=18.5 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (59.2.0)\n",
"Requirement already satisfied: backcall in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (0.2.0)\n",
"Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (3.0.8)\n",
"Requirement already satisfied: jedi>=0.10 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (0.17.1)\n",
"Requirement already satisfied: pexpect>4.3 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (4.8.0)\n",
"Requirement already satisfied: pickleshare in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (0.7.5)\n",
"Requirement already satisfied: pyparsing>=2.0.2 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from packaging->pytest>=6.2.5->jbrowse-jupyter==1.2.1) (2.4.7)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from requests->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (1.25.11)\n",
"Requirement already satisfied: idna<3,>=2.5 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from requests->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (2.10)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from requests->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (2020.6.20)\n",
"Requirement already satisfied: chardet<4,>=3.0.2 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from requests->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (3.0.4)\n",
"Requirement already satisfied: parso<0.8.0,>=0.7.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jedi>=0.10->ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (0.7.0)\n",
"Requirement already satisfied: MarkupSafe>=0.23 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from Jinja2>=2.10.1->Flask>=1.0.4->dash==2.0.0->jbrowse-jupyter==1.2.1) (2.0.1)\n",
"Requirement already satisfied: ptyprocess>=0.5 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from pexpect>4.3->ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (0.6.0)\n",
"Requirement already satisfied: wcwidth in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (0.2.5)\n",
"Requirement already satisfied: pyzmq>=13 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jupyter-client->ipykernel->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (19.0.2)\n",
"Requirement already satisfied: jupyter-core>=4.6.0 in /Users/teresamartinez/opt/anaconda3/lib/python3.8/site-packages (from jupyter-client->ipykernel->jupyter_dash>=0.4.0->jbrowse-jupyter==1.2.1) (4.6.3)\n",
"Building wheels for collected packages: jbrowse-jupyter\n",
" Building wheel for jbrowse-jupyter (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for jbrowse-jupyter: filename=jbrowse_jupyter-1.2.1-py3-none-any.whl size=23012 sha256=dc06962e969611682d804c0be04df525f0ddaf4de081e7ff81ca334a6ad8ef75\n",
" Stored in directory: /private/var/folders/96/hq94_1qd3c9_q87bwqhg05s80000gn/T/pip-ephem-wheel-cache-_0jqacx4/wheels/a5/b8/b6/451f32abe96728b448365b4289261b6a436d79dd1ace71c4f1\n",
"Successfully built jbrowse-jupyter\n",
"Installing collected packages: dash, dash-jbrowse, jbrowse-jupyter\n",
" Attempting uninstall: dash\n",
" Found existing installation: dash 2.1.0\n",
" Uninstalling dash-2.1.0:\n",
" Successfully uninstalled dash-2.1.0\n",
" Attempting uninstall: dash-jbrowse\n",
" Found existing installation: dash-jbrowse 1.0.0\n",
" Uninstalling dash-jbrowse-1.0.0:\n",
" Successfully uninstalled dash-jbrowse-1.0.0\n",
"Successfully installed dash-2.0.0 dash-jbrowse-1.0.1 jbrowse-jupyter-1.2.1\n",
"\u001b[33mWARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.\n",
"You should consider upgrading via the '/Users/teresamartinez/opt/anaconda3/bin/python -m pip install --upgrade pip' command.\u001b[0m\n"
]
}
],
"source": [
"!pip install git+https://github.com/GMOD/jbrowse-jupyter.git@main"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -12,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -21,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -45,13 +144,13 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<IPython.lib.display.IFrame at 0x7fabb956ee10>",
"text/plain": "<IPython.lib.display.IFrame at 0x7fac089d0438>",
"text/html": "\n <iframe\n width=\"100%\"\n height=\"300\"\n src=\"http://127.0.0.1:3003/\"\n frameborder=\"0\"\n allowfullscreen\n ></iframe>\n "
},
"metadata": {}
Expand All @@ -66,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -86,13 +185,13 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<IPython.lib.display.IFrame at 0x7fac010633c8>",
"text/plain": "<IPython.lib.display.IFrame at 0x7fabc80d3668>",
"text/html": "\n <iframe\n width=\"100%\"\n height=\"800\"\n src=\"http://127.0.0.1:8000/\"\n frameborder=\"0\"\n allowfullscreen\n ></iframe>\n "
},
"metadata": {}
Expand Down
127 changes: 127 additions & 0 deletions example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"metadata": {
"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.8.12-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3.8.12 64-bit ('jbrowse-jupyter': conda)",
"metadata": {
"interpreter": {
"hash": "dc9fc419d624b95bc9cc0bd84733299ab39c72ed5f2a2912fba5b902d66850aa"
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from dash import 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"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
" app = JupyterDash(__name__)\n",
" server = app.server"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"locations = [\n",
" {\"value\": \"17:41,196,332..41,277,401\", \"label\": \"BRCA1\"\n",
" },\n",
" {\"value\": \"13:32,889,615..32,974,375\", \"label\": \"BRCA2\"},\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Return the component with a specific location.\n",
"@app.callback(\n",
" Output(\"default-container\", \"children\"), Input(\"location-to-view\", \"value\")\n",
")\n",
"def return_jbrowse(location):\n",
" print(location)\n",
" conf = create(\"view\", genome=\"hg19\")\n",
" conf.set_location(location)\n",
" return create_component(conf.get_config())"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"\n",
"app.layout = html.Div(\n",
" [\n",
" html.P(\"Select a location to view.\"),\n",
" dcc.Dropdown(\n",
" id=\"location-to-view\", options=locations, value=\"1:1..90\"\n",
" ),\n",
" html.Hr(),\n",
" dcc.Loading(id=\"default-container\"),\n",
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "<IPython.lib.display.IFrame at 0x7f9d58f6db50>",
"text/html": "\n <iframe\n width=\"100%\"\n height=\"650\"\n src=\"http://127.0.0.1:3039/\"\n frameborder=\"0\"\n allowfullscreen\n \n ></iframe>\n "
},
"metadata": {}
}
],
"source": [
"app.run_server(mode=\"inline\", use_reloader=False, debug=True, port=3039)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
]
}

0 comments on commit 85639a7

Please sign in to comment.