├── README.md ├── Figure7.txt ├── SupplementaryFig.5.txt ├── SupplementaryFig.8.txt ├── SupplementaryFig.9.txt ├── SupplementaryFig.6.txt ├── SupplementaryFig.7.txt ├── SupplementaryFig.3.txt ├── Figure1.txt ├── SupplementaryFig.1.txt ├── Figure5.txt ├── Figure6.txt ├── Figure2.txt ├── SupplementaryFig.2.txt ├── Figure4.txt ├── SupplementaryFig.4.txt └── Figure3.txt /README.md: -------------------------------------------------------------------------------- 1 | # MVI_HCC 2 | These are code and scripts for MVI+ HCC scRNA-seq analysis. 3 | ![image](https://github.com/ZhoulabCPH/MVI_HCC/assets/143063392/d993bc86-655d-4265-90c2-35ac9be85324) 4 | -------------------------------------------------------------------------------- /Figure7.txt: -------------------------------------------------------------------------------- 1 | ######## Figure 7a 2 | library(Seurat) 3 | library(dplyr) 4 | library(CellChat) 5 | 6 | netVisual_bubble(cellchat,sources.use = c('mCAF','Arterial EC'), 7 | targets.use = c('CD1C_DC','CLEC9A_DC','Cycling_DC','LAMP3_DC'),comparison = c(1,2), angle.x = 45) 8 | 9 | 10 | ######## Figure 7b 11 | netVisual_bubble(cellchat,sources.use = c('LAMP3_DC'), 12 | targets.use = c('Activated T RGS1','Treg','IL7R Tmem','T naive','Tcyc','TNF Tmem','Inflamed NK','Mature NK','NKcyc'),comparison = c(1,2), angle.x = 45) 13 | 14 | 15 | 16 | ######## Figure 7c 17 | netVisual_bubble(cellchat,sources.use = c('mCAF','Arterial EC'), 18 | targets.use = c('Activated T RGS1','Treg','IL7R Tmem','T naive','Tcyc','TNF Tmem','Inflamed NK','Mature NK','NKcyc'),comparison = c(1,2), angle.x = 45) 19 | 20 | -------------------------------------------------------------------------------- /SupplementaryFig.5.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 5A 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | 6 | VlnPlot(Stromal,features = c('HEY1','CXCL12'),group.by = 'meta.cluster',pt.size = 0) 7 | 8 | 9 | ######## Supplementary 5B 10 | gene = TCGA_T[c('BAX','FOXC1'),] %>% t() %>% data.frame() 11 | gene = gene[intersect(rownames(gene),rownames(TCGA_sur)),] 12 | TCGA_sur = TCGA_sur[intersect(rownames(gene),rownames(TCGA_sur)),] 13 | gene$OS.time = TCGA_sur$OS.time 14 | gene$OS = TCGA_sur$OS 15 | 16 | cut = surv_cutpoint(gene,time = "OS.time",event = "OS",variables = "FOXC1") 17 | sur = surv_categorize(cut) 18 | ggsurvplot(survfit(Surv(sur$OS.time,event = sur$OS)~FOXC1, 19 | data=sur), 20 | pval = TRUE, 21 | risk.table = TRUE, 22 | risk.table.col = "strata", 23 | #linetype = "strata", 24 | surv.median.line = "hv", 25 | ggtheme = theme_bw(), 26 | palette=c("#ED0000","#00468B")) 27 | cut = surv_cutpoint(gene,time = "OS.time",event = "OS",variables = "BAX") 28 | sur = surv_categorize(cut) 29 | ggsurvplot(survfit(Surv(sur$OS.time,event = sur$OS)~BAX, 30 | data=sur), 31 | pval = TRUE, 32 | risk.table = TRUE, 33 | risk.table.col = "strata", 34 | #linetype = "strata", 35 | surv.median.line = "hv", 36 | ggtheme = theme_bw(), 37 | palette=c("#ED0000","#00468B")) -------------------------------------------------------------------------------- /SupplementaryFig.8.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 8B 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | library(CellChat) 6 | 7 | netAnalysis_signalingRole_scatter(cellchat_MVI) 8 | cc_NonMVI = netAnalysis_signalingRole_scatter(cellchat_NonMVI) 9 | names(cc_MVI) = c('MVI_OUT','MVI_INCOME','labels','MVI_COUNT') 10 | names(cc_NonMVI) = c('NonMVI_OUT','NonMVI_INCOME','labels','NonMVI_COUNT') 11 | 12 | cc = inner_join(cc_MVI,cc_NonMVI,by = 'labels') 13 | cc$DE_OUT = cc$MVI_OUT - cc$NonMVI_OUT 14 | cc$DE_INCOM = cc$MVI_INCOME - cc$NonMVI_INCOME 15 | cc$de_count = cc$MVI_COUNT - cc$NonMVI_COUNT 16 | 17 | cc = arrange(cc,DE_OUT) 18 | cc$labels =factor(cc$labels,levels = cc$labels) 19 | p1 = ggplot(cc,aes(x=labels ,y=DE_OUT,color=DE_OUT))+geom_point(size=5)+ coord_flip()+ 20 | geom_line()+geom_segment(aes(x=labels,xend=labels,y=0,yend=DE_OUT))+ 21 | theme(axis.text.x = element_text(angle = 90))+theme_few()+ 22 | scale_color_gradient2(midpoint=0, low="#2276B2", mid="#EFEFEF",high="red") 23 | p2 = ggplot(cc,aes(x=labels ,y=DE_INCOM,color=DE_INCOM))+geom_point(size=5)+ coord_flip()+ 24 | geom_line()+geom_segment(aes(x=labels,xend=labels,y=0,yend=DE_INCOM))+ 25 | theme(axis.text.x = element_text(angle = 90))+theme_few()+ 26 | scale_color_gradient2(midpoint=0, low="#2276B2", mid="#EFEFEF",high="red")+ylim(-1,0.5) 27 | p1|p2 28 | 29 | 30 | 31 | ######## Supplementary 8C 32 | DE_weight = cellchat_MVI@net$weight - cellchat_NonMVI@net$weight 33 | 34 | bk <- c(seq(-2,2,by=0.01)) 35 | color = c(colorRampPalette(colors = c("blue","white"))(length(bk)/2),colorRampPalette(colors = c("white","red"))(length(bk)/2)) 36 | 37 | 38 | pheatmap(DE_weight[c("Arterial i EC",'mCAF'), 39 | c("CLEC9A_DC","Cycling_DC","CD1C_DC","LAMP3_DC", 40 | "FCGR3A_Mono","FCGR3B_Mono",'VCAN_Mono', 41 | "TREM2_Macro","HLA_Macro","MACRO_Macro",'IL1B_Macro','Mast')],color = colorRampPalette(c('blue','white','red'))(100), 42 | border = F,cluster_rows = T,cluster_cols = T,scale = 'row') 43 | 44 | 45 | pheatmap(DE_weight[c("Arterial i EC",'mCAF'), 46 | c("Tcyc","Treg","Activated T RGS1","IL7R Tmem","Inflamed NK","Mature NK","NKcyc","T naive","TNF Tmem")], 47 | color = colorRampPalette(c('blue','white','red'))(100), 48 | border = F,cluster_rows = T,cluster_cols = T,scale = 'row') 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /SupplementaryFig.9.txt: -------------------------------------------------------------------------------- 1 | library(Seurat) 2 | library(dplyr) 3 | library(ggpubr) 4 | 5 | HCC6NR = Read10X('HCC6NR/filtered_feature_bc_matrix') 6 | image <- Read10X_Image(image.dir = file.path("HCC6NR/", "spatial"), filter.matrix = TRUE) 7 | HCC6NR <- CreateSeuratObject(counts = HCC6NR, assay = "Spatial") 8 | image <- image[Cells(x = HCC6NR)] 9 | DefaultAssay(HCC6NR = image) <- "Spatial" 10 | HCC6NR[["slice1"]] <- image 11 | 12 | SpatialFeaturePlot(HCC6NR, features = "nFeature_Spatial") 13 | HCC6NR = SCTransform(HCC6NR, assay = "Spatial", return.only.var.genes = FALSE, verbose = FALSE) 14 | 15 | HCC6NR <- RunPCA(HCC6NR, verbose = FALSE) 16 | HCC6NR <- RunUMAP(HCC6NR, reduction = "pca", dims = 1:10) 17 | 18 | HCC7NR = Read10X('HCC7NR/filtered_feature_bc_matrix') 19 | image <- Read10X_Image(image.dir = file.path("HCC7NR/", "spatial"), filter.matrix = TRUE) 20 | HCC7NR <- CreateSeuratObject(counts = HCC7NR, assay = "Spatial") 21 | image <- image[Cells(x = HCC7NR)] 22 | DefaultAssay(HCC7NR = image) <- "Spatial" 23 | HCC7NR[["slice1"]] <- image 24 | 25 | SpatialFeaturePlot(HCC7NR, features = "nFeature_Spatial") 26 | HCC7NR = SCTransform(HCC7NR, assay = "Spatial", return.only.var.genes = FALSE, verbose = FALSE) 27 | 28 | HCC7NR <- RunPCA(HCC7NR, verbose = FALSE) 29 | HCC7NR <- RunUMAP(HCC7NR, reduction = "pca", dims = 1:10) 30 | 31 | gene = list(filter(Stromal_marker,cluster == 'mCAF' & avg_log2FC >= 0.58 & p_val_adj <= 0.05)$gene, 32 | filter(Stromal_marker,cluster == 'Arterial_i_EC' & avg_log2FC >= 0.58 & p_val_adj <= 0.05)$gene, 33 | filter(Tcell_marker,cluster == 'cycling_T' & avg_log2FC >= 0.58 & p_val_adj <= 0.05)$gene, 34 | filter(Tcell_marker,cluster == 'Treg' & avg_log2FC >= 0.58 & p_val_adj <= 0.05)$gene, 35 | filter(DC_marker,cluster == 'LAMP3_DC' & avg_log2FC >= 0.58 & p_val_adj <= 0.05)$gene) 36 | 37 | 38 | HCC6NR = AddModuleScore(HCC6NR ,features = gene) 39 | HCC7NR = AddModuleScore(HCC7NR ,features = gene) 40 | 41 | 42 | SpatialFeaturePlot(HCC6NR, features = c('Cluster1','Cluster2','Cluster3','Cluster4','Cluster5'),alpha = c(0.2,1),pt.size = 2) + 43 | theme( panel.grid.major = element_blank(),panel.grid.minor = element_blank(), 44 | axis.ticks = element_blank(),axis.text = element_blank(), legend.position = "none") 45 | 46 | SpatialFeaturePlot(HCC7NR, features = c('Cluster1','Cluster2','Cluster3','Cluster4','Cluster5'),alpha = c(0.2,1),pt.size = 2) + 47 | theme( panel.grid.major = element_blank(),panel.grid.minor = element_blank(), 48 | axis.ticks = element_blank(),axis.text = element_blank(), legend.position = "none") 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /SupplementaryFig.6.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 6B 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | 6 | Tumor_HC = CellCycleScoring(object = Tumor_HC, 7 | g2m.features = cc.genes$g2m.genes, 8 | s.features = cc.genes$s.genes) 9 | 10 | prop = prop.table(table(Tumor_HC@meta.data$Phase, Tumor_HC@meta.data[,"MVI"]), 2) *100 11 | prop = reshape2::melt(prop) 12 | ggplot(prop,aes(Var2,value,fill = Var1 ))+geom_bar(stat = "identity") 13 | 14 | 15 | 16 | 17 | ######## Supplementary 6C,D 18 | library(msigdbr) 19 | m_df = msigdbr(species = "Homo sapiens", category = "H") 20 | Tumor_HC <- AddModuleScore(object = Tumor_HC, 21 | features = list(c(filter(m_df, 22 | gs_name == 'HALLMARK_INFLAMMATORY_RESPONSE')$gene_symbol)))+NoLegend() 23 | VlnPlot(Tumor_HC,features = 'INFLAMMATORY_RESPONSE1',group.by = 'MVI',pt.size = 0)+stat_compare_means() 24 | VlnPlot(Tumor_HC,features = c('CCL3','CCL4','CXCL2'),group.by = 'MVI',pt.size = 0)+stat_compare_means() 25 | 26 | 27 | 28 | 29 | ######## Supplementary 6E 30 | library(msigdbr) 31 | library(dplyr) 32 | m_df = msigdbr(species = "Homo sapiens", category = "H") 33 | ccgenes = c(cc.genes$s.genes,cc.genes$g2m.genes) 34 | inflam = filter(m_df,gs_name == 'HALLMARK_INFLAMMATORY_RESPONSE')$gene_symbol 35 | 36 | ssGSEA_Score = gsva(as.matrix(TCGA_HC), list(ccgenes,inflam), 37 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 38 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 39 | names(ssGSEA_Score) = c('Proliferation','Inflammation') 40 | 41 | ssGSEA_Score = ssGSEA_Score[rownames(TCGA_meta),] 42 | ssGSEA_Score$MVI = TCGA_meta$vascular_tumor_cell_type 43 | 44 | ssGSEA_Score[colnames(TCGA_N),'MVI'] = 'Normal' 45 | 46 | ggplot(filter(ssGSEA_Score, MVI %in% c('None','Micro')) , aes(x = MVI, y = Inflammation ,fill = MVI)) + 47 | geom_violin(aes(fill = MVI),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 48 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 49 | theme_bw()+stat_compare_means(method.args = list(alternative = "less"))+ 50 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 51 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+ 52 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 53 | theme(axis.text.x = element_text(size = 14), 54 | axis.text.y = element_text(size = 14), 55 | axis.title.y = element_text(size = 14)) 56 | 57 | 58 | ggplot(filter(ssGSEA_Score, MVI %in% c('None','Micro')) , aes(x = MVI, y = Proliferation ,fill = MVI)) + 59 | geom_violin(aes(fill = MVI),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 60 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 61 | theme_bw()+stat_compare_means(method.args = list(alternative = "less"))+ 62 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 63 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+ 64 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 65 | theme(axis.text.x = element_text(size = 14), 66 | axis.text.y = element_text(size = 14), 67 | axis.title.y = element_text(size = 14)) 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /SupplementaryFig.7.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 7B 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | library(CellChat) 6 | 7 | 8 | prop = prop.table(table(meta$cell_type3, meta[,"sample_name"]), 2) *100 9 | prop = data.frame(prop) 10 | 11 | cor_frame = data.frame(row.names = as.character(unique(prop$Var1))) 12 | for (j in as.character(unique(prop$Var1))) { 13 | for (i in as.character(unique(prop$Var1))) { 14 | a = cbind(filter(prop,Var1 %in% c(j)),filter(prop,Var1 %in% c(i))) 15 | a = a[,c(2,1,3,4,6)] 16 | cor_frame[j,i] = cor(a$Freq,a$Freq.1,method ='spearman') 17 | } 18 | } 19 | 20 | mat = cor_frame['Tumor',] %>% t() %>% data.frame() %>% arrange(Tumor) 21 | mat2 <- matrix(0, nrow = nrow(mat), ncol = nrow(mat), dimnames = list(rownames(mat),rownames(mat))) 22 | mat2['Tumor',] = mat$Tumor 23 | 24 | netVisual_circle(mat2, vertex.size.max = 10,vertex.weight = c(1:42),weight.scale = T, label.edge= F,edge.weight.max = 0.4, 25 | color.use = c(colorRampPalette(c('#3D64AC','#DEEEDD'))(37),'#F4F1B3','#F4EDAE','#F5C885','#C73434','black')) 26 | 27 | 28 | 29 | ######## Supplementary 7C 30 | exp = AverageExpression(Tumor_HC,features = 'MDK',group.by = 'sample_name') 31 | exp = data.frame(t(exp$SCT)) 32 | names(exp) = 'exp' 33 | exp$Var2 = rownames(exp) 34 | prop = prop.table(table(scHC_cell@meta.data$cell_type2, scHC_cell@meta.data[,"orig.ident"]), 2) *100 35 | prop = reshape2::melt(prop) 36 | 37 | prop = filter(prop,Var1 == 'TREM2') 38 | prop = merge(exp,prop,by = 'Var2') 39 | 40 | ggplot(prop, 41 | aes(x = exp,y = value))+ 42 | geom_point(size = 5)+ 43 | geom_smooth(method = lm)+ stat_cor() 44 | 45 | 46 | ######## Supplementary 7D 47 | MDK = bulk_Expr[c('MDK','NCL'),] %>% t() %>% data.frame() 48 | ggplot(MDK, 49 | aes(x = MDK,y = NCL))+ 50 | geom_point(size = 5)+ 51 | geom_smooth(method = lm)+ stat_cor() 52 | 53 | 54 | 55 | 56 | 57 | ######## Supplementary 7E 58 | 59 | mdk = TCGA_HC[c('MDK'),] %>% t() %>% data.frame() 60 | ssGSEA_Score = gsva(as.matrix(TCGA_HC), as.data.frame(TREM2_Macro_signature), 61 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 62 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 63 | names(ssGSEA_Score) = 'TREM2_Macro' 64 | mdk$a = 'a' 65 | 66 | mdk = mdk[rownames(ssGSEA_Score),] 67 | mdk$ssGSEA_Score = ssGSEA_Score$TREM2_Macro 68 | 69 | mdk = mdk[rownames(TCGA_meta),] 70 | mdk$MVI = TCGA_meta$vascular_tumor_cell_type 71 | 72 | mdk[colnames(TCGA_N),'MVI'] = 'Normal' 73 | 74 | MVI= filter(mdk,MVI %in% c('Micro')) 75 | MVI$CLASS = if_else(MVI$MDK >= median(MVI$MDK),'High','Low') 76 | 77 | ggplot(MVI, aes(x = CLASS, y = TREM2_Macro ,fill = CLASS)) + 78 | geom_violin(aes(fill = CLASS),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 79 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 80 | theme_bw()+stat_compare_means()+ 81 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 82 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+ 83 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 84 | theme(axis.text.x = element_text(size = 14), 85 | axis.text.y = element_text(size = 14), 86 | axis.title.y = element_text(size = 14)) 87 | 88 | 89 | 90 | No_MVI= filter(mdk,MVI %in% c('None')) 91 | No_MVI$CLASS = if_else(No_MVI$MDK >= median(No_MVI$MDK),'High','Low') 92 | 93 | ggplot(No_MVI, aes(x = CLASS, y = TREM2_Macro ,fill = CLASS)) + 94 | geom_violin(aes(fill = CLASS),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 95 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 96 | theme_bw()+stat_compare_means()+ 97 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 98 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+ 99 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 100 | theme(axis.text.x = element_text(size = 14), 101 | axis.text.y = element_text(size = 14), 102 | axis.title.y = element_text(size = 14)) 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /SupplementaryFig.3.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 3A 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | 6 | Bcell = scdata3[,filter(scdata3@meta.data,celltype2 %in% c('B cell')) %>% rownames()] 7 | Bcell_meta = Bcell@meta.data 8 | Bcell = CreateSeuratObject(Bcell@assays$RNA@counts) 9 | Bcell@meta.data = Bcell_meta 10 | Bcell = SCTransform(Bcell, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 11 | Bcell = RunPCA(Bcell, features = VariableFeatures(Bcell)) 12 | ElbowPlot(Bcell,ndims = 50) 13 | library(harmony) 14 | Bcell@meta.data[Bcell$orig.ident %in%c('1NT','T1'),'Patient' ] = 'P1' 15 | Bcell@meta.data[Bcell$orig.ident %in%c('NT2','T2'),'Patient' ] = 'P2' 16 | Bcell@meta.data[Bcell$orig.ident %in%c('NT3','T3'),'Patient' ] = 'P3' 17 | Bcell@meta.data[Bcell$orig.ident %in%c('NT4','T4'),'Patient' ] = 'P4' 18 | Bcell@meta.data[Bcell$orig.ident %in%c('NT5','T5'),'Patient' ] = 'P5' 19 | 20 | Bcell = Bcell %>% RunHarmony("Patient", plot_convergence = TRUE,assay.use = "SCT") 21 | Bcell = RunUMAP(Bcell, reduction = "harmony",dims = 1:20) 22 | 23 | Bcell = FindNeighbors(Bcell, reduction = "harmony", dims = 1:20) 24 | Bcell = FindClusters(Bcell, resolution = 0.1,algorithm=1) 25 | 26 | DimPlot(Bcell, reduction = "umap",group.by = 'seurat_clusters',label = T)+NoLegend() 27 | 28 | Bcell2 = Bcell[,filter(Bcell@meta.data,!SCT_snn_res.2 %in% c(28,4,7,26,9,14,20)) %>% rownames()] 29 | 30 | meta = Bcell2@meta.data 31 | Bcell2 = CreateSeuratObject(Bcell2@assays$RNA@counts) 32 | Bcell2@meta.data = meta 33 | 34 | Bcell2 = SCTransform(Bcell2, variable.features.n = 500) 35 | Bcell2 = RunPCA(Bcell2, features = VariableFeatures(Bcell2)) 36 | ElbowPlot(Bcell2,ndims = 50) 37 | Bcell2 = Bcell2 %>% RunHarmony("Patient", plot_convergence = TRUE,assay.use = "SCT") 38 | Bcell2 = RunUMAP(Bcell2, reduction = "harmony",dims = 1:20) 39 | Bcell2 = FindNeighbors(Bcell2, reduction = "harmony", dims = 1:30) 40 | Bcell2 = FindClusters(Bcell2, resolution = 0.1,algorithm=1) 41 | Bcell2 = FindClusters(Bcell2, resolution = 0.05,algorithm=1) 42 | 43 | DimPlot(Bcell2, reduction = "umap",group.by = 'celltype2',label = T, 44 | cols = c('#ECC47A','#B3B4B9','#3CAA5D','#D8E6A7','#93D6C5', 45 | '#A0D3C8','#43C4BE','#EBABC9')) 46 | 47 | 48 | 49 | 50 | ######## Supplementary 3B 51 | jjDotPlot(Bcell2,dot.col = c("#0E6DAE",'white','#C0293B'),xtree=F,ytree = F,id = 'meta.cluster', 52 | gene = c('MS4A1','CD52','HLA-DRA','MKI67','TOP2A','LGALS1','IGHA2','IGHA1','IGHG2','IGHG1','IGHG3','IGHG4', 53 | 'IGKC','IGKV4-1','SDC1','IGLC2','IGLC3','IGHM','CCDC88A')) 54 | 55 | 56 | 57 | ######## Supplementary 3C 58 | library("sscVis") 59 | library("data.table") 60 | library("grid") 61 | library("cowplot") 62 | library("ggrepel") 63 | library("readr") 64 | library("plyr") 65 | library("ggpubr") 66 | library("ggplot2") 67 | table(Bcell2$celltype2) 68 | 69 | Bcell2$loc = Bcell2$MVI 70 | Bcell2$meta.cluster = Bcell2$celltype2 71 | 72 | names(Bcell2@meta.data)[25] = 'loc' 73 | names(Bcell2@meta.data)[17] = 'meta.cluster' 74 | 75 | out.prefix <- "Fig1" 76 | OR.CD8.list <- do.tissueDist(cellInfo.tb = Bcell2@meta.data, 77 | out.prefix= sprintf("%s.STARTRAC.dist.T.baseline.CD8",out.prefix), 78 | pdf.width=4,pdf.height=6,verbose=1) 79 | 80 | 81 | bk <- c(seq(-2,2,by=0.01)) 82 | color = c(colorRampPalette(colors = c("white","#FB7568"))(length(bk)/2),colorRampPalette(colors = c("#FB7568","#FC554B"))(length(bk)/2)) 83 | pheatmap(OR.CD8.list$OR.dist.mtx,cluster_cols = F,border =F,color =color,breaks = bk,scale = 'row') 84 | 85 | 86 | 87 | 88 | ######## Supplementary 3D 89 | library(msigdbr) 90 | library(stringr) 91 | library(pheatmap) 92 | m_df = msigdbr(species = "Homo sapiens", category = "H") 93 | msigdbr_list = split(x = m_df$gene_symbol, f = m_df$gs_name) 94 | 95 | expr <- as.data.frame(Bcell2@assays$SCT@data) 96 | expr=as.matrix(expr) 97 | Hall_Bcell <- gsva(expr, msigdbr_list, kcdf="Gaussian",method = "gsva") 98 | 99 | Hall_Bcell2 = data.frame(t(Hall_Bcell)) 100 | Hall_Bcell2 = Hall_Bcell2[rownames(Bcell2@meta.data),] 101 | Hall_Bcell2$celltype = Bcell2$celltype2 102 | 103 | Hall_mean = group_by(Hall_Bcell2, celltype) %>% summarize_each(funs(mean)) %>% data.frame() 104 | rownames(Hall_mean) = Hall_mean$celltype 105 | Hall_mean$celltype = NULL 106 | Hall_mean = data.frame(t(Hall_mean)) 107 | rownames(Hall_mean)[1:50] = substring(rownames(Hall_mean),10,)[1:50] 108 | 109 | pheatmap(Hall_mean , fontsize = 8, 110 | color = colorRampPalette(c('#2E80B9','white','#D84234'))(100),scale = 'row', 111 | border=F, 112 | cluster_cols = T, cluster_rows = F, 113 | show_rownames = T, show_colnames = T) 114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /Figure1.txt: -------------------------------------------------------------------------------- 1 | ######## Figure 1B 2 | library(Seurat) 3 | library(ggplot2) 4 | library(dplyr) 5 | library(harmony) 6 | scdata2 = SCTransform(scdata2, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 7 | scdata2 = RunPCA(scdata2, features = VariableFeatures(scdata2)) 8 | ElbowPlot(scdata2,ndims = 50) 9 | 10 | scdata2 = RunUMAP(scdata2, reduction = "pca",dims = 1:30) 11 | scdata2 = RunTSNE(scdata2, dims = 1:30,reduction = "pca",perplexity = 50) 12 | 13 | scdata2 = FindNeighbors(scdata2, reduction = "pca", dims = 1:30) 14 | scdata2 = FindClusters(scdata2, resolution = 0.3,algorithm=1) 15 | 16 | DimPlot(scdata2, reduction = "umap",group.by = 'celltype2',label = T,repel = T,pt.size = 0.01, 17 | cols = c('#EFD4B4','#9BCFB9','#F0C0BD','#FB6264','#4E9C99','#70C055','#E98A27','#FEBC28')) 18 | 19 | DimPlot(scdata2, reduction = "umap") 20 | 21 | 22 | 23 | ######## Figure 1C 24 | FeaturePlot(scdata4,features = "CD3E",reduction = "umap",pt.size = 0.0001,max.cutoff = 1.5, 25 | cols = c("#FFEFD5","#E6E6FA","#87CEFA","#6495ED","#4169E1","#0000CD","#000080"))+ 26 | scale_x_continuous("")+scale_y_continuous("")+ 27 | theme_bw()+ 28 | theme( panel.grid.major = element_blank(),panel.grid.minor = element_blank(), 29 | axis.ticks = element_blank(),axis.text = element_blank(), 30 | legend.position = "none", 31 | plot.title = element_text(hjust = 0.5,size=14))+ggtitle('T cell (CD3E)') 32 | 33 | 34 | ######## Figure 1D 35 | top = cell_marker %>% group_by(cluster) %>% top_n(n = 20, wt = avg_log2FC ) 36 | top = rbind(filter(top,cluster == 'T cell'),filter(top,cluster == 'Myeloid'),filter(top,cluster == 'B cell'),filter(top,cluster == 'Endo'), 37 | filter(top,cluster == 'Mesenchyme'),filter(top,cluster == 'Epi'),filter(top,cluster == 'Malignant')) 38 | 39 | exp = AverageExpression(scdata4,group.by = 'celltype2',features = top$gene) 40 | 41 | scdata4$celltype2 = factor(scdata4$celltype2,levels = c('T cell','Myeloid','B cell','Endo','Mesenchyme','Epi','Malignant')) 42 | exp = exp$SCT 43 | exp = exp[,c('T cell','Myeloid','B cell','Endo','Mesenchyme','Epi','Malignant')] 44 | bk <- c(seq(-2,2,by=0.01)) 45 | color = c(colorRampPalette(colors = c("white","#FEF9F7"))(length(bk)/2),colorRampPalette(colors = c("#FEF9F7","#FB6848"))(length(bk)/2)) 46 | pheatmap(exp, fontsize=6, 47 | color = color,scale = 'row', 48 | border_color = "grey60",border=T, 49 | cluster_cols = F, cluster_rows = F, 50 | show_rownames = F, show_colnames = T) 51 | 52 | 53 | library(clusterProfiler) 54 | res1 = bitr(top$gene,fromType= "SYMBOL" ,toType="ENTREZID",OrgDb="org.Hs.eg.db") 55 | rownames(res1) = res1$SYMBOL 56 | kk <- enrichKEGG(res1[filter(top,cluster == 'T cell')$gene ,2], pvalueCutoff = 0.05,qvalueCutoff = 0.1) 57 | 58 | ego_BP = data.frame() 59 | for (i in as.character(unique(top$cluster))) { 60 | ego_BP2 <- enrichGO(filter(top,cluster == i)$gene, 61 | OrgDb = org.Hs.eg.db,ont = "BP", keyType = 'SYMBOL', 62 | pAdjustMethod = "BH",pvalueCutoff = 0.05,qvalueCutoff = 0.1,readable = FALSE) 63 | ego_BP2@result$celltype = i 64 | ego_BP = rbind(ego_BP,ego_BP2@result[1:10,]) 65 | } 66 | ego_subset = ego_BP[c('GO:0140131','GO:0035747','GO:0010820','GO:0019886','GO:0060333','GO:0043312','GO:0050864','GO:0050853', 67 | 'GO:0042113','GO:0010739','GO:0042118','GO:004544','GO:0006936','GO:0033275','GO:0030239','GO:0070268', 68 | 'GO:0097284','GO:0043588', 'GO:0002576','GO:0034375','GO:0072376'),c(2,5,6,7,8,9,10)] 69 | ego_subset$log10 = -log10(ego_subset$p.adjust) 70 | ego_subset$Description = factor(ego_subset$Description,levels = rev(ego_subset$Description)) 71 | 72 | ggplot(ego_subset, aes(x=Description, y=log10,fill = Count)) + 73 | geom_bar(position = "dodge",stat = "identity",colour="black",width= 0.6)+coord_flip()+ 74 | scale_fill_gradient2(low = "#EFAE95", high = "#F37132") 75 | 76 | 77 | ######## Figure 1G 78 | No_Malignant = filter(scdata4@meta.data,celltype2 != 'Malignant') 79 | prop = prop.table(table(No_Malignant$celltype2, No_Malignant[,"MVI2"]), 2) *100 80 | prop = reshape2::melt(prop) 81 | 82 | 83 | prop$Var1 = factor(prop$Var1,levels = c('T cell','B cell','Myeloid','Epi','Endo','Mesenchyme')) 84 | prop$Var2 = factor(prop$Var2,levels = c('Normal Non-MVI','Normal MVI','Tumor Non-MVI','Tumor MVI')) 85 | ggplot(prop,aes(Var2,value,fill = Var1 ))+geom_bar(stat = "identity",position = "stack")+ ggthemes::theme_few()+ 86 | scale_fill_manual(values = c('#A57EBF','#E2CAAE','#EEC689','#DE6449','#9BCFB9', 87 | '#87B2D4','#50C1E9','#DEA5BE','#93BF82')) 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /SupplementaryFig.1.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 1B 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | 6 | scdata3 = ScaleData(scdata3,features = rownames(scdata3)) 7 | scdata3 = RunPCA(scdata3, features = rownames(scdata3)) 8 | scdata3 = RunTSNE(scdata3,features = rownames(scdata3)) 9 | 10 | 11 | tsne = data.frame(row.names = as.character(unique(scdata3$Patient))) 12 | for (i in as.character(unique(scdata3$Patient))) { 13 | 14 | a = scdata3@reductions$tsne@cell.embeddings[rownames(filter(scdata3@meta.data,Patient == i)),1:2] 15 | tsne[i,'tsne1'] = mean(a[,1] %>% as.numeric()) 16 | tsne[i,'tsne2'] = mean(a[,2] %>% as.numeric()) 17 | 18 | } 19 | 20 | tsne2 = data.frame(row.names = as.character(unique(scdata3$orig.ident))) 21 | for (i in as.character(unique(scdata3$orig.ident))) { 22 | 23 | a = scdata3@reductions$tsne@cell.embeddings[rownames(filter(scdata3@meta.data,orig.ident == i)),1:2] 24 | tsne2[i,'tsne1'] = mean(a[,1] %>% as.numeric()) 25 | tsne2[i,'tsne2'] = mean(a[,2] %>% as.numeric()) 26 | } 27 | 28 | 29 | tsne2$tissue = "N" 30 | tsne2[rownames(pca2) %in% c("T1","T2","T3","T4","T5"), "tissue"] = "T" 31 | 32 | tsne$MVI = "MVI" 33 | tsne[rownames(tsne) %in% c("P4",'P5'), "MVI"] = "No MVI" 34 | 35 | ggplot(data=tsne,aes(x= tsne1,y= tsne2))+geom_point(shape=21,size= 6,aes(color=factor(MVI)shape =factor(MVI) ) ) 36 | 37 | ggplot(data= tsne2,aes(x= tsne1,y= tsne2))+geom_point(shape=21,size= 6,aes(color=factor(tissue)shape =factor(tissue) ) ) 38 | 39 | 40 | 41 | 42 | 43 | ######## Supplementary 1C 44 | library(Seurat) 45 | library(dplyr) 46 | library(ggpubr) 47 | ave_exp = AverageExpression(scdata2,features = rownames(scdata2),slot = 'counts') 48 | ave_exp = ave_exp$RNA 49 | 50 | screen = sapply(strsplit(colnames(TCGA_HC),"-"),"[",4) 51 | screen = sapply(strsplit(screen,""),"[",1) 52 | screen = gsub("2","1",screen) 53 | 54 | TCGA_N = TCGA_HC[,screen==1] 55 | TCGA_T = TCGA_HC[,screen==0] 56 | 57 | intersect_gene = intersect(rownames(scdata2),rownames(TCGA_HC)) 58 | sc__N_exp = rowMeans(scdata2@assays$RNA@counts[intersect_gene,filter(scdata2@meta.data,tissue == 'Normal') %>% rownames()]) %>% data.frame() 59 | sc__T_exp = rowMeans(scdata2@assays$RNA@counts[intersect_gene,filter(scdata2@meta.data,tissue == 'Tumor') %>% rownames()]) %>% data.frame() 60 | 61 | TCGA_N_exp = rowMeans(TCGA_N[intersect_gene,]) %>% data.frame() 62 | TCGA_T_exp = rowMeans(TCGA_T[intersect_gene,]) %>% data.frame() 63 | 64 | names(sc__N_exp) = 'sc__N_exp' 65 | names(sc__T_exp) = 'sc__T_exp' 66 | names(TCGA_N_exp) = 'TCGA_N_exp' 67 | names(TCGA_T_exp) = 'TCGA_T_exp' 68 | 69 | cor = cbind(sc__N_exp,sc__T_exp,TCGA_N_exp,TCGA_T_exp) 70 | ggplot(cor,aes_string(x = cor$TCGA_T_exp,y = cor$sc__T_exp)) + 71 | geom_point(size = 1,color = '#898281',alpha = 1) + 72 | geom_smooth(method = 'loess',se = T,size = 1) + 73 | stat_cor(method = "spearman",digits = 3,size=4)+ 74 | theme_bw() +theme(axis.title = element_text(size = 16), 75 | axis.text = element_text(size = 14), 76 | axis.ticks.length = unit(0.25,'cm'), 77 | axis.ticks = element_line(size = 1), 78 | panel.border = element_rect(size = 1.5), 79 | panel.grid = element_blank()) + ylim(0,50)+ 80 | xlab('Bulk RNA-seq(FPKM)')+ ylab("scRNA-seq(Count)") 81 | 82 | 83 | ggplot(cor,aes_string(x = cor$TCGA_N_exp,y = cor$sc__N_exp)) + 84 | geom_point(size = 1,color = '#898281',alpha = 1) + 85 | geom_smooth(method = 'loess',se = T,size = 1) + 86 | stat_cor(method = "spearman",digits = 3,size=4)+ 87 | theme_bw() +theme(axis.title = element_text(size = 16), 88 | axis.text = element_text(size = 14), 89 | axis.ticks.length = unit(0.25,'cm'), 90 | axis.ticks = element_line(size = 1), 91 | panel.border = element_rect(size = 1.5), 92 | panel.grid = element_blank()) + ylim(0,50)+ 93 | xlab('Bulk RNA-seq(FPKM)')+ ylab("scRNA-seq(Count)") 94 | 95 | 96 | 97 | 98 | ######## Supplementary 1D 99 | scdata[["percent.mt"]] = PercentageFeatureSet(scdata, pattern = "^MT-") #线粒体细胞 100 | scdata[["percent.rb"]] = PercentageFeatureSet(scdata, pattern = "^RP[SL]") 101 | 102 | VlnPlot(scdata, features = c("nFeature_RNA", "nCount_RNA", "percent.mt","percent.rb"),ncol = 2,pt.size = 0, 103 | cols = c('#A6DDEA','#80D0C3','#C8E8E1','#C2C8DA','#9EAAC4','#F9CDBF','#F3A59A','#EE8080','#D8CEC2','#BFB0A4')) 104 | 105 | 106 | ######## Supplementary 1E 107 | scdata@meta.data %>% 108 | ggplot(aes(color = orig.ident, x=percent.mt, fill=orig.ident)) + 109 | geom_density(alpha = 0.2) + 110 | scale_x_log10() + 111 | theme_classic() + 112 | geom_vline(xintercept = 40)+ 113 | scale_color_manual(values = c('#A6DDEA','#80D0C3','#C8E8E1','#C2C8DA','#9EAAC4','#F9CDBF','#F3A59A','#EE8080','#D8CEC2','#BFB0A4')) 114 | 115 | scdata@meta.data %>% 116 | ggplot(aes(color = orig.ident, x=nFeature_RNA, fill=orig.ident)) + 117 | geom_density(alpha = 0.2) + 118 | scale_x_log10() + 119 | theme_classic() + 120 | geom_vline(xintercept = c(400,6000))+ 121 | scale_color_manual(values = c('#A6DDEA','#80D0C3','#C8E8E1','#C2C8DA','#9EAAC4','#F9CDBF','#F3A59A','#EE8080','#D8CEC2','#BFB0A4')) 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /Figure5.txt: -------------------------------------------------------------------------------- 1 | ######## Figure 5a 2 | library(scRNAtoolVis) 3 | library(ggplot2) 4 | library(ggpubr) 5 | library(Seurat) 6 | library(dplyr) 7 | library(pheatmap) 8 | 9 | HC = scdata3[,filter(scdata3@meta.data,celltype %in% c('Hepa')) %>% rownames()] 10 | HC = SCTransform(HC, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 11 | HC = RunPCA(HC, features = VariableFeatures(HC)) 12 | ElbowPlot(HC,ndims = 50) 13 | 14 | HC = RunUMAP(HC, reduction = "pca",dims = 1:30) 15 | HC = FindNeighbors(HC, reduction = "pca", dims = 1:30) 16 | HC = FindClusters(HC, resolution = 1,algorithm=1) 17 | 18 | DimPlot(HC, reduction = "umap",group.by = 'seurat_clusters',label = T)+NoLegend() 19 | 20 | FeaturePlot(HC, reduction = "umap", features = c("PTPRC")) # Doublet 15,18 21 | 22 | HC2 = HC[,filter(HC@meta.data, !SCT_snn_res.1 %in% c(15,18)) %>% rownames()] 23 | 24 | 25 | HC2 = SCTransform(HC2, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 26 | HC2 = RunPCA(HC2, features = VariableFeatures(HC2)) 27 | ElbowPlot(HC2,ndims = 50) 28 | 29 | 30 | HC2 = RunUMAP(HC2, reduction = "pca",dims = 1:24) 31 | HC2 = FindNeighbors(HC2, reduction = "pca", dims = 1:24) 32 | HC2 = FindClusters(HC2, resolution = 0.2,algorithm= 1) 33 | 34 | DimPlot(HC2, reduction = "umap",group.by = 'SCT_snn_res.0.1', 35 | label = T,cols = c('#DAAAB8','#E26648','#BC6805','#F3C92B','#6EAE1F','#B1D7EA','#364B90'))+NoLegend() 36 | DimPlot(HC2, reduction = "umap",group.by = 'Patient',label = F,cols = c('#98C282','#E29F58','#AB836A','#7E98BB','#A780B9')) 37 | DimPlot(HC2, reduction = "umap",group.by = 'orig.ident',label = F) 38 | 39 | 40 | 41 | 42 | ######## Figure 5b 43 | library(msigdbr) 44 | library(GSVA) 45 | library(Seurat) 46 | library(readxl) 47 | library(stringr) 48 | anno = read_excel('hallmark.xlsx') %>% data.frame() 49 | rownames(anno) = anno$Hallmark.Name 50 | anno = data.frame(row.names = anno$Hallmark.Name,anno$Process.Category) 51 | m_df = msigdbr(species = "Homo sapiens", category = "H") 52 | msigdbr_list = split(x = m_df$gene_symbol, f = m_df$gs_name) 53 | 54 | expr <- as.data.frame(Malig@assays$SCT@data) 55 | expr=as.matrix(expr) 56 | Hall <- gsva(expr, msigdbr_list, kcdf="Gaussian",method = "gsva") 57 | 58 | 59 | Hall = data.frame(t(Hall)) 60 | colnames(Hall) = substring(colnames(Hall),10,) 61 | 62 | Hall = Hall[rownames(Malig@meta.data),] 63 | 64 | Hall$MVI2 = Malig$MVI2 65 | 66 | Hall_mean = group_by(Hall, MVI2) %>% summarize_each(funs(mean)) %>% data.frame() 67 | rownames(Hall_mean) = Hall_mean$MVI2 68 | Hall_mean$MVI2 = NULL 69 | Hall_mean = data.frame(t(Hall_mean)) 70 | Hall_mean$fc = (Hall_mean$MVI-Hall_mean$Non_MVI)*10 71 | 72 | Hall_mean$name = rownames(Hall_mean) 73 | Hall_mean = arrange(Hall_mean,fc) 74 | Hall_mean$name = factor(Hall_mean$name,levels = (Hall_mean$name)) 75 | ggplot(Hall_mean[c(1:5,46:50),], aes(x=name, y=fc)) + 76 | geom_bar(position = "dodge",stat = "identity",colour="black",fill = "#f7c2c5",width=0.6)+coord_flip()+ylim(-1.5,2) 77 | 78 | 79 | 80 | ######## Figure 5c 81 | HC2 = CellCycleScoring(object = HC2, 82 | g2m.features = cc.genes$g2m.genes, 83 | s.features = cc.genes$s.genes) 84 | 85 | table(HC2$MVI,HC2$Phase) 86 | prop = prop.table(table(HC2@meta.data$Phase, HC2@meta.data[,"MVI"]), 2) *100 87 | prop = reshape2::melt(prop) 88 | ggplot(prop,aes(Var2,value,fill = Var1 ))+geom_bar(stat = "identity") 89 | 90 | 91 | 92 | ######## Figure 5d 93 | library(msigdbr) 94 | VlnPlot(Malig,features = c('CCL3','CCL4','HLA-G'),group.by = 'MVI',pt.size = 0) 95 | 96 | m_df = msigdbr(species = "Homo sapiens", category = "H") 97 | Malig <- AddModuleScore(object = Malig, 98 | features = list(c(filter(m_df, 99 | gs_name == 'HALLMARK_INFLAMMATORY_RESPONSE')$gene_symbol)))+NoLegend() 100 | VlnPlot(Malig,features = 'INFLAMMATORY_RESPONSE1',group.by = 'MVI',pt.size = 0)+stat_compare_means() 101 | 102 | 103 | 104 | ######## Figure 5e-f 105 | library(monocle) 106 | Mono_matrix = as(as.matrix(GetAssayData(HC2,slot = "count")), 'sparseMatrix') 107 | feature_ann = data.frame(gene_id=rownames(Mono_matrix),gene_short_name=rownames(Mono_matrix)) 108 | rownames(feature_ann) = rownames(Mono_matrix) 109 | Mono_fd = new("AnnotatedDataFrame", data = feature_ann) 110 | sample_ann = HC2@meta.data 111 | Mono_pd = new("AnnotatedDataFrame", data =sample_ann) 112 | Mono.cds = newCellDataSet(Mono_matrix,phenoData =Mono_pd,featureData =Mono_fd,expressionFamily=negbinomial.size()) 113 | 114 | Mono.cds = estimateSizeFactors(Mono.cds) 115 | Mono.cds = estimateDispersions(Mono.cds) 116 | disp_table = dispersionTable(Mono.cds) 117 | unsup_clustering_genes = subset(disp_table, mean_expression >= 1) 118 | Mono.cds = setOrderingFilter(Mono.cds, unsup_clustering_genes$gene_id) 119 | Mono.cds = reduceDimension( Mono.cds, max_components = 2,method = 'DDRTree') 120 | Mono.cds = orderCells(Mono.cds,root_state=3) 121 | 122 | plot_cell_trajectory(Mono.cds, color_by = "State",cell_size = 1,show_branch_points=T) 123 | plot_cell_trajectory(Mono.cds, color_by = "Pseudotime",cell_size = 1,show_branch_points=T)+ 124 | theme(legend.position = "right") + scale_colour_gradient(low = "#FAF5A9", high = "#C52F2D") 125 | plot_cell_trajectory(Mono.cds, color_by = "Patient",cell_size = 1,show_branch_points=T)+ facet_wrap(~Patient) 126 | plot_cell_trajectory(Mono.cds, color_by = "MVI",cell_size = 1,show_branch_points=T)+ 127 | scale_color_manual(values=c('#FC6F13','#2BBAD7','#F0C0BD')) 128 | 129 | Time_diff <- differentialGeneTest(Mono.cds, cores = 10) 130 | 131 | plot_pseudotime_heatmap(Mono.cds[filter(Time_diff,qval==0) %>% rownames(),], 132 | num_clusters = 4, 133 | show_rownames = T,return_heatmap=T, 134 | hmcols = colorRampPalette(c('#5773D8','white','#C22E31'))(100)) 135 | 136 | 137 | ######## Figure 5h 138 | prop = prop.table(table(scdata5$celltype3, scdata5@meta.data[,"orig.ident"]), 2) *100 139 | prop = data.frame(prop) 140 | 141 | cor_frame = data.frame(row.names = as.character(unique(prop$Var1))) 142 | for (j in as.character(unique(prop$Var1))) { 143 | for (i in as.character(unique(prop$Var1))) { 144 | a = cbind(filter(prop,Var1 %in% c(j)),filter(prop,Var1 %in% c(i))) 145 | a = a[,c(2,1,3,4,6)] 146 | cor_frame[j,i] = cor(a$Freq,a$Freq.1 ) 147 | } 148 | } 149 | 150 | mat = cor_frame['Malignant',] %>% t() %>% data.frame() %>% arrange(Malignant) 151 | mat2 <- matrix(0, nrow = nrow(mat), ncol = nrow(mat), dimnames = list(rownames(mat),rownames(mat))) 152 | mat2['Malignant',] = mat$Malignant 153 | 154 | netVisual_circle(mat2, vertex.size.max = 10,vertex.weight = c(1:42),weight.scale = T, label.edge= F,edge.weight.max = 0.4, 155 | color.use = c(colorRampPalette(c('#3D64AC','#DEEEDD'))(37),'#F4F1B3','#F4EDAE','#F5C885','#C73434','black')) 156 | 157 | 158 | 159 | ######## Figure 5j 160 | exp = AverageExpression(scdata5,group.by = 'orig.ident',features = 'MDK') 161 | exp = exp$SCT 162 | 163 | exp = data.frame(t(exp)) 164 | exp$name = rownames(exp) 165 | exp$trem2 = filter(prop,Var1 == "TREM2_Macro")$Freq 166 | 167 | ggplot(exp,aes(x = trem2,y = t.exp.))+ 168 | geom_point(size = 5)+ 169 | geom_smooth(method = lm)+ stat_cor()+ggthemes::theme_few() 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /Figure6.txt: -------------------------------------------------------------------------------- 1 | ######## Figure 6a 2 | library(scRNAtoolVis) 3 | library(ggplot2) 4 | library(ggpubr) 5 | library(Seurat) 6 | library(dplyr) 7 | library(pheatmap) 8 | 9 | scdata5 = scdata4[,filter(scdata4@meta.data,celltype3 != c('Other') & celltype3 != 'Malignant' & celltype3 != 'EPI') %>% rownames(),] 10 | 11 | prop = prop.table(table(scdata5$celltype3, scdata5@meta.data[,"orig.ident"]), 2) *100 12 | prop = data.frame(prop) 13 | 14 | cor_frame = data.frame(row.names = as.character(unique(prop$Var1))) 15 | for (j in as.character(unique(prop$Var1))) { 16 | for (i in as.character(unique(prop$Var1))) { 17 | a = cbind(filter(prop,Var1 %in% c(j)),filter(prop,Var1 %in% c(i))) 18 | a = a[,c(2,1,3,4,6)] 19 | cor_frame[j,i] = cor(a$Freq,a$Freq.1 ) 20 | } 21 | } 22 | 23 | p_value = data.frame(row.names = as.character(unique(prop$Var1))) 24 | for (j in as.character(unique(prop$Var1))) { 25 | for (i in as.character(unique(prop$Var1))) { 26 | a = cbind(filter(prop,Var1 %in% c(j)),filter(prop,Var1 %in% c(i))) 27 | a = a[,c(2,1,3,4,6)] 28 | b = cor.test(a$Freq,a$Freq.1) 29 | p_value[j,i] = b[[3]] 30 | } 31 | } 32 | p_value = round(p_value,3) 33 | p_value[p_value > 0.1] = 10 34 | for (i in 1:ncol(p_value)) { 35 | cor_frame[p_value[,i] == 10,i] = 0 36 | } 37 | 38 | pheatmap::pheatmap(cor_frame,color = colorRampPalette(c('#303595','white','#CD7158'))(100), 39 | #clustering_method = 'ward', 40 | border =F) 41 | 42 | 43 | 44 | 45 | ######## Figure 6b 46 | ssGSEA_Score = gsva(as.matrix(bulk_Data), as.data.frame(program_genes), 47 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 48 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 49 | names(ssGSEA_Score) = c('program_score') 50 | 51 | ssGSEA_Score = ssGSEA_Score[rownames(bulk_meta),] 52 | ssGSEA_Score$OS = bulk_meta$OS 53 | ssGSEA_Score$OS.time = bulk_meta$OS.time 54 | 55 | library(survival) 56 | library(survminer) 57 | cut = surv_cutpoint(ssGSEA_Score,time = "OS.time",event = "OS",variables = "program_score") 58 | sur = surv_categorize(cut) 59 | ggsurvplot(survfit(Surv(sur$OS.time,event = sur$OS)~program_score, 60 | data=sur), 61 | pval = TRUE, 62 | risk.table = F, 63 | risk.table.col = "strata", 64 | ggtheme = theme_few(), 65 | font.x = c(14),font.y = c(14), 66 | font.tickslab = c(14, "black"), 67 | legend = c(0.88,0.9), 68 | legend.title = "", 69 | palette=c("#ED0000","#00468B"))+ylab('Overall survival')+xlab('Time (day)')+ 70 | ggtitle('CLAMT Program') 71 | 72 | 73 | 74 | ######## Figure 6c 75 | ssGSEA_Score = gsva(as.matrix(TCGA), as.data.frame(program_genes), 76 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 77 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 78 | names(ssGSEA_Score) = c('program_score') 79 | 80 | ssGSEA_Score = ssGSEA_Score[rownames(TCGA_meta),] 81 | ssGSEA_Score$MVI = TCGA_meta$vascular_tumor_cell_type 82 | 83 | ssGSEA_Score[colnames(TCGA_N),'MVI'] = 'Normal' 84 | ssGSEA_Score = filter(ssGSEA_Score,MVI %in% c('Micro','None')) 85 | ssGSEA_Score[ssGSEA_Score$MVI == 'None','MVI'] = 'MVI- HCC' 86 | ssGSEA_Score[ssGSEA_Score$MVI == 'Micro','MVI'] = 'MVI+ HCC' 87 | 88 | ggplot(ssGSEA_Score, aes(x = MVI, y = program_score,fill = MVI)) + 89 | geom_violin(aes(fill = MVI),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 90 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 91 | theme_bw()+stat_compare_means()+ 92 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 93 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+theme_few()+ 94 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 95 | ylab('Estimate of module')+xlab('')+ 96 | theme(axis.text.x = element_text(size = 14), 97 | axis.text.y = element_text(size = 14), 98 | axis.title.y = element_text(size = 14)) 99 | 100 | 101 | 102 | ######## Figure 6d 103 | library(Seurat) 104 | library(dplyr) 105 | library(CellChat) 106 | MVI = scdata4[,filter(scdata4@meta.data,MVI2 %in% c('Tumor MVI')) %>% rownames()] 107 | NoMVI = scdata4[,filter(scdata4@meta.data,MVI2 %in% c('Tumor Non-MVI')) %>% rownames()] 108 | 109 | data.input <- MVI@assays$SCT@data 110 | identity = data.frame(group = MVI$celltype3, row.names = names(MVI$celltype3)) 111 | unique(identity$group) 112 | cellchat <- createCellChat(data.input, meta = identity, group.by = "group") 113 | cellchat <- addMeta(cellchat, meta = identity) 114 | cellchat <- setIdent(cellchat, ident.use = "group") 115 | groupSize <- as.numeric(table(cellchat@idents)) 116 | CellChatDB <- CellChatDB.human 117 | dplyr::glimpse(CellChatDB$interaction) # Show the structure of the database 118 | CellChatDB.use <- CellChatDB 119 | cellchat@DB <- CellChatDB.use 120 | cellchat <- subsetData(cellchat) 121 | future::plan("multiprocess", workers = 4) 122 | cellchat <- identifyOverExpressedGenes(cellchat) 123 | cellchat <- identifyOverExpressedInteractions(cellchat) 124 | cellchat <- projectData(cellchat, PPI.human) 125 | cellchat <- computeCommunProb(cellchat) 126 | cellchat <- filterCommunication(cellchat, min.cells = 10) 127 | cellchat <- computeCommunProbPathway(cellchat) 128 | cellchat <- aggregateNet(cellchat) 129 | cellchat_MVI = cellchat 130 | 131 | data.input <- NoMVI@assays$SCT@data 132 | identity = data.frame(group = NoMVI$celltype3, row.names = names(NoMVI$celltype3)) 133 | unique(identity$group) 134 | cellchat <- createCellChat(data.input, meta = identity, group.by = "group") 135 | cellchat <- addMeta(cellchat, meta = identity) 136 | cellchat <- setIdent(cellchat, ident.use = "group") 137 | groupSize <- as.numeric(table(cellchat@idents)) 138 | CellChatDB <- CellChatDB.human 139 | dplyr::glimpse(CellChatDB$interaction) # Show the structure of the database 140 | CellChatDB.use <- CellChatDB 141 | cellchat@DB <- CellChatDB.use 142 | cellchat <- subsetData(cellchat) 143 | future::plan("multiprocess", workers = 4) 144 | cellchat <- identifyOverExpressedGenes(cellchat) 145 | cellchat <- identifyOverExpressedInteractions(cellchat) 146 | cellchat <- projectData(cellchat, PPI.human) 147 | cellchat <- computeCommunProb(cellchat) 148 | cellchat <- filterCommunication(cellchat, min.cells = 10) 149 | cellchat <- computeCommunProbPathway(cellchat) 150 | cellchat <- aggregateNet(cellchat) 151 | cellchat_NonMVI = cellchat 152 | 153 | 154 | object.list <- list(MVI = cellchat_MVI, NonMVI = cellchat_NonMVI) 155 | cellchat <- mergeCellChat(object.list, add.names = names(object.list)) 156 | 157 | weight_M = cellchat_MVI@net$weight %>% data.frame() 158 | weight_NM = cellchat_NonMVI@net$weight %>% data.frame() 159 | 160 | weight = cellchat_MVI@net$weight 161 | weight2 = cellchat_NonMVI@net$weight 162 | 163 | weight = data.frame(weight - weight2) 164 | weight$name = rownames(weight) 165 | 166 | weight = reshape2::melt(weight) 167 | chordDiagram(filter(weight,value >= 0)) 168 | chordDiagram(filter(weight,value <= 0)) 169 | 170 | 171 | 172 | ######## Figure 6e 173 | ligand_MVI = subsetCommunication(cellchat_MVI)[which(subsetCommunication(cellchat_MVI)$ligand %in% ligand_MVI),] 174 | ligand_NonMVI = subsetCommunication(cellchat_NonMVI)[which(subsetCommunication(cellchat_NonMVI)$ligand %in% ligand_NonMVI),] 175 | 176 | ligand_MVI = group_by(ligand_MVI[,c('ligand','prob')], ligand) %>% summarize_each(funs(median)) %>% data.frame() 177 | ligand_NonMVI = group_by(ligand_NonMVI[,c('ligand','prob')], ligand) %>% summarize_each(funs(median)) %>% data.frame() 178 | ligand_MVI$class = 'MVI' 179 | ligand_NonMVI$class = 'NonMVI' 180 | ligand = rbind(ligand_MVI,ligand_NonMVI) 181 | ligand$y = rownames(ligand) 182 | 183 | ligand$y = factor(ligand$y,levels = ligand$y) 184 | ggplot(data = ligand,aes(x=y,y= prob,color=as.factor(class),size= prob))+ 185 | geom_point()+ geom_text_repel(label = ligand$ligand,color = 'black')+ggthemes::theme_few() 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /Figure2.txt: -------------------------------------------------------------------------------- 1 | ######## Figure 2a-b 2 | library(scRNAtoolVis) 3 | library(ggplot2) 4 | library(ggpubr) 5 | library(Seurat) 6 | library(dplyr) 7 | library(harmony) 8 | Tcell = scdata3[,filter(scdata3@meta.data,celltype2 %in% c('T cell')) %>% rownames()] 9 | Tcell = SCTransform(Tcell, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 10 | 11 | Tcell = RunPCA(Tcell, features = VariableFeatures(Tcell)) 12 | ElbowPlot(Tcell,ndims = 50) 13 | 14 | 15 | Tcell$MVI = 'MVI' 16 | Tcell@meta.data[Tcell$Patient %in%c('P4','P5'),'MVI' ] = 'Non_MVI' 17 | 18 | Tcell = Tcell %>% RunHarmony("Patient", plot_convergence = TRUE,assay.use = "SCT") 19 | Tcell = RunUMAP(Tcell, reduction = "harmony",dims = 1:20) 20 | 21 | Tcell = FindNeighbors(Tcell, reduction = "harmony", dims = 1:20) 22 | Tcell = FindClusters(Tcell, resolution = 0.3,algorithm=1) 23 | 24 | 25 | Tcell2 = Tcell[,filter(Tcell@meta.data,SCT_snn_res.0.3 %in% c(4,0,6,1,2,5,3)) %>% rownames()] # 8,7,10 Doublet 9 is myeloid 26 | 27 | Tcell2 = SCTransform(Tcell2, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 28 | 29 | Tcell2 = RunPCA(Tcell2, features = VariableFeatures(Tcell2)) 30 | ElbowPlot(Tcell3,ndims = 50) 31 | 32 | Tcell2 = Tcell2 %>% RunHarmony("Patient", plot_convergence = TRUE,assay.use = "SCT") 33 | Tcell3 = RunUMAP(Tcell3, reduction = "harmony",dims = 1:20) 34 | 35 | rb.genes <- rownames(Tcell2)[grep("^RP[SL]",rownames(Tcell2))] 36 | Tcell2 = Tcell2[(!(rownames(Tcell2) %in% rb.genes))] 37 | 38 | Tcell3 = FindNeighbors(Tcell3, reduction = "harmony", dims = 1:20) 39 | Tcell3 = FindClusters(Tcell3, resolution = 0.6,algorithm=1) 40 | 41 | DimPlot(Tcell2, reduction = "umap",group.by = 'SCT_snn_res.0.3',label = T,split.by = 'MVI')+NoLegend() 42 | 43 | 44 | T_marker = FindAllMarkers(Tcell3) 45 | top = T_marker %>% group_by(cluster) %>% top_n(n = 10, wt = avg_log2FC ) 46 | 47 | jjDotPlot(Tcell3,id = 'celltype3', dot.col = c("#0E6DAE",'white','#C0293B'),xtree=F,ytree = F, 48 | gene = c('NCAM1','XCL1','FCER1G', # CD56 NK 49 | 'CCL4L2','CCL3L1','CCL4', # Inflamed NK 50 | 'GNLY','NKG7','PRF1', # GNLY CTL 51 | 'EGR1','FOSB','TNF', # TNF memory T cells 52 | 'IL7R','LTB','CXCR4', # IL7R memory T cells 53 | 'RGS1','CXCL13','CD8A', # Activated T CD8 RGS1 54 | 'SELL','CCR7', # Tn 55 | 'FOXP3','CTLA4', # Treg 56 | 'MKI67','TOP2A')) # Cycling 57 | 58 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 1, 'celltype3'] = 'CD56 NK' 59 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 6, 'celltype3'] = 'Inflamed NK' 60 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 3, 'celltype3'] = 'GNLY CTL' 61 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 0, 'celltype3'] = 'TNF Tmem' 62 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 2, 'celltype3'] = 'IL7R Tmem' 63 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 5, 'celltype3'] = 'Activated T RGS1' 64 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 7, 'celltype3'] = 'T naive' 65 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 8, 'celltype3'] = 'Treg' 66 | Tcell3@meta.data[Tcell3$SCT_snn_res.0.5 == 4, 'celltype3'] = 'Cycling' 67 | 68 | DimPlot(Tcell3, reduction = "umap",group.by = 'celltype3',label = T, 69 | cols = c('#6C67AC','#FDBF6F','#B49D99','#9DCAE1','#E31A1C','#FF7F00', 70 | '#DEEDF9','#3F93C7','#CAB2D6')) 71 | 72 | 73 | 74 | ######## Figure 2c 75 | Tcell3 = CellCycleScoring(object = Tcell3, 76 | g2m.features = cc.genes$g2m.genes, 77 | s.features = cc.genes$s.genes) 78 | 79 | library(jjPlot) 80 | jjplot_vln = Tcell3@meta.data[,c('S.Score','G2M.Score','celltype3')] 81 | jjplot_vln = reshape2::melt(jjplot_vln) 82 | names(jjplot_vln) = c( 'id','gene','exp') 83 | map_df(unique(jjplot_vln$id),function(x){ 84 | tmp <- jjplot_vln %>% filter(id == x) 85 | map_df(unique(tmp$gene),function(j){ 86 | tmp1 <- tmp %>% filter(gene == j) 87 | # calculate median expressions 88 | tmp1$median_exp <- mean(tmp1$exp) 89 | return(tmp1) 90 | }) -> res 91 | return(res) 92 | }) -> jjplot_vln 93 | 94 | ggplot(jjplot_vln,aes(x = gene,y = id)) + 95 | geom_jjviomap(aes(val = exp,fill = median_exp), 96 | width = 1) + 97 | scale_fill_gradient(low = 'white',high = '#B92D30') + 98 | theme_bw(base_size = 14) + 99 | theme(panel.grid = element_blank(), 100 | axis.text.x = element_text(angle = 90,hjust = 1,vjust = 0.5)) + 101 | coord_fixed() 102 | 103 | 104 | 105 | ######## Figure 2d 106 | library("sscVis") 107 | library("data.table") 108 | library("grid") 109 | library("cowplot") 110 | library("ggrepel") 111 | library("readr") 112 | library("plyr") 113 | library("ggpubr") 114 | library("ggplot2") 115 | library("pheatmap") 116 | 117 | Tcell3@meta.data[Tcell3$orig.ident %in% c('1NT','NT2','NT3'),'MVI'] = 'N_MVI' 118 | Tcell3@meta.data[Tcell3$orig.ident %in% c('NT4','NT5'),'MVI'] = 'N_Non-MVI' 119 | Tcell3@meta.data[Tcell3$orig.ident %in% c('T1','T2','T3'),'MVI'] = 'T_MVI' 120 | Tcell3@meta.data[Tcell3$orig.ident %in% c('T4','T5' ),'MVI'] = 'T_Non-MVI' 121 | 122 | names(Tcell3@meta.data)[7] = 'loc' 123 | names(Tcell3@meta.data)[21] = 'meta.cluster' 124 | 125 | out.prefix <- "E/Fig1" 126 | OR.CD8.list <- do.tissueDist(cellInfo.tb = Tcell3@meta.data, 127 | out.prefix= sprintf("%s.STARTRAC.dist.T.baseline.CD8",out.prefix), 128 | pdf.width=4,pdf.height=6,verbose=1) 129 | 130 | pheatmap(OR.CD8.list$OR.dist.mtx,cluster_cols = F,color = colorRampPalette(c('white','#FB7568','#FD3F38'))(100)) 131 | 132 | 133 | 134 | ######## Figure 2e-f 135 | c4 = Tcell3[,filter(Tcell3@meta.data,SCT_snn_res.0.5 == 4) %>% rownames()] 136 | c4 = SCTransform(c4, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 137 | 138 | c4 = RunPCA(c4, features = VariableFeatures(c4)) 139 | ElbowPlot(c4) 140 | c4 = RunUMAP(c4, reduction = "pca",dims = 1:12) 141 | c4 = FindNeighbors(c4, reduction = "pca", dims = 1:12) 142 | c4 = FindClusters(c4, resolution = 0.2,algorithm=1) 143 | DimPlot(c4, reduction = "umap",group.by = 'SCT_snn_res.0.3',label = T)+NoLegend() 144 | 145 | 146 | FeaturePlot(c4,features = "PLP2",reduction = "umap",pt.size = 0.6, 147 | cols = c("#FFEFD5","#E6E6FA","#87CEFA","#6495ED","#4169E1","#0000CD","#000080"))+ 148 | scale_x_continuous("")+scale_y_continuous("")+ 149 | theme_bw()+ 150 | theme( panel.grid.major = element_blank(),panel.grid.minor = element_blank(), 151 | axis.ticks = element_blank(),axis.text = element_blank(), 152 | legend.position = "none", 153 | plot.title = element_text(hjust = 0.5,size=14)) 154 | 155 | 156 | ######## Figure 2i 157 | library(org.Hs.eg.db) 158 | library(clusterProfiler) 159 | library(pathview) 160 | library(enrichplot) 161 | gmt <- read.gmt("h.all.v7.4.symbols.gmt") 162 | gmt <- read.gmt("c5.go.bp.v2022.1.Hs.symbols.gmt") 163 | gmt <- read.gmt("c2.cp.kegg.v2022.1.Hs.symbols.gmt") 164 | 165 | Idents(Tcell3) = 'celltype3' 166 | TCYC_edg = FindMarkers(Tcell3,ident.1 = 'Tcyc') 167 | TCYC_edg = filter(TCYC_edg,p_val_adj <= 0.05) 168 | #write.csv(CYC1_edg,file = 'E:/CYC1_DEG.Rdata') 169 | 170 | TCYC_edg$SYMBOL = rownames(TCYC_edg) 171 | names(TCYC_edg)[2] = c("logFC" ) 172 | 173 | TCYC_edg <- TCYC_edg %>% arrange(desc(logFC)) 174 | 175 | geneList = TCYC_edg$logFC 176 | names(geneList) <- TCYC_edg$SYMBOL 177 | 178 | gsea <- GSEA(geneList,TERM2GENE = gmt) # Hall 179 | gsea2 <- GSEA(geneList,TERM2GENE = gmt) # GO bp 180 | gsea3 <- GSEA(geneList,TERM2GENE = gmt) # KEGG 181 | 182 | library(GseaVis) 183 | gseaNb(object = gsea, 184 | geneSetID = c('HALLMARK_G2M_CHECKPOINT','HALLMARK_E2F_TARGETS','HALLMARK_GLYCOLYSIS')) 185 | 186 | gseaNb(object = gsea, 187 | geneSetID = c('HALLMARK_TNFA_SIGNALING_VIA_NFKB','HALLMARK_INFLAMMATORY_RESPONSE','HALLMARK_UV_RESPONSE_UP'), 188 | curveCol = jjAnno::useMyCol('paired',3)) 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /SupplementaryFig.2.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 2A 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | 6 | cd8 = Tcell3[,rownames(filter(Tcell3@meta.data,celltype3 %in% c('RGS1_Tex','IL7R_Tmem','cycling_T','TNF Tmem')))] 7 | CYT=c('CD160','FCGR3A','FGFBP2','GNLY','GZMB','GZMH','GZMK','KLRG1','NCR3','NKG7','PRF1','TBX21') # DOI:10.1038/s41590-022-01312-0 8 | cd8 <- AddModuleScore(cd8, features = list(c(CYT)), name = "CYT") 9 | VlnPlot(cd8,features = 'CYT1',group.by = 'celltype3',pt.size = 0)+NoLegend() 10 | 11 | exhausted = readxl::read_excel('E:/学习/单细胞/单细胞肝癌/Figure/TEX_stage.xlsx') %>% data.frame() 12 | Precursor_exhausted = exhausted$Decoding.the.multicellular.ecosystem.of.vena.caval.tumor.thrombus.in.clear.cell.renal.cell.carcinoma.by.single.cell.RNA.sequencing[2:35] 13 | Terminally_exhausted = exhausted$...2[2:201] 14 | cd8 <- AddModuleScore(cd8, features = list(c(Precursor_exhausted)), name = "Precursor_exhausted") # DOI:10.1186/s13059-022-02651-9 15 | cd8 <- AddModuleScore(cd8, features = list(c(Terminally_exhausted)), name = "Terminally_exhausted") 16 | VlnPlot(cd8,features = 'Precursor_exhausted1',group.by = 'celltype3',pt.size = 0)+NoLegend() 17 | VlnPlot(cd8,features = 'Terminally_exhausted1',group.by = 'celltype3',pt.size = 0)+NoLegend() 18 | 19 | 20 | ######## Supplementary 2B 21 | library(monocle) 22 | cd8 = Tcell3[,rownames(filter(Tcell3@meta.data,celltype3 %in% c('RGS1_Tex','IL7R_Tmem','cycling_T','TNF Tmem')))] 23 | Mono_matrix = as(as.matrix(GetAssayData(cd8 ,slot = "count")), 'sparseMatrix') 24 | feature_ann = data.frame(gene_id=rownames(Mono_matrix),gene_short_name=rownames(Mono_matrix)) 25 | rownames(feature_ann) = rownames(Mono_matrix) 26 | Mono_fd = new("AnnotatedDataFrame", data = feature_ann) 27 | sample_ann = cd8@meta.data 28 | Mono_pd = new("AnnotatedDataFrame", data =sample_ann) 29 | Mono.cds = newCellDataSet(Mono_matrix,phenoData =Mono_pd,featureData =Mono_fd,expressionFamily=negbinomial.size()) 30 | 31 | Mono.cds = estimateSizeFactors(Mono.cds) 32 | Mono.cds = estimateDispersions(Mono.cds) 33 | disp_table = dispersionTable(Mono.cds) 34 | unsup_clustering_genes = subset(disp_table, mean_expression >= 0.5) 35 | Mono.cds = setOrderingFilter(Mono.cds, unsup_clustering_genes$gene_id) 36 | Mono.cds = reduceDimension( Mono.cds, max_components = 2,method = 'DDRTree') 37 | Mono.cds = orderCells(Mono.cds) 38 | 39 | plot_cell_trajectory(Mono.cds, color_by = "celltype3",cell_size = 0.0001,show_branch_points=F)+ 40 | theme(legend.position = "right") + scale_color_manual(values=c('#6761A1','#9BC4DA','#E3C39F','#4189B9')) 41 | 42 | 43 | Pseudotime = pData(Mono.cds)[,c('Pseudotime','celltype3')] 44 | 45 | ggplot(Pseudotime, aes(x=Pseudotime,y=celltype3,fill=celltype3))+ 46 | geom_density_ridges(scale=1) + 47 | #geom_vline(xintercept = c(5,10),linetype=2)+ 48 | scale_y_discrete("")+ 49 | theme_minimal()+ 50 | theme( 51 | panel.grid = element_blank()) 52 | 53 | 54 | 55 | 56 | ######## Supplementary 2C 57 | Time_diff <- differentialGeneTest(Mono.cds, cores = 1) 58 | Time_genes <- top_n(Time_diff, n = 100, desc(qval)) %>% pull(gene_short_name) %>% as.character() 59 | 60 | plot_pseudotime_heatmap(Mono.cds[c('PDCD1','TIGIT','HAVCR2','CTLA4','LAG3','TOX',Time_genes),], 61 | num_clusters = 4, 62 | show_rownames = T,return_heatmap=T, 63 | hmcols = colorRampPalette(c('#5773D8','white','#C22E31'))(100)) 64 | 65 | 66 | ######## Supplementary 2D 67 | Tcell_HC = scHC_cell[,filter(meta,cell_type %in% c('C0_Tcell','C1_Tcell','C19_Tcell','C3_Tcell','C5_Tcell' )) %>% rownames()] 68 | Tcell_HC 69 | mrna = read.table('mRNA_GRCh38.95.gtf.TXT') 70 | Tcell_HC = Tcell_HC[mrna$V14,] 71 | Tcell_HC = CreateSeuratObject(Tcell_HC,min.cells = 10) 72 | Tcell_HC = NormalizeData(Tcell_HC, normalization.method = "LogNormalize", scale.factor = 10000) 73 | Tcell_HC = FindVariableFeatures(Tcell_HC, selection.method = "vst", nfeatures = 3000) 74 | Tcell_HC = ScaleData(Tcell_HC, features = VariableFeatures(Tcell_HC)) 75 | 76 | Tcell_HC = RunPCA(Tcell_HC, features = VariableFeatures(Tcell_HC)) 77 | Tcell_HC = Tcell_HC %>% RunHarmony("sample_name", plot_convergence = TRUE,assay.use = "SCT") 78 | Tcell_HC = RunUMAP(Tcell_HC,reduction = 'pca',dims = 1:10) 79 | 80 | Tcell_HC = FindNeighbors(Tcell_HC, reduction = "pca", dims = 1:10) 81 | Tcell_HC = FindClusters(Tcell_HC, resolution = 0.6,algorithm=1) 82 | 83 | DimPlot(Tcell_HC, reduction = "umap",group.by = 'celltype',label = T,pt.size = 0.0001, 84 | cols = c('#239774','#D15B1B','#726CAA','#A9D580','#609B2F','#2970A8','#DD337C','#9BC9E0','#A37226','#5F5F5F','#35A038'))+NoLegend() 85 | 86 | 87 | 88 | ######## Supplementary 2E 89 | library(jjPlot) 90 | jjplot_vln = Tcell_HC@assays$RNA@data[c('MKI67','PLP2','SIVA1'),] %>% t() %>% data.frame() 91 | 92 | jjplot_vln = jjplot_vln[rownames(Tcell_HC@meta.data),] 93 | jjplot_vln$id = Tcell_HC$celltype 94 | jjplot_vln = reshape2::melt(jjplot_vln) 95 | names(jjplot_vln) = c( 'id','gene','exp') 96 | map_df(unique(jjplot_vln$id),function(x){ 97 | tmp <- jjplot_vln %>% filter(id == x) 98 | map_df(unique(tmp$gene),function(j){ 99 | tmp1 <- tmp %>% filter(gene == j) 100 | # calculate median expressions 101 | tmp1$median_exp <- mean(tmp1$exp) 102 | return(tmp1) 103 | }) -> res 104 | return(res) 105 | }) -> jjplot_vln 106 | 107 | ggplot(jjplot_vln,aes(x = gene,y = id)) + 108 | geom_jjviomap(aes(val = exp,fill = median_exp), 109 | width = 1) + 110 | scale_fill_gradient(low = 'white',high = '#B92D30') + 111 | theme_bw(base_size = 14) + 112 | theme(panel.grid = element_blank(), 113 | axis.text.x = element_text(angle = 90,hjust = 1,vjust = 0.5)) + 114 | coord_fixed() 115 | 116 | 117 | ######## Supplementary 2G 118 | library(GSVA) 119 | library(survival) 120 | library(survminer) 121 | ssGSEA_Score = gsva(as.matrix(bulk_Expr), as.data.frame(cycling_T_signature), 122 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 123 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 124 | names(ssGSEA_Score) = c('cycling_T') 125 | 126 | ssGSEA_Score = ssGSEA_Score[rownames(bulk_meta),] 127 | ssGSEA_Score$OS = bulk_meta$OS 128 | ssGSEA_Score$OS.time = bulk_meta$OS.time 129 | 130 | ssGSEA_Score$OS = as.numeric(ssGSEA_Score$OS) 131 | ssGSEA_Score$OS.time = as.numeric(ssGSEA_Score$OS.time) 132 | 133 | cut = surv_cutpoint(ssGSEA_Score,time = "OS.time",event = "OS",variables = "cycling_T") 134 | sur = surv_categorize(cut) 135 | 136 | ggsurvplot(survfit(Surv(sur$OS.time,event = sur$OS)~cycling_T, 137 | data=sur), 138 | pval = TRUE, 139 | risk.table = F, 140 | risk.table.col = "strata", 141 | ggtheme = theme_few(), 142 | font.x = c(14),font.y = c(14), 143 | font.tickslab = c(14, "black"), 144 | legend = c(0.88,0.9), 145 | legend.title = "", 146 | palette=c("#ED0000","#00468B"))+ylab('Overall survival')+xlab('Time (day)')+ 147 | ggtitle('cycling_T') 148 | 149 | 150 | 151 | 152 | ######## Supplementary 2H 153 | ssGSEA_Score = gsva(as.matrix(TCGA_HC), as.data.frame(cycling_T_signature), 154 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 155 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 156 | names(ssGSEA_Score) = c('cycling_T') 157 | 158 | TCGA_meta = TCGA_meta[rownames(ssGSEA_Score),] 159 | ssGSEA_Score$MVI = TCGA_meta$vascular_tumor_cell_type 160 | ssGSEA_Score = data.frame(ssGSEA_Score) 161 | ssGSEA_Score[colnames(TCGA_N),'MVI'] = 'Normal' 162 | ssGSEA_Score = filter(ssGSEA_Score,MVI %in% c('Micro','None')) 163 | ssGSEA_Score[ssGSEA_Score$MVI == 'None','MVI'] = 'MVI- HCC' 164 | ssGSEA_Score[ssGSEA_Score$MVI == 'Micro','MVI'] = 'MVI+ HCC' 165 | 166 | ggplot(ssGSEA_Score, aes(x = MVI, y = cycling_T,fill = MVI)) + 167 | geom_violin(aes(fill = MVI),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 168 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 169 | theme_bw()+stat_compare_means(method.args = list(alternative = "greater"))+ 170 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 171 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+theme_few()+ 172 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 173 | ylab('Estimate of module')+xlab('')+ 174 | theme(axis.text.x = element_text(size = 14), 175 | axis.text.y = element_text(size = 14), 176 | axis.title.y = element_text(size = 14)) 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /Figure4.txt: -------------------------------------------------------------------------------- 1 | ######## Figure 4a 2 | library(scRNAtoolVis) 3 | library(ggplot2) 4 | library(ggpubr) 5 | library(Seurat) 6 | library(dplyr) 7 | library(pheatmap) 8 | library(harmony) 9 | Stromal = scdata4[,filter(scdata4@meta.data,celltype2 %in% c('Endo','Mesenchyme')) %>% rownames()] 10 | Stromal = SCTransform(Stromal, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 11 | 12 | Stromal = RunPCA(Stromal, features = VariableFeatures(Stromal)) 13 | ElbowPlot(Stromal,ndims = 50) 14 | 15 | library(harmony) 16 | Stromal@meta.data[Stromal$orig.ident %in%c('1NT','T1'),'Patient' ] = 'P1' 17 | Stromal@meta.data[Stromal$orig.ident %in%c('NT2','T2'),'Patient' ] = 'P2' 18 | Stromal@meta.data[Stromal$orig.ident %in%c('NT3','T3'),'Patient' ] = 'P3' 19 | Stromal@meta.data[Stromal$orig.ident %in%c('NT4','T4'),'Patient' ] = 'P4' 20 | Stromal@meta.data[Stromal$orig.ident %in%c('NT5','T5'),'Patient' ] = 'P5' 21 | 22 | Stromal$MVI = 'MVI' 23 | Stromal@meta.data[Stromal$Patient %in%c('P4','P5'),'MVI' ] = 'Non_MVI' 24 | 25 | Stromal = Stromal %>% RunHarmony("Patient", plot_convergence = TRUE,assay.use = "SCT") 26 | Stromal = RunUMAP(Stromal, reduction = "harmony",dims = 1:20) 27 | 28 | Stromal = FindNeighbors(Stromal, reduction = "harmony", dims = 1:20) 29 | Stromal = FindClusters(Stromal, resolution = 0.3,algorithm=1) 30 | Stromal = FindClusters(Stromal, resolution = 0.4,algorithm=1) 31 | 32 | Stromal@meta.data[Stromal$seurat_clusters == '0','celltype3'] = 'LSEC' 33 | Stromal@meta.data[Stromal$seurat_clusters == '1','celltype3'] = 'TEC' 34 | Stromal@meta.data[Stromal$seurat_clusters == '2','celltype3'] = 'mCAF' 35 | Stromal@meta.data[Stromal$seurat_clusters == '3','celltype3'] = 'Inflam EC' 36 | Stromal@meta.data[Stromal$seurat_clusters == '4','celltype3'] = 'VSMCs' 37 | Stromal@meta.data[Stromal$seurat_clusters == '5','celltype3'] = 'Arterial_1 EC' 38 | Stromal@meta.data[Stromal$seurat_clusters == '6','celltype3'] = 'Tip-like EC' 39 | Stromal@meta.data[Stromal$seurat_clusters == '7','celltype3'] = 'Cycling EC' 40 | Stromal@meta.data[Stromal$seurat_clusters == '8','celltype3'] = 'Arterial_2 EC' 41 | Stromal@meta.data[Stromal$seurat_clusters == '10','celltype3'] = 'Lymphatic EC' 42 | 43 | DimPlot(Stromal, reduction = "umap",group.by = 'celltype3',label = T)+NoLegend() 44 | 45 | 46 | ######## Figure 4b 47 | library(scRNAtoolVis) 48 | jjDotPlot(Stromal,id = 'meta.cluster', dot.col = c("#0E6DAE",'white','#C0293B'),xtree=F,ytree = T, 49 | gene = c('RGS5','NDUFA4L2','MYH11','TAGLN','PROX1','CCL21','VWA1','PLVAP','IL33','FOSB', 50 | 'ACKR1','SELP','GJA5','IGFBP3','SULF1','SERPINE2','MKI67','TOP2A','CLEC4G','CLEC1B') 51 | 52 | 53 | 54 | ######## Figure 4c 55 | cor = AverageExpression(Stromal,features = VariableFeatures(Stromal),group.by = 'meta.cluster') 56 | cor = cor$SCT 57 | cor2 = cor(cor) 58 | 59 | pheatmap(cor2, border=F,clustering_method = 'ward', 60 | color = colorRampPalette(c('#000015','#5A5AB3','white','#FDBA40','#FF3F00'))(100), 61 | cluster_cols = T, cluster_rows = T, 62 | show_rownames = T, show_colnames = T) 63 | 64 | 65 | ######## Figure 4d 66 | library("sscVis") 67 | library("data.table") 68 | library("grid") 69 | library("cowplot") 70 | library("ggrepel") 71 | library("readr") 72 | library("plyr") 73 | library("ggpubr") 74 | library("ggplot2") 75 | 76 | Stromal@meta.data[Stromal$orig.ident %in% c('1NT','NT2','NT3'),'MVI'] = 'N_MVI' 77 | Stromal@meta.data[Stromal$orig.ident %in% c('NT4','NT5'),'MVI'] = 'N_Non-MVI' 78 | Stromal@meta.data[Stromal$orig.ident %in% c('T1','T2','T3'),'MVI'] = 'T_MVI' 79 | Stromal@meta.data[Stromal$orig.ident %in% c('T4','T5' ),'MVI'] = 'T_Non-MVI' 80 | 81 | names(Stromal@meta.data)[7] = 'loc' 82 | names(Stromal@meta.data)[20] = 'meta.cluster' 83 | 84 | Stromal$meta.cluster = Stromal$celltype3 85 | 86 | out.prefix <- "E/Fig1" 87 | OR.CD8.list <- do.tissueDist(cellInfo.tb = Stromal@meta.data, 88 | out.prefix= sprintf("%s.STARTRAC.dist.T.baseline.CD8",out.prefix), 89 | pdf.width=4,pdf.height=6,verbose=1) 90 | 91 | bk <- c(seq(-1,1,by=0.01)) 92 | color = c(colorRampPalette(colors = c("white","#FDC2BC"))(length(bk)/2),colorRampPalette(colors = c("#FDC2BC","#FC554B"))(length(bk)/2)) 93 | pheatmap(OR.CD8.list$OR.dist.mtx,cluster_cols = F,border =F,color =color,breaks = bk,scale = 'row') 94 | 95 | 96 | 97 | ######## Figure 4e 98 | library(Scillus) 99 | table(Stromal$meta.cluster) 100 | Idents(Stromal) = 'meta.cluster' 101 | table(Stromal$meta.cluster) 102 | AEC1_marker = FindMarkers(Stromal,ident.1 = 'Arterial EC',ident.2 = c('Arterial_2 EC'),logfc.threshold = 0) 103 | 104 | AEC = Stromal[,filter(Stromal@meta.data,meta.cluster %in% c('Arterial EC','Arterial_2 EC')) %>% rownames()] 105 | 106 | AEC = ScaleData(AEC,features = rownames(AEC)) 107 | DoHeatmap(AEC,features = c(filter(AEC1_marker,p_val_adj<=0.05 & avg_log2FC >=1 & pct.1 >=0.5) %>% rownames(), 108 | filter(AEC1_marker,p_val_adj<=0.05 & avg_log2FC <=1 & pct.2 >=0.5) %>% rownames())) 109 | 110 | 111 | 112 | ######## Figure 4f 113 | library(clusterProfiler) 114 | AEC1_marker = filter(AEC1_marker,p_val_adj<=0.05) 115 | 116 | up = filter(AEC1_marker,avg_log2FC >= 0.58 & p_val_adj <= 0.05) 117 | res1=bitr(up$SYMBOL,fromType= "SYMBOL" ,toType="ENTREZID",OrgDb="org.Hs.eg.db") 118 | 119 | kk <- enrichKEGG(res1$ENTREZID, pvalueCutoff = 0.05,qvalueCutoff = 0.05) 120 | up = kk@result[1:10,c('Description','pvalue')] 121 | 122 | down = filter(AEC1_marker,avg_log2FC <= -0.58 & p_val_adj <= 0.05) 123 | res1=bitr(down$SYMBOL,fromType= "SYMBOL" ,toType="ENTREZID",OrgDb="org.Hs.eg.db") 124 | 125 | kk1 <- enrichKEGG(res1$ENTREZID, pvalueCutoff = 0.05,qvalueCutoff = 0.05) 126 | down = kk1@result[1:10,c('Description','pvalue')] 127 | 128 | up$Description = factor(up$Description,levels = rev(up$Description)) 129 | ggplot(data=up,mapping = aes(x=Description,y=-log10(pvalue)))+geom_bar(stat="identity")+ 130 | theme_bw()+coord_flip()+ylim(0,8)+ 131 | theme(panel.grid.major=element_blank(),panel.grid.minor=element_blank()) 132 | 133 | down$Description = factor(down$Description,levels = rev(down$Description)) 134 | ggplot(data=down,mapping = aes(x=Description,y=-log10(pvalue)))+geom_bar(stat="identity")+ 135 | theme_bw()+coord_flip()+ylim(0,4)+ 136 | theme(panel.grid.major=element_blank(),panel.grid.minor=element_blank()) 137 | p1/p2 138 | 139 | 140 | 141 | ######## Figure 4i 142 | library(msigdbr) 143 | library(GSVA) 144 | library(Seurat) 145 | library(readxl) 146 | anno = read_excel('hallmark.xlsx') %>% data.frame() 147 | rownames(anno) = anno$Hallmark.Name 148 | anno = data.frame(row.names = anno$Hallmark.Name,anno$Process.Category) 149 | m_df = msigdbr(species = "Homo sapiens", category = "H") 150 | msigdbr_list = split(x = m_df$gene_symbol, f = m_df$gs_name) 151 | 152 | expr <- as.data.frame(Stromal@assays$SCT@data) 153 | expr=as.matrix(expr) 154 | Hall <- gsva(expr, msigdbr_list, kcdf="Gaussian",method = "gsva") 155 | 156 | 157 | Hall = data.frame(t(Hall)) 158 | colnames(Hall) = substring(colnames(Hall),10,) 159 | 160 | Hall = Hall[rownames(Stromal@meta.data),] 161 | 162 | Hall$celltype = Stromal$meta.cluster 163 | 164 | Hall_mean = group_by(Hall, celltype) %>% summarize_each(funs(mean)) %>% data.frame() 165 | rownames(Hall_mean) = Hall_mean$celltype 166 | Hall_mean$celltype = NULL 167 | Hall_mean = data.frame(t(Hall_mean)) 168 | 169 | 170 | rownames(Hall_mean) = gsub("([_])"," ",str_to_title(rownames(Hall_mean)) ) 171 | rownames(anno) = gsub("([_])"," ",str_to_title(rownames(anno)) ) 172 | 173 | anno = arrange(anno,anno.Process.Category) 174 | 175 | Hall_mean = Hall_mean[rownames(anno),] 176 | 177 | pheatmap(Hall_mean , fontsize = 8, 178 | color = colorRampPalette(c('#2E80B9','white','#D84234'))(100),scale = 'row', 179 | border=F,clustering_method = 'ward', 180 | annotation_row = anno, 181 | cluster_cols = T, cluster_rows = F, 182 | show_rownames = T, show_colnames = T) 183 | 184 | 185 | ######## Figure 4j 186 | library(readxl) 187 | library(jjPlot) 188 | growth_factor= read_excel('growth_factor.xlsx') 189 | growth_factor = c(growth_factor$growth_factor) 190 | 191 | Stromal = AddModuleScore(Stromal,features = list(c(growth_factor)),name = "growth_factor") 192 | 193 | jjplot_vln = Stromal@meta.data[,c('growth_factor')] %>% data.frame() 194 | 195 | jjplot_vln$id = Stromal$meta.cluster 196 | jjplot_vln = reshape2::melt(jjplot_vln) 197 | names(jjplot_vln) = c( 'id','gene','exp') 198 | map_df(unique(jjplot_vln$id),function(x){ 199 | tmp <- jjplot_vln %>% filter(id == x) 200 | map_df(unique(tmp$gene),function(j){ 201 | tmp1 <- tmp %>% filter(gene == j) 202 | # calculate median expressions 203 | tmp1$median_exp <- mean(tmp1$exp) 204 | return(tmp1) 205 | }) -> res 206 | return(res) 207 | }) -> jjplot_vln 208 | ggplot(jjplot_vln,aes(x = gene,y = id)) + 209 | geom_jjviomap(aes(val = exp,fill = median_exp), 210 | width = 1) + 211 | scale_fill_gradient(low = 'white',high = '#B92D30') + 212 | theme_bw(base_size = 14) + 213 | theme(panel.grid = element_blank(), 214 | axis.text.x = element_text(angle = 90,hjust = 1,vjust = 0.5)) + 215 | coord_fixed() 216 | 217 | 218 | -------------------------------------------------------------------------------- /SupplementaryFig.4.txt: -------------------------------------------------------------------------------- 1 | ######## Supplementary 4A 2 | library(Seurat) 3 | library(dplyr) 4 | library(ggpubr) 5 | 6 | FeaturePlot(Mye2,features = c('C1QC','S100A8','KIT'),reduction = "umap",pt.size = 0.001, 7 | cols = c("#FFEFD5","#E6E6FA","#87CEFA","#6495ED","#4169E1","#0000CD","#000080"))+ 8 | scale_x_continuous("")+scale_y_continuous("")+ 9 | theme_bw()+ 10 | theme( panel.grid.major = element_blank(),panel.grid.minor = element_blank(), 11 | axis.ticks = element_blank(),axis.text = element_blank(), 12 | legend.position = "none", 13 | plot.title = element_text(hjust = 0.5,size=14)) 14 | 15 | Mye2 <- AddModuleScore(Mye2, features = list(c("CD1C","CLEC9A")), name = "DC_score") 16 | FeaturePlot(Mye2,features = "DC_score1",reduction = "umap",pt.size = 0.001, 17 | cols = c("#FFEFD5","#E6E6FA","#87CEFA","#6495ED","#4169E1","#0000CD","#000080"))+ 18 | scale_x_continuous("")+scale_y_continuous("")+ 19 | theme_bw()+ 20 | theme( panel.grid.major = element_blank(),panel.grid.minor = element_blank(), 21 | axis.ticks = element_blank(),axis.text = element_blank(), 22 | legend.position = "none", 23 | plot.title = element_text(hjust = 0.5,size=14))+ggtitle('CD1C,CLEC9A') 24 | 25 | 26 | 27 | 28 | 29 | ######## Supplementary 4C 30 | library(harmony) 31 | Mye_HC = scHC_cell[,filter(meta,cell_type %in% c('C11_Mye.','C2_Mye.','C20_Mye','C8_Mye.' )) %>% rownames()] 32 | 33 | mrna = read.table('mRNA_GRCh38.95.gtf.TXT') 34 | Mye_HC = Mye_HC[mrna$V14,] 35 | Mye_HC = CreateSeuratObject(Mye_HC,min.cells = 10) 36 | 37 | meta = filter(meta,cell_type %in% c('C11_Mye.','C2_Mye.','C20_Mye','C8_Mye.' )) 38 | Mye_HC@meta.data = Mye_HC@meta.data[rownames(meta),] 39 | Mye_HC@meta.data = meta 40 | 41 | Mye_HC = SCTransform(Mye_HC) 42 | Mye_HC = RunPCA(Mye_HC, features = VariableFeatures(Mye_HC)) 43 | Mye_HC = Mye_HC %>% RunHarmony("sample_name", plot_convergence = TRUE,assay.use = "SCT") 44 | ElbowPlot(Mye_HC) 45 | Mye_HC = RunUMAP(Mye_HC,reduction = 'harmony',dims = 1:15) 46 | 47 | Mye_HC = FindNeighbors(Mye_HC, reduction = "harmony", dims = 1:15) 48 | Mye_HC = FindClusters(Mye_HC, resolution = 0.1,algorithm=1) 49 | 50 | Mye_HC2 = Mye_HC[,rownames(filter(Mye_HC@meta.data,SCT_snn_res.0.1 != 5))] 51 | DimPlot(Mye_HC2, reduction = "umap",group.by = 'meta.cluster',label = T,pt.size = 0.0001)+NoLegend() 52 | 53 | 54 | 55 | 56 | 57 | ######## Supplementary 4D 58 | library("sscVis") 59 | library("data.table") 60 | library("grid") 61 | library("cowplot") 62 | library("ggrepel") 63 | library("readr") 64 | library("plyr") 65 | library("ggpubr") 66 | library("ggplot2") 67 | 68 | out.prefix <- "Fig1" 69 | OR.CD8.list <- do.tissueDist(cellInfo.tb = Mye_HC2@meta.data, 70 | out.prefix= sprintf("%s.STARTRAC.dist.T.baseline.CD8",out.prefix), 71 | pdf.width=4,pdf.height=6,verbose=1) 72 | 73 | pheatmap(OR.CD8.list$OR.dist.mtx,cluster_cols = F,border =F,color = colorRampPalette(viridis::viridis(7))(100),scale = 'row') 74 | 75 | 76 | 77 | ######## Supplementary 4E 78 | library(GSVA) 79 | library(survival) 80 | library(survminer) 81 | ssGSEA_Score = gsva(as.matrix(bulk_Expr), list(TREM2_Macro_signature,LAMP3_DC_signature,cycling_DC_signature), 82 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 83 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 84 | names(ssGSEA_Score) = c('TREM2_Macro','LAMP3_DC','cycling_DC') 85 | 86 | ssGSEA_Score = ssGSEA_Score[rownames(bulk_meta),] 87 | ssGSEA_Score$OS = bulk_meta$OS 88 | ssGSEA_Score$OS.time = bulk_meta$OS.time 89 | 90 | ssGSEA_Score$OS = as.numeric(ssGSEA_Score$OS) 91 | ssGSEA_Score$OS.time = as.numeric(ssGSEA_Score$OS.time) 92 | 93 | cut = surv_cutpoint(ssGSEA_Score,time = "OS.time",event = "OS",variables = "TREM2_Macro") 94 | sur = surv_categorize(cut) 95 | 96 | ggsurvplot(survfit(Surv(sur$OS.time,event = sur$OS)~TREM2_Macro, 97 | data=sur), 98 | pval = TRUE, 99 | risk.table = F, 100 | risk.table.col = "strata", 101 | ggtheme = theme_few(), 102 | font.x = c(14),font.y = c(14), 103 | font.tickslab = c(14, "black"), 104 | legend = c(0.88,0.9), 105 | legend.title = "", 106 | palette=c("#ED0000","#00468B"))+ylab('Overall survival')+xlab('Time (day)') 107 | 108 | 109 | cut = surv_cutpoint(ssGSEA_Score,time = "OS.time",event = "OS",variables = "LAMP3_DC") 110 | sur = surv_categorize(cut) 111 | 112 | ggsurvplot(survfit(Surv(sur$OS.time,event = sur$OS)~LAMP3_DC, 113 | data=sur), 114 | pval = TRUE, 115 | risk.table = F, 116 | risk.table.col = "strata", 117 | ggtheme = theme_few(), 118 | font.x = c(14),font.y = c(14), 119 | font.tickslab = c(14, "black"), 120 | legend = c(0.88,0.9), 121 | legend.title = "", 122 | palette=c("#ED0000","#00468B"))+ylab('Overall survival')+xlab('Time (day)') 123 | 124 | cut = surv_cutpoint(ssGSEA_Score,time = "OS.time",event = "OS",variables = "cycling_DC") 125 | sur = surv_categorize(cut) 126 | 127 | ggsurvplot(survfit(Surv(sur$OS.time,event = sur$OS)~cycling_DC, 128 | data=sur), 129 | pval = TRUE, 130 | risk.table = F, 131 | risk.table.col = "strata", 132 | ggtheme = theme_few(), 133 | font.x = c(14),font.y = c(14), 134 | font.tickslab = c(14, "black"), 135 | legend = c(0.88,0.9), 136 | legend.title = "", 137 | palette=c("#ED0000","#00468B"))+ylab('Overall survival')+xlab('Time (day)') 138 | 139 | 140 | 141 | 142 | 143 | 144 | ######## Supplementary 4F 145 | ssGSEA_Score = gsva(as.matrix(TCGA_HC), list(TREM2_Macro_signature,LAMP3_DC_signature,cycling_DC_signature), 146 | method='ssgsea', kcdf='Gaussian', abs.ranking=TRUE) 147 | ssGSEA_Score = as.data.frame(t(ssGSEA_Score)) 148 | names(ssGSEA_Score) = c('TREM2_Macro','LAMP3_DC','cycling_DC') 149 | 150 | 151 | TCGA_meta = TCGA_meta[rownames(ssGSEA_Score),] 152 | ssGSEA_Score$MVI = TCGA_meta$vascular_tumor_cell_type 153 | ssGSEA_Score = data.frame(ssGSEA_Score) 154 | ssGSEA_Score[colnames(TCGA_N),'MVI'] = 'Normal' 155 | ssGSEA_Score = filter(ssGSEA_Score,MVI %in% c('Micro','None')) 156 | ssGSEA_Score[ssGSEA_Score$MVI == 'None','MVI'] = 'MVI- HCC' 157 | ssGSEA_Score[ssGSEA_Score$MVI == 'Micro','MVI'] = 'MVI+ HCC' 158 | 159 | ggplot(ssGSEA_Score, aes(x = MVI, y = TREM2_Macro,fill = MVI)) + 160 | geom_violin(aes(fill = MVI),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 161 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 162 | theme_bw()+stat_compare_means(method.args = list(alternative = "greater"))+ 163 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 164 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+theme_few()+ 165 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 166 | ylab('Estimate of module')+xlab('')+ 167 | theme(axis.text.x = element_text(size = 14), 168 | axis.text.y = element_text(size = 14), 169 | axis.title.y = element_text(size = 14)) 170 | 171 | ggplot(ssGSEA_Score, aes(x = MVI, y = LAMP3_DC,fill = MVI)) + 172 | geom_violin(aes(fill = MVI),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 173 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 174 | theme_bw()+stat_compare_means(method.args = list(alternative = "greater"))+ 175 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 176 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+theme_few()+ 177 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 178 | ylab('Estimate of module')+xlab('')+ 179 | theme(axis.text.x = element_text(size = 14), 180 | axis.text.y = element_text(size = 14), 181 | axis.title.y = element_text(size = 14)) 182 | 183 | 184 | 185 | ggplot(ssGSEA_Score, aes(x = MVI, y = cycling_DC,fill = MVI)) + 186 | geom_violin(aes(fill = MVI),alpha=0.9,lwd=0.7,width=0.3,color="white")+ 187 | geom_boxplot(alpha=0,outlier.color = NA, lwd=0.8,width=0.5)+ 188 | theme_bw()+stat_compare_means(method.args = list(alternative = "greater"))+ 189 | scale_fill_manual(values=c("#2BBBD8","#FD7013"))+ 190 | scale_color_manual(values=c("#2BBBD8","#FD7013"))+theme_few()+ 191 | theme(legend.position = "none",axis.text = element_text(color = "black"))+ 192 | ylab('Estimate of module')+xlab('')+ 193 | theme(axis.text.x = element_text(size = 14), 194 | axis.text.y = element_text(size = 14), 195 | axis.title.y = element_text(size = 14)) 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | ######## Supplementary 4G 204 | Mono = Mye2[,filter(Mye2@meta.data,celltype2 == 'Monocyte') %>% rownames()] 205 | Mono = SCTransform(Mono,vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 206 | Mono = RunPCA(Mono, features = VariableFeatures(Mono)) 207 | ElbowPlot(Mono,ndims = 50) 208 | 209 | Mono = RunUMAP(Mono, reduction = "harmony",dims = 1:30) 210 | Mono = FindNeighbors(Mono, reduction = "harmony", dims = 1:30) 211 | Mono = FindClusters(Mono, resolution = 0.1,algorithm=1) 212 | 213 | Mono2 = Mono[,filter(Mono@meta.data,SCT_snn_res.0.1 != '3') %>% rownames()] 214 | 215 | Mono2 = SCTransform(Mono2,vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 216 | Mono2 = RunPCA(Mono2, features = VariableFeatures(Mono2)) 217 | ElbowPlot(Mono2,ndims = 50) 218 | Mono2 = RunUMAP(Mono2, reduction = "harmony",dims = 1:20) 219 | Mono2 = FindNeighbors(Mono2, reduction = "harmony", dims = 1:20) 220 | Mono2 = FindClusters(Mono2, resolution = 0.1,algorithm=1) 221 | 222 | Mono2@meta.data[Mono2$SCT_snn_res.0.1 %in% c(0), 'celltype2'] = 'VCAN_Mono' 223 | Mono2@meta.data[Mono2$SCT_snn_res.0.1 %in% c(1), 'celltype2'] = 'FCGR3A_Mono' 224 | Mono2@meta.data[Mono2$SCT_snn_res.0.1 %in% c(2), 'celltype2'] = 'FCGR3B_Mono' 225 | 226 | 227 | DimPlot(Mono2, reduction = "umap",group.by = 'celltype2',label = T)+NoLegend() 228 | 229 | 230 | 231 | ######## Supplementary 4H 232 | library(scRNAtoolVis) 233 | jjDotPlot(Mono2,id = 'celltype2', dot.col = c("#0E6DAE",'white','#C0293B'),xtree=F,ytree = F, 234 | gene = c('HLA-DPB1','LST1','CD52','IFITM3', # FCGR3A_Mono 235 | 'FCGR3B','TXNIP','G0S2','CST7', # FCGR3B_Mono 236 | 'VCAN','FCN1','S100A12','THBS1')) # VCAN_Mono 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /Figure3.txt: -------------------------------------------------------------------------------- 1 | ######## Figure 3a 2 | library(scRNAtoolVis) 3 | library(ggplot2) 4 | library(ggpubr) 5 | library(Seurat) 6 | library(dplyr) 7 | library(pheatmap) 8 | library(harmony) 9 | Mye = scdata3[,filter(scdata3@meta.data,celltype2 %in% c('Myeloid')) %>% rownames()] 10 | Mye = SCTransform(Mye, vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 11 | Mye = RunPCA(Mye, features = VariableFeatures(Mye)) 12 | ElbowPlot(Mye,ndims = 50) 13 | 14 | library(harmony) 15 | Mye@meta.data[Mye$orig.ident %in%c('1NT','T1'),'Patient' ] = 'P1' 16 | Mye@meta.data[Mye$orig.ident %in%c('NT2','T2'),'Patient' ] = 'P2' 17 | Mye@meta.data[Mye$orig.ident %in%c('NT3','T3'),'Patient' ] = 'P3' 18 | Mye@meta.data[Mye$orig.ident %in%c('NT4','T4'),'Patient' ] = 'P4' 19 | Mye@meta.data[Mye$orig.ident %in%c('NT5','T5'),'Patient' ] = 'P5' 20 | 21 | Mye = Mye %>% RunHarmony("Patient", plot_convergence = TRUE,assay.use = "SCT") 22 | Mye = RunUMAP(Mye, reduction = "harmony",dims = 1:25) 23 | ElbowPlot(Mye,ndims = 50) 24 | 25 | rb.genes <- rownames(Mye)[grep("^RP[SL]",rownames(Mye))] 26 | mt.genes <- rownames(Mye)[grep("^MT",rownames(Mye))] 27 | 28 | Mye2 = Mye[(!(rownames(Mye) %in% c(rb.genes,mt.genes)))] 29 | 30 | Mye2 = FindNeighbors(Mye2, reduction = "harmony", dims = 1:25) 31 | Mye2 = FindClusters(Mye2, resolution = 0.6,algorithm=1) 32 | DimPlot(Mye2, reduction = "umap",group.by = 'SCT_snn_res.0.6',label = T)+NoLegend() 33 | 34 | 35 | Mye2@meta.data[Mye2$SCT_snn_res.0.6 == 10, 'celltype2'] = 'Cycling' 36 | Mye2@meta.data[Mye2$SCT_snn_res.0.6 %in% c(7,11,1), 'celltype2'] = 'DC' 37 | 38 | Mye2@meta.data[Mye2$SCT_snn_res.0.6 %in% c(0,8,12,2,4,6), 'celltype2'] = 'Macrophage' 39 | 40 | Mye2@meta.data[Mye2$SCT_snn_res.0.6 %in% c(3,5,9), 'celltype2'] = 'Monocyte' 41 | Mye2@meta.data[Mye2$SCT_snn_res.0.6 %in% c(13), 'celltype2'] = 'Mast' 42 | 43 | DimPlot(Mye2,group.by = 'celltype2',cols = c('#1C75B1','#FF7E0A','#D33A30','#FFBC78'),label = T)+NoLegend() 44 | 45 | 46 | ######## Figure 3b 47 | Macro = Mye2[,filter(Mye2@meta.data,celltype2 == 'Macrophage') %>% rownames()] 48 | Macro = SCTransform(Macro,vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 49 | Macro = RunPCA(Macro, features = VariableFeatures(Macro)) 50 | ElbowPlot(Macro,ndims = 50) 51 | 52 | Macro = RunUMAP(Macro, reduction = "harmony",dims = 1:30) 53 | Macro = FindNeighbors(Macro, reduction = "harmony", dims = 1:30) 54 | Macro = FindClusters(Macro, resolution = 0.3,algorithm=1) 55 | 56 | DimPlot(Macro, reduction = "umap",group.by = 'SCT_snn_res.0.3',label = T)+NoLegend() 57 | 58 | Idents(Macro) = 'SCT_snn_res.0.3' 59 | marker = FindMarkers(Macro,ident.1 = 5) 60 | marker$de = marker$pct.1-marker$pct.2 61 | 62 | top = marker %>% group_by(cluster) %>% top_n(n = 10, wt = avg_log2FC ) 63 | 64 | FeaturePlot(Macro, reduction = "umap", features = c("MARCO")) 65 | FeaturePlot(Macro, reduction = "umap", features = c("APOE")) 66 | FeaturePlot(Macro, reduction = "umap", features = c("IL1B")) 67 | FeaturePlot(Macro, reduction = "umap", features = c("HLA-DQA2")) 68 | 69 | FeaturePlot(Macro, reduction = "umap", features = c("RNASE1")) 70 | FeaturePlot(Macro, reduction = "umap", features = c("TREM2")) 71 | FeaturePlot(Macro, reduction = "umap", features = c("ACP5")) 72 | 73 | Macro@meta.data[Macro$SCT_snn_res.0.3 %in% c(3), 'celltype2'] = 'IL1B_Macro' 74 | Macro@meta.data[Macro$SCT_snn_res.0.3 %in% c(1,5), 'celltype2'] = 'TREM2_Macro' 75 | Macro@meta.data[Macro$SCT_snn_res.0.3 %in% c(2), 'celltype2'] = 'AP_Macro' 76 | Macro@meta.data[Macro$SCT_snn_res.0.3 %in% c(0,4), 'celltype2'] = 'MACRO_Macro' 77 | 78 | DimPlot(Macro, reduction = "umap",group.by = 'celltype2',label = T,pt.size = 0.0001, 79 | cols = c('#BEBCDE','#3C86BD','#9ECBE2','#8C6CAF'))+NoLegend() 80 | 81 | 82 | 83 | ######## Figure 3c 84 | library(scRNAtoolVis) 85 | jjDotPlot(Macro,id = 'celltype2', dot.col = c("#0E6DAE",'white','#C0293B'),xtree=F,ytree = F, 86 | gene = c('HLA-DRB6','HLA-DPB1','HLA-DRB1', # AP_Macro 87 | 'IL1B','CCL3','CXCL2', # IL1B_Macro 88 | 'MARCO','CD163','VCAM1', # MARCO_MARCO 89 | 'TREM2','APOE','APOC1')) # TREM2_Macro 90 | 91 | 92 | ######## Figure 3d 93 | library("sscVis") 94 | library("data.table") 95 | library("grid") 96 | library("cowplot") 97 | library("ggrepel") 98 | library("readr") 99 | library("plyr") 100 | library("ggpubr") 101 | library("ggplot2") 102 | library("pheatmap") 103 | OR.CD8.list <- do.tissueDist(cellInfo.tb = Macro@meta.data, 104 | out.prefix= sprintf("%s.STARTRAC.dist.T.baseline.CD8",out.prefix), 105 | pdf.width=4,pdf.height=6,verbose=1) 106 | 107 | 108 | pheatmap(OR.CD8.list$OR.dist.mtx,cluster_cols = F,border =F,color = colorRampPalette(viridis::viridis(7))(100),scale = 'row') 109 | 110 | 111 | ######## Figure 3f 112 | library(org.Hs.eg.db) 113 | library(clusterProfiler) 114 | library(enrichplot) 115 | gmt <- read.gmt("h.all.v7.4.symbols.gmt") 116 | gmt2 <- read.gmt("c5.go.bp.v2022.1.Hs.symbols.gmt") 117 | gmt3 <- read.gmt("c2.cp.kegg.v2022.1.Hs.symbols.gmt") 118 | 119 | Idents(Macro) = 'celltype2' 120 | TREM_marker = FindMarkers(Macro,ident.1 = 'TREM2_Macro') 121 | TREM_marker = filter(TREM_marker,p_val_adj <= .05) 122 | 123 | TREM_marker$SYMBOL = rownames(TREM_marker) 124 | names(TREM_marker)[2] = c("logFC" ) 125 | 126 | TREM_marker <- TREM_marker %>% arrange(desc(logFC)) 127 | geneList = TREM_marker$logFC 128 | names(geneList) <- TREM_marker$SYMBOL 129 | 130 | Macro_gsea <- GSEA(geneList,TERM2GENE = gmt) 131 | Macro_gsea@result %>% View 132 | 133 | library(GseaVis) 134 | gseaNb(object = Macro_gsea, 135 | geneSetID = c('HALLMARK_COAGULATION','HALLMARK_ADIPOGENESIS','HALLMARK_KRAS_SIGNALING_UP')) 136 | 137 | gseaNb(object = Macro_gsea, 138 | geneSetID = c('HALLMARK_TNFA_SIGNALING_VIA_NFKB','HALLMARK_INTERFERON_GAMMA_RESPONSE','HALLMARK_INFLAMMATORY_RESPONSE'), 139 | curveCol = jjAnno::useMyCol('paired',3)) 140 | 141 | 142 | ######## Figure 3g 143 | m_df = msigdbr(species = "Homo sapiens", category = "C2", subcategory = "CP:KEGG") 144 | m_df2 = msigdbr(species = "Homo sapiens", category = "H") 145 | m_df = rbind(m_df,m_df2) 146 | 147 | META = filter(m_df2,gs_name %in% c('HALLMARK_BILE_ACID_METABOLISM','HALLMARK_CHOLESTEROL_HOMEOSTASIS','HALLMARK_FATTY_ACID_METABOLISM', 148 | 'HALLMARK_GLYCOLYSIS','HALLMARK_HEME_METABOLISM','HALLMARK_XENOBIOTIC_METABOLISM','HALLMARK_OXIDATIVE_PHOSPHORYLATION', 149 | 'HALLMARK_ANGIOGENESIS')) 150 | 151 | expr <- as.data.frame(Macro@assays$SCT@data) 152 | msigdbr_list = split(x = META$gene_symbol, f = META$gs_name) 153 | msigdbr_list = split(x = m_df$gene_symbol, f = m_df$gs_name) 154 | 155 | expr=as.matrix(expr) 156 | kegg <- gsva(expr, msigdbr_list, kcdf="Gaussian",method = "gsva",parallel.sz=100) 157 | 158 | data1 = cbind(apply(kegg[,rownames(filter(Macro@meta.data,celltype2 == 'AP_Macro'))], 1, mean) %>% data.frame(), 159 | apply(kegg[,rownames(filter(Macro@meta.data,celltype2 == 'IL1B_Macro'))], 1, mean) %>% data.frame(), 160 | apply(kegg[,rownames(filter(Macro@meta.data,celltype2 == 'MACRO_Macro'))], 1, mean) %>% data.frame(), 161 | apply(kegg[,rownames(filter(Macro@meta.data,celltype2 == 'TREM2_Macro'))], 1, mean) %>% data.frame()) 162 | 163 | names(data1) = c('AP_Macro','IL1B_Macro','MACRO_Macro','TREM2_Macro') 164 | pheatmap(data1[2:8,] , 165 | color = colorRampPalette(c('#2E80B9','white','#D84234'))(100),scale = 'row', 166 | border=F, 167 | cluster_cols = F, cluster_rows = T, 168 | show_rownames = T, show_colnames = T) 169 | 170 | 171 | ######## Figure 3i 172 | DC = Mye3[,filter(Mye3@meta.data,celltype2 %in% c('DC')) %>% rownames()] 173 | DC = SCTransform(DC,vars.to.regress = c("percent.mt", "nFeature_RNA","nCount_RNA")) 174 | DC = RunPCA(DC, features = VariableFeatures(DC)) 175 | ElbowPlot(DC,ndims = 50) 176 | 177 | DC = RunUMAP(DC, reduction = "harmony",dims = 1:25) 178 | DC = FindNeighbors(DC, reduction = "harmony", dims = 1:25) 179 | DC = FindClusters(DC, resolution = 2,algorithm=1) 180 | 181 | DC@meta.data[DC$SCT_snn_res.1.5 %in% c(3), 'celltype2'] = 'Cycling_DC' 182 | DC@meta.data[DC$SCT_snn_res.1.5 %in% c(15,13,10,6,9), 'celltype2'] = 'CLEC9A_DC' 183 | DC@meta.data[DC$SCT_snn_res.1.5 %in% c(16), 'celltype2'] = 'LAMP3_DC' 184 | DC@meta.data[DC$SCT_snn_res.1.5 %in% c(11,7,8,4,14,12,2,1,0,5), 'celltype2'] = 'CD1C_DC' 185 | 186 | DC@meta.data[DC$SCT_snn_res.0.3 %in% c(3), 'celltype2'] = 'Cycling_DC' 187 | DC@meta.data[DC$SCT_snn_res.0.3 %in% c(1), 'celltype2'] = 'CLEC9A_DC' 188 | DC@meta.data[DC$SCT_snn_res.0.3 %in% c(16), 'celltype2'] = 'LAMP3_DC' 189 | DC@meta.data[DC$SCT_snn_res.0.3 %in% c(0,2,4), 'celltype2'] = 'CD1C_DC' 190 | 191 | DimPlot(DC, reduction = "umap",group.by = 'celltype2',label = T,pt.size = 0.0001, 192 | cols = c('#E0C987','#F9B661','#9DD3A8','#8BC24C')) 193 | 194 | 195 | ######## Figure 3j 196 | OR.CD8.list <- do.tissueDist(cellInfo.tb = DC@meta.data, 197 | out.prefix= sprintf("%s.STARTRAC.dist.T.baseline.CD8",out.prefix), 198 | pdf.width=4,pdf.height=6,verbose=1) 199 | 200 | pheatmap(OR.CD8.list$OR.dist.mtx,cluster_cols = F,border =F,color = colorRampPalette(viridis::viridis(7))(100),scale = 'row') 201 | 202 | 203 | 204 | ######## Figure 3k 205 | jjDotPlot(DC,id = 'celltype2', dot.col = c("#0E6DAE",'white','#C0293B'),xtree=F,ytree = F, 206 | gene = c('CD1C','FCER1A','CLEC10A', # CD1C_DC 207 | 'CLEC9A','CPVL','WDFY4', # CLEC9A_DC 208 | 'STMN1','MKI67','TOP2A', # Cycling_DC 209 | 'LAMP3','CCR7','IDO1')) # TREM2_Macro 210 | 211 | 212 | 213 | ######## Figure 3l 214 | library(readxl) 215 | DC_signature = read_excel('signature.xlsx') %>% data.frame() 216 | DC_signature = list(DC_signature$DC.activation %>% na.omit() %>% as.character(), 217 | DC_signature$DC.migration %>% na.omit() %>% as.character(), 218 | DC_signature$DC.tolorgenic %>% na.omit() %>% as.character()) 219 | 220 | DC <- AddModuleScore(object = DC, features = DC_signature) 221 | 222 | library(jjPlot) 223 | jjplot_vln = DC@meta.data[,c('Cluster1','Cluster2','Cluster3')] %>% data.frame() 224 | 225 | jjplot_vln = jjplot_vln[rownames(DC@meta.data),] 226 | jjplot_vln$id = DC$celltype2 227 | jjplot_vln = reshape2::melt(jjplot_vln) 228 | names(jjplot_vln) = c( 'id','gene','exp') 229 | map_df(unique(jjplot_vln$id),function(x){ 230 | tmp <- jjplot_vln %>% filter(id == x) 231 | map_df(unique(tmp$gene),function(j){ 232 | tmp1 <- tmp %>% filter(gene == j) 233 | # calculate median expressions 234 | tmp1$median_exp <- mean(tmp1$exp) 235 | return(tmp1) 236 | }) -> res 237 | return(res) 238 | }) -> jjplot_vln 239 | ggplot(jjplot_vln,aes(x = gene,y = id)) + 240 | geom_jjviomap(aes(val = exp,fill = median_exp), 241 | width = 1) + 242 | scale_fill_gradient(low = 'white',high = '#B92D30') + 243 | theme_bw(base_size = 14) + 244 | theme(panel.grid = element_blank(), 245 | axis.text.x = element_text(angle = 90,hjust = 1,vjust = 0.5)) + 246 | coord_fixed() 247 | 248 | 249 | 250 | DC = CellCycleScoring(object = DC, 251 | g2m.features = cc.genes$g2m.genes, 252 | s.features = cc.genes$s.genes) 253 | 254 | 255 | 256 | library(jjPlot) 257 | jjplot_vln = DC@meta.data[,c('S.Score','G2M.Score','ANTIGEN1')]%>% data.frame() 258 | jjplot_vln$S.Score = NULL 259 | jjplot_vln = jjplot_vln[rownames(DC@meta.data),] 260 | jjplot_vln$id = DC$celltype2 261 | jjplot_vln = reshape2::melt(jjplot_vln) 262 | names(jjplot_vln) = c( 'id','gene','exp') 263 | map_df(unique(jjplot_vln$id),function(x){ 264 | tmp <- jjplot_vln %>% filter(id == x) 265 | map_df(unique(tmp$gene),function(j){ 266 | tmp1 <- tmp %>% filter(gene == j) 267 | # calculate median expressions 268 | tmp1$median_exp <- mean(tmp1$exp) 269 | return(tmp1) 270 | }) -> res 271 | return(res) 272 | }) -> jjplot_vln 273 | 274 | ggplot(jjplot_vln,aes(x = gene,y = id)) + 275 | geom_jjviomap(aes(val = exp,fill = median_exp), 276 | width = 1) + 277 | scale_fill_gradient(low = 'white',high = '#B92D30') + 278 | theme_bw(base_size = 14) + 279 | theme(panel.grid = element_blank(), 280 | axis.text.x = element_text(angle = 90,hjust = 1,vjust = 0.5)) + 281 | coord_fixed() 282 | ggplot(jjplot_vln,aes(x = gene,y = id)) + 283 | geom_jjviomap(aes(val = exp,fill = median_exp), 284 | width = 1) + 285 | scale_fill_gradient(low = '#F6CFCA',high = '#B92D30') + 286 | theme_bw(base_size = 14) + 287 | theme(panel.grid = element_blank(), 288 | axis.text.x = element_text(angle = 90,hjust = 1,vjust = 0.5)) + 289 | coord_fixed() 290 | 291 | 292 | 293 | ######## Figure 3m 294 | MHC = c('HLA-A','HLA-B','HLA-C','HLA-E','HLA-F', 295 | 'HLA-DOA','HLA-DQA2','HLA-DMA','HLA-DQA1','HLA-DQB2','HLA-DPA1','HLA-DRA','HLA-DOB','HLA-DMB', 296 | 'HLA-DPB1','HLA-DQB1','HLA-DPA1','HLA-DRA','HLA-DRB1','HLA-DRB5') 297 | 298 | HLA = AverageExpression(DC,features = MHC,group.by = 'celltype2') 299 | HLA = HLA$SCT 300 | pheatmap(HLA, border=F, 301 | color = colorRampPalette(c('#2E80B9','white','#D84234'))(100),scale = 'row', 302 | cluster_cols = F, cluster_rows = T, 303 | show_rownames = T, show_colnames = T) 304 | 305 | 306 | ######## Figure 3p 307 | Idents(Mye3) = 'MVI' 308 | markers = FindMarkers(Mye3,ident.1 = c('T_MVI'),ident.2 = c('T_Non-MVI'),logfc.threshold = 0) 309 | 310 | ggplot(markers, aes(x=avg_log2FC, y= -log10(p_val_adj ), colour = avg_log2FC)) + 311 | geom_point(size = markers$avg_log2FC) + 312 | scale_color_gradient2(midpoint=0, low="#313695", mid="#f0f0f0",high="#a50026") 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | --------------------------------------------------------------------------------