跟着Seurat官网学Xenium空转分析

文摘   2025-01-11 11:25   美国  

Xenium是由 10x Genomics 推出的一种先进的空间转录组学技术,能够在单细胞分辨率的基础上,精确地检测和定位组织切片中的基因表达情况。这项技术结合了分子检测与空间定位的优势,为研究细胞在组织中的位置及其功能关系提供了重要工具。这里看一下AI对Xenium的理解,描述的非常详细:

  • Xenium 的核心原理:Xenium 的核心是基于高通量的原位杂交 (In Situ Hybridization, ISH) 技术。通过使用特异性探针捕获 RNA 分子,并在组织切片上直接检测信号,Xenium 能够实现以下目标:

    • 单细胞分辨率:识别每个细胞的基因表达模式。

    • 空间信息整合:保留组织切片中细胞的物理位置,揭示细胞间的空间关系。

    • 高通量检测:同时检测数千个目标基因,满足复杂样本的多维度分析需求。

  • Xenium 的技术优势:

    • 空间与分子信息结合:能够同时获得基因表达的数量和细胞所在的组织位置。

    • 无需解离组织:保留了细胞与组织环境的原始结构关系,避免传统单细胞 RNA 测序中组织解离造成的信息丢失。

    • 高通量:相比于传统的空间转录组学方法,Xenium 提供了更高的基因检测通量和精度。

  • Xenium 的应用场景:Xenium 技术在许多生物医学研究领域具有广泛应用,包括但不限于:

    • 肿瘤微环境研究:研究肿瘤细胞与免疫细胞之间的空间关系,揭示潜在的调控机制。

    • 神经科学:解析大脑组织中不同神经元的空间分布及基因表达特性。

    • 发育生物学:监测胚胎发育过程中细胞分化与空间分布的动态变化。

    • 免疫研究:探索免疫细胞在组织中的分布及其与病原体或其他细胞的交互。

下面跟着Seurat学习Xenium的分析流程。Seurat官方教程在https://satijalab.org/seurat/articles/seurat5_spatial_vignette_2

首先下载示例数据:

## Mouse_Brain
wget https://cf.10xgenomics.com/samples/xenium/1.0.2/Xenium_V1_FF_Mouse_Brain_Coronal_Subset_CTX_HP/Xenium_V1_FF_Mouse_Brain_Coronal_Subset_CTX_HP_outs.zip

unzip Xenium_V1_FF_Mouse_Brain_Coronal_Subset_CTX_HP_outs.zip

一. 读入数据

首先,我们读取数据集并创建一个Seurat对象。提供Xenium运行的数据文件夹的路径作为输入路径。RNA数据存储在Seurat对象的Xenium分析中。这一步大概需要一分钟。

library(Seurat)
library(qs)
library(ggplot2)
library(dplyr)

path <- "./Rawdata"
# Load the Xenium data
xenium.obj <- LoadXenium(path, fov = "fov")
# remove cells with 0 counts
xenium.obj <- subset(xenium.obj, subset = nCount_Xenium > 0)

空间信息被加载到Seurat对象的插槽中。

可视化每个细胞基因数量(nFeature_Xenium)和每个细胞的转录本计数情况(nCount_Xenium):

VlnPlot(xenium.obj, features = c("nFeature_Xenium""nCount_Xenium"), ncol = 2, pt.size = 0)
image-20241212233704589

Xenium数据使用ImageDimPlot进行spatial的可视化,这里可以使用这个函数展示一些感兴趣的marker基因:

ImageDimPlot(xenium.obj, fov = "fov", molecules = c("Gad1""Sst""Pvalb""Gfap"), nmols = 20000)
image-20241212233806255

我们还可以使用ImageFeaturePlot()在单细胞水平上可视化关键基因的表达水平。基于这个函数,我们可以设置一个参数调整基因表达的最大值以提高可视化的对比度,例如每个基因的截止值大约为其计数分布的第90个百分位数(可以用max.cutoff='q90'指定)。

ImageFeaturePlot(xenium.obj, features = c("Cux2""Rorb""Bcl11b""Foxp2"), max.cutoff = c(25,
    351210), size = 0.75, cols = c("white""red"))
image-20241212233835957

我们可以使用Crop函数放大选定区域。一旦放大,我们可以看到细胞分割边界以及单个分子。

cropped.coords <- Crop(xenium.obj[["fov"]], x = c(12002900), y = c(37504550), coords = "plot")
xenium.obj[["zoom"]] <- cropped.coords
# visualize cropped area with cell segmentations & selected molecules
DefaultBoundary(xenium.obj[["zoom"]]) <- "segmentation"
ImageDimPlot(xenium.obj, fov = "zoom", axes = TRUE, border.color = "white", border.size = 0.1, cols = "polychrome",
    coord.fixed = FALSE, molecules = c("Gad1""Sst""Npy2r""Pvalb""Nrn1"), nmols = 10000)
image-20241212233955799

二. 标准化分析流程

接下来,我们使用SCTransform进行标准化,然后是降维和聚类分析:

xenium.obj <- SCTransform(xenium.obj, assay = "Xenium") %>% 
  RunPCA(npcs = 30, features = rownames(xenium.obj)) %>% 
  RunUMAP(dims = 1:30) %>% 
  FindNeighbors(reduction = "pca", dims = 1:30) %>% 
  FindClusters(resolution = 0.3)

然后,我们可以通过在UMAP空间中使用DimPlot或在图像上使用ImageDimPlot可视化聚类结果:

DimPlot(xenium.obj)
image-20241212234157999
#FeaturePlot检查marker在umap上的分布情况
#FeaturePlot(xenium.obj, features = c("Cux2", "Bcl11b", "Foxp2", "Gad1", "Sst", "Gfap"))
ImageDimPlot(xenium.obj, cols = "polychrome", size = 0.75)
image-20241212234301617

利用每个细胞的位置信息,计算空间生态位。我们使用来自艾伦大脑研究所的皮质参考来注释细胞,所以我们首先从Xenium数据中取子集,得到皮质细胞。Allen Brain参考可以安装在这里(https://www.dropbox.com/s/cuowvm4vrf65pvq/allen_cortex.rds?dl=1)。

我们使用Slc17a7表达来帮助确定皮质区域。

p1 <- ImageFeaturePlot(xenium.obj, features = "Slc17a7", axes = TRUE, max.cutoff = "q90")
p1
image-20241212235840963
crop <- Crop(xenium.obj[["fov"]], x = c(6002100), y = c(9004700))
xenium.obj[["crop"]] <- crop
p2 <- ImageFeaturePlot(xenium.obj, fov = "crop", features = "Slc17a7", size = 1, axes = TRUE, max.cutoff = "q90")
p2
image-20241212234607132

三. RCTD解卷积

Seurat v5现已纳入RCTD算法分析流程(Robust Cell Type Decomposition),用户可以使用scRNA-seq参考数据集,对空间数据集的spot或者单个细胞进行反卷积分析。

RCTD安装:

devtools::install_github("dmcable/spacexr", build_vignettes = FALSE)

基于Xenium数据,构建RCTD的query数据:

library(spacexr)

query.counts <- GetAssayData(xenium.obj, assay = "Xenium", slot = "counts")[, Cells(xenium.obj[["crop"]])]
coords <- GetTissueCoordinates(xenium.obj[["crop"]], which = "centroids")
rownames(coords) <- coords$cell
coords$cell <- NULL
query <- SpatialRNA(coords, query.counts, colSums(query.counts))

然后是单细胞参考数据集的处理,构建RCTD的Reference数据:

# allen.corted.ref can be downloaded here:
# https://www.dropbox.com/s/cuowvm4vrf65pvq/allen_cortex.rds?dl=1
allen.cortex.ref <- readRDS("/brahms/shared/vignette-data/allen_cortex.rds")
allen.cortex.ref <- UpdateSeuratObject(allen.cortex.ref)

Idents(allen.cortex.ref) <- "subclass"
# remove CR cells because there aren't enough of them for annotation
allen.cortex.ref <- subset(allen.cortex.ref, subset = subclass != "CR")
counts <- GetAssayData(allen.cortex.ref, assay = "RNA", slot = "counts")
cluster <- as.factor(allen.cortex.ref$subclass)
names(cluster) <- colnames(allen.cortex.ref)
nUMI <- allen.cortex.ref$nCount_RNA
names(nUMI) <- colnames(allen.cortex.ref)
nUMI <- colSums(counts)
levels(cluster) <- gsub("/""-", levels(cluster))
reference <- Reference(counts, cluster, nUMI)

运行RCTD:

# run RCTD with many cores
RCTD <- create.RCTD(query, reference, max_cores = 8)
RCTD <- run.RCTD(RCTD, doublet_mode = "doublet")

处理RCTD的结果:

annotations.df <- RCTD@results$results_df
annotations <- annotations.df$first_type
names(annotations) <- rownames(annotations.df)
xenium.obj$predicted.celltype <- annotations
keep.cells <- Cells(xenium.obj)[!is.na(xenium.obj$predicted.celltype)]
xenium.obj <- subset(xenium.obj, cells = keep.cells)

关于RCTD我已介绍多次了,HD空转分析也是采用了RCTD流程。详见:

本质上就是使用单细胞数据以及单细胞注释好的标签来注释空转数据。

更多内容详见官方教程:https://satijalab.org/seurat/articles/seurat5_spatial_vignette_2


生信菜鸟团
生信菜鸟团荣誉归来,让所有想分析生物信息学数据的小伙伴找到归属,你值得拥有!
 推荐账号,扫码关注
推荐账号二维码
 最新文章