How to use FindSubCluster in Seurat?
2
2
Entering edit mode
21 months ago
Pratik ▴ 850

I just found the FindSubCluster tool within Seurat, and am super excited to use it. Just not sure exactly how!

The usage is here:

FindSubCluster(
  object,
  cluster,
  graph.name,
  subcluster.name = "sub.cluster",
  resolution = 0.5,
  algorithm = 1
)

I receive an error when using it.

> test <- FindSubCluster(scfp, 7, scfp, subcluster.name = "test",  resolution = 3, algorithm = 1)
Error in match(x, table, nomatch = 0L) : 
  'match' requires vector arguments
> test <- FindSubCluster(scfp, 7, scfjjd, subcluster.name = "test",  resolution = 3, algorithm = 1)
Error in `[[.Seurat`(object, graph.name) : object 'scfjjd' not found
> test <- FindSubCluster(scfp, 7, RNA, subcluster.name = "test",  resolution = 3, algorithm = 1)
Error in `[[.Seurat`(object, graph.name) : object 'RNA' not found

My object name is scfp. I have done FindClusters already. The cluster I wish to subcluster is 7.

I think my trouble is with the graph.name argument.

I tried this:

> test <- FindSubCluster(scfp, "7", "scfp", subcluster.name = "test",  resolution = 3, algorithm = 1)
Error: Cannot find 'scfp' in this Seurat object

Still no success yet...

Any help would really be appreciated!

seurat R single cell RNA-seq • 7.2k views
ADD COMMENT
1
Entering edit mode

I have never used that function, so I could be completely off, but have a look at FindMultiModalNeighbors. It could be similar to AddModuleScore, which computes the score and add a column (score name) to your metadata.

ADD REPLY
0
Entering edit mode

Thank you @fracarb8. So I got the command to go through after this:

I went to: https://satijalab.org/seurat/articles/multimodal_reference_mapping.html

and Ctrl+F: graph.name

Turns out graph.name is an argument in FindNeighbors. So I just use the FindNeighbors command choosing graph.name as some arbitrary name (test). and then reran FindSubCluster and it worked, partially.

So it looks something like this:

scfp <- FindNeighbors(scfp, graph.name = "test", dims = 1:100)
scfp <- FindClusters(scfp, graph.name = "test", resolution = 4, algorithm = 1, verbose = TRUE)
scfp <- FindSubCluster(scfp, "5", "test", subcluster.name = "blood",  resolution = 2, algorithm = 1)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 93
Number of edges: 758

Running Louvain algorithm...
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.2673
Number of communities: 8
Elapsed time: 0 seconds
1 singletons identified. 7 final clusters.

However, no success in visualizing the results via tSNE or UMAP. I tried rerunning RunTSNE, and then seeing the plot, but still no success.

ADD REPLY
4
Entering edit mode
21 months ago
Pratik ▴ 850

Okay so I got it... I think. I explored the Seurat object a litle bit more and found that the cluster assignments were saved. I was able to visualize using the group.by argument so here is the process:

scfp <- FindNeighbors(scfp, graph.name = "test", dims = 1:100)
scfp <- FindClusters(scfp, graph.name = "test", resolution = 2, algorithm = 1, verbose = TRUE)
scfp <- RunTSNE(scfp, dims = 1:100)
DimPlot(scfp, reduction = "tsne", label = TRUE, label.size = 6 )

enter image description here And then after doing this:

scfp <- FindSubCluster(scfp, "6", "test", subcluster.name = "blood",  resolution = 2, algorithm = 1)
DimPlot(scfp, reduction = "tsne", group.by = "blood", label = TRUE, label.size = 6)

This is the resulting tSNE:

enter image description here

Of course going to play around to optimize cluster numbers...

Thank you @fracarb8. You got me going!

ADD COMMENT
2
Entering edit mode

Just found out that even if you don't rerun FindNeighbors with graph.name = "test", you can find the default names of the graphs here: names(yourSeuratObject@graphs).

For my integrated object these are integrated_nn and integrated_snn.

ADD REPLY

Login before adding your answer.

Traffic: 2132 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6