Skip to content

Commit c0d4b17

Browse files
committed
set various colors for motifs, change default parameters
1 parent cd59840 commit c0d4b17

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/vitessce/widget_plugins/spatial_query.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
2525
const [uuid, setUuid] = React.useState(1);
2626
const [queryType, setQueryType] = React.useState('grid');
27-
const [maxDist, setMaxDist] = React.useState(100);
28-
const [minSize, setMinSize] = React.useState(4);
29-
const [minCount, setMinCount] = React.useState(10);
27+
const [maxDist, setMaxDist] = React.useState(10);
28+
const [minSize, setMinSize] = React.useState(0);
29+
const [minCount, setMinCount] = React.useState(0);
3030
const [minSupport, setMinSupport] = React.useState(0.5);
3131
3232
const cellTypeOfInterest = obsSetSelection?.length === 1 && obsSetSelection[0][0] === "Cell Type"
@@ -52,21 +52,21 @@
5252
<label>
5353
{/* Maximum distance to consider a cell as a neighbor. */}
5454
Max. Dist.
55-
<input type="range" value={maxDist} onChange={e => setMaxDist(parseFloat(e.target.value))} min={50} max={250} step={1} />
55+
<input type="range" value={maxDist} onChange={e => setMaxDist(parseFloat(e.target.value))} min={1} max={20} step={1} />
5656
{maxDist}
5757
</label>
5858
<br/>
5959
<label>
6060
{/* Minimum neighborhood size for each point to consider. */}
6161
Min. Size
62-
<input type="range" value={minSize} onChange={e => setMinSize(parseFloat(e.target.value))} min={0} max={20} step={1} />
62+
<input type="range" value={minSize} onChange={e => setMinSize(parseFloat(e.target.value))} min={0} max={20} step={0.5} />
6363
{minSize}
6464
</label>
6565
<br/>
6666
<label>
6767
{/* Minimum number of cell type to consider. */}
6868
Min. Count
69-
<input type="range" value={minCount} onChange={e => setMinCount(parseFloat(e.target.value))} min={0} max={30} step={1} />
69+
<input type="range" value={minCount} onChange={e => setMinCount(parseFloat(e.target.value))} min={0} max={100} step={1} />
7070
{minCount}
7171
</label>
7272
<br/>
@@ -160,6 +160,7 @@ def __init__(self,
160160
dataset='test',
161161
spatial_key=spatial_key,
162162
label_key=label_key,
163+
feature_name=feature_name,
163164
leaf_size=10,
164165
build_gene_index=False,
165166
if_lognorm=if_lognorm,
@@ -171,7 +172,7 @@ def __init__(self,
171172
"version": "0.1.3",
172173
"tree": [
173174
{
174-
"name": "Spatial-Query Results",
175+
"name": "SpatialQuery Results",
175176
"children": [
176177

177178
]
@@ -186,7 +187,7 @@ def __init__(self,
186187
},
187188
{
188189
"color": [255, 255, 255],
189-
"path": ["Spatial-Query Results"],
190+
"path": ["SpatialQuery Results"],
190191
}
191192
]
192193

@@ -218,7 +219,7 @@ def fp_tree_to_obs_sets_tree(self, fp_tree, sq_id):
218219
"version": "0.1.3",
219220
"tree": [
220221
{
221-
"name": f"Spatial-Query Results {sq_id}",
222+
"name": f"SpatialQuery Results {sq_id}",
222223
"children": [
223224

224225
]
@@ -233,7 +234,7 @@ def fp_tree_to_obs_sets_tree(self, fp_tree, sq_id):
233234
motif = row["itemsets"]
234235
except KeyError:
235236
motif = row["motifs"]
236-
cell_i = row["cell_id"]
237+
cell_i = row["neighbor_id"]
237238

238239
motif_name = str(list(motif))
239240

@@ -248,8 +249,9 @@ def fp_tree_to_obs_sets_tree(self, fp_tree, sq_id):
248249
]
249250
})
250251

252+
first_ct_color = self.ct_to_color.get(list(motif)[0], [255, 255, 255])
251253
obs_set_color.append({
252-
"color": [255, 255, 255],
254+
"color": first_ct_color,
253255
"path": [additional_obs_sets["tree"][0]["name"], motif_name]
254256
})
255257

@@ -282,7 +284,7 @@ def run_sq(self, prev_config):
282284
min_support=min_support,
283285
# dis_duplicates=dis_duplicates,
284286
if_display=True,
285-
fig_size=(9, 6),
287+
figsize=(9, 6),
286288
return_cellID=True,
287289
)
288290
print(params_dict)

0 commit comments

Comments
 (0)