1

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

4

1 回答 1

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))
于 2020-09-25T12:24:54.193 回答