Tools

arrow_function(points_bokeh_plot, adata, embedding_key, bt_slider_roll, bt_slider_pitch, bt_slider_yaw, source_rotmatrix_etc, bt_toggle_anim, hidden_checkbox_A, div_signature_list, multiselect_signature, sign_nr, sl_component1, sl_component2, sl_component3, label_sign)[source]

Create and manage the arrow tool for oriented signature analysis Add the “Arrow Tool” to the Bokeh scatter plot that lets the user draw an arrow (start and end points). The arrow direction is then used to compute an oriented signature: a set of features most correlated with the arrow direction in the embedding space.

Parameters:
Returns:

  • bt_sign_oriented (bokeh.models.Button): Button that triggers oriented signature computation based on the drawn arrow.

  • help_button_oriented (bokeh.models.HelpButton): Tooltip button describing requirements for computing oriented signatures.

Return type:

Tuple containing the Bokeh widgets created by this function

csv_load_button(source)[source]

Create a button to load previously selected points from a CSV file.

Parameters:

source (bokeh.models.ColumnDataSource) – Data source with at least a "name" field, against which CSV entries will be matched.

Returns:

button (bokeh.models.Button)
  • "Load selection": On click, it prompts for a CSV file and updates source.selected.indices with the matched entries.

download_selected_button(source, original_keys)[source]

Create a button to download selected points as a CSV file.

Parameters:
  • source – bokeh.models.ColumnDataSource Data source containing the selected points to be downloaded.

  • original_keys – list of str Column names to include in the downloaded CSV file.

Returns:

  • "Save selected". On click, it downloads the currently selected points as a CSV file.

Return type:

button (bokeh.models.Button)

gene_query_button(offset_text_feature_color)[source]

Create a button to search for genes in the HGNC database.

This function generates a Bokeh Button when clicked, extracts the feature names from the feature input text box, and for each feature, opens a new browser tab to the corresponding search results page on the HGNC website. It may include + and - operators, as well as Ensembl IDs.

Parameters:

offset_text_feature_color (bokeh.models.TextInput) – Text input for entering feature names to color samples in the scatter plot.

Returns:

Button that opens HGNC search pages for the features listed in offset_text_feature_color.

Return type:

btn_open_link (bokeh.models.Button)

signature_buttons(adata, offset_text_feature_color, offset_label, hidden_checkbox_A, hidden_checkbox_B, label_signature)[source]

Create the UI elements e.g., buttons, help tooltips, and a multi-select widget that allow users to compute differential feature signatures between interactively defined cell subsets. It provides options to compare “Subset A vs. Rest” and “Subset A vs. Subset B”.

Parameters:
  • adata (anndata.AnnData) – Annotated data matrix of shape n_obs x n_vars.

  • offset_text_feature_color (bokeh.models.TextInput) – Text input for entering feature names to color samples in the scatter plot.

  • offset_label (bokeh.models.TextInput) – Hidden text input that stores the group labels for generating violin/heatmap plots

  • hidden_checkbox_A (bokeh.models.CheckboxGroup) – Widget storing “Subset A” sample indices.

  • hidden_checkbox_B (bokeh.models.CheckboxGroup) – Widget storing “Subset B” sample indices.

  • label_signature – bokeh.models.MultiSelect Widget listing available group labels including Subset A and Subset B or Rest.

Returns:

Return type:

Tuple containing the Bokeh components created by this function

subset_buttons(points_bokeh_plot, source_rotmatrix_etc, bt_slider_range)[source]

Generate toggle switches and buttons for setting, highlighting, and selecting subsets of samples directly within from the scatterplot.

Parameters:
  • points_bokeh_plot (bokeh.plotting.figure) – The main Bokeh scatter plot figure.

  • source_rotmatrix_etc (bokeh.models.ColumnDataSource) – Data source for tracking points’ positions after rotations in the scatterplot.

  • bt_slider_range (bokeh.models.RangeSlider) – Slider for filtering samples based on a selected feature’s value. It is passed here so its value can be reset when the user clears a selection.

Returns:

Tuple containing all the created Bokeh widgets so they can be added

to the main application layout.