Hi, Thank you for your indication! I have fixed the command as removing gene_id = gene and the title of mgs(cluster_markers_all) following "gene", "type", and "weight".
nmf_mod_ls = SPOTlight( x = seurat_sc,
y = data_sc@assays$Spatial@counts,
group = "category",
mgs = cluster_test,
weight_id = "weight",
group_id = "type",
gene_id = "gene")
However, again, it shows the different error
Error in trainNMF(x = x, y = y, groups = groups, mgs = mgs, n_top = n_top, :
is.null(groups) | length(groups) == ncol(x) is not TRUE
Right now, I have not indicated how to fix it :(