Skip to content

Commit c188e60

Browse files
committed
Link_views
1 parent 809016f commit c188e60

3 files changed

Lines changed: 39 additions & 22 deletions

File tree

notebooks/01-Single-Spatial-View.ipynb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,15 @@
313313
"| `spatialTargetY` | Y-coordinate of the viewport center | `500.0` |\n",
314314
"| `featureSelection` | List of selected genes or other features | `[\"EPCAM\"]` |\n",
315315
"\n",
316-
"Use `config.link_views()` to pin initial values for one or more coordination types across a list of views:\n",
316+
"Use `config.link_views_by_dict()` to set initial values for one or more coordination types across a list of views:\n",
317317
"\n",
318318
"```python\n",
319-
"config.link_views(\n",
320-
" views=[my_view],\n",
321-
" c_types=[\"spatialZoom\", \"spatialTargetX\", \"spatialTargetY\"],\n",
322-
" c_values=[2, 500.0, 500.0]\n",
319+
"config.link_views_by_dict([my_view],\n",
320+
" {\n",
321+
" \"spatialZoom\": 2,\n",
322+
" \"spatialTargetX\": 500.0,\n",
323+
" \"spatialTargetY\": 500.0\n",
324+
" }\n",
323325
")\n",
324326
"```"
325327
]
@@ -343,10 +345,12 @@
343345
"spatial_view2 = config2.add_view(\"spatialBeta\", dataset=dataset2)\n",
344346
"\n",
345347
"# Set the initial zoom level and pan position\n",
346-
"config2.link_views(\n",
347-
" views=[spatial_view2],\n",
348-
" c_types=[\"spatialZoom\", \"spatialTargetX\", \"spatialTargetY\"],\n",
349-
" c_values=[-2, 300.0, 300.0]\n",
348+
"config2.link_views_by_dict([spatial_view2],\n",
349+
" {\n",
350+
" \"spatialZoom\": -2,\n",
351+
" \"spatialTargetX\": 300.0,\n",
352+
" \"spatialTargetY\": 300.0,\n",
353+
" }\n",
350354
")\n",
351355
"\n",
352356
"config2.layout(spatial_view2)\n",
@@ -555,7 +559,7 @@
555559
"spatial = vc.add_view(\"spatialBeta\", dataset=dataset)\n",
556560
"\n",
557561
"# Link all views to share the same obsType coordination value\n",
558-
"vc.link_views([spatial], [\"obsType\"], [\"spot\"])\n",
562+
"vc.link_views_by_dict([spatial], { \"obsType\": \"spot\" })\n",
559563
"\n",
560564
"vc.layout(spatial)\n",
561565
"vc.widget()"

notebooks/02-Multiple-Views.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
"heatmap2 = vc2.add_view(vt.HEATMAP, dataset=dataset2)\n",
293293
"\n",
294294
"# Link obsType so all views refer to \"spot\"\n",
295-
"vc2.link_views([spatial, lc, obs_sets2, genes2, heatmap2], [\"obsType\"], [wrapper.obs_type_label])\n",
295+
"vc2.link_views_by_dict([spatial, lc, obs_sets2, genes2, heatmap2], { \"obsType\": wrapper.obs_type_label })\n",
296296
"\n",
297297
"vc2.layout(spatial | (vconcat(lc, obs_sets2, genes2) / heatmap2))\n",
298298
"vc2.widget()"

notebooks/04-Coordinated-Multiple-Views.ipynb

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@
5555
"id": "a826e108",
5656
"metadata": {},
5757
"source": [
58-
"## 2. Setting initial coordination values with `link_views()`\n",
58+
"## 2. Setting initial coordination values with `link_views_by_dict()`\n",
5959
"\n",
60-
"The `link_views()` method sets the **initial value** of one or more coordination types for a group of views. All listed views will share the same coordination scope for the listed types.\n",
60+
"The `link_views_by_dict()` method sets the **initial value** of one or more coordination types for a group of views. All listed views will share the same coordination scope for the listed types.\n",
6161
"\n",
6262
"```python\n",
63-
"config.link_views(\n",
64-
" views=[view1, view2],\n",
65-
" coordination_types=[\"featureSelection\", \"obsColorEncoding\"],\n",
66-
" coordination_values=[[\"CD79A\"], \"geneSelection\"]\n",
63+
"config.link_views_by_dict(\n",
64+
" [view1, view2],\n",
65+
" { \"featureSelection\": [\"CD79A\"], \"obsColorEncoding\": \"geneSelection\" },\n",
6766
")\n",
6867
"```\n",
6968
"\n",
@@ -201,7 +200,7 @@
201200
"# Give each scatterplot its own independent featureSelection scope\n",
202201
"[scope_a, scope_b] = vc2.add_coordination(\"featureSelection\", \"featureSelection\")\n",
203202
"scope_a.set_value([\"CD79A\"])\n",
204-
"scope_b.set_value([\"LYV\"])\n",
203+
"scope_b.set_value([\"LYZ\"])\n",
205204
"\n",
206205
"umap_a.use_coordination(scope_a)\n",
207206
"umap_b.use_coordination(scope_b)\n",
@@ -251,11 +250,25 @@
251250
")\n",
252251
"\n",
253252
"# ...\n",
254-
"```\n",
255-
"\n",
256-
"You already saw this in Session 1 for the multiplexed image. For most beginner use cases `link_views()` is sufficient; `link_views_by_dict()` becomes useful when configuring image channels or other deeply nested state."
253+
"```\n"
257254
]
258255
},
256+
{
257+
"cell_type": "code",
258+
"execution_count": null,
259+
"id": "bc4b9209",
260+
"metadata": {},
261+
"outputs": [],
262+
"source": []
263+
},
264+
{
265+
"cell_type": "code",
266+
"execution_count": null,
267+
"id": "721c5049",
268+
"metadata": {},
269+
"outputs": [],
270+
"source": []
271+
},
259272
{
260273
"cell_type": "markdown",
261274
"id": "d0ab4d80",
@@ -463,7 +476,7 @@
463476
"\n",
464477
"# We use .add_coordination to obtain a reference to a \"featureSelection\" scope as a Python variable.\n",
465478
"[gene_selection_scope] = vc2.add_coordination(\"featureSelection\")\n",
466-
"gene_selection_scope.set_value([\"Epcam\"])\n",
479+
"gene_selection_scope.set_value([\"Sdhb\"])\n",
467480
"\n",
468481
"vc2.link_views_by_dict([spatial, layer_controller, feature_list], {\n",
469482
" \"obsType\": wrapper.obs_type_label,\n",

0 commit comments

Comments
 (0)