{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# For its use in colab notebook\n", "!pip install jbrowse-jupyter" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# For its use in colab notebook\n", "!pip install pandas\n", "!pip install --force-reinstall MarkupSafe==2.0.1" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from jbrowse_jupyter import launch, create" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "hg38 = create('LGV', genome='hg38')" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " refName start end name\n", "0 10 100 175 feature1\n", "1 10 150 225 feature2\n", "2 10 200 275 feature3\n", "3 10 250 325 feature4\n" ] } ], "source": [ "data = {'refName':['10', '10', '10', '10'],\n", " 'start':[100, 150, 200, 250],\n", " 'end':[175, 225, 275, 325],\n", " 'name':['feature1', 'feature2', 'feature3', 'feature4']}\n", "\n", "df = pd.DataFrame(data)\n", "print(df)\n", "hg38.add_df_track(df, 'track_name', track_id=\"df_track_id\", overwrite=True)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " <iframe\n", " width=\"100%\"\n", " height=\"300\"\n", " src=\"http://127.0.0.1:3013/\"\n", " frameborder=\"0\"\n", " allowfullscreen\n", " \n", " ></iframe>\n", " " ], "text/plain": [ "<IPython.lib.display.IFrame at 0x7fed89f39b50>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "hg38.set_location(\"10:100..350\")\n", "hg38.set_default_session(['df_track_id'], False)\n", "new_conf = hg38.get_config()\n", "launch(new_conf, port=3013)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "tracks = [\n", " (\"https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/ncbi_refseq/GCA_000001405.15_GRCh38_full_analysis_set.refseq_annotation.sorted.gff.gz\", \"gff-demo\"),\n", " (\"https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/skbr3/SKBR3_Feb17_GRCh38.sorted.bam\", \"bam-demo\"),\n", " (\"https://hgdownload.cse.ucsc.edu/goldenpath/hg38/phyloP100way/hg38.phyloP100way.bw\", \"bigwig-demo\"),\n", " (\"https://ftp.ncbi.nlm.nih.gov/pub/clinvar/vcf_GRCh38/clinvar.vcf.gz\", \"vcf-demo\"),\n", " (\"https://jbrowse.org/genomes/GRCh38/repeats.bb\", \"bigbed\")\n", "]\n", "for track in tracks:\n", " data = track[0]\n", " track_id = track[1]\n", " hg38.add_track(data, track_id=track_id)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " <iframe\n", " width=\"100%\"\n", " height=\"800\"\n", " src=\"http://127.0.0.1:8000/\"\n", " frameborder=\"0\"\n", " allowfullscreen\n", " \n", " ></iframe>\n", " " ], "text/plain": [ "<IPython.lib.display.IFrame at 0x7fed58e04e20>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# set theme\n", "hg38.set_theme(\"#311b92\", \"#0097a7\", \"#f57c00\", \"#d50000\")\n", "hg38.set_default_session(['gff-demo', 'bigbed'],False)\n", "hg38.set_location(\"1:110654228..110936130\")\n", "new_conf2 = hg38.get_config()\n", "launch(new_conf2, id=\"test-2\",height=800, dash_comp=\"LGV\", port=8000)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.8.13" }, "vscode": { "interpreter": { "hash": "aaf81c8f28912d07c45359b3a81eb2244c23c90e1b370733684a5666e4e4597e" } } }, "nbformat": 4, "nbformat_minor": 4 }