Dimension reduction page with linked charts
Idea / Use case
Often, users wish to inspect the dimension reduction and distribution of cell metadata (e.g. cluster, timepoint, number of genes, etc). The idea is to present a certain dimension reduction (e.g. obtained by PCA, t-SNE or UMAP) and allow to define a highlighting variable, which will be color-coded onto the reduced dimension (e.g. clustering). Additionally, up to three metadata are allowed to be aggregated by the highlighting variable. These metadata can be of any type and plots will be shown according to the type:
Two actions are thinkable:
- Whenever a user selects a subset of cells from the dimension reduction, aggregates are updated and plots of metadata are shown only data from selected cells.
- Whenever a user hovers a group of cells (e.g. all with the same clustering), plots of aggregated metadata change to highlight the hovered group.
A special case is the number of observations (cells) for each highlighting variable (i.e. it will be a bar plot). The user creating the page should be allowed to decide whether to include the special bar plot or not.
A function that takes
- the report object
- the 2D coordinates of the reduced dimension
- a dataframe with metadata
- the name of the highlighting variable
- the page title
and generates a static page with linked charts. Implementation of the interactive version will be done later.
Plotly has a lot of capability to create client-side linked charts (no need for shiny): https://plotly-r.com/client-side-linking.html
- Interactive version: The highlighting variable can be selected
- Wrapper functions for popular classes:
- Another special case: Cluster silhouette plot.