Run NMF (non-negative matrix factorization)
Usage
RunNMF(object, ...)
# S3 method for class 'Seurat'
RunNMF(
object,
assay = NULL,
layer = "data",
features = NULL,
nbes = 50,
nmf.method = "RcppML",
tol = 1e-05,
maxit = 100,
rev.nmf = FALSE,
ndims.print = 1:5,
nfeatures.print = 30,
reduction.name = "nmf",
reduction.key = "BE_",
verbose = TRUE,
seed.use = 11,
...
)
# S3 method for class 'Assay'
RunNMF(
object,
assay = NULL,
layer = "data",
features = NULL,
nbes = 50,
nmf.method = "RcppML",
tol = 1e-05,
maxit = 100,
rev.nmf = FALSE,
ndims.print = 1:5,
nfeatures.print = 30,
reduction.key = "BE_",
verbose = TRUE,
seed.use = 11,
...
)
# S3 method for class 'Assay5'
RunNMF(
object,
assay = NULL,
layer = "data",
features = NULL,
nbes = 50,
nmf.method = "RcppML",
tol = 1e-05,
maxit = 100,
rev.nmf = FALSE,
ndims.print = 1:5,
nfeatures.print = 30,
reduction.key = "BE_",
verbose = TRUE,
seed.use = 11,
...
)
# Default S3 method
RunNMF(
object,
assay = NULL,
layer = "data",
nbes = 50,
nmf.method = "RcppML",
tol = 1e-05,
maxit = 100,
rev.nmf = FALSE,
ndims.print = 1:5,
nfeatures.print = 30,
reduction.key = "BE_",
verbose = TRUE,
seed.use = 11,
...
)
Arguments
- object
An object. This can be a Seurat object, an Assay object, or a matrix-like object.
- ...
Additional arguments passed to RcppML::nmf or NMF::nmf.
- assay
The assay to be used for the analysis. Default is
NULL
.- layer
The layer to be used for the analysis. Default is
"data"
.- features
The features to be used for the analysis. Default is
NULL
, which uses all variable features.- nbes
The number of basis vectors (components) to be computed. Default is
50
.- nmf.method
The NMF algorithm to be used. Currently supported values are
"RcppML"
and"NMF"
. Default is"RcppML"
.- tol
The tolerance for convergence (only applicable when nmf.method is
"RcppML"
). Default is1e-5
.- maxit
The maximum number of iterations for convergence (only applicable when nmf.method is
"RcppML"
). Default is100
.- rev.nmf
Whether to perform reverse NMF (i.e., transpose the input matrix) before running the analysis. Default is
FALSE
.- ndims.print
The dimensions (number of basis vectors) to print in the output. Default is
1:5
.- nfeatures.print
The number of features to print in the output. Default is
30
.- reduction.name
The name of the reduction to be stored in the Seurat object. Default is
"nmf"
.- reduction.key
The prefix for the column names of the basis vectors. Default is
"BE_"
.- verbose
Whether to print the message. Default is
TRUE
.- seed.use
The random seed to be used. Default is
11
.
Examples
library(Matrix)
#>
#> Attaching package: ‘Matrix’
#> The following object is masked from ‘package:S4Vectors’:
#>
#> expand
pancreas_sub <- RunNMF(object = pancreas_sub)
#> Warning: Layer ‘data’ is empty
#> Error in apply(X = data_use[features, ], MARGIN = 1, FUN = stats::var): dim(X) must have a positive length
CellDimPlot(
pancreas_sub,
group.by = "CellType",
reduction = "nmf"
)
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.