当前位置:网站首页>单细胞数据复现-肺癌文章代码复现7
单细胞数据复现-肺癌文章代码复现7
2022-06-09 22:49:00 【小胡子刺猬】
单细胞数据复现-肺癌文章代码复现1https://cloud.tencent.com/developer/article/1992648
单细胞数据复现-肺癌文章代码复现2https://cloud.tencent.com/developer/article/1995619
单细胞数据复现-肺癌文章代码复现3https://cloud.tencent.com/developer/article/1996043
单细胞数据复现-肺癌文章代码复现4https://cloud.tencent.com/developer/article/2006654
单细胞数据复现-肺癌文章代码复现5https://cloud.tencent.com/developer/article/2008487
单细胞数据复现-肺癌文章代码复现6https://cloud.tencent.com/developer/article/2008704
下面主要是对差异基因进行分析,也是按照以前得思路进行样本水平得选取,然后进行归一化,然后进行得markers得确定进行得差异分析。
###DEGs macrophages
imm_macro <- subset(imm_anno, subset = cell_type_imm %in% c("Alveolar_Macrophages1",
"Alveolar_Macrophages2",
"Alveolar_Macrophages3",
"CD14_Macrophages1",
"CD14_Macrophages2",
"CD14_Macrophages3",
"CD14_Macrophages4",
"CD14_Macrophages5",
"Macrophages_Proliferating"))
imm_macro <- ScaleData(imm_macro)
Idents(imm_macro) <- [email protected]$cell_type_imm
macro_markers <- FindAllMarkers(imm_macro, only.pos = T, min.pct = 0.25, min.diff.pct = 0.25)
top_macro_markers <- macro_markers %>% group_by(cluster) %>% top_n(10, wt = avg_log2FC)
##这里得画热图得函数是上几次中运用到得函数,可以展示分组和分群。
DoMultiBarHeatmap(imm_macro, features = top_macro_markers$gene, group.by = "cell_type_imm", additional.group.by = "tissue_type",additional.group.sort.by = "tissue_type", cols.use = list(tissue_type = use_colors), draw.lines = F) +
scale_fill_viridis()
#ggsave2("HeatMap_Macro.pdf", path = "output/fig4", width = 30, height = 40, units = "cm")
ggsave2("SuppFig7B.png", path = "../results", width = 30, height = 40, units = "cm")
#ggsave2("HeatMap_Macro.emf", path = "output/fig4", width = 30, height = 40, units = "cm")下面是T细胞得水平得差异基因得计算
###DEGs T cells
imm_T <- subset(imm_anno, subset = cell_type_imm %in% c("T_conv1",
"T_conv2",
"T_reg",
"T_CD8_1",
"T_CD8_2",
"T_CD8_3",
"T_CD8_Proliferating"))
imm_T <- ScaleData(imm_T)
Idents(imm_T) <- [email protected]$cell_type_imm
markers_T <- FindAllMarkers(imm_T, only.pos = T, min.pct = 0.25, min.diff.pct = 0.25)
top_markers_T <- markers_T %>% group_by(cluster) %>% top_n(10, wt = avg_log2FC)
DoMultiBarHeatmap(imm_T, features = top_markers_T$gene, group.by = "cell_type_imm", additional.group.by = "tissue_type",additional.group.sort.by = "tissue_type", cols.use = list(tissue_type = use_colors), draw.lines = F) +
scale_fill_viridis()
#ggsave2("HeatMap_T.pdf", path = "output/fig4", width = 30, height = 35, units = "cm")没有出来,怀疑是heatmap没有加载出来
ggsave2("SuppFig7C.png", path = "../results", width = 30, height = 35, units = "cm")
#ggsave2("HeatMap_T.emf", path = "output/fig4", width = 30, height = 35, units = "cm")##这里我感觉我没有看懂,但是这些代码基本是没有问题得,所以又做医学得友友给我评论给我讲讲看,谢谢呐
###selected hallmark signatures and M1vsM2 signatures
##一般情况下,如果recursive = FALSE,则unlist只会作用于列表的第一层
m1m2_pws <- read_lines("CLASSICAL_M1_VS_ALTERNATIVE_M2_MACROPHAGE_UP.gmt") %>%
lapply(str_split, "\\t") %>%
unlist(recursive = F) %>%
lapply(function(x) setNames(list(x[-c(1:2)]), x[1])) %>%
unlist(recursive = F)
##append:向向量中增加元素
m1m2_pws <- append(m1m2_pws, read_lines("CLASSICAL_M1_VS_ALTERNATIVE_M2_MACROPHAGE_DN.gmt") %>%
lapply(str_split, "\\t") %>%
unlist(recursive = F) %>%
lapply(function(x) setNames(list(x[-c(1:2)]), x[1])) %>%
unlist(recursive = F))
imm_anno <- AddModuleScore(object = imm_anno, features = m1m2_pws, name = c("m1up", "m1dn"), nbin = 12)
VlnPlot(imm_anno, features = c("HALLMARK_INFLAMMATORY_RESPONSE31",
"HALLMARK_ALLOGRAFT_REJECTION46",
"HALLMARK_INTERFERON_GAMMA_RESPONSE19",
"HALLMARK_TNFA_SIGNALING_VIA_NFKB1",
"m1up1",
"m1dn2"),
group.by = "cell_type_imm", pt.size = 0, ncol = 3, idents = c("Alveolar_Macrophages1",
"Alveolar_Macrophages2",
"Alveolar_Macrophages3",
"CD14_Macrophages1",
"CD14_Macrophages2",
"CD14_Macrophages3",
"CD14_Macrophages4",
"CD14_Macrophages5",
"Macrophages_Proliferating"), cols = use_colors)
ggsave2("Fig4C.pdf", path = "../results", width = 30, height = 20, units = "cm")
###T cell signatures
T_exhausted <- read_excel("CD8_T_cells_exhausted.xlsx", skip = 1)
cytotoxicity <- c("PRF1", "IFNG", "GNLY", "NKG7", "GZMB", "GZMA", "GZMH", "KLRK1", "KLRB1", "KLRD1", "CTSW", "CST7")
T_cell_markers <- list(T_exhausted$GeneSymbol, cytotoxicity)
imm_T <- AddModuleScore(imm_T, features = T_cell_markers, name = c("exhaustion", "cytotoxicity"), nbin = 12)
VlnPlot(imm_T, features = c("cytotoxicity2", "exhaustion1"), pt.size = 0, group.by = "cell_type_imm", cols = use_colors, idents = c("T_CD8_1", "T_CD8_2", "T_CD8_3", "T_CD8_Proliferating"), ncol = 1)
ggsave2("Fig4F.pdf", path = "../results", width = 10, height = 20, units = "cm")
边栏推荐
- Getting to know websocket
- 2022 practice questions and mock exam of quality controller municipal direction general basic (quality controller) examination
- Use of mongodb and crud operation
- 虚拟机环境配置记录1
- Still doubting the digital collection? The national team is starting to get in
- Server operation and maintenance environment security system (Part 2)
- Is it safe for Huatai Securities to open an account
- String-4-242. 有效的字母异位词
- Record the 'new' course of an emergency investigation
- Deploy MySQL based on statefulset in kubernetes (Part 1)
猜你喜欢

What is liquidity pledge? What is a farm pledge?

服务器运维环境安全体系(下篇)

Still doubting the digital collection? The national team is starting to get in

Explanation of leetcode UHF questions (III)

Online text string batch replacement tool

Autre contenu lourd | formes de produits et mesures de contrôle des risques pour les prêts en espèces à l'étranger

只需八步将小程序一键打包生成App

Use of packet capturing tool fiddler

Getting to know websocket

荐书 | 手牵手一步两步望着天,看星星一颗两颗连成线
随机推荐
Swift GCD Notify after concurrent execution Lock barrier
How about opening an account at CICC securities? Is it safe? Account opening
Microcomputer principle and interface technology exercise 1
騰訊-NCNN簡介
Easyrecovery15 mobile computer full function data recovery software
JG file upload code and export Excel
这知识我没见过--MySQL 服务演进
AI helps release the potential energy of legal affairs -- the itarms contract intelligent review system of Fada was officially released
Project training (XV) -- Video multi character recognition supplement
Implementing Lmax disruptor queue from scratch (II) analysis of consumption dependency principle among multiple consumers and consumer groups
手推单精度浮点类型
Server operation and maintenance environment security system (Part 2)
IEEE 754浮点数标准详解
在线JSON转CSV工具
虚拟机环境配置记录1
How to protect personal rights and interests when the universe is not an illegal place?
[Title brushing] longest increasing subsequence
MongoDB的使用及CRUD操作
双塔模型-语义索引策略 [In-batch Negatives]
CMD command