美文网首页
空间转录组

空间转录组

作者: 皮尔洛_dys | 来源:发表于2023-02-26 12:53 被阅读0次

第一步 数据准备

以GSE203612( https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE203612)为例,分析空间转录组数据需要下载以下文件。

准备数据

下载完成后以GSE203612为文件名创建文件夹并将数据下载在该文件夹下。在该文件夹中再创建一个文件夹命名为spatial,并将除h5文件以外的所有文件移至spatial文件夹中,并将对应文件的名称改为下图所示,至此数据准备完成。


第二部 数据分析

library(Seurat)
library(SeuratData)
library(ggplot2)
library(patchwork)
library(dplyr)
setwd("/mnt/alamo01/users/dengys/")
library(readxl)
#读取空间转录组数据 规范化数据 Data preprocessing
brain<-Seurat::Load10X_Spatial("/mnt/alamo01/users/dengys/st") 
plot1 <- VlnPlot(brain, features = "nCount_Spatial", pt.size = 0.1) + NoLegend()
plot2 <- SpatialFeaturePlot(brain, features = "nCount_Spatial") + theme(legend.position = "right")
wrap_plots(plot1, plot2)
brain <- SCTransform(brain, assay = "Spatial", verbose = FALSE)
#
SpatialFeaturePlot(brain, features = c("NOC2L", "ISG15"))

p1 <- SpatialFeaturePlot(brain, features = "NOC2L", pt.size.factor = 1)
p2 <- SpatialFeaturePlot(brain, features = "NOC2L", alpha = c(0.1, 1))
p1 + p2
brain@assays$SCT
brain <- RunPCA(brain, assay = "SCT", verbose = FALSE)
brain <- FindNeighbors(brain, reduction = "pca", dims = 1:30)
brain <- FindClusters(brain, resolution = 1)
brain <- RunUMAP(brain, reduction = "pca", dims = 1:30)


p1 <- DimPlot(brain, reduction = "umap", label = TRUE)
p2 <- SpatialDimPlot(brain, label = TRUE, label.size = 3)
p1 + p2

gene_table = read_excel("/mnt/alamo01/users/dengys/ST/AnimalTFDB4_human.xlsx",sheet = 1)

gene_list = gene_table$Symbol
row.name.matx = row.names(brain@assays$SCT@counts)
intersect.gene = intersect(gene_list,row.name.matx)

for(i in intersect.gene)
{
  print(i)
  p = SpatialFeaturePlot(brain, features = i)
  ggsave(p,file =paste( "./ST/",".jpg",sep = i),width = 3,height = 3,dpi = 200)
}

#ggsave(p,file =paste( "./ST/","dys.jpg",sep = i),width = 3,height = 3,dpi = 200)
SpatialDimPlot(brain, cells.highlight = CellsByIdentities(object = brain, idents = c(2, 1, 4, 3,
                                                                                     5, 8)), facet.highlight = TRUE, ncol = 3)
de_markers <- FindMarkers(brain, ident.1 = 5, ident.2 = 1)
SpatialFeaturePlot(object = brain, features = rownames(de_markers)[1:3], alpha = c(0.1, 1), ncol = 3)



sample.dataframe=as.data.frame(intersect.gene) 
library(xlsx) #load the package
write.xlsx(x = sample.dataframe, file = "./AnimalTFDB4_human.xlsx",
           sheetName = "TestSheet", row.names = FALSE)






相关文章

网友评论

      本文标题:空间转录组

      本文链接:https://www.haomeiwen.com/subject/pdlhkdtx.html