|
95 | 95 | " table_path=\"tables/table_tubules\",\n", |
96 | 96 | " labels_path=\"labels/labels_tubules\",\n", |
97 | 97 | " obs_feature_matrix_path=\"tables/table_tubules/X\",\n", |
98 | | - " #obs_feature_matrix_path=\"tables/table/X\",\n", |
99 | | - " #obs_set_paths=[\"tables/table/obs/annotation\"],\n", |
100 | | - " #obs_set_names=[\"Annotation\"],\n", |
101 | | - " #region=\"tubules\",\n", |
102 | 98 | " coordinate_system=\"global\",\n", |
103 | 99 | " coordination_values={\n", |
104 | 100 | " \"fileUid\": \"labels_tubules\",\n", |
|
111 | 107 | " SpatialDataWrapper(\n", |
112 | 108 | " sdata_url=sdata_url,\n", |
113 | 109 | " labels_path=\"labels/labels_arteries_arterioles\",\n", |
114 | | - " #obs_feature_matrix_path=\"tables/table/X\",\n", |
115 | | - " #obs_set_paths=[\"tables/table/obs/annotation\"],\n", |
116 | | - " #obs_set_names=[\"Annotation\"],\n", |
117 | | - " #region=\"tubules\",\n", |
118 | 110 | " coordinate_system=\"global\",\n", |
119 | 111 | " coordination_values={\n", |
120 | 112 | " \"fileUid\": \"labels_arteries_arterioles\",\n", |
|
129 | 121 | " table_path=\"tables/table_cortical_interstitia\",\n", |
130 | 122 | " labels_path=\"labels/labels_cortical_interstitia\",\n", |
131 | 123 | " obs_feature_matrix_path=\"tables/table_cortical_interstitia/X\",\n", |
132 | | - " \n", |
133 | | - " #obs_feature_matrix_path=\"tables/table/X\",\n", |
134 | | - " #obs_set_paths=[\"tables/table/obs/annotation\"],\n", |
135 | | - " #obs_set_names=[\"Annotation\"],\n", |
136 | | - " #region=\"tubules\",\n", |
137 | 124 | " coordinate_system=\"global\",\n", |
138 | 125 | " coordination_values={\n", |
139 | 126 | " \"fileUid\": \"labels_cortical_interstitia\",\n", |
|
148 | 135 | " table_path=\"tables/table_globally_sclerotic_glomeruli\",\n", |
149 | 136 | " labels_path=\"labels/labels_globally_sclerotic_glomeruli\",\n", |
150 | 137 | " obs_feature_matrix_path=\"tables/table_globally_sclerotic_glomeruli/X\",\n", |
151 | | - " #obs_feature_matrix_path=\"tables/table/X\",\n", |
152 | | - " #obs_set_paths=[\"tables/table/obs/annotation\"],\n", |
153 | | - " #obs_set_names=[\"Annotation\"],\n", |
154 | | - " #region=\"tubules\",\n", |
155 | 138 | " coordinate_system=\"global\",\n", |
156 | 139 | " coordination_values={\n", |
157 | 140 | " \"fileUid\": \"labels_globally_sclerotic_glomeruli\",\n", |
|
166 | 149 | " table_path=\"tables/table_non_globally_sclerotic_glomeruli\",\n", |
167 | 150 | " labels_path=\"labels/labels_non_globally_sclerotic_glomeruli\",\n", |
168 | 151 | " obs_feature_matrix_path=\"tables/table_non_globally_sclerotic_glomeruli/X\",\n", |
169 | | - " #obs_feature_matrix_path=\"tables/table/X\",\n", |
170 | | - " #obs_set_paths=[\"tables/table/obs/annotation\"],\n", |
171 | | - " #obs_set_names=[\"Annotation\"],\n", |
172 | | - " #region=\"tubules\",\n", |
173 | 152 | " coordinate_system=\"global\",\n", |
174 | 153 | " coordination_values={\n", |
175 | 154 | " \"fileUid\": \"labels_non_globally_sclerotic_glomeruli\",\n", |
|
183 | 162 | " sdata_url=sdata_url,\n", |
184 | 163 | " table_path=\"tables/table_interstitialfibrosis_and_tubular_atrophy\",\n", |
185 | 164 | " labels_path=\"labels/labels_interstitialfibrosis_and_tubular_atrophy\",\n", |
186 | | - " #obs_feature_matrix_path=\"tables/table/X\",\n", |
187 | | - " #obs_set_paths=[\"tables/table/obs/annotation\"],\n", |
188 | | - " #obs_set_names=[\"Annotation\"],\n", |
189 | | - " #region=\"tubules\",\n", |
190 | 165 | " coordinate_system=\"global\",\n", |
191 | 166 | " coordination_values={\n", |
192 | 167 | " \"fileUid\": \"labels_interstitialfibrosis_and_tubular_atrophy\",\n", |
|
201 | 176 | " table_path=\"tables/table_peritubular_capillaries\",\n", |
202 | 177 | " labels_path=\"labels/labels_peritubular_capillaries\",\n", |
203 | 178 | " obs_feature_matrix_path=\"tables/table_peritubular_capillaries/X\",\n", |
204 | | - " #obs_feature_matrix_path=\"tables/table/X\",\n", |
205 | | - " #obs_set_paths=[\"tables/table/obs/annotation\"],\n", |
206 | | - " #obs_set_names=[\"Annotation\"],\n", |
207 | | - " #region=\"tubules\",\n", |
| 179 | + " obs_set_paths=[\n", |
| 180 | + " \"tables/table_peritubular_capillaries/obs/cortex_ifta_set\",\n", |
| 181 | + " \"tables/table_peritubular_capillaries/obs/cortex_set\",\n", |
| 182 | + " \"tables/table_peritubular_capillaries/obs/ifta_set\",\n", |
| 183 | + " [\"tables/table_peritubular_capillaries/obs/cortex_set\", \"tables/table_peritubular_capillaries/obs/ifta_set\"],\n", |
| 184 | + " ],\n", |
| 185 | + " obs_set_names=[\n", |
| 186 | + " \"Cortex and IFTA membership\",\n", |
| 187 | + " \"Cortex membership\",\n", |
| 188 | + " \"IFTA membership\",\n", |
| 189 | + " \"Cortex and IFTA hierarchy\",\n", |
| 190 | + " ],\n", |
208 | 191 | " coordinate_system=\"global\",\n", |
209 | 192 | " coordination_values={\n", |
210 | 193 | " \"fileUid\": \"labels_peritubular_capillaries\",\n", |
|
231 | 214 | "ngsg_feature_list = vc.add_view(\"featureList\", dataset=dataset).set_props(title=\"Non-Globally Sclerotic Glomeruli\")\n", |
232 | 215 | "ngsg_histogram = vc.add_view(\"featureValueHistogram\", dataset=dataset)\n", |
233 | 216 | "\n", |
| 217 | + "# Add obsSets, obsSetSizes, and violin plot views for PTC sets+areas/aspectRatio\n", |
| 218 | + "pt_sets = vc.add_view(\"obsSets\", dataset=dataset)\n", |
| 219 | + "pt_bar_plot = vc.add_view(\"obsSetSizes\", dataset=dataset)\n", |
| 220 | + "pt_violin_plot = vc.add_view(\"obsSetFeatureValueDistribution\", dataset=dataset).set_props(jitter=True)\n", |
| 221 | + "\n", |
| 222 | + "\n", |
234 | 223 | "# Coordination of views.\n", |
235 | 224 | "[ft_scope, fvt_scope] = vc.add_coordination(\"featureType\", \"featureValueType\")\n", |
236 | 225 | "ft_scope.set_value(\"feature\")\n", |
|
242 | 231 | "\n", |
243 | 232 | "[pt_ot_scope, pt_fs_scope, pt_oce_scope] = vc.add_coordination(\"obsType\", \"featureSelection\", \"obsColorEncoding\")\n", |
244 | 233 | "pt_ot_scope.set_value(ptc_obstype)\n", |
245 | | - "pt_oce_scope.set_value(\"spatialChannelColor\")\n", |
| 234 | + "pt_fs_scope.set_value([\"Area\"])\n", |
| 235 | + "pt_oce_scope.set_value(\"cellSetSelection\")\n", |
246 | 236 | "\n", |
247 | 237 | "\n", |
248 | 238 | "[gsg_ot_scope, gsg_fs_scope, gsg_oce_scope, gsg_fvcr_scope] = vc.add_coordination(\"obsType\", \"featureSelection\", \"obsColorEncoding\", \"featureValueColormapRange\")\n", |
|
257 | 247 | "\n", |
258 | 248 | "vc.link_views_by_dict([spatial, layer_controller], {\n", |
259 | 249 | " \"imageLayer\": CL([{\n", |
| 250 | + " \"spatialLayerOpacity\": 0.1,\n", |
260 | 251 | " \"photometricInterpretation\": \"RGB\",\n", |
261 | 252 | " }]),\n", |
262 | 253 | "}, meta=True, scope_prefix=get_initial_coordination_scope_prefix(\"A\", \"image\"))\n", |
|
271 | 262 | " \"featureType\": ft_scope,\n", |
272 | 263 | " \"featureValueType\": fvt_scope,\n", |
273 | 264 | " \"featureSelection\": t_fs_scope,\n", |
274 | | - " \"spatialChannelVisible\": True,\n", |
275 | | - " \"spatialChannelColor\": [255, 255, 255],\n", |
| 265 | + " \"spatialChannelVisible\": False,\n", |
| 266 | + " \"spatialChannelColor\": [73, 155, 119],\n", |
276 | 267 | " \"spatialChannelOpacity\": 0.5,\n", |
277 | 268 | " \"obsColorEncoding\": t_oce_scope,\n", |
278 | 269 | " \"featureValueColormapRange\": [0, 1],\n", |
279 | 270 | " \"featureAggregationStrategy\": \"first\",\n", |
| 271 | + " \"spatialSegmentationFilled\": True,\n", |
280 | 272 | " \"obsHighlight\": None,\n", |
281 | 273 | " }]),\n", |
282 | 274 | " },\n", |
|
287 | 279 | " \"obsType\": \"Artery\",\n", |
288 | 280 | " \"featureType\": ft_scope,\n", |
289 | 281 | " \"featureValueType\": fvt_scope,\n", |
290 | | - " \"spatialChannelVisible\": True,\n", |
291 | | - " \"spatialChannelColor\": [255, 255, 255],\n", |
| 282 | + " \"spatialChannelVisible\": False,\n", |
| 283 | + " \"spatialChannelColor\": [237, 226, 107],\n", |
292 | 284 | " \"spatialChannelOpacity\": 0.5,\n", |
293 | 285 | " \"obsColorEncoding\": \"spatialChannelColor\",\n", |
294 | 286 | " \"featureValueColormapRange\": [0, 1],\n", |
295 | 287 | " \"featureAggregationStrategy\": \"first\",\n", |
| 288 | + " \"spatialSegmentationFilled\": True,\n", |
296 | 289 | " \"obsHighlight\": None,\n", |
297 | 290 | " }]),\n", |
298 | 291 | " },\n", |
|
309 | 302 | " \"obsColorEncoding\": \"spatialChannelColor\",\n", |
310 | 303 | " \"featureValueColormapRange\": [0, 1],\n", |
311 | 304 | " \"featureAggregationStrategy\": \"first\",\n", |
| 305 | + " \"spatialSegmentationFilled\": True,\n", |
312 | 306 | " \"obsHighlight\": None,\n", |
313 | 307 | " }]),\n", |
314 | 308 | " },\n", |
|
321 | 315 | " \"featureValueType\": fvt_scope,\n", |
322 | 316 | " \"featureSelection\": gsg_fs_scope,\n", |
323 | 317 | " \"spatialChannelVisible\": False,\n", |
324 | | - " \"spatialChannelColor\": [255, 255, 255],\n", |
| 318 | + " \"spatialChannelColor\": [52, 113, 171],\n", |
325 | 319 | " \"spatialChannelOpacity\": 0.5,\n", |
326 | 320 | " \"obsColorEncoding\": gsg_oce_scope,\n", |
327 | 321 | " \"featureValueColormapRange\": gsg_fvcr_scope,\n", |
328 | 322 | " \"featureAggregationStrategy\": \"first\",\n", |
| 323 | + " \"spatialSegmentationFilled\": True,\n", |
329 | 324 | " \"obsHighlight\": None,\n", |
330 | 325 | " }]),\n", |
331 | 326 | " },\n", |
|
338 | 333 | " \"featureValueType\": fvt_scope,\n", |
339 | 334 | " \"featureSelection\": ngsg_fs_scope,\n", |
340 | 335 | " \"spatialChannelVisible\": False,\n", |
341 | | - " \"spatialChannelColor\": [255, 255, 255],\n", |
| 336 | + " \"spatialChannelColor\": [114, 179, 226],\n", |
342 | 337 | " \"spatialChannelOpacity\": 0.5,\n", |
343 | 338 | " \"obsColorEncoding\": ngsg_oce_scope,\n", |
344 | 339 | " \"featureValueColormapRange\": ngsg_fvcr_scope,\n", |
345 | 340 | " \"featureAggregationStrategy\": \"first\",\n", |
| 341 | + " \"spatialSegmentationFilled\": True,\n", |
346 | 342 | " \"obsHighlight\": None,\n", |
347 | 343 | " }]),\n", |
348 | 344 | " },\n", |
|
353 | 349 | " \"obsType\": \"Interstitial Fibrosis and Tubular Atrophy\",\n", |
354 | 350 | " \"featureType\": ft_scope,\n", |
355 | 351 | " \"featureValueType\": fvt_scope,\n", |
356 | | - " \"spatialChannelVisible\": False,\n", |
357 | | - " \"spatialChannelColor\": [255, 255, 255],\n", |
358 | | - " \"spatialChannelOpacity\": 0.5,\n", |
| 352 | + " \"spatialChannelVisible\": True,\n", |
| 353 | + " \"spatialChannelColor\": [218, 161, 66],\n", |
| 354 | + " \"spatialChannelOpacity\": 1.0,\n", |
359 | 355 | " \"obsColorEncoding\": \"spatialChannelColor\",\n", |
360 | 356 | " \"featureValueColormapRange\": [0, 1],\n", |
361 | 357 | " \"featureAggregationStrategy\": \"first\",\n", |
| 358 | + " \"spatialSegmentationFilled\": False,\n", |
362 | 359 | " \"obsHighlight\": None,\n", |
363 | 360 | " }]),\n", |
364 | 361 | " },\n", |
|
370 | 367 | " \"featureType\": ft_scope,\n", |
371 | 368 | " \"featureValueType\": fvt_scope,\n", |
372 | 369 | " \"featureSelection\": pt_fs_scope,\n", |
373 | | - " \"spatialChannelVisible\": False,\n", |
374 | | - " \"spatialChannelColor\": [255, 255, 255],\n", |
375 | | - " \"spatialChannelOpacity\": 0.5,\n", |
| 370 | + " \"spatialChannelVisible\": True,\n", |
| 371 | + " \"spatialChannelColor\": [197, 101, 47],\n", |
| 372 | + " \"spatialChannelOpacity\": 1.0,\n", |
376 | 373 | " \"obsColorEncoding\": pt_oce_scope,\n", |
377 | | - " \"featureValueColormapRange\": [0, 1],\n", |
| 374 | + " \"featureValueColormapRange\": [0, 0.5],\n", |
378 | 375 | " \"featureAggregationStrategy\": \"first\",\n", |
| 376 | + " \"spatialSegmentationFilled\": True,\n", |
379 | 377 | " \"obsHighlight\": None,\n", |
380 | 378 | " }]),\n", |
381 | 379 | " }\n", |
|
388 | 386 | "pt_feature_list.use_coordination(pt_ot_scope, ft_scope, fvt_scope, pt_fs_scope, pt_oce_scope)\n", |
389 | 387 | "pt_histogram.use_coordination(pt_ot_scope, ft_scope, fvt_scope, pt_fs_scope, pt_oce_scope)\n", |
390 | 388 | "\n", |
| 389 | + "pt_sets.use_coordination(pt_ot_scope, ft_scope, fvt_scope, pt_fs_scope, pt_oce_scope)\n", |
| 390 | + "pt_bar_plot.use_coordination(pt_ot_scope, ft_scope, fvt_scope, pt_fs_scope, pt_oce_scope)\n", |
| 391 | + "pt_violin_plot.use_coordination(pt_ot_scope, ft_scope, fvt_scope, pt_fs_scope, pt_oce_scope)\n", |
| 392 | + "\n", |
| 393 | + "\n", |
391 | 394 | "gsg_feature_list.use_coordination(gsg_ot_scope, ft_scope, fvt_scope, gsg_fs_scope, gsg_oce_scope, gsg_fvcr_scope)\n", |
392 | 395 | "gsg_histogram.use_coordination(gsg_ot_scope, ft_scope, fvt_scope, gsg_fs_scope, gsg_oce_scope, gsg_fvcr_scope)\n", |
393 | 396 | "\n", |
|
396 | 399 | "\n", |
397 | 400 | "\n", |
398 | 401 | "# Layout the views in a grid arrangement.\n", |
399 | | - "vc.layout(vconcat(hconcat(spatial, layer_controller, split=[3, 1]), hconcat(\n", |
400 | | - " (tubules_feature_list / tubules_histogram),\n", |
401 | | - " (pt_feature_list / pt_histogram),\n", |
402 | | - " (gsg_feature_list / gsg_histogram),\n", |
403 | | - " (ngsg_feature_list / ngsg_histogram)\n", |
404 | | - ")));" |
| 402 | + "vc.layout(vconcat(\n", |
| 403 | + " hconcat(spatial, layer_controller, split=[3, 1]),\n", |
| 404 | + " hconcat(\n", |
| 405 | + " (tubules_feature_list / tubules_histogram),\n", |
| 406 | + " (pt_feature_list / pt_histogram),\n", |
| 407 | + " (gsg_feature_list / gsg_histogram),\n", |
| 408 | + " (ngsg_feature_list / ngsg_histogram)\n", |
| 409 | + " ),\n", |
| 410 | + " hconcat(pt_sets, pt_bar_plot, pt_violin_plot)\n", |
| 411 | + "));" |
405 | 412 | ] |
406 | 413 | }, |
407 | 414 | { |
408 | 415 | "cell_type": "code", |
409 | 416 | "execution_count": null, |
410 | | - "metadata": { |
411 | | - "tags": [] |
412 | | - }, |
| 417 | + "metadata": {}, |
413 | 418 | "outputs": [], |
414 | 419 | "source": [ |
415 | 420 | "vw = vc.widget(height=1000)\n", |
416 | 421 | "vw" |
417 | 422 | ] |
418 | 423 | }, |
| 424 | + { |
| 425 | + "cell_type": "code", |
| 426 | + "execution_count": null, |
| 427 | + "metadata": {}, |
| 428 | + "outputs": [], |
| 429 | + "source": [ |
| 430 | + "#import json\n", |
| 431 | + "#print(json.dumps(vc.to_dict(), indent=2))" |
| 432 | + ] |
| 433 | + }, |
| 434 | + { |
| 435 | + "cell_type": "code", |
| 436 | + "execution_count": null, |
| 437 | + "metadata": {}, |
| 438 | + "outputs": [], |
| 439 | + "source": [] |
| 440 | + }, |
419 | 441 | { |
420 | 442 | "cell_type": "code", |
421 | 443 | "execution_count": null, |
|
0 commit comments