Skip to content

Commit 4f251b4

Browse files
authored
Support obsSpots and obsPoints (#312)
1 parent 611819e commit 4f251b4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

vitessce/wrappers.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def create_image_json(self, img_url):
512512

513513

514514
class AnnDataWrapper(AbstractWrapper):
515-
def __init__(self, adata_path=None, adata_url=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, request_init=None, feature_labels_path=None, obs_labels_path=None, convert_to_dense=True, coordination_values=None, obs_labels_paths=None, obs_labels_names=None, **kwargs):
515+
def __init__(self, adata_path=None, adata_url=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, request_init=None, feature_labels_path=None, obs_labels_path=None, convert_to_dense=True, coordination_values=None, obs_labels_paths=None, obs_labels_names=None, **kwargs):
516516
"""
517517
Wrap an AnnData object by creating an instance of the ``AnnDataWrapper`` class.
518518
@@ -528,6 +528,8 @@ def __init__(self, adata_path=None, adata_url=None, obs_feature_matrix_path=None
528528
:param list[str] obs_embedding_paths: Column names like `['obsm/X_umap', 'obsm/X_pca']` for showing scatterplots
529529
:param list[str] obs_embedding_names: Overriding names like `['UMAP', 'PCA']` for displaying above scatterplots
530530
:param list[str] obs_embedding_dims: Dimensions along which to get data for the scatterplot, like `[[0, 1], [4, 5]]` where `[0, 1]` is just the normal x and y but `[4, 5]` could be comparing the third and fourth principal components, for example.
531+
:param str obs_spots_path: Column name in `obsm` that contains centroid coordinates for displaying spots in the spatial viewer
532+
:param str obs_points_path: Column name in `obsm` that contains centroid coordinates for displaying points in the spatial viewer
531533
:param dict request_init: options to be passed along with every fetch request from the browser, like `{ "header": { "Authorization": "Bearer dsfjalsdfa1431" } }`
532534
:param str feature_labels_path: The name of a column containing feature labels (e.g., alternate gene symbols), instead of the default index in `var` of the AnnData store.
533535
: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.
@@ -565,6 +567,8 @@ def __init__(self, adata_path=None, adata_url=None, obs_feature_matrix_path=None
565567
self._spatial_polygon_obsm = obs_segmentations_path
566568
self._mappings_obsm = obs_embedding_paths
567569
self._mappings_obsm_dims = obs_embedding_dims
570+
self._spatial_spots_obsm = obs_spots_path
571+
self._spatial_points_obsm = obs_points_path
568572
self._request_init = request_init
569573
self._gene_alias = feature_labels_path
570574
# Support legacy provision of single obs labels path
@@ -612,6 +616,14 @@ def get_anndata_zarr(base_url):
612616
options["obsSegmentations"] = {
613617
"path": self._spatial_polygon_obsm
614618
}
619+
if self._spatial_spots_obsm is not None:
620+
options["obsSpots"] = {
621+
"path": self._spatial_spots_obsm
622+
}
623+
if self._spatial_points_obsm is not None:
624+
options["obsPoints"] = {
625+
"path": self._spatial_points_obsm
626+
}
615627
if self._mappings_obsm is not None:
616628
options["obsEmbedding"] = []
617629
if self._mappings_obsm_names is not None:

0 commit comments

Comments
 (0)