From f5372fcdfdc22d894b9a45c3d70c4971a4cfdc6e Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Wed, 20 Nov 2024 18:02:59 -0500 Subject: [PATCH] clear notebooks --- notebooks/example.ipynb | 203 +------ notebooks/multiple-coordinated-views.ipynb | 627 +-------------------- 2 files changed, 28 insertions(+), 802 deletions(-) diff --git a/notebooks/example.ipynb b/notebooks/example.ipynb index 8605d4d8..cdd84bb2 100644 --- a/notebooks/example.ipynb +++ b/notebooks/example.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "2a014a14-3d7c-4288-8534-df01d7bf2432", "metadata": {}, "outputs": [], @@ -12,57 +12,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "61233841", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Track({\n", - " color: Color({\n", - " shorthand: 's1:N'\n", - " }),\n", - " data: {'type': 'csv', 'url': 'https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/circos-segdup-edited.txt', 'chromosomeField': 'c2', 'genomicFields': ['s1', 'e1', 's2', 'e2']},\n", - " height: 130,\n", - " mark: 'withinLink',\n", - " opacity: OpacityValue({\n", - " value: 0.2\n", - " }),\n", - " stroke: StrokeValue({\n", - " value: 'black'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 0.5\n", - " }),\n", - " width: 600,\n", - " x: X({\n", - " domain: GenomicDomain({\n", - " chromosome: '1',\n", - " interval: [103900000, 104100000]\n", - " }),\n", - " shorthand: 's1:G'\n", - " }),\n", - " x1: X1({\n", - " domain: GenomicDomain({\n", - " chromosome: '1'\n", - " }),\n", - " shorthand: 's2:G'\n", - " }),\n", - " x1e: X1e({\n", - " shorthand: 'e2:G'\n", - " }),\n", - " xe: Xe({\n", - " shorthand: 'e1:G'\n", - " })\n", - "})" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "csvData = gos.csv(\n", " url=\"https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/circos-segdup-edited.txt\",\n", @@ -87,141 +40,15 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "88f3a522", - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - "\n", - "\n", - "
\n", - " \n", - "\n", - "" - ], - "text/plain": [ - "View({\n", - " subtitle: 'Tutorial Examples',\n", - " title: 'Basic Marks: Bar',\n", - " tracks: [Track({\n", - " color: Color({\n", - " field: 's1',\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'csv', 'url': 'https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/circos-segdup-edited.txt', 'chromosomeField': 'c2', 'genomicFields': ['s1', 'e1', 's2', 'e2']},\n", - " height: 130,\n", - " mark: 'withinLink',\n", - " opacity: OpacityValue({\n", - " value: 0.2\n", - " }),\n", - " stroke: StrokeValue({\n", - " value: 'black'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 0.5\n", - " }),\n", - " width: 600,\n", - " x: X({\n", - " domain: GenomicDomain({\n", - " chromosome: '1',\n", - " interval: [103900000, 104100000]\n", - " }),\n", - " field: 's1',\n", - " type: 'genomic'\n", - " }),\n", - " x1: X1({\n", - " domain: GenomicDomain({\n", - " chromosome: '1'\n", - " }),\n", - " field: 's2',\n", - " type: 'genomic'\n", - " }),\n", - " x1e: X1e({\n", - " field: 'e2',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'e1',\n", - " type: 'genomic'\n", - " })\n", - " })]\n", - "})" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "metadata": {}, + "outputs": [], "source": [ "# just render a view (not a mutable object)\n", - "track.view(title=\"Basic Marks: Bar\", subtitle=\"Tutorial Examples\")" + "view = track.view(title=\"Basic Marks: Bar\", subtitle=\"Tutorial Examples\", id=\"aa\")\n", + "w = view.widget()\n", + "w" ] }, { @@ -230,6 +57,16 @@ "id": "7a82cfcc", "metadata": {}, "outputs": [], + "source": [ + "view.id" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "05d7ecf9-d336-4daa-8d49-447d062f7236", + "metadata": {}, + "outputs": [], "source": [] } ], @@ -249,7 +86,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.12.7" } }, "nbformat": 4, diff --git a/notebooks/multiple-coordinated-views.ipynb b/notebooks/multiple-coordinated-views.ipynb index 6be89bc8..ce28fb02 100644 --- a/notebooks/multiple-coordinated-views.ipynb +++ b/notebooks/multiple-coordinated-views.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "c8988b10", "metadata": {}, "outputs": [], @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "252487de", "metadata": {}, "outputs": [], @@ -56,201 +56,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "8e125ba2", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - "\n", - "\n", - "
\n", - " \n", - "\n", - "" - ], - "text/plain": [ - "View({\n", - " alignment: 'stack',\n", - " layout: 'circular',\n", - " spacing: 1,\n", - " tracks: (View({\n", - " alignment: 'overlay',\n", - " height: 300,\n", - " tracks: (Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " mark: 'bar',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " x: X({\n", - " field: 'start',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " }), Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " mark: 'brush',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " x: X({\n", - " linkingId: 'detail-1'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " }), Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " mark: 'brush',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " x: X({\n", - " linkingId: 'detail-2'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " })),\n", - " width: 300\n", - " }), Track({\n", - " data: {'type': 'csv', 'url': 'https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/rearrangements.bulk.1639.simple.filtered.pub', 'headerNames': ['chr1', 'p1s', 'p1e', 'chr2', 'p2s', 'p2e', 'type', 'id', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6'], 'separator': '\\t', 'genomicFieldsToConvert': [{'chromosomeField': 'chr1', 'genomicFields': ['p1s', 'p1e']}, {'chromosomeField': 'chr2', 'genomicFields': ['p2s', 'p2e']}]},\n", - " height: 100,\n", - " mark: 'withinLink',\n", - " opacity: OpacityValue({\n", - " value: 0.6\n", - " }),\n", - " stroke: Stroke({\n", - " field: 'chr1',\n", - " range: ['steelblue'],\n", - " type: 'nominal'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " width: 300,\n", - " x: X({\n", - " field: 'p1s',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'p2e',\n", - " type: 'genomic'\n", - " })\n", - " }))\n", - "})" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "bar_base = gos.Track(data=mv).mark_bar().encode(\n", " x='start:G',\n", @@ -282,163 +91,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "6cb98e9b", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - "\n", - "\n", - "
\n", - " \n", - "\n", - "" - ], - "text/plain": [ - "View({\n", - " arrangement: 'vertical',\n", - " spacing: 20,\n", - " views: (View({\n", - " linkingId: 'detail-1',\n", - " tracks: [Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " height: 100,\n", - " mark: 'bar',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 0\n", - " }),\n", - " width: 300,\n", - " x: X({\n", - " field: 'start',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " })],\n", - " xDomain: GenomicDomain({\n", - " chromosome: '3'\n", - " })\n", - " }), View({\n", - " linkingId: 'detail-2',\n", - " tracks: [Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " height: 100,\n", - " mark: 'bar',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 0\n", - " }),\n", - " width: 300,\n", - " x: X({\n", - " field: 'start',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " })],\n", - " xDomain: GenomicDomain({\n", - " chromosome: '10'\n", - " })\n", - " }))\n", - "})" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "detail_1 = bar_base.encode(strokeWidth=gos.value(0)).properties(width=300, height=100).view(\n", " linkingId='detail-1',\n", @@ -464,277 +120,10 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "0e1a635e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - "\n", - "\n", - "
\n", - " \n", - "\n", - "" - ], - "text/plain": [ - "View({\n", - " arrangement: 'horizontal',\n", - " title: 'Overview and Detail Views',\n", - " views: (View({\n", - " alignment: 'stack',\n", - " layout: 'circular',\n", - " spacing: 1,\n", - " tracks: (View({\n", - " alignment: 'overlay',\n", - " height: 300,\n", - " tracks: (Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " mark: 'bar',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " x: X({\n", - " field: 'start',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " }), Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " mark: 'brush',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " x: X({\n", - " linkingId: 'detail-1'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " }), Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " mark: 'brush',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " x: X({\n", - " linkingId: 'detail-2'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " })),\n", - " width: 300\n", - " }), Track({\n", - " data: {'type': 'csv', 'url': 'https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/rearrangements.bulk.1639.simple.filtered.pub', 'headerNames': ['chr1', 'p1s', 'p1e', 'chr2', 'p2s', 'p2e', 'type', 'id', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6'], 'separator': '\\t', 'genomicFieldsToConvert': [{'chromosomeField': 'chr1', 'genomicFields': ['p1s', 'p1e']}, {'chromosomeField': 'chr2', 'genomicFields': ['p2s', 'p2e']}]},\n", - " height: 100,\n", - " mark: 'withinLink',\n", - " opacity: OpacityValue({\n", - " value: 0.6\n", - " }),\n", - " stroke: Stroke({\n", - " field: 'chr1',\n", - " range: ['steelblue'],\n", - " type: 'nominal'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 2\n", - " }),\n", - " width: 300,\n", - " x: X({\n", - " field: 'p1s',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'p2e',\n", - " type: 'genomic'\n", - " })\n", - " }))\n", - " }), View({\n", - " arrangement: 'vertical',\n", - " spacing: 20,\n", - " views: (View({\n", - " linkingId: 'detail-1',\n", - " tracks: [Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " height: 100,\n", - " mark: 'bar',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 0\n", - " }),\n", - " width: 300,\n", - " x: X({\n", - " field: 'start',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " })],\n", - " xDomain: GenomicDomain({\n", - " chromosome: '3'\n", - " })\n", - " }), View({\n", - " linkingId: 'detail-2',\n", - " tracks: [Track({\n", - " color: Color({\n", - " field: 'sample',\n", - " range: ['steelblue', 'salmon', 'steelblue', 'salmon'],\n", - " type: 'nominal'\n", - " }),\n", - " data: {'type': 'multivec', 'url': 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec', 'row': 'sample', 'column': 'position', 'value': 'peak', 'categories': ['sample 1', 'sample 2', 'sample 3', 'sample 4'], 'binSize': 2},\n", - " height: 100,\n", - " mark: 'bar',\n", - " stroke: StrokeValue({\n", - " value: 'white'\n", - " }),\n", - " strokeWidth: StrokeWidthValue({\n", - " value: 0\n", - " }),\n", - " width: 300,\n", - " x: X({\n", - " field: 'start',\n", - " type: 'genomic'\n", - " }),\n", - " xe: Xe({\n", - " field: 'end',\n", - " type: 'genomic'\n", - " }),\n", - " y: Y({\n", - " field: 'peak',\n", - " type: 'quantitative'\n", - " })\n", - " })],\n", - " xDomain: GenomicDomain({\n", - " chromosome: '10'\n", - " })\n", - " }))\n", - " }))\n", - "})" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "gos.horizontal(overview, detail_view).properties(\n", " title='Overview and Detail Views',\n",