troutpy.pl.paired_nmf_factors

troutpy.pl.paired_nmf_factors#

troutpy.pl.paired_nmf_factors(sdata, layer='nmf_data', n_factors=5, figsize=(12, 6), spot_size_exrna=5, spot_size_cells=10, cmap_exrna='YlGnBu', cmap_cells='Reds', vmax_exrna='p99', vmax_cells=None, save=False, output_path='', format='pdf')#

Plot the spatial distribution of NMF factors for extracellular transcripts and cells.

For each factor, the extracellular spot loadings and the cellular loadings are overlaid on the same spatial axes.

Parameters:
  • sdata (SpatialData) – Spatial data object containing both extracellular and cell data.

  • layer (str (default: 'nmf_data')) – Layer in sdata to extract the extracellular NMF data from.

  • n_factors (int (default: 5)) – Number of NMF factors to plot.

  • figsize (tuple[float, float] (default: (12, 6))) – Size of the figure for each subplot.

  • spot_size_exrna (float (default: 5)) – Size of the spots for the extracellular transcript scatter plot.

  • spot_size_cells (float (default: 10)) – Size of the spots for the cell scatter plot.

  • cmap_exrna (str (default: 'YlGnBu')) – Colormap for the extracellular transcript NMF factors.

  • cmap_cells (str (default: 'Reds')) – Colormap for the cell NMF factors.

  • vmax_exrna (str | float | None (default: 'p99')) – Maximum value for the extracellular transcript color scale.

  • vmax_cells (Union[str, float, None] (default: None)) – Maximum value for the cell color scale.

  • save (bool (default: False)) – Whether to save each factor’s figure to output_path.

  • output_path (str (default: '')) – Directory in which to save the figures. A figures subdirectory is created within it.

  • format (str (default: 'pdf')) – File format used when saving the figures.

Return type:

None

Returns:

None