Seurat中的FindVariableFeatures函数产生“ match(x,table,nomatch = 0L)中的错误:'match'需要向量参数”

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

tangfeng1212 回答:Seurat中的FindVariableFeatures函数产生“ match(x,table,nomatch = 0L)中的错误:'match'需要向量参数”

变量特征已经存储在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))
本文链接:https://www.f2er.com/3079840.html

大家都在问