Skip to content

Commit

Permalink
improved cache handling & user feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Obermayer committed Oct 29, 2019
1 parent 0befa91 commit 4137afd
Show file tree
Hide file tree
Showing 17 changed files with 304 additions and 138 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.1
------

- improved cache handling
- improved user feedback for filtering & differential expression

------
v0.7.0
------
Expand Down
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SCelVis: Easy Single-Cell Visualization

|
.. image:: scelvis/assets/movie.gif
.. image:: tutorial/scelvis_movie.gif
:height: 400px
:align: center

Expand Down Expand Up @@ -216,6 +216,7 @@ You can use the following environment variables to configure the server.
- ``SCELVIS_CACHE_DIR`` -- directory to use for the cache (default is to create a temporary directory)
- ``SCELVIS_CACHE_REDIS_URL`` -- enable caching with REDIS and provide connection URL
- ``SCELVIS_CACHE_DEFAULT_TIMEOUT`` -- cache lifetime coverage
- ``SCELVIS_CACHE_PRELOAD_DATA`` -- will preload all data at startup
- ``SCELVIS_UPLOAD_DIR`` -- the directory to store uploaded data sets in (default is to create a temporary directory)
- ``SCELVIS_UPLOAD_DISABLED`` -- set to "0" to disable upload feature
- ``SCELVIS_CONVERSION_DISABLED`` -- set to "0" to disable the conversion feature
Expand Down
20 changes: 10 additions & 10 deletions scelvis/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,21 @@
# Setup the cache.
cache.setup_cache(app)

# preload data if required
if settings.CACHE_PRELOAD_DATA:
from . import store

logger.info("preloading data ...")
store.load_all_metadata()
logger.info("preloading done.")

# Set app title
app.title = "SCelVis v%s" % __version__

# Serve assets locally
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True

# TODO: Better use the approach from this URL:
# - https://community.plot.ly/t/dynamic-controls-and-dynamic-output-components/5519
app.config.suppress_callback_exceptions = True

# Setup the application's main layout.
Expand All @@ -75,13 +81,12 @@
callbacks.register_select_cell_plot_type(app)
callbacks.register_update_cell_scatter_plot_params(app)
callbacks.register_toggle_select_cells_controls(app)
callbacks.register_update_select_cells_choices(app)
callbacks.register_update_select_cells_selected(app)
callbacks.register_activate_select_cells_buttons(app)
callbacks.register_update_cell_violin_plot_params(app)
callbacks.register_update_cell_bar_chart_params(app)
callbacks.register_toggle_filter_cells_controls(app, "meta")
callbacks.register_update_filter_cells_controls(app, "meta")

callbacks.register_update_filter_cells_controls(app)

# Cellbacks for the "genes" tab pane.
callbacks.register_select_gene_plot_type(app)
Expand All @@ -90,7 +95,6 @@
callbacks.register_select_gene_violin_plot(app)
callbacks.register_select_gene_dot_plot(app)
callbacks.register_toggle_filter_cells_controls(app, "expression")
callbacks.register_update_filter_cells_controls(app, "expression")

# callbacks for the filter cells div (on "cells" tab pane, but required for both)
callbacks.register_update_filter_cells_filters(app)
Expand All @@ -116,9 +120,6 @@ def find(name, path):
if name in files:
return os.path.join(root, name)

# TODO: error handling, error handling, error handling
# TODO: prettify the form
# TODO: protect against "zip bomb"
if request.method == "POST":
if "file" not in request.files or not request.files["file"].filename:
flash("No file uploaded!")
Expand Down Expand Up @@ -185,7 +186,6 @@ def find(name, path):
out_file, mimetype="application/binary", as_attachment=True
)
else:
# TODO: prettify HTML form
return """
<!doctype html>
<title>Convert File</title>
Expand Down
Binary file removed scelvis/assets/cells.png
Binary file not shown.
Binary file removed scelvis/assets/genes.png
Binary file not shown.
Binary file removed scelvis/assets/movie.gif
Binary file not shown.
Loading

0 comments on commit 4137afd

Please sign in to comment.