Provided graph.name not present in Seurat object

報錯如下

image.png

1. 如果你是運行如下代碼報的錯。

sce
sce <- NormalizeData(sce, normalization.method =  "LogNormalize", 
                     scale.factor = 10000)
GetAssay(sce,assay = "RNA")
sce <- FindVariableFeatures(sce, 
                            selection.method = "vst", nfeatures = 2000) 
sce <- ScaleData(sce) 
sce <- RunPCA(object = sce, pc.genes = VariableFeatures(sce)) 
res.used <- 0.7
sce <- FindClusters(object = sce, verbose = T, resolution = res.used)

則添加一行代碼即可,如下

res.used <- 0.7
sce <- FindNeighbors(sce, dims = 1:10)
sce <- FindClusters(object = sce, verbose = T, resolution = res.used)

2. 如果不是,看下面

2.1問

Sorry for disturbance.
My question is about cluster specific cluster 6, and then warning message shows below:
Error in FindClusters.Seurat(seurat_combined_6, resolution = 0.5) :
Provided graph.name not present in Seurat object
I could not find any method could work this out. Anyone knows how to do with this issue?

Original coding:

library(dplyr)
library(Seurat)
library(patchwork)
#read rds
seurat_combined <- readRDS(file = "~/Downloads/10x_data/seruat out/salinevsAlign_combined_immue cells.rds")
seurat_combined_6 <- subset(x=seurat_combined, idents=c("6"))

#find neighbor
seurat_combined_6 <- FindNeighbors(seurat_combined_6, dims = 1:10)

#find cluster
seurat_combined_6 <- FindClusters(seurat_combined_6, resolution = 0.5)

head(Idents(seurat_combined_6), 5)

#umap
seurat_combined <- RunUMAP(seurat_combined_6, dims = 1:10)
DimPlot(seurat_combined_6, reduction = "umap")

2.2 答

The code you presented should work, (for example, the lines below work)

seurat_combined_6 <- subset(x=pbmc3k, idents=c("6"))
#find neighbor
seurat_combined_6 <- FindNeighbors(seurat_combined_6, dims = 1:10)
#find cluster
seurat_combined_6 <- FindClusters(seurat_combined_6, resolution = 0.5)

You should make sure your assay is set correctly. I.e. if you originally run PCA on integrated values, make sure you have the DefaultAssay set to 'integrated'. This is the most likely cause of the problem, but if that doesn't fix it, please reopen and we'll take a closer look

2.3 問

Thank you for kind answer, following default could fix it:

DefaultAssay(seurat_combined_6 ) <- "integrated"
seurat_combined_6 <- ScaleData(seurat_combined_6 , verbose = FALSE)
seurat_combined_6 <- RunPCA(seurat_combined_6 , npcs = 30, verbose = FALSE)
seurat_combined_6 <- RunUMAP(seurat_combined_6, reduction = "pca", dims = 1:20)

2.4 答

Hi, I had the same issue. Comes up when I subset the seurat3 object and try to subcluster. I tried a fix that worked for me.
You can try to find the name of the graph object stored in the seurat object and specifiy it in the FindClusters function:

`sce<-RunUMAP(sce, reduction = "pca", features = rownames(sce), umap.method = "umap-learn", n.neighbors = 50)
sce<- FindNeighbors(sce, reduction= "umap", dims = 1:2, verbose = T)
sce<- FindClusters(sce, reduction.type="umap", algorithm= 1, resolution = 0.15, verbose = T, graph.name = "RNA_snn")
#################

you can access graph names through:
sce@graphs$graphname # where graphname is what you choose`

Hope that helps.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容