troutpy.pl.nmf_factors_exrna_cells_W

troutpy.pl.nmf_factors_exrna_cells_W#

troutpy.pl.nmf_factors_exrna_cells_W(sdata, nmf_adata_key='nmf_data', save=True, saving_path='', spot_size=30, cmap='viridis')#

Plot the spatial distribution of each NMF factor for cells.

Extracts the NMF (Non-negative Matrix Factorization) cell loadings (W matrix) from the AnnData object stored at nmf_adata_key within sdata and creates a spatial plot for each factor.

Parameters:
  • sdata (SpatialData) – A spatial transcriptomics dataset that contains the NMF factors in the specified key.

  • nmf_adata_key (str (default: 'nmf_data')) – The key in sdata that contains the AnnData object with NMF results.

  • save (bool (default: True)) – Whether to save the spatial factor plots to disk. The plots are saved in a figures subdirectory of saving_path.

  • saving_path (str (default: '')) – Path where the plots should be saved if save is True.

  • spot_size (int (default: 30)) – Size of the spots in the spatial plot. Only used if save is False.

  • cmap (str (default: 'viridis')) – Colormap to use for the spatial plots.

Return type:

None

Returns:

None