簡體   English   中英

修拉中的 FindVariableFeatures Function 產生“匹配錯誤(x,表,nomatch = 0L):'匹配'需要向量參數”

[英]FindVariableFeatures Function in Seurat Producing “Error in match(x, table, nomatch = 0L) : 'match' requires vector arguments”

我在 RStudio 中運行 Seurat V3,並嘗試在新的子集 object 上運行 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為向量和 dataframe,但無濟於事。 我還想問:從較大的數據集子集新數據集后,我是否需要重新運行 FindVariableFeatures?

變量特征已經存儲在 Seurat object 中。 您可以使用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" 

然后你可以像這樣運行它,雖然默認情況下,它會使用存儲在 object 中的變量特征:

pbmc_small <- RunPCA(pbmc_small,features = VariableFeatures(pbmc_small))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM