Skip to contents

Run NMF (non-negative matrix factorization)

Usage

RunNMF(object, ...)

# S3 method for Seurat
RunNMF(
  object,
  assay = NULL,
  slot = "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 Assay
RunNMF(
  object,
  assay = NULL,
  slot = "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 default
RunNMF(
  object,
  assay = NULL,
  slot = "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.

slot

A character string specifying the slot name 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

pancreas_sub <- RunNMF(object = pancreas_sub)
#> 
#> iter |      tol 
#> ---------------
#>    1 | 9.14e-01
#>    2 | 1.44e-01
#>    3 | 5.46e-02
#>    4 | 2.44e-02
#>    5 | 1.24e-02
#>    6 | 5.94e-03
#>    7 | 3.16e-03
#>    8 | 2.21e-03
#>    9 | 1.20e-03
#>   10 | 8.20e-04
#>   11 | 6.44e-04
#>   12 | 5.50e-04
#>   13 | 4.69e-04
#>   14 | 3.79e-04
#>   15 | 2.90e-04
#>   16 | 2.37e-04
#>   17 | 2.15e-04
#>   18 | 2.23e-04
#>   19 | 2.11e-04
#>   20 | 1.96e-04
#>   21 | 1.80e-04
#>   22 | 1.66e-04
#>   23 | 1.62e-04
#>   24 | 1.59e-04
#>   25 | 1.46e-04
#>   26 | 1.51e-04
#>   27 | 1.93e-04
#>   28 | 1.54e-04
#>   29 | 1.22e-04
#>   30 | 1.05e-04
#>   31 | 9.14e-05
#>   32 | 8.19e-05
#>   33 | 7.46e-05
#>   34 | 6.69e-05
#>   35 | 6.08e-05
#>   36 | 5.81e-05
#>   37 | 5.03e-05
#>   38 | 4.57e-05
#>   39 | 4.40e-05
#>   40 | 4.55e-05
#>   41 | 4.98e-05
#>   42 | 5.38e-05
#>   43 | 5.54e-05
#>   44 | 5.56e-05
#>   45 | 5.61e-05
#>   46 | 5.44e-05
#>   47 | 5.40e-05
#>   48 | 5.52e-05
#>   49 | 5.60e-05
#>   50 | 5.67e-05
#>   51 | 5.88e-05
#>   52 | 6.37e-05
#>   53 | 7.04e-05
#>   54 | 7.89e-05
#>   55 | 8.92e-05
#>   56 | 9.97e-05
#>   57 | 1.10e-04
#>   58 | 1.18e-04
#>   59 | 1.20e-04
#>   60 | 1.20e-04
#>   61 | 1.03e-04
#>   62 | 8.57e-05
#>   63 | 7.39e-05
#>   64 | 6.66e-05
#>   65 | 6.40e-05
#>   66 | 6.66e-05
#>   67 | 7.19e-05
#>   68 | 8.22e-05
#>   69 | 9.14e-05
#>   70 | 1.00e-04
#>   71 | 1.10e-04
#>   72 | 1.23e-04
#>   73 | 1.34e-04
#>   74 | 1.47e-04
#>   75 | 1.54e-04
#>   76 | 1.52e-04
#>   77 | 1.52e-04
#>   78 | 1.57e-04
#>   79 | 1.64e-04
#>   80 | 1.74e-04
#>   81 | 1.91e-04
#>   82 | 2.12e-04
#>   83 | 2.39e-04
#>   84 | 2.69e-04
#>   85 | 3.04e-04
#>   86 | 3.60e-04
#>   87 | 3.20e-04
#>   88 | 3.08e-04
#>   89 | 2.86e-04
#>   90 | 2.46e-04
#>   91 | 1.99e-04
#>   92 | 1.60e-04
#>   93 | 1.38e-04
#>   94 | 1.23e-04
#>   95 | 1.12e-04
#>   96 | 1.01e-04
#>   97 | 8.66e-05
#>   98 | 6.74e-05
#>   99 | 4.89e-05
#>  100 | 3.77e-05
#> 
#>  convergence not reached in 100 iterations
#>   (actual tol = 3.77e-05, target tol = 1.00e-05)
#> BE_ 1 
#> Positive:  Pfn1, Ybx1, Eif5a, Prdx1, Atp5b, Eif4a1, Mdk, Pebp1, Ldha, Hmgn1 
#> 	   Rpl5, Ccnd1, Cox8a, Ywhae, Rpl27, Chchd2, Cox4i1, Dbi, Btf3, Atp5a1 
#> 	   Ppp1ca, Wfdc2, Psma7, Cfl1, Hnrnpk, Atp5h, Atp5j, Uqcrb, Psmb6, Cd24a 
#> Negative:  Ddx3y, Figf, Ace2, Tmem27, Ap1s2, Rai2, Map3k15, Sh3kbp1, Smpx, Cypt3 
#> 	   Usp51, Wnk3, Alg13, Pak3, Nxt2, Cldn2, Mum1l1, Nrk, Zcchc18, Tceal1 
#> 	   Gprasp1, Cenpi, Pou3f4, Fam46d, Magee1, Chic1, Stard8, Pcyt1b, Arx, Gdi1 
#> BE_ 2 
#> Positive:  Cox4i1, Chchd2, Rpl27, Rpl5, Rpl15, Cox8a, Eif3h, Btf3, Hint1, Aes 
#> 	   Rpl30, Sub1, Atp5h, Ctrb1, Ndufa4, Eif3k, Cox6b1, Pebp1, Slc25a3, Psmb1 
#> 	   Atpif1, Atp5f1, Atp5j2, Atp5d, Psma7, Atp5b, Malat1, Atp5c1, Atp5j, Pcbp2 
#> Negative:  Ddx3y, Fancb, Figf, Ace2, Tmem27, Ap1s2, Rai2, Map3k15, Sh3kbp1, Smpx 
#> 	   Cypt3, Ubqln2, Usp51, Wnk3, Pak3, Cldn2, Nrk, Zcchc18, Tceal3, Gprasp1 
#> 	   Cenpi, Pou3f4, Fam46d, Magee1, Stard8, Msn, Pcyt1b, Arx, Xlr4b, Hmgb3 
#> BE_ 3 
#> Positive:  Bex2, Fev, Hmgn3, Krt7, Cystm1, Cryba2, Aplp1, Glud1, Cpe, Cfl1 
#> 	   Pfn1, Ffar2, Tm4sf4, Eif4a1, Btg2, Map1b, Hnrnpk, Cldn4, Ypel3, Gch1 
#> 	   Akr1c19, Gars, Eif3h, Pgrmc1, Runx1t1, Rap1b, Ywhae, Pcbp2, Fxyd3, Jun 
#> Negative:  Fancb, Figf, Ace2, Tmem27, Rai2, Smpx, Usp51, Wnk3, Alg13, Nxt2 
#> 	   Cldn2, Nrk, Zcchc18, Gprasp1, Fam46d, Chic1, Stard8, Msn, Dusp9, Xlr3b 
#> 	   Hmgb3, 3830403N18Rik, Ocrl, Zcchc12, Usp9x, Slc38a5, Pcsk1n, Rnf138rt1, Reps2, Prdx4 
#> BE_ 4 
#> Positive:  Spp1, Dbi, Mgst1, Hmgn1, Mdk, S100a11, Cd24a, Atp1b1, Ywhae, Prdx1 
#> 	   Sparc, Hnrnpk, Atp5h, Pebp1, Cldn3, Cox4i1, Cfl1, Acot1, Aes, Rpl30 
#> 	   Eif4a1, Vim, Ambp, Atp5a1, Ptn, Jun, Serbp1, Cox6b1, Rpl5, Clu 
#> Negative:  Erdr1, Fancb, Figf, Tmem27, Ap1s2, Rai2, Map3k15, Sh3kbp1, Smpx, Cypt3 
#> 	   Ubqln2, Usp51, Wnk3, Alg13, Pak3, Prps1, Mum1l1, Nrk, Zcchc18, Tceal3 
#> 	   Gprasp1, Cenpi, Pou3f4, Fam46d, Magee1, Chic1, Msn, Pcyt1b, Arx, Gdi1 
#> BE_ 5 
#> Positive:  Krt18, Jun, Cyr61, Vim, Cldn3, Ier2, Cox4i1, Pfn1, S100a11, Atp1b1 
#> 	   Prdx1, Anxa2, Atp5b, Dbi, Sparc, H19, Lurap1l, Tagln2, Pdzk1ip1, Sox9 
#> 	   Hes1, Eif3h, Tpm1, Krt19, Slc25a3, 8430408G22Rik, Actb, Fos, Rpl15, Id2 
#> Negative:  Ddx3y, Fancb, Ace2, Tmem27, Ap1s2, Rai2, Map3k15, Smpx, Cypt3, Ubqln2 
#> 	   Usp51, Wnk3, Alg13, Pak3, Prps1, Mum1l1, Nrk, Zcchc18, Tceal1, Tceal3 
#> 	   Gprasp1, Cenpi, Pou3f4, Fam46d, Magee1, Chic1, Msn, Arx, Atp6ap1, Bgn 
CellDimPlot(pancreas_sub, group.by = "CellType", reduction = "nmf")