Server¶
Main application server and layout orchestrator for Yomix.
Considered as the central hub, it is responsible for:
Reading and preprocessing the input
Anndata
object, including optional subsampling and data normalization.Assembling the entire user interface by initializing and arranging all the plotting components and interactive tools from the yomix.plotting and yomix.tools modules.
Managing the Bokeh server lifecycle, including starting the server, handling different data embeddings, and gracefully shutting down previous instances. This allows Yomix to be run both as a standalone script and within interactive environments like Jupyter notebooks.
- gen_modify_doc(filearg, subsampling, title)[source]¶
Read an .h5ad file into an AnnData object and pass it to gen_modify_doc_xd to generate the main Bokeh document function.
- Parameters:
filearg (pathlib.Path) – Path to the .h5ad file containing the AnnData object.
subsampling (int or None) – If not None, randomly subsample this many observations.
title (str) – Title string for the Bokeh document.
- Returns:
Function that accepts a Bokeh Document and populates it with the visualization layout.
- Return type:
modify_doc (callable)
- gen_modify_doc_xd(xd, subsampling, title)[source]¶
Preprocess an AnnData object and build a document factory.
Normalizes the data matrix, computes summary statistics, and sets up categorical labels. Returns an interactive visualization layout.
- Parameters:
xd (anndata.AnnData) – Annotated data matrix of shape n_obs x n_vars.
subsampling (int) – If not None, randomly subsample this many observations.
title (str) – Title for the Bokeh document.
- Returns:
- modify_doc (callable)
Function that accepts a Bokeh Document and populates it with interactive plots, controls, and analysis widgets.
- start_server(xd, subsampling=None, title='', port=5006)[source]¶
Start a Yomix interactive Bokeh server. Run the application in a background thread, serving the given AnnData object through a Bokeh web interface. If a server is already running, it is first stopped and replaced.
- Parameters:
xd (anndata.AnnData) – Annotated data matrix of shape n_obs x n_vars.
subsampling (int) – Number of observations to randomly subsample before launching.
title (str) – Title string for the Bokeh document.
port (int) – Port on which to serve the Bokeh application.
- Returns:
None