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))#
Plot a heatmap of NMF gene loadings, filtered to genes with a high maximum loading.
Extracts the NMF gene loadings matrix (
Hmatrix) from the AnnData object stored atnmf_adata_keywithinsdata, keeps only genes whose maximum loading exceeds 0.05, and plots a heatmap of the filtered loadings sorted by their dominant 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 insdatathat contains the AnnData object with NMF results.save (
bool(default:True)) – Whether to save the heatmap plot to disk. The plot is saved in afiguressubdirectory ofsaving_path.vmin (
float(default:0.0)) – Minimum value for the colormap scale.vmax (
float(default:0.02)) – Maximum value for the colormap scale.saving_path (
str(default:'')) – Path where the plot should be saved ifsaveisTrue.cmap (
str(default:'viridis')) – Colormap to use for the heatmap.figsize (
tuple[float,float] (default:(5, 5))) – Size of the heatmap figure.
- Return type:
- Returns:
None