如何利用 UMAP 坐标来复制论文中描述的 UMAP 可视化?

问题描述 投票:0回答:1

我的目标是使用从元数据文件中提取的 UMAP 坐标重新创建 UMAP 绘图。该文章和 GEO 加入如下:Molgora M 等人。 TREM2 调节重塑肿瘤骨髓景观,增强抗 PD-1 免疫治疗。细胞。 2020.GEO 加入:GSE151710

我想使用的数据集只有:GSM4588939和GSM4588940。我想使用元数据文件 GSE151710_meta_single_cell_2_total_CD45.tsv.gz 中的 UMAP 坐标来组装与补充图 S2 中相同的 UMAP。我该怎么办?

我想知道我可以使用哪些 R 代码。谢谢!

coordinates metadata seurat
1个回答
0
投票

没有什么好的方法可以做到这一点,但以下方法对我有用。根据下游应用程序,您可能想要集成数据而不是合并两个样本。

拉下数据

这里使用linux终端,但可以通过从NCBI下载https来完成。

#count matrices
wget https://ftp.ncbi.nlm.nih.gov/geo/series/GSE151nnn/GSE151710/suppl/GSE151710_RAW.tar
tar -xf GSE151710_RAW.tar 

#coordinates
wget https://ftp.ncbi.nlm.nih.gov/geo/series/GSE151nnn/GSE151710/suppl/GSE151710_meta_single_cell_2_total_CD45.tsv.gz
gunzip GSE151710_meta_single_cell_2_total_CD45.tsv.gz

加载库

library(Seurat)
library(tidyverse)

将计数矩阵加载到 R 中

spar.matrix <- Read10X_h5("GSM4588939_TREM2_WT_1_filtered_feature_bc_matrix.h5",
use.names = TRUE, unique.features = TRUE)

seu.obj_GSM4588939 <- CreateSeuratObject(spar.matrix, project = "trem_ms_data")

spar.matrix <- Read10X_h5("GSM4588940_TREM2_WT_2_filtered_feature_bc_matrix.h5",
use.names = TRUE, unique.features = TRUE)
seu.obj_GSM4588940 <- CreateSeuratObject(spar.matrix, project = "trem_ms_data")

seu.obj <- merge(seu.obj_GSM4588939, seu.obj_GSM4588940)

从 NCBI 加载坐标

tsv文件中的单元格名称与H5对象不匹配,因此代码 清理条形码,使它们匹配。

cellID.df <- read.table("./GSE151710_meta_single_cell_2_total_CD45.tsv")
cellID.df <- cellID.df %>% 
  filter(Sample %in% c("WT_1", "WT_2")) %>% 
  rownames_to_column()

cellID.df$rowname <- paste0(substr(cellID.df$rowname, 6, nchar(cellID.df$rowname)), "-1")
cellID.df <- cellID.df %>%
  mutate(
    rowname = ifelse(grepl("1", Sample), 
      paste0(rowname, "_1"),
      paste0(rowname, "_2")
    )
  )

cellID.df <- cellID.df %>%
  select(rowname, UMAP_1, UMAP_2) %>%
  column_to_rownames()

将坐标存储在 Seurat 对象中并绘图!

seu.obj <- subset(seu.obj, cells = rownames(cellID.df))

seu.obj@reductions$umap <- CreateDimReducObject(
    embeddings = as.matrix(cellID.df), assay = "RNA", key = "UMAP_")

p <- DimPlot(seu.obj, reduction = "umap") + NoLegend()
ggsave("umap.png")

关键包版本:

R version 4.1.1 (2021-08-10)
tidyverse_1.3.1
SeuratObject_4.1.3
Seurat_4.3.0
ggplot2_3.3.6

UMAP of the data with the coordinates from the original publication

© www.soinside.com 2019 - 2024. All rights reserved.