|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 1, |
| 5 | + "execution_count": null, |
6 | 6 | "id": "2a014a14-3d7c-4288-8534-df01d7bf2432", |
7 | 7 | "metadata": {}, |
8 | 8 | "outputs": [], |
|
12 | 12 | }, |
13 | 13 | { |
14 | 14 | "cell_type": "code", |
15 | | - "execution_count": 2, |
| 15 | + "execution_count": null, |
16 | 16 | "id": "61233841", |
17 | 17 | "metadata": {}, |
18 | | - "outputs": [ |
19 | | - { |
20 | | - "data": { |
21 | | - "text/plain": [ |
22 | | - "Track({\n", |
23 | | - " color: Color({\n", |
24 | | - " shorthand: 's1:N'\n", |
25 | | - " }),\n", |
26 | | - " 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", |
27 | | - " height: 130,\n", |
28 | | - " mark: 'withinLink',\n", |
29 | | - " opacity: OpacityValue({\n", |
30 | | - " value: 0.2\n", |
31 | | - " }),\n", |
32 | | - " stroke: StrokeValue({\n", |
33 | | - " value: 'black'\n", |
34 | | - " }),\n", |
35 | | - " strokeWidth: StrokeWidthValue({\n", |
36 | | - " value: 0.5\n", |
37 | | - " }),\n", |
38 | | - " width: 600,\n", |
39 | | - " x: X({\n", |
40 | | - " domain: GenomicDomain({\n", |
41 | | - " chromosome: '1',\n", |
42 | | - " interval: [103900000, 104100000]\n", |
43 | | - " }),\n", |
44 | | - " shorthand: 's1:G'\n", |
45 | | - " }),\n", |
46 | | - " x1: X1({\n", |
47 | | - " domain: GenomicDomain({\n", |
48 | | - " chromosome: '1'\n", |
49 | | - " }),\n", |
50 | | - " shorthand: 's2:G'\n", |
51 | | - " }),\n", |
52 | | - " x1e: X1e({\n", |
53 | | - " shorthand: 'e2:G'\n", |
54 | | - " }),\n", |
55 | | - " xe: Xe({\n", |
56 | | - " shorthand: 'e1:G'\n", |
57 | | - " })\n", |
58 | | - "})" |
59 | | - ] |
60 | | - }, |
61 | | - "execution_count": 2, |
62 | | - "metadata": {}, |
63 | | - "output_type": "execute_result" |
64 | | - } |
65 | | - ], |
| 18 | + "outputs": [], |
66 | 19 | "source": [ |
67 | 20 | "csvData = gos.csv(\n", |
68 | 21 | " url=\"https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/circos-segdup-edited.txt\",\n", |
|
87 | 40 | }, |
88 | 41 | { |
89 | 42 | "cell_type": "code", |
90 | | - "execution_count": 3, |
| 43 | + "execution_count": null, |
91 | 44 | "id": "88f3a522", |
92 | | - "metadata": { |
93 | | - "scrolled": true |
94 | | - }, |
95 | | - "outputs": [ |
96 | | - { |
97 | | - "data": { |
98 | | - "text/html": [ |
99 | | - "\n", |
100 | | - "<!DOCTYPE html>\n", |
101 | | - "<html>\n", |
102 | | - "<head>\n", |
103 | | - " <style>.error { color: red; }</style>\n", |
104 | | - " <link rel=\"stylesheet\" href=\"https://unpkg.com/higlass@1.11/dist/hglib.css\">\n", |
105 | | - "</head>\n", |
106 | | - "<body>\n", |
107 | | - " <div id=\"jupyter-gosling-b21fb3e30816413d991b4879dae37703\"></div>\n", |
108 | | - " <script type=\"module\">\n", |
109 | | - "\n", |
110 | | - " async function loadScript(src) {\n", |
111 | | - " return new Promise(resolve => {\n", |
112 | | - " const script = document.createElement('script');\n", |
113 | | - " script.onload = resolve;\n", |
114 | | - " script.src = src;\n", |
115 | | - " script.async = false;\n", |
116 | | - " document.head.appendChild(script);\n", |
117 | | - " });\n", |
118 | | - " }\n", |
119 | | - "\n", |
120 | | - " async function loadGosling() {\n", |
121 | | - " // Manually load scripts from window namespace since requirejs might not be\n", |
122 | | - " // available in all browser environments.\n", |
123 | | - " // https://github.com/DanielHreben/requirejs-toggle\n", |
124 | | - " if (!window.gosling) {\n", |
125 | | - " window.__requirejsToggleBackup = {\n", |
126 | | - " define: window.define,\n", |
127 | | - " require: window.require,\n", |
128 | | - " requirejs: window.requirejs,\n", |
129 | | - " };\n", |
130 | | - " for (const field of Object.keys(window.__requirejsToggleBackup)) {\n", |
131 | | - " window[field] = undefined;\n", |
132 | | - " }\n", |
133 | | - "\n", |
134 | | - " // load dependencies sequentially\n", |
135 | | - " const sources = [\n", |
136 | | - " \"https://unpkg.com/react@17/umd/react.production.min.js\",\n", |
137 | | - " \"https://unpkg.com/react-dom@17/umd/react-dom.production.min.js\",\n", |
138 | | - " \"https://unpkg.com/pixi.js@6/dist/browser/pixi.min.js\",\n", |
139 | | - " \"https://unpkg.com/gosling.js@0.9.4/dist/gosling.js\",\n", |
140 | | - " ];\n", |
141 | | - "\n", |
142 | | - " for (const src of sources) await loadScript(src);\n", |
143 | | - "\n", |
144 | | - " // restore requirejs after scripts have loaded\n", |
145 | | - " Object.assign(window, window.__requirejsToggleBackup);\n", |
146 | | - " delete window.__requirejsToggleBackup;\n", |
147 | | - " }\n", |
148 | | - " return window.gosling;\n", |
149 | | - " };\n", |
150 | | - "\n", |
151 | | - " var el = document.getElementById('jupyter-gosling-b21fb3e30816413d991b4879dae37703');\n", |
152 | | - " var spec = {\"tracks\": [{\"data\": {\"type\": \"csv\", \"url\": \"https://raw.githubusercontent.com/sehilyi/gemini-datasets/master/data/circos-segdup-edited.txt\", \"chromosomeField\": \"c2\", \"genomicFields\": [\"s1\", \"e1\", \"s2\", \"e2\"]}, \"height\": 130, \"mark\": \"withinLink\", \"width\": 600, \"color\": {\"field\": \"s1\", \"type\": \"nominal\"}, \"opacity\": {\"value\": 0.2}, \"stroke\": {\"value\": \"black\"}, \"strokeWidth\": {\"value\": 0.5}, \"x\": {\"domain\": {\"chromosome\": \"1\", \"interval\": [103900000, 104100000]}, \"field\": \"s1\", \"type\": \"genomic\"}, \"x1\": {\"domain\": {\"chromosome\": \"1\"}, \"field\": \"s2\", \"type\": \"genomic\"}, \"x1e\": {\"field\": \"e2\", \"type\": \"genomic\"}, \"xe\": {\"field\": \"e1\", \"type\": \"genomic\"}}], \"title\": \"Basic Marks: Bar\", \"subtitle\": \"Tutorial Examples\"};\n", |
153 | | - " var opt = {\"padding\": 0, \"theme\": null};\n", |
154 | | - "\n", |
155 | | - " loadGosling()\n", |
156 | | - " .then(gosling => gosling.embed(el, spec, opt))\n", |
157 | | - " .catch(err => {\n", |
158 | | - " el.innerHTML = `<div class=\"error\">\n", |
159 | | - " <p>JavaScript Error: ${error.message}</p>\n", |
160 | | - " <p>This usually means there's a typo in your Gosling specification. See the javascript console for the full traceback.</p>\n", |
161 | | - "</div>`;\n", |
162 | | - " throw error;\n", |
163 | | - " });\n", |
164 | | - " </script>\n", |
165 | | - "</body>\n", |
166 | | - "</html>" |
167 | | - ], |
168 | | - "text/plain": [ |
169 | | - "View({\n", |
170 | | - " subtitle: 'Tutorial Examples',\n", |
171 | | - " title: 'Basic Marks: Bar',\n", |
172 | | - " tracks: [Track({\n", |
173 | | - " color: Color({\n", |
174 | | - " field: 's1',\n", |
175 | | - " type: 'nominal'\n", |
176 | | - " }),\n", |
177 | | - " 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", |
178 | | - " height: 130,\n", |
179 | | - " mark: 'withinLink',\n", |
180 | | - " opacity: OpacityValue({\n", |
181 | | - " value: 0.2\n", |
182 | | - " }),\n", |
183 | | - " stroke: StrokeValue({\n", |
184 | | - " value: 'black'\n", |
185 | | - " }),\n", |
186 | | - " strokeWidth: StrokeWidthValue({\n", |
187 | | - " value: 0.5\n", |
188 | | - " }),\n", |
189 | | - " width: 600,\n", |
190 | | - " x: X({\n", |
191 | | - " domain: GenomicDomain({\n", |
192 | | - " chromosome: '1',\n", |
193 | | - " interval: [103900000, 104100000]\n", |
194 | | - " }),\n", |
195 | | - " field: 's1',\n", |
196 | | - " type: 'genomic'\n", |
197 | | - " }),\n", |
198 | | - " x1: X1({\n", |
199 | | - " domain: GenomicDomain({\n", |
200 | | - " chromosome: '1'\n", |
201 | | - " }),\n", |
202 | | - " field: 's2',\n", |
203 | | - " type: 'genomic'\n", |
204 | | - " }),\n", |
205 | | - " x1e: X1e({\n", |
206 | | - " field: 'e2',\n", |
207 | | - " type: 'genomic'\n", |
208 | | - " }),\n", |
209 | | - " xe: Xe({\n", |
210 | | - " field: 'e1',\n", |
211 | | - " type: 'genomic'\n", |
212 | | - " })\n", |
213 | | - " })]\n", |
214 | | - "})" |
215 | | - ] |
216 | | - }, |
217 | | - "execution_count": 3, |
218 | | - "metadata": {}, |
219 | | - "output_type": "execute_result" |
220 | | - } |
221 | | - ], |
| 45 | + "metadata": {}, |
| 46 | + "outputs": [], |
222 | 47 | "source": [ |
223 | 48 | "# just render a view (not a mutable object)\n", |
224 | | - "track.view(title=\"Basic Marks: Bar\", subtitle=\"Tutorial Examples\")" |
| 49 | + "view = track.view(title=\"Basic Marks: Bar\", subtitle=\"Tutorial Examples\", id=\"aa\")\n", |
| 50 | + "w = view.widget()\n", |
| 51 | + "w" |
225 | 52 | ] |
226 | 53 | }, |
227 | 54 | { |
|
230 | 57 | "id": "7a82cfcc", |
231 | 58 | "metadata": {}, |
232 | 59 | "outputs": [], |
| 60 | + "source": [ |
| 61 | + "view.id" |
| 62 | + ] |
| 63 | + }, |
| 64 | + { |
| 65 | + "cell_type": "code", |
| 66 | + "execution_count": null, |
| 67 | + "id": "05d7ecf9-d336-4daa-8d49-447d062f7236", |
| 68 | + "metadata": {}, |
| 69 | + "outputs": [], |
233 | 70 | "source": [] |
234 | 71 | } |
235 | 72 | ], |
|
249 | 86 | "name": "python", |
250 | 87 | "nbconvert_exporter": "python", |
251 | 88 | "pygments_lexer": "ipython3", |
252 | | - "version": "3.9.7" |
| 89 | + "version": "3.12.7" |
253 | 90 | } |
254 | 91 | }, |
255 | 92 | "nbformat": 4, |
|
0 commit comments