Skip to content

Commit 5059f07

Browse files
author
Benedikt Obermayer
committed
fix ReferenceError; updated README and movie
1 parent 3f3288c commit 5059f07

File tree

6 files changed

+53
-44
lines changed

6 files changed

+53
-44
lines changed

HISTORY.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
History
33
=======
44

5+
------
6+
v0.7.2
7+
------
8+
9+
- fix ReferenceError
10+
- updated README and tutorialmovie
11+
512
------
613
v0.7.1
714
------

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ The prerequisites are:
237237
- Python 3, either
238238
- system-wide installation with ``virtualenv``, or
239239
- installed with `Conda <https://docs.conda.io/en/latest/>`__.
240+
- `Git LFS <https://git-lfs.github.com/>`__ must be installed for obtaining the example data files.
240241
241242
For ``virtualenv``, first create a virtual environment and activate it.
242243
@@ -254,6 +255,7 @@ For a Conda-based setup create a new environment and activate it.
254255
255256
Next, clone the repository and install the software as editable (``-e``).
256257
Also install the development requirements to get helpers such as black.
258+
(Note that you must have `Git LFS <https://git-lfs.github.com/>`__ installed to actually obtain the data files).
257259
258260
.. code-block:: shell
259261

scelvis/ui/cells.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def render_controls_scatter(data):
4747
),
4848
html.Hr(),
4949
render_select_cells(data),
50+
# hidden div to store selection of cells
51+
html.Div(id="select_cells_selected", style={"display": "none"}),
5052
],
5153
title="Select x- and y-coordinates for embedding (TSNE or UMAP); "
5254
"color points according to cell annotation (e.g., cluster identity or n_genes); "
@@ -189,10 +191,10 @@ def render_select_cells_controls(data):
189191
id="select_cells_view_groups",
190192
color="link",
191193
style={
192-
"padding-left": 2,
193-
"padding-right": 2,
194-
"padding-top": 0,
195-
"padding-bottom": 3,
194+
"paddingLeft": 2,
195+
"paddingRight": 2,
196+
"paddingTop": 0,
197+
"paddingBottom": 3,
196198
},
197199
),
198200
"or",
@@ -201,10 +203,10 @@ def render_select_cells_controls(data):
201203
id="select_cells_view_table",
202204
color="link",
203205
style={
204-
"padding-left": 2,
205-
"padding-right": 0,
206-
"padding-top": 0,
207-
"padding-bottom": 3,
206+
"paddingLeft": 2,
207+
"paddingRight": 0,
208+
"paddingTop": 0,
209+
"paddingBottom": 3,
208210
},
209211
),
210212
"; download ",
@@ -227,7 +229,6 @@ def render_select_cells_controls(data):
227229
id="select_cells_get_results",
228230
style={"display": "none"},
229231
),
230-
html.Div(id="select_cells_results", style={"display": "none"}),
231232
]
232233
)
233234

@@ -263,19 +264,18 @@ def render_controls(data):
263264
html.Hr(),
264265
# Placeholder for the plot-specific controls.
265266
html.Div(id="meta_plot_controls"),
267+
# hidden div for selection results
268+
html.Div(id="select_cells_results", style={"display": "none"}),
266269
]
267270

268271

269272
def render(data):
270273
"""Render the "Cell Annotation" content."""
271274
return dbc.Row(
272275
children=[
273-
# hidden div to store selection of cells
274-
html.Div(id="select_cells_selected", style={"display": "none"}),
275276
dbc.Col(children=render_controls(data), className="col-3"),
276277
# Placeholder for the plot.
277278
dbc.Col(children=[dcc.Loading(id="meta_plot", type="circle")], className="col-9"),
278-
# dbc.Col(children=[html.Div(id="meta_plot")], className="col-9"),
279279
]
280280
)
281281

@@ -302,8 +302,12 @@ def render_plot_scatter(data, xc, yc, col, filters_json, select_json):
302302
return {}, "", True
303303

304304
# make sure groups are disjoint
305-
group_A = list(set(selected["group_A"]) - set(selected["group_B"]))
306-
group_B = list(set(selected["group_B"]) - set(selected["group_A"]))
305+
group_A = list(
306+
(set(selected["group_A"]) - set(selected["group_B"])) & set(ad_here.obs_names)
307+
)
308+
group_B = list(
309+
(set(selected["group_B"]) - set(selected["group_A"])) & set(ad_here.obs_names)
310+
)
307311

308312
if len(group_A) == 0 or len(group_B) == 0:
309313
return {}, "", True

scelvis/ui/common.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,43 @@ def render_plot(data_type, plot_type):
3535

3636
def render_filter_cells_collapse(data, token):
3737

38-
return html.Div(
39-
[
40-
dbc.Button(
41-
"filter cells",
42-
id="%s_filter_cells_button" % token,
43-
className="text-left",
44-
color="primary",
45-
outline=True,
46-
size="md",
47-
),
48-
dbc.Collapse(
49-
dbc.Card(dbc.CardBody(render_filter_cells_controls(data, token))),
50-
id="%s_filter_cells_collapse" % token,
51-
),
52-
],
53-
id="%s_filter_cells_div" % token,
54-
)
38+
children = [
39+
dbc.Button(
40+
"filter cells",
41+
id="%s_filter_cells_button" % token,
42+
className="text-left",
43+
color="primary",
44+
outline=True,
45+
size="md",
46+
),
47+
dbc.Collapse(
48+
dbc.Card(dbc.CardBody(render_filter_cells_controls(data, token))),
49+
id="%s_filter_cells_collapse" % token,
50+
),
51+
]
52+
53+
if token == "meta":
54+
# store list of choices in hidden div
55+
filters = {}
56+
children.append(
57+
html.Div(
58+
id="filter_cells_filters", style={"display": "none"}, children=json.dumps(filters)
59+
)
60+
)
61+
62+
return html.Div(children=children, id="%s_filter_cells_div" % token)
5563

5664

5765
def render_filter_cells_controls(data, token):
5866

59-
# store list of choices in hidden div
60-
filters = {}
6167
options = (
6268
[{"label": "ncells", "value": "ncells"}]
6369
+ [{"label": c, "value": c} for c in data.categorical_meta]
6470
+ [{"label": c, "value": c} for c in data.numerical_meta]
6571
+ [{"label": g, "value": g} for g in data.genes]
6672
)
6773

68-
output = [
74+
return [
6975
html.Div(
7076
[dcc.Dropdown(id="%s_filter_cells_attribute" % token, options=options, value="None")]
7177
),
@@ -135,15 +141,6 @@ def render_filter_cells_controls(data, token):
135141
),
136142
]
137143

138-
if token == "meta":
139-
output.append(
140-
html.Div(
141-
id="filter_cells_filters", style={"display": "none"}, children=json.dumps(filters)
142-
)
143-
)
144-
145-
return output
146-
147144

148145
def apply_filter_cells_filters(data, filters_json):
149146

scelvis/ui/genes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def render(data):
166166
# Placeholder for the plot.
167167
dbc.Col(
168168
children=[dcc.Loading(id="expression_plot", type="circle")],
169-
# children=[html.Div(id="expression_plot")],
170169
className="col-9",
171170
),
172171
]

tutorial/scelvis_movie.gif

391 KB
Loading

0 commit comments

Comments
 (0)