第一步 數(shù)據(jù)準(zhǔn)備
以GSE203612( https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE203612)為例,分析空間轉(zhuǎn)錄組數(shù)據(jù)需要下載以下文件。
準(zhǔn)備數(shù)據(jù)
下載完成后以GSE203612為文件名創(chuàng)建文件夾并將數(shù)據(jù)下載在該文件夾下依痊。在該文件夾中再創(chuàng)建一個(gè)文件夾命名為spatial债蓝,并將除h5文件以外的所有文件移至spatial文件夾中讥珍,并將對(duì)應(yīng)文件的名稱改為下圖所示诽凌,至此數(shù)據(jù)準(zhǔn)備完成捕犬。
第二部 數(shù)據(jù)分析
library(Seurat)
library(SeuratData)
library(ggplot2)
library(patchwork)
library(dplyr)
setwd("/mnt/alamo01/users/dengys/")
library(readxl)
#讀取空間轉(zhuǎn)錄組數(shù)據(jù) 規(guī)范化數(shù)據(jù) 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)