Diff of /FigS5C.R [000000] .. [8e0848]

Switch to unified view

a b/FigS5C.R
1
GIT_HOME="/research/users/ppolonen/git_home/ImmunogenomicLandscape-BloodCancers/"
2
source(file.path(GIT_HOME, "common_scripts/visualisation/plotting_functions.R"))
3
source(file.path(GIT_HOME, "common_scripts/statistics/functions_statistics.R"))
4
source(file.path(GIT_HOME, "common_scripts/statistics/statistics_wrappers.R"))
5
source(file.path(GIT_HOME, "common_scripts/pathway_analysis/functions.GSEA.R"))
6
source(file.path(GIT_HOME, "common_scripts/scRNA/functions.scRNA.analysis.R"))
7
source(file.path(GIT_HOME, "common_scripts/statistics/useful_functions.R"))
8
9
library(Matrix)
10
library(Seurat)
11
library(data.table)
12
library(ComplexHeatmap)
13
library(circlize)
14
library(parallel)
15
library(ggplot2)
16
17
setwd("/research/groups/sysgen/PROJECTS/HEMAP_IMMUNOLOGY/petri_work/HEMAP_IMMUNOLOGY/Published_data_figures")
18
19
20
# analyze FIMM and Galen AML and find costim associations to certain clusters.
21
co.stim=data.table::fread("costim_ligands_final.txt", data.table = F)[,c(1,3,5)]
22
co.stimR=data.table::fread("costim_ligands_final.txt", data.table = F)
23
co.stimR.f=c(unlist(strsplit(co.stimR$`Receptor gene`, ", ")), "LAG3")
24
co.stim=rbind(co.stim, c("FGL1", "LAG3", "Inhibitory"))
25
26
load("AML_Galen_scRNA.Rdata")
27
galen=scmat
28
29
load("HCA_scRNA.Rdata")
30
HCA=scmat
31
32
load("FIMM_AML_scRNA.Rdata")
33
34
# plot from each dataset all significant genes:
35
subtype.order=c("MDS-like", "Progenitor-like", "Monocyte-like", "Monocyte-like-MLL", "CEBPA", "RUNX1-RUNX1T1", "CBFB-MYH11", "PML-RARA")
36
37
fimm=scmat[,scmat[["SingleR.label"]][,1]%in%c("HSC", "MPP", "GMP", "CMP", "MEP", "Monocytes", "Erythrocytes")]
38
galen.sub=galen[,galen[["SingleR.label"]][,1]%in%c("HSC", "MPP", "GMP", "CMP", "MEP", "Monocytes", "Erythrocytes")]
39
hca=HCA[,HCA[["SingleR.label"]][,1]%in%c("HSC", "MPP", "GMP", "CMP", "MEP", "Monocytes", "Erythrocytes")]
40
41
Idents(fimm)=fimm[["SingleR.label"]][,1]
42
Idents(galen.sub)=factor(galen.sub[["SingleR.label"]][,1], levels=c("HSC", "MPP", "GMP", "CMP", "MEP", "Monocytes", "Erythrocytes"))
43
Idents(hca)=hca[["SingleR.label"]][,1]
44
45
# do DE gene tests:
46
DE.FIMM=FindAllMarkers(object = fimm, features = genelist[genelist%in%rownames(scmat)], only.pos = T, logfc.threshold = 0.15)
47
DE.galen=FindAllMarkers(object = galen.sub, features = genelist[genelist%in%rownames(galen)], only.pos = T, logfc.threshold = 0.15)
48
DE.HCA=FindAllMarkers(object = hca, features = genelist[genelist%in%rownames(HCA)], only.pos = T, logfc.threshold = 0.15)
49
50
all=rbind(DE.FIMM, DE.galen, DE.HCA)
51
all=all[order(match(all$cluster, c("HSC", "MPP", "GMP", "CMP", "MEP", "Monocytes", "Erythrocytes"))),]
52
53
a=table(all$cluster, all$gene)
54
genelist.filt=c(colnames(a[,apply(a, 2, function(v)any(v>1))]), "C10orf54")
55
56
# these were selected for the figure:
57
genelist.filt=c("CD34", "CLEC2B", "TNFRSF14", "CD84", "VSIR", "C10orf54", "CD68", "CD48","CD86","ENTPD1") 
58
59
pdf("FigS5C_VISTA_FIMM_dotplot.pdf", width = 4.5, height = 2.5)
60
plot.DotPlot(fimm, features = genelist.filt[genelist.filt%in%rownames(scmat)], cols=c("grey75", "red"), scale.max = 50, scale.min = 10, dot.scale = 4)
61
plot.DotPlot(galen.sub, features = genelist.filt[genelist.filt%in%rownames(galen)], cols=c("grey75", "red"), scale.max = 50, scale.min = 10, dot.scale = 4)
62
plot.DotPlot(hca, features = genelist.filt[genelist.filt%in%rownames(HCA)], cols=c("grey75", "red"), scale.max = 50, scale.min = 10, dot.scale = 4)
63
dev.off()