scRNA-seq Clustering(二)

时间:2022-07-23
本文章向大家介绍scRNA-seq Clustering(二),主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Cluster the cells

Seurat使用基于graph的聚类方法,该方法使用K最近邻(KNN)图(默认情况下)将细胞嵌入到图结构中,在具有相似基因表达模式的细胞之间绘制边缘。然后,它试图将该图划分为高度互连的‘quasi-cliques’或 ‘communities’[ Seurat - Guided Clustering Tutorial(https://satijalab.org/seurat/v3.1/pbmc3k_tutorial.html)]。

我们将使用 FindClusters() 函数来执行基于图的分群。resolution 是设置下游聚类分群“granularity”的重要参数,需要针对每个单独的实验进行优化。对于3,000-5,000个单元的数据集,resolution设置在0.4-1.4之间的通常会产生良好的聚类。分辨率值越高,簇的数量就越多,这对于较大的数据集通常是必需的。

FindClusters() 函数允许我们输入一系列分辨率,来计算分群的“granularity”。这对于测试哪个分辨率最合适非常有帮助,而不必为每个分辨率都单独运行该函数。

# Determine the K-nearest neighbor graph
seurat_integrated <- FindNeighbors(object = seurat_integrated,
                                dims = 1:40)
                                
# Determine the clusters for various resolutions
seurat_integrated <- FindClusters(object = seurat_integrated,
                               resolution = c(0.4, 0.6, 0.8, 1.0, 1.4))

如果我们查看Seurat对象的元数据( seurat_integrated@metadata ),则计算出的每种不同分辨率都有单独的列。

# Explore resolutions
seurat_integrated@meta.data %>%
        View()

一开始选择分辨率,我们通常选择介于0.6或0.8之间的分辨率。我们将从0.8的分辨率开始,首先使用 Idents() 函数指定分群的标识。

# Assign identity of clusters
Idents(object = seurat_integrated) <- "integrated_snn_res.0.8"

为了可视化细胞群集,有几种不同的降维技术可能会有所帮助。最流行的方法包括 t-distributed stochastic neighbor embedding (t-SNE)(https://kb.10xgenomics.com/hc/en-us/articles/217265066-What-is-t-Distributed-Stochastic-Neighbor-Embedding-t-SNE-) 和Uniform Manifold Approximation and Projection (UMAP) (https://umap-learn.readthedocs.io/en/latest/index.html)技术。

这两种方法的目的都是将高维空间中具有相似局部邻域的细胞放在一起放在低维空间中。这些方法将要求您输入用于可视化的PCA维度的数量,我们建议使用与聚类分析输入相同的PC数量。在这里,我们将继续使用UMAP方法(https://umap-learn.readthedocs.io/en/latest/how_umap_works.html) 来可视化分群。

## Calculation of UMAP
## DO NOT RUN (calculated in the last lesson)

# seurat_integrated <- RunUMAP(seurat_integrated,
#                  reduction = "pca",
#                  dims = 1:40)
# Plot the UMAP
DimPlot(seurat_integrated,
        reduction = "umap",
        label = TRUE,
        label.size = 6)

这对 探索其他分辨率 也很有用。它将使您快速了解如何根据分辨率参数更改分群。例如,让我们切换为0.4的分辨率:

# Assign identity of clusters
Idents(object = seurat_integrated) <- "integrated_snn_res.0.4"

# Plot the UMAP
DimPlot(seurat_integrated,
        reduction = "umap",
        label = TRUE,
        label.size = 6)

你的UMAP图与上面的相比怎么样?

与课程中的图像相比,簇的外观可能存在一些变化。特别是,您可能会看到分群标签的不同之处。这主要是软件包版本(主要是Seurat依赖项)稍有不同造成的不幸结果。

如果您的分群看起来与课程中的内容相同,请转到下一节,不用下载任何内容。


如果您的群集看起来与课程中的不同,请单击鼠标右键并将此Rdata 文件(https://www.dropbox.com/s/sz2xpg43xnbv7qx/seurat_integrated.RData.bz?dl=1) 下载到 data 文件夹。它包含我们为该类创建的 seurat_integrated 对象。

下载该大文件后,您需要:

  • 解压
  • 将该对象加载到R会话并覆盖现有对象:
load("data/seurat_integrated.RData")

我们现在将继续使用0.8分辨率来检查预期细胞类型的质量控制度量和已知标记。再次绘制UMAP,以确保您现在的图像与您在课程中看到的图像相同:

# Assign identity of clusters
Idents(object = seurat_integrated) <- "integrated_snn_res.0.8"

# Plot the UMAP
DimPlot(seurat_integrated,
        reduction = "umap",
        label = TRUE,
        label.size = 6)

未完待续......


注:以上内容来自哈佛大学生物信息中心(HBC)_的教学团队的生物信息学培训课程。原文链接:https://hbctraining.github.io/scRNA-seq/schedule/ 点击 “阅读原文” 可直达。