Skip to content

Commit 560c63d

Browse files
authored
Update coordination in spatialdata configuration (#418)
1 parent 8dafa7d commit 560c63d

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

docs/notebooks/spatial_data_mouseliver.ipynb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@
269269
"obs_sets = vc.add_view(\"obsSets\", dataset=dataset)\n",
270270
"heatmap = vc.add_view(\"heatmap\", dataset=dataset)\n",
271271
"\n",
272+
"[obs_color_encoding_scope] = vc.add_coordination(\"obsColorEncoding\")\n",
273+
"obs_color_encoding_scope.set_value(\"cellSetSelection\")\n",
274+
"\n",
272275
"vc.link_views_by_dict([spatial, layer_controller], {\n",
273276
" \"imageLayer\": CL([{\n",
274277
" \"photometricInterpretation\": \"BlackIsZero\",\n",
@@ -283,12 +286,15 @@
283286
"vc.link_views_by_dict([spatial, layer_controller], {\n",
284287
" \"segmentationLayer\": CL([{\n",
285288
" \"segmentationChannel\": CL([{\n",
286-
" \"obsColorEncoding\": \"cellSetSelection\",\n",
289+
" \"obsColorEncoding\": obs_color_encoding_scope,\n",
287290
" }]),\n",
288291
" }]),\n",
289292
"}, scope_prefix=get_initial_coordination_scope_prefix(\"A\", \"obsSegmentations\"))\n",
290293
"\n",
291294
"vc.link_views([spatial, layer_controller, feature_list, obs_sets, heatmap], [\"obsType\"], [wrapper.obs_type_label])\n",
295+
"vc.link_views_by_dict([feature_list, obs_sets, heatmap], {\n",
296+
" \"obsColorEncoding\": obs_color_encoding_scope,\n",
297+
"}, meta=False)\n",
292298
"\n",
293299
"# Layout the views in a grid arrangement.\n",
294300
"vc.layout((spatial / heatmap) | (layer_controller / (feature_list | obs_sets)));"

docs/notebooks/spatial_data_mouseliver_remote.ipynb

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@
152152
"metadata": {},
153153
"outputs": [],
154154
"source": [
155-
"zip_filepath = join(base_url, \"mouse_liver.spatialdata.zarr.zip\")\n",
156-
"spatialdata_filepath = join(base_url, \"mouse_liver.spatialdata.zarr\")\n",
157-
"adata_zarr_filepath = join(base_url, \"mouse_liver.anndata.zarr\")\n",
158-
"adata_h5ad_filepath = join(base_url, \"mouse_liver.h5ad\")\n",
159-
"ref_spec_json_filepath = join(base_url, \"mouse_liver.h5ad.ref.json\")\n",
160-
"ome_tiff_filepath = join(base_url, \"mouse_liver.ome.tif\")\n",
161-
"offsets_json_filepath = join(base_url, \"mouse_liver.ome.tif.offsets.json\")\n",
162-
"ome_zarr_filepath = join(base_url, \"mouse_liver.ome.zarr\")\n",
163-
"labels_ome_zarr_filepath = join(base_url, \"mouse_liver.labels.ome.zarr\")"
155+
"zip_filepath = f\"{base_url}/mouse_liver.spatialdata.zarr.zip\"\n",
156+
"spatialdata_filepath = f\"{base_url}/mouse_liver.spatialdata.zarr\"\n",
157+
"adata_zarr_filepath = f\"{base_url}/mouse_liver.anndata.zarr\"\n",
158+
"adata_h5ad_filepath = f\"{base_url}/mouse_liver.h5ad\"\n",
159+
"ref_spec_json_filepath = f\"{base_url}/mouse_liver.h5ad.ref.json\"\n",
160+
"ome_tiff_filepath = f\"{base_url}/mouse_liver.ome.tif\"\n",
161+
"offsets_json_filepath = f\"{base_url}/mouse_liver.ome.tif.offsets.json\"\n",
162+
"ome_zarr_filepath = f\"{base_url}/mouse_liver.ome.zarr\"\n",
163+
"labels_ome_zarr_filepath = f\"{base_url}/mouse_liver.labels.ome.zarr\""
164164
]
165165
},
166166
{
@@ -232,6 +232,9 @@
232232
"obs_sets = vc.add_view(\"obsSets\", dataset=dataset)\n",
233233
"heatmap = vc.add_view(\"heatmap\", dataset=dataset)\n",
234234
"\n",
235+
"[obs_color_encoding_scope] = vc.add_coordination(\"obsColorEncoding\")\n",
236+
"obs_color_encoding_scope.set_value(\"cellSetSelection\")\n",
237+
"\n",
235238
"vc.link_views_by_dict([spatial, layer_controller], {\n",
236239
" \"imageLayer\": CL([{\n",
237240
" \"photometricInterpretation\": \"BlackIsZero\",\n",
@@ -246,12 +249,15 @@
246249
"vc.link_views_by_dict([spatial, layer_controller], {\n",
247250
" \"segmentationLayer\": CL([{\n",
248251
" \"segmentationChannel\": CL([{\n",
249-
" \"obsColorEncoding\": \"cellSetSelection\",\n",
252+
" \"obsColorEncoding\": obs_color_encoding_scope,\n",
250253
" }]),\n",
251254
" }]),\n",
252255
"}, scope_prefix=get_initial_coordination_scope_prefix(\"A\", \"obsSegmentations\"))\n",
253256
"\n",
254257
"vc.link_views([spatial, layer_controller, feature_list, obs_sets, heatmap], [\"obsType\"], [wrapper.obs_type_label])\n",
258+
"vc.link_views_by_dict([feature_list, obs_sets, heatmap], {\n",
259+
" \"obsColorEncoding\": obs_color_encoding_scope,\n",
260+
"}, meta=False)\n",
255261
"\n",
256262
"# Layout the views in a grid arrangement.\n",
257263
"vc.layout((spatial / heatmap) | (layer_controller / (feature_list | obs_sets)));"

0 commit comments

Comments
 (0)