Convenience function to plot NMF program usage on UMAP coordinates. This is a wrapper around vizDimRed() specifically for UMAP plotting.
Usage
vizUMAP(
x,
nmf_name = "NMF",
program = 1,
point_size = 0.8,
alpha = 1,
color_scale = "viridis",
title = NULL
)
Arguments
- x
A SingleCellExperiment object with NMF results and UMAP coordinates
- nmf_name
Character, name of NMF result to use (default "NMF")
- program
Character or integer, which NMF program to plot (e.g., "NMF_1", "NMF_4", or 4)
- point_size
Numeric, size of points (default 0.8)
- alpha
Numeric, transparency of points (default 1.0)
- color_scale
Character, color scale to use: "viridis", "plasma", "inferno", "magma" (default "viridis")
- title
Character, plot title (if NULL, auto-generates from program name)
Examples
# Basic usage
library(scuttle)
sce <- mockSCE()
sce <- logNormCounts(sce)
sce <- runNMFscape(sce, k = 5)
#> Running NMF with k=5 factors...
#>
#> iter | tol
#> ---------------
#> 1 | 8.25e-01
#> 2 | 4.25e-02
#> 3 | 2.05e-02
#> 4 | 1.09e-02
#> 5 | 6.73e-03
#> 6 | 4.52e-03
#> 7 | 3.20e-03
#> 8 | 2.34e-03
#> 9 | 1.76e-03
#> 10 | 1.34e-03
#> 11 | 1.03e-03
#> 12 | 7.86e-04
#> 13 | 5.99e-04
#> 14 | 4.52e-04
#> 15 | 3.41e-04
#> 16 | 2.59e-04
#> 17 | 2.00e-04
#> 18 | 1.57e-04
#> 19 | 1.25e-04
#> 20 | 1.01e-04
#> 21 | 8.34e-05
#> 22 | 6.86e-05
#> 23 | 5.74e-05
#> 24 | 4.79e-05
#> 25 | 4.01e-05
#> 26 | 3.40e-05
#> 27 | 2.90e-05
#> 28 | 2.48e-05
#> 29 | 2.10e-05
#> 30 | 1.79e-05
#> 31 | 1.50e-05
#> 32 | 1.27e-05
#> 33 | 1.10e-05
#> 34 | 9.67e-06
#> NMF completed. Results stored in reducedDim(x, 'NMF')
#> Basis matrix stored in metadata(x)$NMF_basis
sce <- runUMAP(sce)
#> Error in runUMAP(sce): could not find function "runUMAP"
# Plot NMF program 1 on UMAP
vizUMAP(sce, program = 1)
#> Error in vizDimRed(x = x, dimred = "UMAP", nmf_name = nmf_name, program = program, point_size = point_size, alpha = alpha, color_scale = color_scale, title = title, dims = c(1, 2)): Dimension reduction 'UMAP' not found in reducedDims(x). Available: NMF
# Plot specific program by name with custom styling
vizUMAP(sce, program = "NMF_4", color_scale = "plasma", point_size = 1.2)
#> Error in vizDimRed(x = x, dimred = "UMAP", nmf_name = nmf_name, program = program, point_size = point_size, alpha = alpha, color_scale = color_scale, title = title, dims = c(1, 2)): Dimension reduction 'UMAP' not found in reducedDims(x). Available: NMF