vitessce 3.6.2__py3-none-any.whl → 3.6.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vitessce/config.py +1 -1
- vitessce/data_utils/ome.py +6 -2
- vitessce/file_def_utils.py +11 -0
- vitessce/widget.py +33 -8
- vitessce/wrappers.py +7 -2
- {vitessce-3.6.2.dist-info → vitessce-3.6.4.dist-info}/METADATA +1 -1
- {vitessce-3.6.2.dist-info → vitessce-3.6.4.dist-info}/RECORD +9 -9
- {vitessce-3.6.2.dist-info → vitessce-3.6.4.dist-info}/WHEEL +0 -0
- {vitessce-3.6.2.dist-info → vitessce-3.6.4.dist-info}/licenses/LICENSE +0 -0
vitessce/config.py
CHANGED
|
@@ -602,7 +602,7 @@ class VitessceConfigView:
|
|
|
602
602
|
})
|
|
603
603
|
spatial_view.use_coordination_by_dict(scopes)
|
|
604
604
|
"""
|
|
605
|
-
if "coordinationScopes" not in self.view
|
|
605
|
+
if "coordinationScopes" not in self.view or self.view["coordinationScopes"] is None:
|
|
606
606
|
self.view["coordinationScopes"] = {}
|
|
607
607
|
|
|
608
608
|
if "coordinationScopesBy" not in self.view or self.view["coordinationScopesBy"] is None:
|
vitessce/data_utils/ome.py
CHANGED
|
@@ -99,7 +99,9 @@ def rgb_img_to_ome_zarr(img_arr, output_path, img_name="Image", chunks=(1, 256,
|
|
|
99
99
|
z_root.attrs["omero"] = {
|
|
100
100
|
"name": img_name,
|
|
101
101
|
"version": "0.3",
|
|
102
|
-
"rdefs": {
|
|
102
|
+
"rdefs": {
|
|
103
|
+
"model": "color",
|
|
104
|
+
},
|
|
103
105
|
"channels": [
|
|
104
106
|
{
|
|
105
107
|
"label": "R",
|
|
@@ -156,7 +158,9 @@ def multiplex_img_to_ome_zarr(img_arr, channel_names, output_path, img_name="Ima
|
|
|
156
158
|
z_root.attrs["omero"] = {
|
|
157
159
|
"name": img_name,
|
|
158
160
|
"version": "0.3",
|
|
159
|
-
"rdefs": {
|
|
161
|
+
"rdefs": {
|
|
162
|
+
"model": "greyscale",
|
|
163
|
+
},
|
|
160
164
|
"channels": [
|
|
161
165
|
{
|
|
162
166
|
"label": channel_name,
|
vitessce/file_def_utils.py
CHANGED
|
@@ -101,6 +101,17 @@ def gen_obs_labels_schema(options: dict, paths: Optional[list[str]] = None, name
|
|
|
101
101
|
return options
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
def gen_obs_feature_columns_schema(options: dict, obs_feature_column_paths: Optional[list[str]] = None):
|
|
105
|
+
if obs_feature_column_paths is not None:
|
|
106
|
+
options["obsFeatureColumns"] = [
|
|
107
|
+
{
|
|
108
|
+
"path": col_path
|
|
109
|
+
}
|
|
110
|
+
for col_path in obs_feature_column_paths
|
|
111
|
+
]
|
|
112
|
+
return options
|
|
113
|
+
|
|
114
|
+
|
|
104
115
|
def gen_path_schema(key: str, path: Optional[str], options: dict):
|
|
105
116
|
if path is not None:
|
|
106
117
|
options[key] = {
|
vitessce/widget.py
CHANGED
|
@@ -163,7 +163,7 @@ const { createRoot } = await importWithMap("react-dom/client", importMap);
|
|
|
163
163
|
const e = React.createElement;
|
|
164
164
|
|
|
165
165
|
function isAbsoluteUrl(s) {
|
|
166
|
-
return s
|
|
166
|
+
return s?.startsWith('http://') || s?.startsWith('https://');
|
|
167
167
|
}
|
|
168
168
|
const WORKSPACES_URL_KEYWORD = 'https://workspaces-pt';
|
|
169
169
|
const OPTIONS_URL_KEYS = ['offsetsUrl', 'refSpecUrl'];
|
|
@@ -201,7 +201,7 @@ function prependBaseUrl(config, proxy, hasHostName) {
|
|
|
201
201
|
...d,
|
|
202
202
|
files: d.files.map(f => {
|
|
203
203
|
const updatedFileDef = { ...f };
|
|
204
|
-
if (!isAbsoluteUrl(f.url)) {
|
|
204
|
+
if (f.url && !isAbsoluteUrl(f.url) ) {
|
|
205
205
|
// Update the main file URL if necessary.
|
|
206
206
|
updatedFileDef.url = `${origin}${baseUrl}${f.url}`;
|
|
207
207
|
}
|
|
@@ -214,6 +214,28 @@ function prependBaseUrl(config, proxy, hasHostName) {
|
|
|
214
214
|
updatedOptions[key] = `${origin}${baseUrl}${optionValue}`;
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
|
+
|
|
218
|
+
// Update image URLs if they exist
|
|
219
|
+
if ('images' in f.options && Array.isArray(f.options.images)) {
|
|
220
|
+
const updatedImages = f.options.images.map(image => {
|
|
221
|
+
const updatedImage = { ...image };
|
|
222
|
+
|
|
223
|
+
if (image.url && !isAbsoluteUrl(image.url)) {
|
|
224
|
+
updatedImage.url = `${origin}${baseUrl}${image.url}`;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const metadata = { ...image.metadata };
|
|
228
|
+
if (metadata?.omeTiffOffsetsUrl && !isAbsoluteUrl(metadata.omeTiffOffsetsUrl)) {
|
|
229
|
+
metadata.omeTiffOffsetsUrl = `${origin}${baseUrl}${metadata.omeTiffOffsetsUrl}`;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
updatedImage.metadata = metadata;
|
|
233
|
+
|
|
234
|
+
return updatedImage;
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
updatedOptions.images = updatedImages;
|
|
238
|
+
}
|
|
217
239
|
updatedFileDef.options = updatedOptions;
|
|
218
240
|
}
|
|
219
241
|
return updatedFileDef;
|
|
@@ -232,6 +254,7 @@ async function render(view) {
|
|
|
232
254
|
const storeUrls = view.model.get('store_urls');
|
|
233
255
|
const invokeTimeout = view.model.get('invoke_timeout');
|
|
234
256
|
const invokeBatched = view.model.get('invoke_batched');
|
|
257
|
+
const preventScroll = view.model.get('prevent_scroll');
|
|
235
258
|
|
|
236
259
|
const pageMode = view.model.get('page_mode');
|
|
237
260
|
const pageEsm = view.model.get('page_esm');
|
|
@@ -424,7 +447,7 @@ async function render(view) {
|
|
|
424
447
|
const divRef = React.useRef();
|
|
425
448
|
|
|
426
449
|
React.useEffect(() => {
|
|
427
|
-
if(!divRef.current) {
|
|
450
|
+
if(!divRef.current || !preventScroll) {
|
|
428
451
|
return () => {};
|
|
429
452
|
}
|
|
430
453
|
|
|
@@ -450,7 +473,7 @@ async function render(view) {
|
|
|
450
473
|
divRef.current.removeEventListener("mouseleave", handleMouseLeave);
|
|
451
474
|
}
|
|
452
475
|
};
|
|
453
|
-
}, [divRef]);
|
|
476
|
+
}, [divRef, preventScroll]);
|
|
454
477
|
|
|
455
478
|
// Config changed on JS side (from within <Vitessce/>),
|
|
456
479
|
// send updated config to Python side.
|
|
@@ -600,7 +623,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
600
623
|
|
|
601
624
|
next_port = DEFAULT_PORT
|
|
602
625
|
|
|
603
|
-
js_package_version = Unicode('3.6.
|
|
626
|
+
js_package_version = Unicode('3.6.4').tag(sync=True)
|
|
604
627
|
js_dev_mode = Bool(False).tag(sync=True)
|
|
605
628
|
custom_js_url = Unicode('').tag(sync=True)
|
|
606
629
|
plugin_esm = List(trait=Unicode(''), default_value=[]).tag(sync=True)
|
|
@@ -609,10 +632,11 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
609
632
|
page_esm = Unicode('').tag(sync=True)
|
|
610
633
|
invoke_timeout = Int(300000).tag(sync=True)
|
|
611
634
|
invoke_batched = Bool(True).tag(sync=True)
|
|
635
|
+
prevent_scroll = Bool(True).tag(sync=True)
|
|
612
636
|
|
|
613
637
|
store_urls = List(trait=Unicode(''), default_value=[]).tag(sync=True)
|
|
614
638
|
|
|
615
|
-
def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=False, js_package_version='3.6.
|
|
639
|
+
def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=False, js_package_version='3.6.4', js_dev_mode=False, custom_js_url='', plugins=None, remount_on_uid_change=True, prefer_local=True, invoke_timeout=300000, invoke_batched=True, page_mode=False, page_esm=None, prevent_scroll=True):
|
|
616
640
|
"""
|
|
617
641
|
Construct a new Vitessce widget.
|
|
618
642
|
|
|
@@ -632,6 +656,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
632
656
|
:param bool invoke_batched: Should invocations (Zarr gets) be submitted in batch, or individually? By default, True.
|
|
633
657
|
:param bool page_mode: Whether to render the <Vitessce/> component in grid-mode or page-mode. By default, False.
|
|
634
658
|
:param str page_esm: The ES module string for the page component creation function. Optional.
|
|
659
|
+
:param bool prevent_scroll: Should mouseover in the Vitessce widget prevent disable the scrolling of the notebook? By default, True.
|
|
635
660
|
|
|
636
661
|
.. code-block:: python
|
|
637
662
|
:emphasize-lines: 4
|
|
@@ -665,7 +690,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
665
690
|
js_package_version=js_package_version, js_dev_mode=js_dev_mode, custom_js_url=custom_js_url,
|
|
666
691
|
plugin_esm=plugin_esm, remount_on_uid_change=remount_on_uid_change,
|
|
667
692
|
page_mode=page_mode, page_esm=('' if page_esm is None else page_esm),
|
|
668
|
-
invoke_timeout=invoke_timeout, invoke_batched=invoke_batched,
|
|
693
|
+
invoke_timeout=invoke_timeout, invoke_batched=invoke_batched, prevent_scroll=prevent_scroll,
|
|
669
694
|
uid=uid_str, store_urls=list(self._stores.keys())
|
|
670
695
|
)
|
|
671
696
|
|
|
@@ -747,7 +772,7 @@ class VitessceWidget(anywidget.AnyWidget):
|
|
|
747
772
|
# Launch Vitessce using plain HTML representation (no ipywidgets)
|
|
748
773
|
|
|
749
774
|
|
|
750
|
-
def ipython_display(config, height=600, theme='auto', base_url=None, host_name=None, uid=None, port=None, proxy=False, js_package_version='3.6.
|
|
775
|
+
def ipython_display(config, height=600, theme='auto', base_url=None, host_name=None, uid=None, port=None, proxy=False, js_package_version='3.6.4', js_dev_mode=False, custom_js_url='', plugins=None, remount_on_uid_change=True, page_mode=False, page_esm=None):
|
|
751
776
|
from IPython.display import display, HTML
|
|
752
777
|
uid_str = "vitessce" + get_uid_str(uid)
|
|
753
778
|
|
vitessce/wrappers.py
CHANGED
|
@@ -33,6 +33,7 @@ from vitessce.file_def_utils import (
|
|
|
33
33
|
gen_sdata_obs_spots_schema,
|
|
34
34
|
gen_sdata_obs_sets_schema,
|
|
35
35
|
gen_sdata_obs_feature_matrix_schema,
|
|
36
|
+
gen_obs_feature_columns_schema,
|
|
36
37
|
)
|
|
37
38
|
|
|
38
39
|
from .constants import (
|
|
@@ -1192,7 +1193,7 @@ def raise_error_if_more_than_one(inputs):
|
|
|
1192
1193
|
|
|
1193
1194
|
|
|
1194
1195
|
class AnnDataWrapper(AbstractWrapper):
|
|
1195
|
-
def __init__(self, adata_path=None, adata_url=None, adata_store=None, adata_artifact=None, ref_path=None, ref_url=None, ref_artifact=None, obs_feature_matrix_path=None, feature_filter_path=None, initial_feature_filter_path=None, obs_set_paths=None, obs_set_names=None, obs_locations_path=None, obs_segmentations_path=None, obs_embedding_paths=None, obs_embedding_names=None, obs_embedding_dims=None, obs_spots_path=None, obs_points_path=None, feature_labels_path=None, obs_labels_path=None, convert_to_dense=True, coordination_values=None, obs_labels_paths=None, obs_labels_names=None, is_zip=None, **kwargs):
|
|
1196
|
+
def __init__(self, adata_path=None, adata_url=None, adata_store=None, adata_artifact=None, ref_path=None, ref_url=None, ref_artifact=None, obs_feature_matrix_path=None, obs_feature_column_paths=None, feature_filter_path=None, initial_feature_filter_path=None, obs_set_paths=None, obs_set_names=None, obs_locations_path=None, obs_segmentations_path=None, obs_embedding_paths=None, obs_embedding_names=None, obs_embedding_dims=None, obs_spots_path=None, obs_points_path=None, feature_labels_path=None, obs_labels_path=None, convert_to_dense=True, coordination_values=None, obs_labels_paths=None, obs_labels_names=None, is_zip=None, **kwargs):
|
|
1196
1197
|
"""
|
|
1197
1198
|
Wrap an AnnData object by creating an instance of the ``AnnDataWrapper`` class.
|
|
1198
1199
|
|
|
@@ -1218,6 +1219,7 @@ class AnnDataWrapper(AbstractWrapper):
|
|
|
1218
1219
|
:param str obs_labels_path: (DEPRECATED) The name of a column containing observation labels (e.g., alternate cell IDs), instead of the default index in `obs` of the AnnData store. Use `obs_labels_paths` and `obs_labels_names` instead. This arg will be removed in a future release.
|
|
1219
1220
|
:param list[str] obs_labels_paths: The names of columns containing observation labels (e.g., alternate cell IDs), instead of the default index in `obs` of the AnnData store.
|
|
1220
1221
|
:param list[str] obs_labels_names: The optional display names of columns containing observation labels (e.g., alternate cell IDs), instead of the default index in `obs` of the AnnData store.
|
|
1222
|
+
:param list[str] obs_feature_column_paths: The paths to columns (typically in `obs`) that contain numerical values per observation (e.g., cell size, quality control metrics, etc.) which are not part of the main expression matrix.
|
|
1221
1223
|
:param bool convert_to_dense: Whether or not to convert `X` to dense the zarr store (dense is faster but takes more disk space).
|
|
1222
1224
|
:param coordination_values: Coordination values for the file definition.
|
|
1223
1225
|
:param is_zip: Boolean indicating whether the Zarr store is in a zipped format.
|
|
@@ -1289,6 +1291,7 @@ class AnnDataWrapper(AbstractWrapper):
|
|
|
1289
1291
|
self._spatial_spots_obsm = obs_spots_path
|
|
1290
1292
|
self._spatial_points_obsm = obs_points_path
|
|
1291
1293
|
self._feature_labels = feature_labels_path
|
|
1294
|
+
self._obs_feature_column_paths = obs_feature_column_paths
|
|
1292
1295
|
# Support legacy provision of single obs labels path
|
|
1293
1296
|
if (obs_labels_path is not None):
|
|
1294
1297
|
warnings.warn("`obs_labels_path` will be deprecated in a future release.", DeprecationWarning)
|
|
@@ -1357,6 +1360,7 @@ class AnnDataWrapper(AbstractWrapper):
|
|
|
1357
1360
|
options = gen_obs_feature_matrix_schema(options, self._expression_matrix, self._gene_var_filter, self._matrix_gene_var_filter)
|
|
1358
1361
|
options = gen_feature_labels_schema(self._feature_labels, options)
|
|
1359
1362
|
options = gen_obs_labels_schema(options, self._obs_labels_elems, self._obs_labels_names)
|
|
1363
|
+
options = gen_obs_feature_columns_schema(options, self._obs_feature_column_paths)
|
|
1360
1364
|
|
|
1361
1365
|
if len(options.keys()) > 0:
|
|
1362
1366
|
if self.is_h5ad:
|
|
@@ -1397,7 +1401,7 @@ SpatialDataWrapperType = TypeVar('SpatialDataWrapperType', bound='SpatialDataWra
|
|
|
1397
1401
|
|
|
1398
1402
|
class SpatialDataWrapper(AnnDataWrapper):
|
|
1399
1403
|
|
|
1400
|
-
def __init__(self, sdata_path: Optional[str] = None, sdata_url: Optional[str] = None, sdata_store: Optional[Union[str, zarr.storage.StoreLike]] = None, sdata_artifact: Optional[ln.Artifact] = None, image_path: Optional[str] = None, region: Optional[str] = None, coordinate_system: Optional[str] = None, affine_transformation: Optional[np.ndarray] = None, obs_spots_path: Optional[str] = None, labels_path: Optional[str] = None, table_path: str = "tables/table", **kwargs):
|
|
1404
|
+
def __init__(self, sdata_path: Optional[str] = None, sdata_url: Optional[str] = None, sdata_store: Optional[Union[str, zarr.storage.StoreLike]] = None, sdata_artifact: Optional[ln.Artifact] = None, image_path: Optional[str] = None, region: Optional[str] = None, coordinate_system: Optional[str] = None, affine_transformation: Optional[np.ndarray] = None, obs_spots_path: Optional[str] = None, labels_path: Optional[str] = None, table_path: str = "tables/table", coordination_values=None, **kwargs):
|
|
1401
1405
|
"""
|
|
1402
1406
|
Wrap a SpatialData object.
|
|
1403
1407
|
|
|
@@ -1444,6 +1448,7 @@ class SpatialDataWrapper(AnnDataWrapper):
|
|
|
1444
1448
|
if self._adata_path is not None:
|
|
1445
1449
|
self.zarr_folder = 'spatialdata.zarr'
|
|
1446
1450
|
self.obs_type_label = None
|
|
1451
|
+
self._coordination_values = coordination_values
|
|
1447
1452
|
if self._coordination_values is not None and "obsType" in self._coordination_values:
|
|
1448
1453
|
self.obs_type_label = self._coordination_values["obsType"]
|
|
1449
1454
|
self._table_path = table_path
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vitessce
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.4
|
|
4
4
|
Summary: Jupyter widget facilitating interactive visualization of spatial single-cell data with Vitessce
|
|
5
5
|
Project-URL: repository, https://github.com/vitessce/vitessce-python
|
|
6
6
|
Author-email: Mark Keller <mark_keller@hms.harvard.edu>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
vitessce/__init__.py,sha256=GWGahpQMOGFotQXilRccGT0Bnn3OyoCQUCUphW_DtTI,1632
|
|
2
|
-
vitessce/config.py,sha256=
|
|
2
|
+
vitessce/config.py,sha256=GLiFSYh-ACJvQhrEVu3-nqFj1HtlCF86V_mMDljvwFo,81206
|
|
3
3
|
vitessce/config_converter.py,sha256=IRPnGPGaETvJbYZNUv2pe54SHHHsDY9VWo3JRjSI5FM,14681
|
|
4
4
|
vitessce/constants.py,sha256=nBMH55TcnSavcpvYE-epyx3cJ0iDS31eHsL_1e9qb9M,15360
|
|
5
5
|
vitessce/export.py,sha256=L7j5sVC0nBSqGocFWQyyHImSiAF4IjXhmqV1QtpuNc4,3874
|
|
6
|
-
vitessce/file_def_utils.py,sha256=
|
|
6
|
+
vitessce/file_def_utils.py,sha256=0Q1jxTOBDtvbRJEDX3s80oPr1EYrwkqixjkA5-rzAFM,7028
|
|
7
7
|
vitessce/repr.py,sha256=qMmefmZ3E-3sRVxeI5q1DTZnfuwbXKiA85eyqk5MCT4,2287
|
|
8
8
|
vitessce/responses.py,sha256=Z6Wo4AXN-RyzmxMPhSuhpIsHTItHM4GyIgMLGoVEYcU,339
|
|
9
9
|
vitessce/routes.py,sha256=U8T-L-3QCD_tAbPF8LsUlSMhPWNbyzbLNUnxP9Z9s9o,2140
|
|
10
10
|
vitessce/utils.py,sha256=obzjj65qsagu60_yuhGc-0jmHO-BW0Y-bDs0FgrBqLY,981
|
|
11
|
-
vitessce/widget.py,sha256=
|
|
12
|
-
vitessce/wrappers.py,sha256=
|
|
11
|
+
vitessce/widget.py,sha256=gvmfqTy99B7oafSIXM33x46q_5vXENwGd_hxOUA3nRY,34575
|
|
12
|
+
vitessce/wrappers.py,sha256=garL6KfL5hEqGBQpf3NV_ZsZhaV_-RN1GrCmA1Fc_1I,75557
|
|
13
13
|
vitessce/data_utils/__init__.py,sha256=3mWi1lMjoj4_dNbhMOvyE-HEJu0qpMzcmkhfz_5T6n8,361
|
|
14
14
|
vitessce/data_utils/anndata.py,sha256=iLa5-bRezHgBzL_XCHO7w0pc0RQ4urzZbDsqJbBYeCk,10668
|
|
15
15
|
vitessce/data_utils/entities.py,sha256=X8enC_TQbgwBzjgD1x53IPS6aVr9wyP0s-NLuYBeMeU,11705
|
|
16
16
|
vitessce/data_utils/multivec.py,sha256=YVc68uKNdS-ga89GapQjY9lDjmje0dm-MExq1yT_6ZE,11571
|
|
17
|
-
vitessce/data_utils/ome.py,sha256=
|
|
17
|
+
vitessce/data_utils/ome.py,sha256=tJHlSHbZTxpjRgYfTxbYMS9zSnSHQwJVWPZpREAvHtU,5518
|
|
18
18
|
vitessce/widget_plugins/__init__.py,sha256=lto2GXnc7KwjIoT-jvzyRYLj0XTJG3uxoX45Hc9EcWA,82
|
|
19
19
|
vitessce/widget_plugins/demo_plugin.py,sha256=14S7nOxdlKSxIHw9DUcNCN83NE_U1EMPy2D4k0FDues,1797
|
|
20
20
|
vitessce/widget_plugins/spatial_query.py,sha256=CYxvmMT1Je_jguikPROQxlegkPgIIzemKGbZSJfZMyI,12314
|
|
21
|
-
vitessce-3.6.
|
|
22
|
-
vitessce-3.6.
|
|
23
|
-
vitessce-3.6.
|
|
24
|
-
vitessce-3.6.
|
|
21
|
+
vitessce-3.6.4.dist-info/METADATA,sha256=sRseqTRfGZiMcogKRMZutfIMsMPcYPAIL0SliFhg8UU,9826
|
|
22
|
+
vitessce-3.6.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
23
|
+
vitessce-3.6.4.dist-info/licenses/LICENSE,sha256=sNNpI0PQ57AW8_XnTAjU5Yw8YBA_DRNkVHrHYpCIhRU,1067
|
|
24
|
+
vitessce-3.6.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|