Skip to content

Commit cd59840

Browse files
committed
update initialization of SpatialQuery object
1 parent 9faf440 commit cd59840

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

src/vitessce/widget_plugins/spatial_query.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,22 @@ class SpatialQueryPlugin(VitesscePlugin):
123123
plugin_esm = PLUGIN_ESM
124124
commands = {}
125125

126-
def __init__(self, adata, spatial_key="X_spatial", label_key="cell_type"):
126+
def __init__(self,
127+
adata,
128+
spatial_key="X_spatial",
129+
label_key="cell_type",
130+
feature_name="gene_name",
131+
if_lognorm=True,
132+
):
127133
"""
128134
Construct a new Vitessce widget.
129135
130136
:param adata: AnnData.
131137
:type adata: anndata.AnnData
132138
:param str spatial_key: The key in adata.obsm that contains the (x, y) coordinates of each cell. By default, "X_spatial".
133139
:param str label_key: The column in adata.obs that contains the cell type labels. By default, "cell_type".
140+
:param str feature_name: The key in adata.var that contains the gene names. By default, "gene_name".
141+
:param bool if_lognorm: Whether the data in adata.X need to be log-normalized. If input is count data, set to True. By default, True.
134142
135143
.. code-block:: python
136144
@@ -140,14 +148,22 @@ def __init__(self, adata, spatial_key="X_spatial", label_key="cell_type"):
140148
# ...
141149
vc.widget(plugins=[plugin], remount_on_uid_change=False)
142150
"""
143-
from SpatialQuery.spatial_query import spatial_query
151+
from SpatialQuery import spatial_query
144152
import matplotlib.pyplot as plt # Add as dependency / optional dependency?
145153

146154
self.adata = adata
147155
self.spatial_key = spatial_key
148156
self.label_key = label_key
149157

150-
self.tt = spatial_query(adata=adata, dataset='test', spatial_key=spatial_key, label_key=label_key, leaf_size=10)
158+
self.tt = spatial_query(
159+
adata=adata,
160+
dataset='test',
161+
spatial_key=spatial_key,
162+
label_key=label_key,
163+
leaf_size=10,
164+
build_gene_index=False,
165+
if_lognorm=if_lognorm,
166+
)
151167

152168
self.tab20_rgb = [[int(r * 255), int(g * 255), int(b * 255)] for (r, g, b, a) in [plt.cm.tab20(i) for i in range(20)]]
153169

0 commit comments

Comments
 (0)