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 function.
- assay
A character string specifying the assay to be used for the analysis. Default is NULL.
- layer
A character string specifying the layer to be used for the analysis. Default is "data".
- features
A character vector specifying the features to be used for the analysis. Default is NULL, which uses all variable features.
- nbes
An integer specifying the number of basis vectors (components) to be computed. Default is 50.
- nmf.method
A character string specifying the NMF algorithm to be used. Currently supported values are "RcppML" and "NMF". Default is "RcppML".
- tol
A numeric value specifying the tolerance for convergence (only applicable when nmf.method is "RcppML"). Default is 1e-5.
- maxit
An integer specifying the maximum number of iterations for convergence (only applicable when nmf.method is "RcppML"). Default is 100.
- rev.nmf
A logical value indicating whether to perform reverse NMF (i.e., transpose the input matrix) before running the analysis. Default is FALSE.
- ndims.print
An integer vector specifying the dimensions (number of basis vectors) to print in the output. Default is 1:5.
- nfeatures.print
An integer specifying the number of features to print in the output. Default is 30.
- reduction.name
A character string specifying the name of the reduction to be stored in the Seurat object. Default is "nmf".
- reduction.key
A character string specifying the prefix for the column names of the basis vectors. Default is "BE_".
- verbose
A logical value indicating whether to print verbose output. Default is TRUE.
- seed.use
An integer specifying the random seed to be used. Default is 11.
Examples
library(Matrix)
pancreas_sub <- RunNMF(object = pancreas_sub)
#>
#> iter | tol
#> ---------------
#> 1 | 6.93e-01
#> 2 | 1.03e-01
#> 3 | 3.21e-02
#> 4 | 1.47e-02
#> 5 | 8.33e-03
#> 6 | 5.22e-03
#> 7 | 3.55e-03
#> 8 | 2.59e-03
#> 9 | 1.97e-03
#> 10 | 1.52e-03
#> 11 | 1.21e-03
#> 12 | 9.88e-04
#> 13 | 8.17e-04
#> 14 | 6.82e-04
#> 15 | 5.71e-04
#> 16 | 4.81e-04
#> 17 | 4.10e-04
#> 18 | 3.49e-04
#> 19 | 3.08e-04
#> 20 | 2.80e-04
#> 21 | 2.53e-04
#> 22 | 2.30e-04
#> 23 | 2.12e-04
#> 24 | 1.95e-04
#> 25 | 1.83e-04
#> 26 | 1.72e-04
#> 27 | 1.64e-04
#> 28 | 1.58e-04
#> 29 | 1.54e-04
#> 30 | 1.51e-04
#> 31 | 1.49e-04
#> 32 | 1.49e-04
#> 33 | 1.51e-04
#> 34 | 1.54e-04
#> 35 | 1.58e-04
#> 36 | 1.61e-04
#> 37 | 1.65e-04
#> 38 | 1.67e-04
#> 39 | 1.68e-04
#> 40 | 1.67e-04
#> 41 | 1.66e-04
#> 42 | 1.63e-04
#> 43 | 1.59e-04
#> 44 | 1.55e-04
#> 45 | 1.50e-04
#> 46 | 1.44e-04
#> 47 | 1.36e-04
#> 48 | 1.24e-04
#> 49 | 1.12e-04
#> 50 | 1.01e-04
#> 51 | 8.96e-05
#> 52 | 7.88e-05
#> 53 | 7.01e-05
#> 54 | 6.33e-05
#> 55 | 5.80e-05
#> 56 | 5.33e-05
#> 57 | 4.98e-05
#> 58 | 4.66e-05
#> 59 | 4.35e-05
#> 60 | 4.13e-05
#> 61 | 3.91e-05
#> 62 | 3.70e-05
#> 63 | 3.45e-05
#> 64 | 3.22e-05
#> 65 | 2.97e-05
#> 66 | 2.72e-05
#> 67 | 2.53e-05
#> 68 | 2.37e-05
#> 69 | 2.25e-05
#> 70 | 2.13e-05
#> 71 | 2.04e-05
#> 72 | 1.96e-05
#> 73 | 1.89e-05
#> 74 | 1.84e-05
#> 75 | 1.79e-05
#> 76 | 1.76e-05
#> 77 | 1.75e-05
#> 78 | 1.73e-05
#> 79 | 1.72e-05
#> 80 | 1.73e-05
#> 81 | 1.75e-05
#> 82 | 1.78e-05
#> 83 | 1.81e-05
#> 84 | 1.85e-05
#> 85 | 1.91e-05
#> 86 | 1.98e-05
#> 87 | 2.05e-05
#> 88 | 2.13e-05
#> 89 | 2.20e-05
#> 90 | 2.27e-05
#> 91 | 2.33e-05
#> 92 | 2.39e-05
#> 93 | 2.35e-05
#> 94 | 2.36e-05
#> 95 | 2.22e-05
#> 96 | 2.16e-05
#> 97 | 2.11e-05
#> 98 | 2.10e-05
#> 99 | 2.09e-05
#> 100 | 2.09e-05
#>
#> convergence not reached in 100 iterations
#> (actual tol = 2.09e-05, target tol = 1.00e-05)
#> ℹ BE_ 1
#> Positive: Spp1, Sparc, Atp1b1, Vim, Dbi, Clu, Mgst1, Anxa2, Acot1, Cldn3
#> Krt18, Mt1, 1700011H14Rik, Id2, S100a10, Gsta3, S100a11, Krt8, Bicc1, Jun
#> Pdzk1ip1, Mt2, Cyr61, Nudt19, Smtnl2, Ifitm2, Rps12, Sox9, Lurap1l, Rpl12
#> Negative: Doc2b, Gm10244, Gm44210, Pdgfc, Snhg11, 9930012K11Rik, Fut1, Ak5, Efnb2, Carhsp1
#> Hmgcr, Scnn1b, Gmds, Msh6, Ap3b2, Tmem184c, Cgref1, Diaph3, Antxr2, Insig1
#> Tmem198, Mat1a, Rfx6, Pif1, Atp2c1, Rnf150, Xkr5, Ccer2, Pidd1, Reep1
#> BE_ 2
#> Positive: Spp1, Ccnd1, Wfdc2, Mdk, Mgst1, Pebp1, Ptn, Cldn10, Vim, Gapdh
#> Krt8, Cldn3, Sox9, Krt18, Dbi, Aldh1b1, Ldha, Eno1, Rps12, Npm1
#> Rpl12, Ptma, Phgdh, Lurap1l, Deb1, Cd24a, Id2, Atp1b1, Tst, Ybx1
#> Negative: Foxm1, Gm10244, Gm44210, Pdgfc, Snhg11, 9930012K11Rik, Fut1, Fxyd1, Carhsp1, Hmgcr
#> Ap3b2, Tmem184c, Cgref1, Antxr2, Nbl1, Tmem198, Syt17, Mat1a, Rfx6, Atp2c1
#> Rnf150, Xkr5, Ccer2, Reep1, Elfn1, Tmem132b, Msantd1, Ajap1, Trpc4, Hist2h4
#> BE_ 3
#> Positive: Clu, Spp1, Mt1, Csrp2, Krt18, Muc1, H19, Cldn3, Mt2, Hhex
#> Gapdh, Mdk, Rps12, Akr1c19, Mgst1, Rpl36a, Cyr61, Atp1b1, Zfos1, S100a11
#> Pdzk1ip1, Sparc, 1700011H14Rik, Ambp, Gas6, Ldha, 8430408G22Rik, Ttr, Jun, Pdgfa
#> Negative: Doc2b, Foxm1, Prdm5, Gm10244, Gm44210, Fut1, Fxyd1, Ak5, Efnb2, Carhsp1
#> Rrbp1, Hmgcr, Scnn1b, Ap3b2, Tmem184c, Fgfr1, Diaph3, Insig1, Dzip1l, Tmem198
#> Mapkapk3, Rfx6, Pif1, Atp2c1, Rnf150, Ccer2, Pidd1, Tmem132b, Ajap1, Trpc4
#> BE_ 4
#> Positive: Cck, Gadd45a, Mdk, Sox4, Ppp1r14a, Selm, Tmsb4x, Tubb3, Jun, Igfbpl1
#> Btbd17, Neurod2, Sult2b1, Cldn6, Cdkn1a, Smarcd2, Cotl1, Mfap4, Btg2, Hes6
#> Ptma, Aplp1, Sh3bgrl3, Hn1, Mfng, Ppp3ca, Camk2n1, Npm1, Rpl12, Gnas
#> Negative: Doc2b, Foxm1, Prdm5, Gm10244, Pdgfc, Fut1, Fxyd1, Ak5, Efnb2, Ugt2b35
#> Rrbp1, Sult5a1, Scnn1b, Gmds, Notch1, Fgfr1, Clcf1, Cgref1, Diaph3, Neu2
#> Hprt, Antxr2, Nbl1, Dzip1l, Tmem198, Mapkapk3, Atp2c1, Rnf150, Xkr5, Pidd1
#> BE_ 5
#> Positive: 2810417H13Rik, Dut, Rrm2, Pcna, Lig1, Hmgb2, Tyms, H2afz, Gmnn, Tuba1b
#> Tipin, Dek, Dnajc9, Tubb5, Mcm5, Tk1, Nasp, Siva1, Gins2, Mcm6
#> Rpa2, Spc24, Mcm3, Dhfr, Ranbp1, Uhrf1, Rfc2, Snrpd1, Cks1b, Dnmt1
#> Negative: Doc2b, Prdm5, Gm44210, Snhg11, 9930012K11Rik, Fut1, Ak5, Efnb2, Ugt2b35, Rrbp1
#> Scnn1b, Ap3b2, Cgref1, Pcdh9, Neu2, Tmem198, Mapkapk3, Rfx6, Pif1, Rnf150
#> Ccer2, Tmem132b, Ajap1, Tpm2, Trpc4, 1700018L02Rik, Gpld1, Akr1c18, Ngb, Efr3b
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.