napari_dmc_brainmap.visualization.vis_utils package

Submodules

napari_dmc_brainmap.visualization.vis_utils.gene_info_dialog module

class napari_dmc_brainmap.visualization.vis_utils.gene_info_dialog.GeneInfoDialog(parent: QWidget | None = None, only_gene: bool = False, round_expression: bool = False)[source]

Bases: QDialog

Dialog for entering gene information, including file selection, gene list input, and rounding options.

get_gene_info() Tuple[str | None, List[str], int | None][source]

Retrieve the selected file path, gene list, and rounding value.

Returns:

  • File path of the selected gene expression file (or None if not selected).

  • List of gene names.

  • Rounding value (or None if rounding is not enabled).

Return type:

Tuple[Optional[str], List[str], Optional[int]]

select_file() None[source]

Open a file dialog to select a gene expression file and update the file path.

setup_ui() None[source]

Set up the user interface elements of the dialog.

napari_dmc_brainmap.visualization.vis_utils.visualization_utils module

napari_dmc_brainmap.visualization.vis_utils.visualization_utils.get_ancestors(tgt_list: List[str], atlas: BrainGlobeAtlas) List[str][source]

Retrieve the top-level ancestor for each target in the target list.

Parameters:
  • tgt_list (List[str]) – List of target regions.

  • atlas (BrainGlobeAtlas) – BrainGlobeAtlas object for retrieving region hierarchy.

Returns:

List of top-level ancestors for each target.

Return type:

List[str]

napari_dmc_brainmap.visualization.vis_utils.visualization_utils.get_descendants(tgt_list: List[str], atlas: BrainGlobeAtlas) List[str][source]

Retrieve all descendant regions for each target in the target list.

Parameters:
  • tgt_list (List[str]) – List of target regions.

  • atlas (BrainGlobeAtlas) – BrainGlobeAtlas object for retrieving region hierarchy.

Returns:

List of descendant regions.

Return type:

List[str]

napari_dmc_brainmap.visualization.vis_utils.visualization_utils.get_unique_folder(data_fn: Path) Path[source]

Generate a unique folder path by appending a counter if the folder already exists.

Parameters:

data_fn (Path) – Initial folder path.

Returns:

Unique folder path.

Return type:

Path

napari_dmc_brainmap.visualization.vis_utils.visualization_utils.match_lists(list1: List[Any], list2: List[Any]) Tuple[List[Any], List[Any]][source]

Match two lists by length, padding the shorter list with random colors if needed.

Parameters:
  • list1 (List[Any]) – First list.

  • list2 (List[Any]) – Second list.

Returns:

Adjusted lists with matched lengths.

Return type:

Tuple[List[Any], List[Any]]

napari_dmc_brainmap.visualization.vis_utils.visualization_utils.resort_df(tgt_data_to_plot: DataFrame, tgt_list: List[str], index_sort: bool = False) DataFrame[source]

Resort the dataframe based on a target list of regions.

Parameters:
  • tgt_data_to_plot (pd.DataFrame) – Dataframe containing target data.

  • tgt_list (List[str]) – Target list of regions to sort by.

  • index_sort (bool) – Whether to sort by index. Defaults to False.

Returns:

Resort dataframe.

Return type:

pd.DataFrame

Module contents