单细胞CNS文章复现Single-cell profiling of tumor heterogeneity and the microenvironment in advanced non-s...

今天要复现的这篇文献来自新鲜出炉的NC。


image.png

这篇是关于肺癌的。作者通过对42例晚期肺癌进行单细胞测序,描绘了晚期肺癌的单细胞微环境图谱,为肺癌的精准靶向治疗提供了有益参考。


image.png

要复现的是这两张图。b和d,一张是按细胞类型分开,一张是按病人分开。


image.png
image.png

考虑到大部分粉丝都没有服务器。我们只选取两个病人P10和p28简单走下流程。其实再多的病人也是大同小异。就是计算资源需要的更多。
首先我们加载需要的包

> library(Seurat)
Attaching SeuratObject
> library(cowplot)
> library(patchwork)
> library(tidyverse)

查看文章参数设置,可以看到作者保留的是200到5000个基因,线粒体比例设置了30%。


image.png

读入数据
这篇文章作者提供了表达矩阵,我们直接下载读入即可。

> ctrl.data <- read.table(file = "GSM4453585_P10_expL.txt", header = T)

根据文献说明,我们设置min.features = 200

> # Set up control object
> ctrl <- CreateSeuratObject(counts = ctrl.data, project = "P10", min.cells = 3,min.features = 200)
> ctrl$stim <- "P10"

看下线粒体比例

> ctrl[["percent.mt"]] <- PercentageFeatureSet(ctrl, pattern = "^MT-")
> # Visualize QC metrics as a violin plot
> VlnPlot(ctrl, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
image.png

可以看出作者提供的这是已经处理过的数据啦,线粒体都在30%以下。基因在200-5000之间。可以直接使用,不用再做质控啦。

根据文献说明选择600个高变异基因进行后续分析


image.png
> ctrl <- NormalizeData(ctrl, verbose = FALSE)
> ctrl <- FindVariableFeatures(ctrl, selection.method = "vst", nfeatures = 600)

同样方法读取另一个病人P28数据

> stim <- CreateSeuratObject(counts = stim.data, project = "P28", min.cells = 3,min.features = 200)
> stim$stim <- "p28"
> stim <- NormalizeData(stim, verbose = FALSE)
> stim <- FindVariableFeatures(stim, selection.method = "vst", nfeatures = 600)

执行整合
然后,我们使用该功能识别锚点,以 Seurat 对象列表作为输入,并使用这些锚点将两个数据集集成在一起。主成分选择20。

> immune.anchors <- FindIntegrationAnchors(object.list = list(ctrl, stim), dims = 1:20)
> immune.combined <- IntegrateData(anchorset = immune.anchors, dims = 1:20)
Integrating data
> # Run the standard workflow for visualization and clustering
> immune.combined <- ScaleData(immune.combined, verbose = FALSE)
> immune.combined <- RunPCA(immune.combined, npcs = 30, verbose = FALSE)
> # t-SNE and Clustering
> immune.combined <- RunUMAP(immune.combined, reduction = "pca", dims = 1:20)
> immune.combined <- FindNeighbors(immune.combined, reduction = "pca", dims = 1:20)

resolution 我们设为0.3得到11个群,和文章分群数量保持一致

> immune.combined <- FindClusters(immune.combined, resolution = 0.3)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck

Number of nodes: 6113
Number of edges: 227607

Running Louvain algorithm...
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.9245
Number of communities: 11
Elapsed time: 0 seconds

可视化得到文中两张图。因为我们只有两个病人,图片有出入是肯定的。但两个病人融合还不错。

> p1 <- DimPlot(immune.combined, reduction = "umap", group.by = "stim")
image.png
> p2 <- DimPlot(immune.combined, reduction = "umap", label = TRUE)
image.png

两个病人分开展示一下

> DimPlot(immune.combined, reduction = "umap", split.by = "stim")
image.png

看出还是缺点意思,就是细胞类型没有注释出来。
注释下细胞类型

> DefaultAssay(immune.combined) <- "RNA"
> sce <- immune.combined
> sce_for_SingleR <- GetAssayData(sce, slot="data")
> library(SingleR)
> hpca.se <- HumanPrimaryCellAtlasData()
> [email protected]$seurat_clusters
> pred.hesc <- SingleR(test = sce_for_SingleR, ref = hpca.se, labels = hpca.se$label.main,
+                      method = "cluster", clusters = clusters, 
+                      assay.type.test = "logcounts", assay.type.ref = "logcounts")
Warning message:
'method="cluster"' is no longer necessary when 'cluster=' is specified 
> table(pred.hesc$labels)

           B_cell Endothelial_cells  Epithelial_cells       Fibroblasts        Macrophage 
                1                 1                 3                 1                 1 
         Monocyte           NK_cell           T_cells Tissue_stem_cells 
                1                 1                 1                 1 

> DimPlot(sce, reduction = "umap", group.by = "singleR")
image.png

但是我们的这个分群结果,跟文章是有一定差异的,我们调整下细胞名称,尽量和文章一致:

> new.cluster.ids <- c("Cancer", "Cancer", "Myeloid", "Fibroblast", "Monocyte", "B_cell",
+                      "T_cell", "NK", "Cancer",'Alveolar','Endothelial')
> names(new.cluster.ids) <- levels(sce)
> sce <- RenameIdents(sce, new.cluster.ids)
> DimPlot(sce, reduction = "umap", label = TRUE, pt.size = 0.5) + NoLegend()
> DimPlot(sce, reduction = "umap", label = TRUE, pt.size = 1.5) + NoLegend()
image.png

这样类型就差不多了。

你可能感兴趣的:(单细胞CNS文章复现Single-cell profiling of tumor heterogeneity and the microenvironment in advanced non-s...)