我正在RStudio中运行Seurat V3,并尝试在新子集的对象上运行PCA。作为该过程的一部分,我正在使用以下命令:
tnk.cells <- FindVariableFeatures(tnk.cells, assay = "RNA", selection.method = "vst", nfeatures = 2000)
tnk.cells <- RunPCA(tnk.cells, verbose = TRUE, npcs = 30, features = FindVariableFeatures(tnk.cells))
第一个过程似乎有效,但是我不确定是否确实如此,如果可以,我是否需要在第二个命令中指定“功能”应引用这些功能。无论哪种方式,每次我尝试运行第二个命令时,它都会产生此错误以及三个警告消息:
Error in match(x, table, nomatch = 0L) :
'match' requires vector arguments
In addition: Warning messages:
1: In FindVariableFeatures.Assay(object = assay.data, selection.method = selection.method, :
selection.method set to 'vst' but count slot is empty; will use data slot instead
2: In eval(predvars, data, env) : NaNs produced
3: In hvf.info$variance.expected[not.const] <- 10^fit$fitted :
number of items to replace is not a multiple of replacement length
有人知道为什么会产生这些错误/警告吗?我试图将“ FindVariableFeatures”的输出强制为矢量和数据帧,但无济于事。我还想问一问:从较大的数据集中替换一个新数据集后,是否需要重新运行FindVariableFeatures?
答案 0 :(得分:1)
变量特征已经存储在Seurat对象中。您可以使用VariableFeatures()
来访问它们,例如:
library(Seurat)
pbmc_small =SCTransform(pbmc_small)
pbmc_small = FindVariableFeatures(pbmc_small,nfeatures=20)
head(VariableFeatures(pbmc_small))
[1] "GNLY" "PPBP" "PF4" "S100A8" "VDAC3" "CD1C"
然后您可以像这样运行它,尽管默认情况下,它将使用存储在对象中的变量功能:
pbmc_small <- RunPCA(pbmc_small,features = VariableFeatures(pbmc_small))