r语言 - 修拉生成"Error in match(x, table, nomatch = 0L) : 'match' requires vector arguments"中的查找变量特征函数



我正在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?

变量特性已存储在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))

最新更新