Skip to content

Conversation

@nlee3105
Copy link
Contributor

HTML Download

Description:

Boxplot and Sankey diagrams can now be downloaded as interactive HTML files

Problems:

Changes:

App.py: Two new shared variables were added to store Sankey and boxplot figures so that the app can reuse the same figure for display and HTML downloading

Server/anno_vs_anno_server.py, server/boxplot_server.py: Now when a Sankey/boxplot Plotly figure is generated, the code saves it to a shared variable, and a download handler is present

Server/data_input_server.py: A helper function was added to sanitize file names and the cleaned file name is stored in a shared variable.

UI/...: Buttons added for downloading

Areas for Improvement:

The UI may be inconsistent now between graphs that can be downloaded as an HTML file and those that cannot

Code cleanup/ if-not hacks and flipper variable

Description:

When originally created, there was a bug in Shiny for Python that crashed the program when a statement like the example below was used:

If x is True: # or "If x” implying the boolean check.
     Run Code A
Else:
      Run Code B

In order to get around that, the original coder used not statements to flip logic and get around the crashes:

If x is not False: # not False is essentially True
      Run Code A
Else:
Run Code B

However, with recent updates to Shiny this issue was fixed, and standard if statements will no longer crash the program. In this PR, we went through the entire code and changed all if-not hacks to follow standard conventions.
The flipper variable was a redundant variable that could be cut out without affecting program performance. Getting rid of it helped declutter the code and improve readability.

Problems:

This change affects multiple files and could have merge conflicts with the main branch

Changes:

Changed all if-not logic to follow normal/standard logic flow. Removed flipper variable.

Caching Dataset to increase efficiency

Description:

Since plot caching would require core refactoring of the codebase and due to the limited time we had at the end of the semester, we decided to go with Dataset caching instead.

We could visibly observe the improvement of loading times for majority of the types of plots on the SPAC Shiny app.

Majority of the logistics are done through the cached_load_data(file_path) function, which first checks if the file is cached, and caches into _data_cache dictionary if not already cached.

The data_input_server module uses the caching functions to load data. It handles: User file uploads (.h5ad and .pickle files), Preloaded dataset selection from dropdowns, Coordinating which data source to use (uploaded vs. preloaded)

Problems:

.pickle file caching is still unstable, compared to .h5ad files

Changes:

data_processing.py and data_input_server.py

Areas for Improvement

Need to quantify the loading times to see exactly how much loading times have improved by

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants