diff --git a/HISTORY.rst b/HISTORY.rst index df32625..4d7f8d7 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,13 @@ History ======= +------ +v0.7.2 +------ + +- fix ReferenceError +- updated README and tutorialmovie + ------ v0.7.1 ------ diff --git a/README.rst b/README.rst index e81b6eb..cb07249 100644 --- a/README.rst +++ b/README.rst @@ -237,6 +237,7 @@ The prerequisites are: - Python 3, either - system-wide installation with ``virtualenv``, or - installed with `Conda `__. +- `Git LFS `__ must be installed for obtaining the example data files. For ``virtualenv``, first create a virtual environment and activate it. @@ -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 `__ installed to actually obtain the data files). .. code-block:: shell diff --git a/scelvis/ui/cells.py b/scelvis/ui/cells.py index 6eee599..ba309f9 100644 --- a/scelvis/ui/cells.py +++ b/scelvis/ui/cells.py @@ -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); " @@ -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", @@ -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 ", @@ -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"}), ] ) @@ -263,6 +264,8 @@ 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"}), ] @@ -270,12 +273,9 @@ 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"), ] ) @@ -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 diff --git a/scelvis/ui/common.py b/scelvis/ui/common.py index a0334c7..5f29ec9 100644 --- a/scelvis/ui/common.py +++ b/scelvis/ui/common.py @@ -35,29 +35,35 @@ 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] @@ -65,7 +71,7 @@ def render_filter_cells_controls(data, token): + [{"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")] ), @@ -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): diff --git a/scelvis/ui/genes.py b/scelvis/ui/genes.py index 9bd49a3..a19d9bd 100644 --- a/scelvis/ui/genes.py +++ b/scelvis/ui/genes.py @@ -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", ), ] diff --git a/tutorial/scelvis_movie.gif b/tutorial/scelvis_movie.gif index 4c83fe4..bd111e4 100644 Binary files a/tutorial/scelvis_movie.gif and b/tutorial/scelvis_movie.gif differ