首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >单细胞测序—PDA文章复现_单分组(Fig.1_Fig.2)

单细胞测序—PDA文章复现_单分组(Fig.1_Fig.2)

原创
作者头像
sheldor没耳朵
发布于 2024-09-03 10:04:00
发布于 2024-09-03 10:04:00
2780
举报
文章被收录于专栏:单细胞测序单细胞测序

单细胞测序—PDA文章复现_单分组(Fig.1_Fig.2)

最近在学习复现Cellular heterogeneity during mouse pancreatic ductal adenocarcinoma progression at single-cell resolution,这篇文章的内容。这里记录下Fig1和Fig2的复现过程。

1 文章简介

文章的Fig1,Fig2只涉及GSE125588的前三个数据集,是基于0.6的resolution进行降维聚类,采用tsne降维方法。文章中并未提及细胞过滤等参数。因此我做出的结果会与文章中略微存在差异。

值得说明的是文章中并不是把三个数据集去除批次效应后整合在一起进行分析的,而是每个数据集单独进行分析。

GSM3577882

Normal Pancreas

GSM3577883

Early KIC

GSM3577884

Late KIC

1.1 Fig1总览

1.2 Fig2总览

2 文章复现

GEO上下载整理好数据之后,不需要去批次整合数据,而是每个数据集单独读取,进行独立的分析

2.1 early-KIC

step1-run-basic-early-KIC.R为例

代码语言:r
AI代码解释
复制
rm(list=ls())
options(stringsAsFactors = F) 
source('scRNA_scripts/lib.R')

###### step1:导入数据 ######    
library(ReactomePA)
library(ggplot2)
dir.create("./early-KIC")
setwd('./early-KIC/')
sce.data <- Read10X("../raw_data/GSM3577883_early_KIC/")

sce.all <- CreateSeuratObject(counts = sce.data,
                              project = 'early-KIC',
                              min.cells = 5, 
                              min.features = 300)
as.data.frame(sce.all@assays$RNA$counts[1:10, 1:2])
head(sce.all@meta.data, 10)
table(sce.all@meta.data$orig.ident) 
 

###### step2:QC质控 ######
dir.create("./1-QC")
setwd("./1-QC")
# 如果过滤的太狠,就需要去修改这个过滤代码
source('../../scRNA_scripts/qc.R')
sce.all.filt = basic_qc(sce.all)
print(dim(sce.all))
print(dim(sce.all.filt))
setwd('../')


sp='mouse'

###### step3: 无需harmony整合多个单细胞样品 ######
###### 可用如下简单方法 ######
f = "obj.Rdata"
if(!file.exists(f)){
  sce.all.filt = sce.all.filt %>% 
    NormalizeData() %>%  
    FindVariableFeatures() %>%  
    ScaleData(features = rownames(.)) %>%  
    RunPCA(features = VariableFeatures(.))  %>%
    FindNeighbors(dims = 1:15) %>% 
    FindClusters(resolution = 0.6) %>% 
    RunTSNE(dims = 1:15)
  save(sce.all.filt,file = f)
}

p1 <- DimPlot(sce.all.filt, reduction = "tsne",label = T)+NoLegend();p1

###### 或标准流程 ######
sce.all.int <- sce.all.filt

table(Idents(sce.all.int))
table(sce.all.int$seurat_clusters)
table(sce.all.int$RNA_snn_res.0.6) 


dir.create('check-by-0.6')
setwd('check-by-0.6')
sel.clust = "RNA_snn_res.0.6"
sce.all.int <- SetIdent(sce.all.int, value = sel.clust)
table(sce.all.int@active.ident) 
source('../../scRNA_scripts/check-all-markers.R')
{
  marker_paper <- c("Amy1", "Amy2a2", "Pyy", "Sst", "Ins1", "Ins2",
                    "Sox9", "Krt18", "Col1a1", "Col1a2", "Cd52", "Cd14", 
                    "Cdh5", "Pecam1")
  paper_marker <- DotPlot(sce.all.int , features = marker_paper )  + 
    coord_flip() + 
    theme(axis.text.x=element_text(angle=45,hjust = 1))
  p_tsne=DimPlot(sce.all.int, reduction = "tsne",raster = F,
                 label = T,repel = T)

  paper_marker + p_tsne
  ggsave(paste('paper_marker_and_tsne.pdf'),width  = 12,height = 10)
  }
setwd('../') 
getwd()


###### step5: 确定单细胞亚群生物学名字 ######
 VlnPlot(sce.all.int, features = marker_paper ,pt.size = 0,ncol = 1)
 ggsave("marker_paper_vio_0.6.pdf",width = 3.5,height = 20)


colnames(sce.all.int@meta.data)
table(sce.all.int$RNA_snn_res.0.6)

if(F){
  sce.all.int
  celltype=data.frame(ClusterID=0:13 ,
                      celltype= 0:13) 
  #定义细胞亚群        
  celltype[celltype$ClusterID %in% c( 8),2]='Endothelial cells'   
  celltype[celltype$ClusterID %in% c( 1,5,7 ),2]='Macrophages' 
  celltype[celltype$ClusterID %in% c( 13 ),2]='Fibroblasts-3' 
  celltype[celltype$ClusterID %in% c( 0,2,9),2]='Fibroblasts-2'
  celltype[celltype$ClusterID %in% c( 6 ),2]='Fibroblasts-1'
  celltype[celltype$ClusterID %in% c( 3 ),2]='Cancer cells'
  celltype[celltype$ClusterID %in% c( 11),2]='Beta cells'
  celltype[celltype$ClusterID %in% c( 10,12),2]='Islet cells'
  celltype[celltype$ClusterID %in% c( 4),2]='Acinar cells'
  
  head(celltype)
  celltype
  table(celltype$celltype)
  sce.all.int@meta.data$celltype = "NA"
  
  for(i in 1:nrow(celltype)){
    sce.all.int@meta.data[which(sce.all.int@meta.data$RNA_snn_res.0.6 == celltype$ClusterID[i]),'celltype'] <- celltype$celltype[i]}
  Idents(sce.all.int)=sce.all.int$celltype
  
  
}

DimPlot(sce.all.int, reduction = "tsne",raster = F,group.by = 'RNA_snn_res.0.6',
        label = T,repel = T) +
  DimPlot(sce.all.int, reduction = "tsne",raster = F,group.by = 'celltype',
          label = T,repel = T) 
ggsave(paste('paper_anno_and_tsne.pdf'),width  = 12,height = 10)

DimPlot(sce.all.int, reduction = "tsne",raster = F,group.by = 'celltype',
        label = T,repel = T) 
ggsave(paste('tsne.pdf'),width  = 8,height = 6)
#marker可视化
VlnPlot(sce.all.int, features = marker_paper ,pt.size = 0,ncol = 1)
ggsave("marker_paper_vio_celltype.pdf",width = 3.5,height = 35)

#计算比例
df=data.frame(clu=names(table(sce.all.int$seurat_clusters)),
                per=sprintf("%1.2f%%",100*table(sce.all.int$seurat_clusters)/length(sce.all.int$seurat_clusters)))
sce.all.int$per=df[match(sce.all.int$seurat_clusters,df$clu),2]
sce.all.int$new=paste0(sce.all.int$celltype,"(",sce.all.int$per,")")
table(sce.all.int$new)
DimPlot(sce.all.int,reduction='tsne',
        group.by='new',
        label.box=T,label=T,repel=T)
ggsave(paste('paper_anno_percentage.pdf'),width  = 12,height = 10)

#可视化优化
PropPlot <- function(object, groupBy){
  # (1)获取绘图数据
  plot_data = object@meta.data %>% 
    dplyr::select(orig.ident, {{groupBy}}) %>% 
    dplyr::rename(group = as.name(groupBy))
  
  # (2)绘图
  figure = ggbarstats(data = plot_data, 
                      x = group, y = orig.ident,
                      package = 'ggsci',
                      palette = 'category20c_d3',
                      results.subtitle = FALSE,
                      bf.message = FALSE,
                      proportion.test = FALSE,
                      label.args = list(size = 2, 
                                        fill = 'white', 
                                        alpha = 0.85,
                                        family = 'sans',
                                        fontface = 'bold'),
                      perc.k = 2,
                      title = '',
                      xlab = '',
                      legend.title = 'Seurat Cluster',
                      ggtheme = ggpubr::theme_pubclean()) +
    theme(axis.ticks.x = element_blank(),
          axis.ticks.y = element_line(color = 'black', lineend = 'round'),
          legend.position = 'right',
          axis.text.x = element_text(size = 15, color = 'black', family = 'Arial'),
          axis.text.y = element_text(size = 15, color = 'black', family = 'Arial'),
          legend.text = element_text(family = 'Arial', size = 10, color = 'black'),
          legend.title = element_text(family = 'Arial', size = 13, color = 'black')) 
  
  # (3)去除柱子下面的样本量标识:
  gginnards::delete_layers(x = figure, match_type = 'GeomText')
}
library(ggstatsplot)
library(gginnards)
# pdf('percentage.pdf',width = 5,height = 8)
# PropPlot(object  =  sce.all.int,  groupBy  =  'celltype')
# dev.off()
CairoPDF("percentage.pdf", width = 5, height = 8)
PropPlot(object = sce.all.int, groupBy = 'celltype')
dev.off()

# 如果前面成功的给各个细胞亚群命名了
# 就可以运行下面的代码
sce.all.int$celltype = as.character(sce.all.int$celltype)
if("celltype" %in% colnames(sce.all.int@meta.data ) ){
  
  sel.clust = "celltype"
  sce.all.int <- SetIdent(sce.all.int, value = sel.clust)
  table(sce.all.int@active.ident) 
  
  dir.create('check-by-celltype')
  setwd('check-by-celltype')
  source('../../scRNA_scripts/check-all-markers.R')
  setwd('../') 
  getwd()
  phe=sce.all.int@meta.data
  save(phe,file = 'phe.Rdata')
  pdf('celltype-vs-orig.ident.pdf',width = 10)
  gplots::balloonplot(table(sce.all.int$orig.ident,
                            sce.all.int$celltype))
  dev.off()
}

######  FeaturePlot 基因可视化 ######
FeaturePlot(sce.all.int, features = c("Cdh1", "Epcam", "Gjb1",
                               "Cdh2", "Cd44", "Axl"),ncol = 3)
ggsave("FeaturePlot.pdf",width = 9,height = 4.5)

save(sce.all.int,file = "early-KIC.Rdata")

因为文章中给了mark基因,因此设置marker_paper <- c("Amy1",...),向量。做了同文章中一样的mark基因小提琴图,首先根据0.6的分辨率分的0-14簇分组进行绘图

marker_paper_vio_0.6.pdf

对比文章中的图进行手动细胞注释

获得降维聚类分群的结果

paper_anno_and_tsne.pdf

接下来再定义和调用PropPlot函数,得到亚群的比例图。

左上为原文章细胞分群及比例。左下(tsne.pdf)和右图(percentage.pdf)为复现过程中的细胞分群与比例

Mark基因(右图为marker_paper_vio_celltype.pdf)对比

以上是early-KIC分组中Fig1的内容,Fig暂时只做了FeaturePlot.pdf部分

总体对比下

2.2 late-KIC

另外两个分组操作类似,这里不做赘述。

2.3 normal-pan

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
单细胞实战之样本整理,细胞注释和部分图表绘制---从入门到进阶(初级篇1)
在完成了马拉松课程后,我们应该对单细胞分析有了基本了解。接下来,我们将开启新的篇章——单细胞实战:从入门到进阶。
凑齐六个字吧
2025/02/08
3260
单细胞实战之样本整理,细胞注释和部分图表绘制---从入门到进阶(初级篇1)
用V5版本Seurat做单细胞数据文献复现
V5和V4的代码区别主要在前期导入数据和其中的数据有些许改变,曾老师在之前的几篇推文还有直播中都有提到。
生信菜鸟团
2024/01/19
3.6K0
用V5版本Seurat做单细胞数据文献复现
百万细胞舍我其谁(一晚上解决战斗)
而且,在为了,百万级别的单细胞转录组数据集会越来越多,首先是现在的10x单细胞转录组一个样品普遍只需要不到1万的人民币,而且国产是半价,只需要区区100万人民币就可以拿到100万甚至更多的细胞数量。这个经费对于张泽民院士来说,那就是毛毛雨了,他老人家的绝大部分cns文章都是标配百万级别单细胞数量。而且现在越来越多的多个单细胞数据整合文章,反正是公共数据集,多整合一些就很容易达到百万的数据量!
生信菜鸟团
2024/12/30
1770
百万细胞舍我其谁(一晚上解决战斗)
一篇单细胞文献复现及代码部分更新
https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE151177
生信菜鸟团
2023/12/14
1.8K0
一篇单细胞文献复现及代码部分更新
转录组和单细胞下游基于R的数据分析-01
数据链接是:https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE212199
生信技能树
2024/03/25
2510
转录组和单细胞下游基于R的数据分析-01
区区20万个单细胞居然超内存了
其中一个数据集是2020发在NC的肺癌单细胞文章:《Single-cell RNA sequencing demonstrates the molecular and cellular reprogramming of metastatic lung adenocarcinoma》,是44个肺癌病人的58个10x技术的单细胞转录组样品,因为是两三年前的10x单细胞技术那个时候都比较辣鸡所以细胞数量就平均每个样品是3千,这样的话合计是20万个单细胞。
生信技能树
2023/02/27
2.2K1
区区20万个单细胞居然超内存了
单细胞转录组分析揭示胃肠道间质瘤和微环境的异质性
文章标题:《Single-cell transcriptome analysis revealed the heterogeneity and microenvironment of gastrointestinal stromal tumors》
生信技能树
2021/12/10
9720
单细胞转录组分析揭示胃肠道间质瘤和微环境的异质性
文献数据复现——原发性和转移性肝细胞癌多细胞生态系统的单细胞图谱
文献:A single-cell atlas of the multicellular ecosystem of primary and metastatic hepatocellular carcinoma.
生信菜鸟团
2022/10/31
3K1
BD单细胞测序数据分析流程(全)
BD和10x是两种常见的单细胞测序技术平台。我们已经分享了很多的10x 测序的教程。
生信菜鸟团
2024/04/11
3.1K0
BD单细胞测序数据分析流程(全)
单细胞测序—亚群比例图绘制
最近在复现Cellular heterogeneity during mouse pancreatic ductal adenocarcinoma progression at single-cell resolution 这篇文章的聚类分群时注意到论文图中把细胞亚群的比例也显示在图中,如图
sheldor没耳朵
2024/09/02
3834
单细胞测序—亚群比例图绘制
学徒作业|GSE217845-胰腺癌中的巨噬细胞细分亚群
学徒作业的要求是:从上面的数据集GSE217845里面的10个胰腺癌的10x技术单细胞转录组数据的第一层次降维聚类分群里面提前髓系免疫细胞后,继续细分降维聚类拿到里面的巨噬细胞,然后继续细分巨噬细胞看看能否复现文章里面的:
生信技能树jimmy
2024/04/15
4610
学徒作业|GSE217845-胰腺癌中的巨噬细胞细分亚群
上皮细胞里面混入了淋巴系和髓系免疫细胞呢
也就是说, 我把髓系免疫细胞区分成为巨噬细胞和中性粒细胞,还有mast细胞,而且把b细胞是可以区分成为浆细胞和普通b细胞。跟文章不一样的哦,所以我得到如下所示的亚群:
生信技能树
2024/11/21
960
上皮细胞里面混入了淋巴系和髓系免疫细胞呢
单细胞水平看小鼠胰腺导管腺癌进展中的细胞异质性
文章链接:https://insight.jci.org/articles/view/129212
生信技能树
2021/12/10
9540
单细胞水平看小鼠胰腺导管腺癌进展中的细胞异质性
自己做的单细胞注释与文献对比:注释信息完全对不上?(数据注释篇)
这个数据对应的文献于2022年11月15号发表在Cell Discov. 杂志上,标题为《Single-cell sequencing unveils key contributions of immune cell populations in cancer-associated adipose wasting》。下面这个图是文献中的单细胞注释结果:
生信技能树
2025/06/09
1500
自己做的单细胞注释与文献对比:注释信息完全对不上?(数据注释篇)
脑脊液单细胞转录组数据处理
前些天我们公众号弄了一个活动,详见:春节期间单细胞转录组数据分析全免费,收到了上百个需求, 本来呢我们自己就算是春节前后14天不吃不喝不眠不休也不可能完成这么多单细胞数据处理。好在我灵机一动,想起来了前面两个月培养的一百多个在线实习生,毕竟教了他们R语言,转录组,以及单细胞转录组。 所以我写了一个还算是比较自动化的单细胞转录组数据处理代码,如果是我自己的,可以在十几分钟就完成复现文章的第一层次降维聚类分群图,比如数据集:https://www.ncbi.nlm.nih.gov/geo/query/acc.c
生信技能树
2023/02/27
5190
脑脊液单细胞转录组数据处理
肝细胞癌(HCC)单细胞数据复现及解决上周推文的一些问题
「cancer-associated fibroblasts provide immunosuppressive microenvironment for hepatocellular carcinoma via secretion of macrophage migration inhibitory factor.」 Cell Discov 2023 Mar 6;9(1):25.
生信菜鸟团
2023/08/23
2.1K0
肝细胞癌(HCC)单细胞数据复现及解决上周推文的一些问题
单细胞测序—标准流程代码(2) — 标记基因与细胞注释
书接上回,已经做好数据质控、过滤、去批次、降维聚类分群后,接下来就是进行细胞注释方面的工作
sheldor没耳朵
2024/08/22
1.1K0
单细胞测序—标准流程代码(2) — 标记基因与细胞注释
小鼠的5个样品的10x技术单细胞转录组上游定量(文末赠送全套代码)
新鲜出炉(2023年5月)的文章:《Fueling sentinel node via reshaping cytotoxic T lymphocytes with a flex-patch for
生信技能树
2023/09/04
6960
小鼠的5个样品的10x技术单细胞转录组上游定量(文末赠送全套代码)
上下游,合体!
前面我们详细地分开学习了单细胞上游、下游,这次我们就学习曾老师的一个完整的项目来实战前面学过的基本流程,并适度拓宽。其实一开始我不打算把我自己学习的这个实战贴出来,想着只在新推文开头告诉大家我拿这个练手了,学学其他的,奈何我的单细胞之路处处坑,曾老师原推文已经很详细了,我都能菜出“新花样”强行变成推文素材。
生信菜鸟团
2023/08/23
3300
上下游,合体!
学徒单细胞作业:敲除Dnmt1基因对小鼠肺部发育的影响
另外,前两天在《生信技能树》和《单细胞天地》等公众号都推出来了一个10X单细胞转录组钜惠套餐,详见:2个分组的单细胞项目标准分析,原价15~20万的6个10x单细胞转录组套餐,现价10万。其实本文介绍的就是:敲除Dnmt1基因前后分组的两个单细胞转录组数据分析。
生信技能树
2021/11/23
9830
推荐阅读
相关推荐
单细胞实战之样本整理,细胞注释和部分图表绘制---从入门到进阶(初级篇1)
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档