Skip to content

Commit

Permalink
fix ReferenceError; updated README and movie
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Obermayer committed Nov 11, 2019
1 parent 3f3288c commit 5059f07
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 44 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
History
=======

------
v0.7.2
------

- fix ReferenceError
- updated README and tutorialmovie

------
v0.7.1
------
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ The prerequisites are:
- Python 3, either
- system-wide installation with ``virtualenv``, or
- installed with `Conda <https://docs.conda.io/en/latest/>`__.
- `Git LFS <https://git-lfs.github.com/>`__ must be installed for obtaining the example data files.
For ``virtualenv``, first create a virtual environment and activate it.
Expand All @@ -254,6 +255,7 @@ For a Conda-based setup create a new environment and activate it.
Next, clone the repository and install the software as editable (``-e``).
Also install the development requirements to get helpers such as black.
(Note that you must have `Git LFS <https://git-lfs.github.com/>`__ installed to actually obtain the data files).
.. code-block:: shell
Expand Down
32 changes: 18 additions & 14 deletions scelvis/ui/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def render_controls_scatter(data):
),
html.Hr(),
render_select_cells(data),
# hidden div to store selection of cells
html.Div(id="select_cells_selected", style={"display": "none"}),
],
title="Select x- and y-coordinates for embedding (TSNE or UMAP); "
"color points according to cell annotation (e.g., cluster identity or n_genes); "
Expand Down Expand Up @@ -189,10 +191,10 @@ def render_select_cells_controls(data):
id="select_cells_view_groups",
color="link",
style={
"padding-left": 2,
"padding-right": 2,
"padding-top": 0,
"padding-bottom": 3,
"paddingLeft": 2,
"paddingRight": 2,
"paddingTop": 0,
"paddingBottom": 3,
},
),
"or",
Expand All @@ -201,10 +203,10 @@ def render_select_cells_controls(data):
id="select_cells_view_table",
color="link",
style={
"padding-left": 2,
"padding-right": 0,
"padding-top": 0,
"padding-bottom": 3,
"paddingLeft": 2,
"paddingRight": 0,
"paddingTop": 0,
"paddingBottom": 3,
},
),
"; download ",
Expand All @@ -227,7 +229,6 @@ def render_select_cells_controls(data):
id="select_cells_get_results",
style={"display": "none"},
),
html.Div(id="select_cells_results", style={"display": "none"}),
]
)

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


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

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

# make sure groups are disjoint
group_A = list(set(selected["group_A"]) - set(selected["group_B"]))
group_B = list(set(selected["group_B"]) - set(selected["group_A"]))
group_A = list(
(set(selected["group_A"]) - set(selected["group_B"])) & set(ad_here.obs_names)
)
group_B = list(
(set(selected["group_B"]) - set(selected["group_A"])) & set(ad_here.obs_names)
)

if len(group_A) == 0 or len(group_B) == 0:
return {}, "", True
Expand Down
55 changes: 26 additions & 29 deletions scelvis/ui/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,43 @@ def render_plot(data_type, plot_type):

def render_filter_cells_collapse(data, token):

return html.Div(
[
dbc.Button(
"filter cells",
id="%s_filter_cells_button" % token,
className="text-left",
color="primary",
outline=True,
size="md",
),
dbc.Collapse(
dbc.Card(dbc.CardBody(render_filter_cells_controls(data, token))),
id="%s_filter_cells_collapse" % token,
),
],
id="%s_filter_cells_div" % token,
)
children = [
dbc.Button(
"filter cells",
id="%s_filter_cells_button" % token,
className="text-left",
color="primary",
outline=True,
size="md",
),
dbc.Collapse(
dbc.Card(dbc.CardBody(render_filter_cells_controls(data, token))),
id="%s_filter_cells_collapse" % token,
),
]

if token == "meta":
# store list of choices in hidden div
filters = {}
children.append(
html.Div(
id="filter_cells_filters", style={"display": "none"}, children=json.dumps(filters)
)
)

return html.Div(children=children, id="%s_filter_cells_div" % token)


def render_filter_cells_controls(data, token):

# store list of choices in hidden div
filters = {}
options = (
[{"label": "ncells", "value": "ncells"}]
+ [{"label": c, "value": c} for c in data.categorical_meta]
+ [{"label": c, "value": c} for c in data.numerical_meta]
+ [{"label": g, "value": g} for g in data.genes]
)

output = [
return [
html.Div(
[dcc.Dropdown(id="%s_filter_cells_attribute" % token, options=options, value="None")]
),
Expand Down Expand Up @@ -135,15 +141,6 @@ def render_filter_cells_controls(data, token):
),
]

if token == "meta":
output.append(
html.Div(
id="filter_cells_filters", style={"display": "none"}, children=json.dumps(filters)
)
)

return output


def apply_filter_cells_filters(data, filters_json):

Expand Down
1 change: 0 additions & 1 deletion scelvis/ui/genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ def render(data):
# Placeholder for the plot.
dbc.Col(
children=[dcc.Loading(id="expression_plot", type="circle")],
# children=[html.Div(id="expression_plot")],
className="col-9",
),
]
Expand Down
Binary file modified tutorial/scelvis_movie.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5059f07

Please sign in to comment.