trainNMF | R Documentation |
This is the training function used by SPOTLight. This function takes in single cell expression data, trains the model and learns topic profiles for each cell type
trainNMF(
x,
y,
groups = NULL,
mgs,
n_top = NULL,
gene_id = "gene",
group_id = "cluster",
weight_id = "weight",
hvg = NULL,
model = c("ns", "std"),
scale = TRUE,
verbose = TRUE,
slot_sc = "counts",
slot_sp = "counts",
...
)
x, y |
single-cell and mixture dataset, respectively. Can be a
numeric matrix or |
groups |
character vector of group labels for cells in |
mgs |
|
n_top |
integer scalar specifying the number of markers to select per group. By default NULL uses all the marker genes to initialize the model. |
gene_id, group_id, weight_id |
character specifying the column
in |
hvg |
character vector containing hvg to include in the model. By default NULL. |
model |
character string indicating which model to use when running NMF. Either "ns" (default) or "std". |
scale |
logical specifying whether to scale single-cell counts to unit variance. This gives the user the option to normalize the data beforehand as you see fit (CPM, FPKM, ...) when passing a matrix or specifying the slot from where to extract the count data. |
verbose |
logical. Should information on progress be reported? |
slot_sc, slot_sp |
If the object is of class |
... |
additional parameters. |
base a list where the first element is an NMFfit
object and
the second is a matrix containing the topic profiles learnt.
Marc Elosua Bayes & Helena L Crowell
set.seed(321)
# mock up some single-cell, mixture & marker data
sce <- mockSC(ng = 200, nc = 10, nt = 3)
spe <- mockSP(sce)
mgs <- getMGS(sce)
res <- trainNMF(
x = sce,
y = spe,
groups = sce$type,
mgs = mgs,
weight_id = "weight",
group_id = "type",
gene_id = "gene")
# Get NMF model
res[["mod"]]
# Get topic profiles
res[["topic"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.