需要的包
mamba install -y -c conda-forge -c bioconda -c r \
r-ggsci \
r-dplyr \
r-future \
r-seurat \
r-clustree \
r-cowplot \
r-data.table \
r-ggplot2 \
r-patchwork \
r-stringr \
r-qs \
r-matrix
读取
library(Seurat)
library(ggplot2)
## 首先读取表达矩阵数据
ct = Read10X("~/Desktop/project/建模项目/新辅空转/GSE252176 RAW/GSM7996201_SXR_1/raw_feature_bc_matrix/")
## 然后读取image信息
img <- Read10X_Image(image.dir = file.path("./GSE252176 RAW/GSM7996201_SXR_1/",
"spatial"), filter.matrix = TRUE)
## 接着创建seurat对象
sceP <- CreateSeuratObject(counts = ct, assay = "Spatial")
img <- img[Cells(x = sceP)]
DefaultAssay(sceP = img) <- "Spatial"
sceP[['slice1']] <- img
## 空间分布
plot2 <- SpatialFeaturePlot(sceP,
features = "nCount_Spatial",
pt.size.factor = 2)
ggsave(filename = "1-QC/FeaturePlot_nCount.pdf", width = 12,height = 6, plot = plot2)