troutpy.pl.nmf_gene_contributions#
- troutpy.pl.nmf_gene_contributions(sdata, nmf_adata_key='nmf_data', save=True, vmin=0.0, vmax=0.02, saving_path='', cmap='viridis', figsize=(5, 5))#
Extracts the NMF (Non-negative Matrix Factorization) gene loadings matrix from the specified AnnData object within the spatial data (
sdata), filters genes based on their maximum loading value, and plots a heatmap of the filtered loadings.- Parameters:
sdata (spatialdata.SpatialData) – A spatial transcriptomics dataset that contains the NMF factors in the specified key.
nmf_adata_key (str) – The key in
sdatathat contains the AnnData object with NMF results. Defaults to ‘nmf_data’.save (bool) – Whether to save the heatmap plot to disk. Defaults to True.
vmin (float) – Minimum value for the colormap scale. Defaults to 0.0.
vmax (float) – Maximum value for the colormap scale. Defaults to 0.02.
saving_path (str) – Path where the plot should be saved if
saveis True. The plot is saved in afiguressubdirectory.cmap (str) – Colormap to use for the heatmap. Defaults to ‘viridis’.
figsize (tuple) – Size of the heatmap figure. Defaults to (5, 5).
- Returns:
None