OSCR

Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug.

Code ↔ Paper

27 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 27 matches · 1 of them tie a paragraph to a whole file, not to given lines: a weak match, whose lines are not tinted
  1. [1] § STAR★Methods › Method details › Unsupervised clustering analysis ↔ workline2.R, lines 606–650 · score 0.94 · ConsensusClusterPlus, clusterAlg, pFeature, pItem, maxK, inner
  2. [2] § Results › Immune infiltration differences in gliomas with different disulfidptosis patterns ↔ workline2.R, lines 1546–1581 · score 0.90 · innate immunity, immune infiltration, tumor cells, NK cells, granulocytes, priming
  3. [3] § STAR★Methods › Method details › Immune microenvironment analysis ↔ R/deconvo_tme.R, lines 1–48 · score 0.87 · MCP counter, quanTIseq, xCell, IOBR package, immune cell, EPIC
  4. [4] § STAR★Methods › Method details › Single-cell RNA-seq and in silico perturbation analysis ↔ R/scTenifoldKnk.R, lines 1–110 · score 0.86 · silico knockout, gene regulatory networks, Quality control, scTenifoldKnk, single cell, mitochondrial
  5. [5] § STAR★Methods › Method details › Data collection and preprocessing ↔ workline2.R, lines 418–502 · score 0.83 · CD2AP, SLC7A11, ACTB, DSTN, TLN1, MYL6
  6. [6] § Results › Transcriptional and genetic characteristics of 15 disulfidptosis genes ↔ workline2.R, lines 2–40 · score 0.81 · Missense mutations, CD2AP, SLC7A11, ACTB, DSTN, TLN1
  7. [7] § STAR★Methods › Quantification and statistical analysis ↔ R/batch_kruskal.R, lines 1–60 · score 0.80 · Kruskal Wallis, Benjamini Hochberg, chi squared, rank sum, variables, validation
  8. [8] § STAR★Methods › Method details › Single-cell RNA-seq and in silico perturbation analysis ↔ Supplementary analysis.R, lines 94–134 · score 0.78 · Cell cycle scoring, variable feature, Seurat, Quality control, Harmony, RNA
  9. [9] § Results › Immune infiltration characteristics associated with DisulfidpScore scores in gliomas ↔ R/data_doc.R, lines 51–116 · score 0.74 · epithelial mesenchymal transition, immune checkpoint, immune microenvironment, stromal, activity, cycle
  10. [10] § Results › Deciphering disulfidptosis and IQGAP1-driven networks in gliomas at single-cell resolution ↔ R/scTenifoldKnk.R, lines 1–110 · score 0.73 · silico knockout, gene regulatory network, perturbed genes, scTenifoldKnk, cell
  11. [11] § STAR★Methods › Method details › Construction and validation of the prognostic model ↔ R/BinomialModel.R, lines 1–115 · score 0.72 · cross validation, Model Construction, 0–1, LASSO, splitting, Ridge
  12. [12] § Results › Deciphering disulfidptosis and IQGAP1-driven networks in gliomas at single-cell resolution ↔ Supplementary analysis.R, lines 136–184 · score 0.70 · cell cycle phases, SingleR, UMAP, atlas, LGG, IQGAP1
  13. [13] § STAR★Methods › Method details › Pathway enrichment analysis ↔ workline2.R, lines 1269–1341 · score 0.65 · c2 cp kegg, v2023, MSigDB, Hs, GSEA, symbols
  14. [14] § STAR★Methods › Method details › Construction and validation of the prognostic model ↔ R/PrognosticModel.R, lines 1–117 · score 0.64 · cross validation, LASSO, splitting, Ridge, CV, fold
  15. [15] § Results › Unsupervised clustering to identify different disulfidptosis patterns in gliomas ↔ workline2.R, lines 606–650 · score 0.64 · CD2AP, remove batch, MYL6, ACTN4, CAPZB, INF2
  16. [16] § Results › Signaling pathway differences in gliomas with different disulfidptosis patterns ↔ R/data_doc.R, lines 51–116 · score 0.64 · epithelial mesenchymal transition, Cell cycle, checkpoint, pathways, tumor, regulation
  17. [17] § STAR★Methods › Method details › Pathway enrichment analysis ↔ R/sig_gsea.R, lines 245–295 · score 0.62 · MSigDB, clusterProfiler, Hs, GSEA, database, symbols
  18. [18] § Results › Transcriptional and genetic characteristics of 15 disulfidptosis genes ↔ workline2.R, lines 2–40 · score 0.61 · Missense mutations, SLC7A11, COAD, SNVs, FLNB, FLNA
  19. [19] § STAR★Methods › Quantification and statistical analysis ↔ R/batch_wilcoxon.R, lines 1–59 · score 0.58 · Benjamini Hochberg, Wilcoxon rank sum, variables, validation
  20. [20] § STAR★Methods › Method details › Immune microenvironment analysis ↔ R/iobr_deconvo_pipeline.R, the whole file · a weak match · score 0.58 · IOBR, MCP, xCELL, EPIC, IPS, QuantiSeq
  21. [21] § Results › Model construction based on the disulfidptosis patterns ↔ R/BinomialModel.R, lines 1–115 · score 0.57 · cross validation, model construction, LASSO, Ridge, fold, training
  22. [22] § Results › Predictive ability of DisulfidpScore for chemotherapy drug sensitivity in gliomas ↔ pRRophetic/R/predict_from_cgp.R, lines 146–181 · score 0.56 · drug response, drug sensitivity, AUY922, bortezomib, elesclomol, IC50
  23. [23] § Results › Immune infiltration characteristics associated with DisulfidpScore scores in gliomas ↔ workline2.R, lines 2196–2272 · score 0.55 · cancer immunity cycle, immune functions, DisulfidpScore score, cell
  24. [24] § Results › Predictive ability of DisulfidpScore ↔ R/PrognosticModel.R, lines 239–292 · score 0.53 · dependent ROC curves, predictive accuracy, AUC, prognostic
  25. [25] § STAR★Methods › Method details › Immunotherapy prediction analysis ↔ R/batch_wilcoxon.R, lines 1–59 · score 0.53 · Benjamini Hochberg, Wilcoxon rank sum, validate
  26. [26] § Results › Signaling pathway differences in gliomas with different disulfidptosis patterns ↔ R/sig_gsea.R, lines 1–113 · score 0.53 · conducted gene, Cell cycle, KRAS, hallmark, pathways, regulation
  27. [27] § STAR★Methods › Method details › Construction and validation of the prognostic model ↔ R/PrognosticModel.R, lines 1–117 · score 0.50 · predictive accuracy, ROC, prognostic, curves, regression, Cox

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 3,168 lines · 101 KB · no license · 8 matches

  1. #1.1 15个DRG的SNV分析####
  2. library(maftools)
  3. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.1 genomic")
  4. load("TCGA-LGG_maf.rdata")
  5. barcode=as.data.frame(unique(data$Tumor_Sample_Barcode))
  6. colnames(barcode)="sample"
  7. data1=data
  8. load("TCGA-GBM_maf.rdata")
  9. barcode2=as.data.frame(unique(data$Tumor_Sample_Barcode))
  10. colnames(barcode2)="sample"
  11. data2=data
  12. #合并lgg和gbm
  13. data <- rbind(data1,data2)
  14. maf.coad <- data
  15. class(maf.coad) #data.frame
  16. dim(maf.coad) #87957 141
  17. #匹配结果
  18. setwd("/home/data/t060432/HRT/Disulfidptosis/data/1.1 SNV&CNV/snv")
  19. clin <- read.csv("Grade_SNV_barcode.csv",header=TRUE) #660
  20. clin <- clin[-c(434,514),] #去除2个异常样本 TCGA-06-5416-01A-01D-1486-08,TCGA-DU-6392-01A-11D-1705-08
  21. maf.coad=merge(data,clin,by="Tumor_Sample_Barcode") #59090 142
  22. sample=unique(maf.coad$Tumor_Sample_Barcode)
  23. maf <- read.maf(maf.coad,clinicalData = clin)
  24. #瀑布图
  25. gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  26. "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  27. vc_cols = c("#8DD3C7","#80B1D3","#B2DF8A","#33A02C","#FB9A99","#E31A1C","#FDBF6F","#FF7F00",'#CAB2D6')
  28. names(vc_cols) = c('Multi_Hit','Missense_Mutation','Frame_Shift_Del','Nonsense_Mutation',
  29. 'Frame_Shift_Ins','In_Frame_Ins','Splice_Site','In_Frame_Del','Translation_Start_Site')
  30. oncoplot(maf = maf, genes=gene,
  31. draw_titv = F,fontSize = 0.75 ,
  32. colors = vc_cols,bgCol = "transparent")
  33. #互斥/共现
  34. par(oma = c(3, 4, 5, 1))
  35. somaticInteractions(maf = maf,
  36. genes=gene,
  37. pvalue = c(0.05, 0.5),
  38. colPal = "PiYG")
  39. #1.2 15个DRG的CNV分析####
  40. setwd("/home/data/t060432/HRT/Disulfidptosis/data/1.1 SNV&CNV/cnv")
  41. lgg=fread("TCGA-LGG.gistic.tsv",header = T, sep = '\t',data.table = F)
  42. gbm=fread("TCGA-GBM.gistic.tsv",header = T, sep = '\t',data.table = F)
  43. a=unique(colnames(gbm))
  44. gbm=gbm[,a] #614
  45. #基因注释
  46. LGG <- fread('gencode.v22.annotation.gene.probeMap',data.table = F)%>%
  47. select(id,gene)%>%
  48. inner_join(lgg,by=c('id'='Gene Symbol'))%>%
  49. select(-id)%>%
  50. group_by(gene)%>%
  51. summarise_all(mean)%>%
  52. column_to_rownames('gene')
  53. GBM <- fread('gencode.v22.annotation.gene.probeMap',data.table = F)%>%
  54. select(id,gene)%>%
  55. inner_join(gbm,by=c('id'='Gene Symbol'))%>%
  56. select(-id)%>%
  57. group_by(gene)%>%
  58. summarise_all(mean)%>%
  59. column_to_rownames('gene')
  60. #合并
  61. identical(rownames(LGG),rownames(GBM))
  62. gliomas=cbind(LGG,GBM)
  63. gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  64. "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  65. cnvdat <- gliomas[rownames(gliomas) %in% gene,]
  66. #替换为字符串
  67. cnvdat[cnvdat ==1] <- "gain"
  68. cnvdat[cnvdat ==-1] <- "loss"
  69. cnvdat[cnvdat ==0] <- "neutral"
  70. #统计gain和loss
  71. cnvdat <- as.data.frame(t(cnvdat))
  72. cnv <- as.data.frame(t(apply(cnvdat,2,table)))
  73. #绘图
  74. dat <- cnv
  75. dat$Gene <- rownames(dat)
  76. library(ggalt)
  77. #method1
  78. p <- ggplot(aes(x=loss,xend=gain,y=Gene),data=dat)+
  79. geom_dumbbell(colour_x = "green",colour_xend = "red",size_x = 2,size_xend = 2,size=0.5,color="gray",dot_guide = T)+
  80. theme_light()+theme(panel.grid.minor.x =element_blank(),
  81. panel.grid = element_blank(),
  82. legend.position = c("top")
  83. )+ xlab("CNV.frequency(%)")
  84. p
  85. #1.3 15个DRG的染色体圈图####
  86. library(RCircos)
  87. #导入人类染色体数据
  88. data(UCSC.HG38.Human.CytoBandIdeogram)
  89. head(UCSC.HG38.Human.CytoBandIdeogram)
  90. #构建RCircos的core components
  91. cyto.info <- UCSC.HG38.Human.CytoBandIdeogram
  92. RCircos.Set.Core.Components(cyto.info, chr.exclude=NULL,tracks.inside=6, tracks.outside=0)
  93. #染色体图
  94. RCircos.Set.Plot.Area()
  95. RCircos.Chromosome.Ideogram.Plot()
  96. #染色体位置信息在genemap22
  97. setwd("/home/data/t060432/HRT/Disulfidptosis/data/1.3 circos")
  98. data=read.table("15DRG-cricos.txt", head = T)
  99. #将基因与染色体连接
  100. name.col <- 4
  101. side <- "in"
  102. track.num <- 1
  103. RCircos.Gene.Connector.Plot(data, track.num, side)
  104. track.num <- 2
  105. RCircos.Gene.Name.Plot(data, name.col,track.num, side)
  106. #1.4 15个DRG的共表达网络####
  107. library(tidyverse)
  108. library(ggplot2)
  109. library(igraph)
  110. library(ggraph)
  111. library(RColorBrewer)
  112. library(tidygraph)
  113. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  114. load(file="TCGA.RData")
  115. gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  116. "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  117. gene=TCGA[gene,]
  118. gene=as.data.frame(t(gene)) #691
  119. M = cor(gene)
  120. #计算r和p
  121. data=gene
  122. m1=data[,c(1:15)]
  123. m2=data[,c(1:15)]
  124. cor_2_matrix <- function(m1,m2){
  125. apply(m2 , 2, function(x){
  126. unlist(apply(m1, 2,function(y){
  127. cor(as.numeric(x),
  128. as.numeric(y))
  129. }))
  130. })
  131. }
  132. rdf=cor_2_matrix( m1 , m2 ) %>% as.data.frame()
  133. rdf$gene=rownames(rdf)
  134. rdf <- rdf %>% gather(key = 'soure',value = 'r',-gene)
  135. corP_2_matrix <- function(m1,m2){
  136. apply(m2 , 2, function(x){
  137. unlist(apply(m1, 2,function(y){
  138. cor.test(as.numeric(x),
  139. as.numeric(y))$p.value
  140. }))
  141. })
  142. }
  143. pdf=corP_2_matrix( m1 , m2 ) %>% as.data.frame()
  144. pdf$gene=rownames(pdf)
  145. pdf <- pdf %>% gather(key = 'source',value = 'p',-gene)
  146. Toal <- bind_cols(pdf,rdf) %>%.[-c(4,5)]
  147. Toal2 <- filter(Toal,p<0.0001)
  148. colnames(Toal2) <- c('to','from','pvalue','corr')
  149. #加上相关性信息
  150. Toal2$relation=ifelse(Toal2$corr>0,'Positive correlation with P < 0.0001','Negative correlation with P < 0.0001')
  151. #去除相关性为1的行
  152. Toal3 = filter(Toal2, Toal2$corr !='1')
  153. table(Toal3$relation)
  154. #Negative correlation with P < 0.0001 Positive correlation with P < 0.0001
  155. #22 130
  156. #加载cox回归结果
  157. setwd("/home/data/t060432/HRT/Disulfidptosis/data/1.4 co-network")
  158. Toal4 = read.table(file="15DRG-cor-network.txt",header=T)
  159. m_data=Toal3
  160. #节点数据
  161. nodes <- data.frame(name = unique(union(m_data$from, m_data$to)))
  162. identical(Toal4$Gene,nodes$name)
  163. nodes$survival_impact <- Toal4$Cox_test_pvalue
  164. nodes$cluster <- c(rep("Disulfidptosis",15))
  165. nodes$role_type <- Toal4$type
  166. #边数据
  167. edges <- m_data[c("from","to","corr")]
  168. colnames(edges)[3]="Pearson_R"
  169. edges$class <- ifelse(edges$Pearson_R>0, "Positive correlation with P < 0.0001",
  170. "Negative correlation with P < 0.0001")
  171. g <- tbl_graph(nodes = nodes, edges = edges)
  172. class(g)
  173. #绘制图形
  174. colors <- "white"
  175. ggraph(g,layout='linear',circular = TRUE) +
  176. geom_node_point(aes(size=survival_impact,colour = role_type),
  177. alpha = 0.8) +
  178. geom_node_text(aes(x = x*1.15, y=y*1.15, label=name,color=role_type),
  179. angle=0,hjust=0, fontface="bold",size=2.5,family="Times") +
  180. scale_size_continuous(range = c(16, 8)) +
  181. geom_node_point(size = 4,aes(colour = cluster))+
  182. scale_color_manual(values = c(colors,"#0088FF","#FF0033")) +
  183. geom_edge_arc(mapping = aes(edge_width = abs(Pearson_R),
  184. edge_color = class),
  185. strength = 0.02,alpha = 0.6) +
  186. scale_edge_colour_manual(values = c("#abd9e9", "#fec8c9")) +
  187. scale_edge_width_continuous(range = c(0.5,3)) +
  188. theme_graph()
  189. #1.5 15个DRG的单因素cox回归####
  190. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  191. library(forestplot)
  192. library(grid)
  193. library(magrittr)
  194. library(checkmate)
  195. library(data.table)
  196. library(survival)
  197. library(survminer)
  198. gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  199. "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  200. #TCGA
  201. load(file="TCGA.RData")
  202. dat=TCGA[gene,]
  203. dat=as.data.frame(t(dat))
  204. identical(rownames(dat),rownames(OS))
  205. data=cbind(OS,dat)
  206. univar_out = data.frame(matrix(NA,15,5))
  207. rownames(univar_out) = colnames(data)[-(1:2)]
  208. colnames(univar_out) = c("Coeffcient","HR","lower .95","upper .95","P-value")
  209. cox_data = data[,c(3:ncol(data))]
  210. cox_data = cbind(data[,c(1:2)],cox_data)
  211. str(cox_data)
  212. for(i in colnames(cox_data)[-(1:2)]){
  213. cox = coxph(Surv(OS.time, OS) ~ cox_data[,i], data = cox_data)
  214. cox_summ = summary(cox)
  215. univar_out[i,1] = cox_summ$coefficients[,1]
  216. univar_out[i,2] = cox_summ$coefficients[,2]
  217. univar_out[i,3] = cox_summ$conf.int[,3]
  218. univar_out[i,4] = cox_summ$conf.int[,4]
  219. univar_out[i,5] = cox_summ$coefficients[,5]
  220. }
  221. univar_out_0.05 = univar_out[univar_out[,5] < 0.05,]
  222. univar_out_TCGA=univar_out[,c(2,5)]
  223. #可视化
  224. uni <- univar_out
  225. uni[,1:4] <- round(uni[,1:4],digits = 3)
  226. uni_tabletext <- data.frame(matrix(NA,(nrow(uni)),3))
  227. for(i in 1 : nrow(uni)){
  228. uni_tabletext[i,1] = rownames(uni)[i]
  229. uni_tabletext[i,2] = paste(uni[i,2],"(",uni[i,3],"-",uni[i,4],")",sep = "")
  230. ifelse(uni[i,5]<0.001,
  231. uni_tabletext[i,3]<-"<0.001",
  232. uni_tabletext[i,3]<-round(uni[i,5],digits = 3))}
  233. uni_tabletext_title <- rbind(c("","HR","P-value"),uni_tabletext)
  234. #森林图
  235. forestplot(uni_tabletext_title,
  236. mean = c(NA,univar_out[,2]),
  237. graph.pos=4,
  238. upper = c(NA,univar_out[,4]),
  239. lower = c(NA,univar_out[,3]),
  240. align = "c",
  241. boxsize=0.4,
  242. zero=1,
  243. lineheight = "auto",
  244. colgap=unit(8,"mm"),
  245. ci.vertices=TRUE,
  246. xticks = c(0,1,2,4,8),
  247. title="Univariate analysis",
  248. col = fpColors(box = "#7FBC41",lines = "black",zero = "grey"))
  249. #1.6 15个DRG的表达水平####
  250. #总体
  251. library(ggpubr)
  252. library(ggplot2)
  253. library(ggsignif)
  254. library(ggdist)
  255. #1.加载数并处理
  256. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  257. load("GTEx-f-t.RData")
  258. load("TCGA.RData")
  259. gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  260. "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  261. gene <- as.vector(gene)
  262. #合并
  263. normal=tpm[gene,]
  264. gliomas=TCGA[gene,]
  265. Exp=cbind(normal,gliomas)
  266. Exp_plot <- as.data.frame(t(Exp))
  267. #2.加载样本信息
  268. sample=rownames(Exp_plot)
  269. group=c(rep("normal",290),rep("LGG",524),rep("GBM",167))
  270. info <- as.data.frame(cbind(sample,group))
  271. colnames(info)=c("Sample","Type")
  272. Exp_plot$sam=info$Type
  273. Exp_plot$sam <- factor(Exp_plot$sam, levels = c("normal","LGG","GBM"))
  274. expr_use <- na.omit(Exp_plot)
  275. expr_use <-as.data.frame(expr_use)
  276. expr_use_long <- gather(expr_use, gene, Expression, -sam)
  277. table(expr_use_long$gene)
  278. colnames(expr_use_long) <- c("Group","gene","Expression")
  279. #3.绘图
  280. p=ggboxplot(expr_use_long, x="gene", y="Expression", color = "black", fill="Group",
  281. ylab="Gene expression",
  282. xlab="",
  283. legend.title=NULL,
  284. palette = c("#FF0033","#009934","#0088FF"),
  285. width=0.6, add = "none")
  286. p1=p+stat_compare_means(aes(group=Group),
  287. method="wilcox.test",
  288. symnum.args=list(cutpoints = c(0, 0.001, 0.01, 0.05, 1), symbols = c("***", "**", "*", " ")),
  289. label = "p.signif")
  290. p1
  291. #疾病分期
  292. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  293. load("TCGA.RData")
  294. table(pheno$grade)
  295. #G2 G3 G4
  296. #214 236 167
  297. a=pheno[,c(1,3)]
  298. a=na.omit(a)
  299. sample=a$sample #617
  300. #1.加载数并处理
  301. Exp <- as.data.frame(t(TCGA[,sample]))
  302. #gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  303. # "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  304. gene="TLN1"
  305. gene <- as.vector(gene)
  306. Exp_plot <- as.data.frame(Exp[,gene])
  307. colnames(Exp_plot) = "TLN1"
  308. rownames(Exp_plot) = rownames(Exp)
  309. #2.加载样本信息
  310. info <- a
  311. colnames(info)=c("Sample","Type")
  312. Exp_plot$sam=info$Type
  313. Exp_plot$sam <- factor(Exp_plot$sam, levels = c("G2","G3","G4"))
  314. expr_use <- na.omit(Exp_plot)
  315. expr_use <-as.data.frame(expr_use)
  316. expr_use_long <- gather(expr_use, gene, Expression, -sam)
  317. table(expr_use_long$gene)
  318. colnames(expr_use_long) <- c("Group","gene","Expression")
  319. #设置比较组
  320. my_comparisons <- list(c("G2", "G3"), c("G3", "G4"), c("G2", "G4"))
  321. Custom.color <- c("#FF0033","#009934","#0088FF")
  322. ggplot(expr_use_long, aes(x = Group, y = Expression, fill=Group)) +
  323. geom_boxplot(position = position_nudge(x = 0.14),width=0.1,outlier.size = 0,outlier.alpha =0)+
  324. stat_halfeye(mapping = aes(fill=Group),width = 0.2, .width = 0, justification = -1.2, point_colour = NA,alpha=0.6) +
  325. scale_fill_manual(values = Custom.color)+
  326. scale_color_manual(values = Custom.color)+
  327. xlab(" ") +
  328. ylab("Expression") +
  329. ggtitle("TLN1")+
  330. theme_classic() +
  331. theme(
  332. legend.position = "none",
  333. axis.title.x = element_text(size = 13),
  334. axis.title.y = element_text(size = 13),
  335. axis.text.x = element_text(size = 12,hjust = 0.3),
  336. axis.text.y = element_text(size = 12),
  337. plot.title = element_text(hjust = 0.5)
  338. )+
  339. geom_signif(comparisons = my_comparisons,step_increase = .1,map_signif_level = TRUE,vjust = 0.5,hjust= 0)
  340. #2.1 DRG的多队列单因素cox回归分析####
  341. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  342. library(forestplot)
  343. library(grid)
  344. library(magrittr)
  345. library(checkmate)
  346. library(data.table)
  347. library(survival)
  348. library(survminer)
  349. gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  350. "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  351. #TCGA(8个胶质瘤列队)
  352. load(file="TCGA.RData")
  353. dat=TCGA[gene,]
  354. dat=as.data.frame(t(dat))
  355. identical(rownames(dat),rownames(OS))
  356. data=cbind(OS,dat)
  357. univar_out = data.frame(matrix(NA,15,5))
  358. rownames(univar_out) = colnames(data)[-(1:2)]
  359. colnames(univar_out) = c("Coeffcient","HR","lower .95","upper .95","P-value")
  360. cox_data = data[,c(3:ncol(data))]
  361. cox_data = cbind(data[,c(1:2)],cox_data)
  362. str(cox_data)
  363. for(i in colnames(cox_data)[-(1:2)]){
  364. cox = coxph(Surv(OS.time, OS) ~ cox_data[,i], data = cox_data)
  365. cox_summ = summary(cox)
  366. univar_out[i,1] = cox_summ$coefficients[,1]
  367. univar_out[i,2] = cox_summ$coefficients[,2]
  368. univar_out[i,3] = cox_summ$conf.int[,3]
  369. univar_out[i,4] = cox_summ$conf.int[,4]
  370. univar_out[i,5] = cox_summ$coefficients[,5]
  371. }
  372. univar_out_0.05 = univar_out[univar_out[,5] < 0.05,]
  373. univar_out_TCGA=univar_out[,c(2,5)]
  374. #汇总
  375. sum=cbind(univar_out_TCGA,univar_out_CGGA325,univar_out_CGGA693,univar_out_GSE16011,
  376. univar_out_GSE108474,univar_out_EMTAB3892,univar_out_GSE4271,univar_out_GSE4412)
  377. colnames(sum)=c("TCGA_HR","TCGA_pvalue","CGGA325_HR","CGGA325_pvalue",
  378. "CGGA693_HR","CGGA693_pvalue","GSE16011_HR","GSE16011_pvalue",
  379. "GSE108474_HR","GSE108474_pvalue","EMTAB3892_HR","EMTAB3892_pvalue",
  380. "GSE4271_HR","GSE4271_pvalue","GSE4412_HR","GSE4412_pvalue")
  381. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.1 cox")
  382. write.table(sum,file="cox_result.txt",quote=F,sep="\t")
  383. #可视化
  384. library(pheatmap)
  385. library(RColorBrewer)
  386. results=read.table(file="heatmap.txt")
  387. datacol<-read.table("anno_col.txt",sep = "\t",header=T,row.names=1)
  388. rownames(datacol)
  389. datarowcolor = list(cohort=c(TCGA = "#F1B6DA", CGGA325 = "#8DD3C7",CGGA693 = "#BC80BD", GSE16011 = "#80B1D3",
  390. GSE108474 = "#FB8072",EMTAB3892 = "#BEBADA",GSE4271 = "#FDB462",GSE4412 = "#B3DE69"))
  391. pheatmap(results,color = colorRampPalette(c("#719dc9", "grey90", "#b595bf"))(25),
  392. border_color="grey30",
  393. cluster_rows = F,cluster_cols = F,shown_colnames=F,
  394. annotation_col = datacol,annotation_colors = datarowcolor,
  395. gaps_col = c(1,2,3,4,5,6,7))
  396. #在超过5个队列中cox.test pvalue < 0.05的基因有9个
  397. #ACTN4、CAPZB、CD2AP、FLNA、INF2、IQGAP1、MYH9、MYL6、PDLIM1
  398. #2.2 8个队列数据合并和去批-meta####
  399. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  400. load(file="TCGA.RData")
  401. load(file="CGGA325.RData")
  402. load(file="CGGA693.RData")
  403. load(file="GSE16011.RData")
  404. GSE16011=as.data.frame(t(GSE16011))
  405. load(file="GSE108474.RData")
  406. GSE108474=as.data.frame(t(GSE108474))
  407. load(file="E-MATE-3892.RData")
  408. E_MATE_3892=as.data.frame(t(E_MATE_3892))
  409. load(file="GSE4271.RData")
  410. GSE4271=as.data.frame(t(GSE4271))
  411. load(file="GSE4412.RData")
  412. GSE4412=as.data.frame(t(GSE4412))
  413. #取symbol交集(10495)
  414. intersects <- function (...) {
  415. Reduce(intersect, list(...))
  416. }
  417. a=intersects(rownames(TCGA),rownames(CGGA325),rownames(CGGA693),rownames(GSE16011),
  418. rownames(GSE108474),rownames(E_MATE_3892),rownames(GSE4271),rownames(GSE4412))
  419. TCGA=TCGA[a,]
  420. CGGA325=CGGA325[a,]
  421. CGGA693=CGGA693[a,]
  422. GSE16011=GSE16011[a,]
  423. GSE108474=GSE108474[a,]
  424. E_MATE_3892=E_MATE_3892[a,]
  425. GSE4271=GSE4271[a,]
  426. GSE4412=GSE4412[a,]
  427. identical(rownames(GSE16011),rownames(E_MATE_3892))
  428. meta=cbind(TCGA,CGGA325,CGGA693,GSE16011,
  429. GSE108474,E_MATE_3892,GSE4271,GSE4412) #2522
  430. meta_pheno=rbind(pheno,CGGA325_pheno,CGGA693_pheno,GSE16011_pheno,
  431. GSE108474_pheno,E_MATE_3892_pheno,GSE4271_pheno,GSE4412_pheno)
  432. group=c(rep("TCGA",691),rep("CGGA325",313),rep("CGGA693",657),rep("GSE16011",264),
  433. rep("GSE108474",284),rep("E_MATE_3892",151),rep("GSE4271",77),rep("GSE4412",85))
  434. save(meta,meta_pheno,group,file="meta.RData")
  435. #PCA(去批前)
  436. load(file="meta.RData")
  437. meta=cbind(meta,group)
  438. pca1 <- prcomp(meta[,-ncol(meta)],center = TRUE,scale. = TRUE)
  439. #提取PC score
  440. df1 <- pca1$x
  441. df1 <- as.data.frame(df1)
  442. #提取主成分的方差贡献率,生成坐标轴标题
  443. summ1 <- summary(pca1)
  444. xlab1 <- paste0("PC1(",round(summ1$importance[2,1]*100,2),"%)")
  445. ylab1 <- paste0("PC2(",round(summ1$importance[2,2]*100,2),"%)")
  446. library(ggplot2)
  447. ggplot(data = df1,aes(x = PC1,y = PC2,color = meta$group))+
  448. geom_point(size = 3)+
  449. labs(x = xlab1,y = ylab1,color = "Cohort",title = "Remove Batch Before")+
  450. guides(fill = "none")+
  451. theme_bw()+
  452. scale_colour_manual(values = c("#8DD3C7","#BC80BD","#BEBADA","#FB8072",
  453. "#80B1D3","#FDB462","#B3DE69","#F1B6DA"))+
  454. theme(plot.title = element_text(hjust = 0.5,size = 15),
  455. axis.text = element_text(size = 11),axis.title = element_text(size = 13),
  456. legend.text = element_text(size = 11),legend.title = element_text(size = 13),
  457. plot.margin = unit(c(0.4,0.4,0.4,0.4),'cm'))
  458. #去除批次效应
  459. library(sva)
  460. load(file="meta.RData")
  461. meta=as.data.frame(t(meta))
  462. Batch=group
  463. combat <- ComBat(dat = meta, batch = Batch)
  464. meta=as.data.frame(combat)
  465. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  466. identical(rownames(meta_pheno),colnames(meta))
  467. save(meta,meta_pheno,group,file="meta.RData")
  468. table(meta_pheno$Grade)
  469. #G2 G3 G4
  470. #599 816 947
  471. gliomas=meta_pheno %>% filter(!is.na(Grade)) #2362
  472. lgg=gliomas[gliomas$Grade=="G2"|gliomas$Grade=="G3",] #1451
  473. gbm=gliomas[gliomas$Grade=="G4",] #947
  474. LGG=meta[,rownames(lgg)]
  475. GBM=meta[,rownames(gbm)]
  476. save(LGG,lgg,file="LGG.RData")
  477. save(GBM,gbm,file="GBM.RData")
  478. #PCA(去批后)
  479. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  480. load(file="meta.RData")
  481. meta=as.data.frame(t(meta))
  482. meta=cbind(meta,group)
  483. pca1 <- prcomp(meta[,-ncol(meta)],center = TRUE,scale. = TRUE)
  484. #提取PC score
  485. df1 <- pca1$x
  486. df1 <- as.data.frame(df1)
  487. #提取主成分的方差贡献率,生成坐标轴标题
  488. summ1 <- summary(pca1)
  489. xlab1 <- paste0("PC1(",round(summ1$importance[2,1]*100,2),"%)")
  490. ylab1 <- paste0("PC2(",round(summ1$importance[2,2]*100,2),"%)")
  491. library(ggplot2)
  492. ggplot(data = df1,aes(x = PC1,y = PC2,color = meta$group))+
  493. geom_point(size = 3)+
  494. labs(x = xlab1,y = ylab1,color = "Cohort",title = "Remove Batch After")+
  495. guides(fill = "none")+
  496. theme_bw()+
  497. scale_colour_manual(values = c("#8DD3C7","#BC80BD","#BEBADA","#FB8072",
  498. "#80B1D3","#FDB462","#B3DE69","#F1B6DA"))+
  499. theme(plot.title = element_text(hjust = 0.5,size = 15),
  500. axis.text = element_text(size = 11),axis.title = element_text(size = 13),
  501. legend.text = element_text(size = 11),legend.title = element_text(size = 13),
  502. plot.margin = unit(c(0.4,0.4,0.4,0.4),'cm'))
  503. #2.3 无监督聚类(PCA,K-M,pheatmap)####
  504. library(ConsensusClusterPlus)
  505. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  506. load(file="meta.RData")
  507. gene=c("ACTN4","CAPZB","CD2AP","FLNA","INF2","IQGAP1","MYH9","MYL6","PDLIM1")
  508. mydata=meta[gene,]
  509. mydata=as.matrix(mydata)
  510. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas")
  511. result_km <- ConsensusClusterPlus(mydata,
  512. maxK = 6,
  513. reps = 1000,
  514. pItem = 0.8,
  515. pFeature = 1,
  516. clusterAlg = "km",
  517. distance="euclidean",
  518. innerLinkage="complete",
  519. finalLinkage = "complete",
  520. title="consensus",
  521. plot="png",
  522. seed = 1234,
  523. writeTable=TRUE)
  524. save(result_km,file="meta-km.RData")
  525. load("meta-km.RData")
  526. #选择K值
  527. maxK = 6
  528. Kvec = 2:maxK
  529. x1 = 0.1; x2 = 0.9
  530. PAC = rep(NA,length(Kvec))
  531. names(PAC) = paste("K=",Kvec,sep="")
  532. for(i in Kvec){
  533. M = result_km[[i]]$consensusMatrix
  534. Fn = ecdf(M[lower.tri(M)])
  535. PAC[i-1] = Fn(x2) - Fn(x1)}
  536. #The optimal K
  537. optK = Kvec[which.min(PAC)]
  538. optK #[2]
  539. #查看分簇
  540. clusterNum=2
  541. cluster=result_km[[clusterNum]][["consensusClass"]]
  542. cluster=as.data.frame(cbind(sample=colnames(meta),group=cluster))
  543. table(cluster$group) #1-1341,2-1118
  544. cluster$group=ifelse(cluster$group=="1","Cluster1","Cluster2")
  545. write.csv(cluster,file="cluster.csv",row.names=F)
  546. #PCA可视化
  547. dat=mydata
  548. dat=as.data.frame(t(dat))
  549. dat=cbind(dat,group=cluster$group)
  550. pca1 <- prcomp(dat[,-ncol(dat)],center = TRUE,scale. = TRUE)
  551. #提取PC score
  552. df1 <- pca1$x
  553. df1 <- as.data.frame(df1)
  554. #提取主成分的方差贡献率,生成坐标轴标题
  555. summ1 <- summary(pca1)
  556. xlab1 <- paste0("PC1(",round(summ1$importance[2,1]*100,2),"%)")
  557. ylab1 <- paste0("PC2(",round(summ1$importance[2,2]*100,2),"%)")
  558. library(ggplot2)
  559. ggplot(data = df1,aes(x = PC1,y = PC2,color = dat$group))+
  560. stat_ellipse(aes(fill = dat$group),type = "norm",geom = "polygon",alpha = 0,color = "grey")+
  561. geom_point(size = 3,alpha=0.8)+
  562. labs(x = xlab1,y = ylab1,color = "Cohort",title = "Meta-cohort")+
  563. guides(fill = "none")+
  564. theme_bw()+
  565. scale_colour_manual(values = c("#F1B6DA","#BC80BD"))+
  566. theme(plot.title = element_text(hjust = 0.5,size = 15),
  567. axis.text = element_text(size = 11),axis.title = element_text(size = 13),
  568. legend.text = element_text(size = 11),legend.title = element_text(size = 13),
  569. plot.margin = unit(c(0.4,0.4,0.4,0.4),'cm'))
  570. #生存分析
  571. library(survival)
  572. library(survminer)
  573. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  574. load(file="meta.RData")
  575. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas")
  576. cluster=read.csv("cluster.csv",header=T)
  577. identical(rownames(meta_pheno),cluster$sample)
  578. rt=cbind(meta_pheno[,c(1:2)],Type=cluster$group)
  579. diff=survdiff(Surv(OS.time, OS) ~ Type, data=rt)
  580. pValue=1-pchisq(diff$chisq, df=1)
  581. if(pValue<0.001){
  582. pValue="p<0.001"
  583. }else{
  584. pValue=paste0("p=", sprintf("%.03f",pValue))
  585. }
  586. fit <- survfit(Surv(OS.time, OS) ~ Type, data = rt)
  587. surPlot=ggsurvplot(fit,
  588. data=rt,
  589. conf.int=F,
  590. pval=pValue,
  591. pval.size=6,
  592. xlab="Time(years)",
  593. #ylab="Overall survival",
  594. legend.title="Cluster",
  595. break.time.by = 5,
  596. palette=c("#F1B6DA","#BC80BD"))
  597. #临床相关性热图
  598. library(pheatmap)
  599. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  600. load("meta.RData")
  601. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas")
  602. cluster=read.csv("cluster.csv",header=T)
  603. identical(colnames(meta),cluster$sample)
  604. gene=c("ACTB","ACTN4","CAPZB","CD2AP","DSTN","FLNA","FLNB","INF2",
  605. "IQGAP1","MYH10","MYH9","MYL6","PDLIM1","SLC7A11","TLN1")
  606. data=cbind(meta_pheno[,c(1,3,4,5)],Cohort=group,Cluster=cluster$group,t(meta[gene,]))
  607. data$OS=ifelse(data$OS=="1","Dead","Alive")
  608. data$Age=ifelse(data$Age>47,">47","≤47")
  609. data$Gender=ifelse(data$Gender=="Male","Male","Female")
  610. #表达显著性验证
  611. library(tidyr)
  612. library(ggpubr)
  613. Exp_plot <- as.data.frame(data[,7:21])
  614. info <- as.data.frame(cbind(sample=rownames(data),group=data$Cluster))
  615. colnames(info)=c("Sample","Type")
  616. Exp_plot$sam=info$Type
  617. Exp_plot$sam <- factor(Exp_plot$sam, levels = c("Cluster1","Cluster2"))
  618. expr_use <- na.omit(Exp_plot)
  619. expr_use <-as.data.frame(expr_use)
  620. expr_use_long <- gather(expr_use, gene, Expression, -sam)
  621. table(expr_use_long$gene)
  622. colnames(expr_use_long) <- c("Group","gene","Expression")
  623. #绘图
  624. p=ggboxplot(expr_use_long, x="gene", y="Expression", color = "black", fill="Group",
  625. ylab="Gene expression",
  626. xlab="",
  627. legend.title=NULL,
  628. palette = c("#FF0033","#009934","#0088FF"),
  629. width=0.6, add = "none")
  630. p1=p+stat_compare_means(aes(group=Group),
  631. method="wilcox.test",
  632. symnum.args=list(cutpoints = c(0, 0.001, 0.01, 0.05, 1), symbols = c("***", "**", "*", " ")),
  633. label = "p.signif")
  634. p1
  635. #表达显著性验证
  636. data=na.omit(data) #2294
  637. data = data[order(data[,"Cluster"]),]
  638. str(data)
  639. table(data$Cluster)
  640. rt=as.data.frame(t(data[,c(7:21)]))
  641. Type=data[,c(1:6)]
  642. anno_col=list(OS=c("Alive"="#A6D854","Dead"="#54b345"),
  643. Age=c("≤47"="#ff7f00",">47"="#FFBE7A"),
  644. Gender=c("Female"="#82B0D2","Male"="#a6cee3"),
  645. Grade=c("G2"="#C7E9B4","G3"="#7FCDBB","G4"="#41B6C4"),
  646. Cohort=c("TCGA"="#8DD3C7","CGGA325"="#FFFFB3","CGGA693"="#BEBADA","GSE16011"="#FB8072",
  647. "GSE108474"="#80B1D3","GSE4412"="#FDB462","GSE4271"="#B3DE69","E_MATE_3892"="#FCCDE5"),
  648. Cluster=c("Cluster1"="#F1B6DA","Cluster2"="#BC80BD"))
  649. pheatmap(rt, annotation=Type,
  650. main="Meta-cohort",
  651. color = colorRampPalette(colors = c("#313695","#4575B4","#74ADD1","#ABD9E9","white",
  652. "#F1B6DA","#DE77AE","#C51B7D","#8E0152"))(50),
  653. cluster_cols =F,
  654. cluster_rows = F,
  655. scale="row",
  656. show_colnames=F,
  657. annotation_colors = anno_col,
  658. fontsize=7.5,
  659. fontsize_row=8,
  660. gaps_col = 1250)
  661. #2.4 分簇的差异分析####
  662. library(limma)
  663. library(edgeR)
  664. library(dplyr)
  665. #RNAseq部分
  666. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  667. load(file="meta.RData")
  668. meta=as.data.frame(t(meta))
  669. meta=meta[,c(1768:2459)] #TCGA
  670. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  671. cluster=read.csv("tcga_cluster.csv")
  672. sample=cluster$sample
  673. meta=meta[,sample]
  674. identical(colnames(meta),cluster$sample)
  675. Group = factor(cluster$group,levels = c("Cluster1","Cluster2"))
  676. table(Group)
  677. #构建 DGEList 对象
  678. design = model.matrix(~0+Group)
  679. colnames(design)=levels(Group)
  680. rownames(design)=colnames(meta)
  681. dge = DGEList(counts=meta)
  682. #计算标准化因子
  683. dge = calcNormFactors(dge)
  684. #将矩阵进行voom转化,即计数数据转换为log2-counts per million (logCPM),生成Elist对象
  685. v = voom(dge,design,normalize="quantile")
  686. #转化后数据用于构建linear model
  687. fit = lmFit(v,design)
  688. #定义比较分组的信息
  689. constrasts = paste(rev(levels(Group)),collapse = "-")
  690. cont.matrix = makeContrasts(contrasts=constrasts,levels = design)
  691. #比较每个基因计算出标准差,使用经验贝叶斯方法进行校正并生成其他统计量
  692. fit3 = contrasts.fit(fit,cont.matrix)
  693. fit3 = eBayes(fit3)
  694. #提取差异分析数据
  695. DEG_limma = topTable(fit3, coef=constrasts, n=Inf)
  696. DEG_limma = na.omit(DEG_limma)
  697. #生成显著上下调gene标签列
  698. DEG_limma$group <- case_when(DEG_limma$logFC > 0.5 & DEG_limma$P.Value < 0.05 ~ "Up",
  699. DEG_limma$logFC < -0.5 & DEG_limma$P.Value < 0.05 ~ "Down",
  700. abs(DEG_limma$logFC) <= 0.5 ~ "None",
  701. DEG_limma$P.Value >= 0.05 ~ "None")
  702. table(DEG_limma$group)
  703. #CGGA325, d,519,u,516
  704. #CGGA693, d,499,u,465
  705. #TCGA, d,527,u,574
  706. #提取差异表达基因
  707. gene=DEG_limma[DEG_limma$group=="Up"|DEG_limma$group=="Down",]
  708. gene=as.data.frame(rownames(gene))
  709. colnames(gene)="tcga"
  710. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.4 DEG")
  711. write.csv(gene,file="tcga.csv",row.names = F)
  712. #microarray部分
  713. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  714. load(file="meta.RData")
  715. meta=as.data.frame(t(meta))
  716. meta=meta[,c(1662:1925)] #GSE16011
  717. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  718. cluster=read.csv("emate3892_cluster.csv")
  719. sample=cluster$sample
  720. meta=meta[,sample]
  721. identical(colnames(meta),cluster$sample)
  722. Group = factor(cluster$group,levels = c("Cluster1","Cluster2"))
  723. table(Group)
  724. #构建design
  725. design = model.matrix(~0+Group)
  726. colnames(design)=levels(Group)
  727. rownames(design)=colnames(meta)
  728. #非线性最小二乘分析
  729. fit = lmFit(meta,design)
  730. #定义比较分组的信息
  731. constrasts = paste(rev(levels(Group)),collapse = "-")
  732. cont.matrix = makeContrasts(contrasts=constrasts,levels = design)
  733. #比较每个基因计算出标准差,使用经验贝叶斯方法进行校正并生成其他统计量
  734. fit3 = contrasts.fit(fit,cont.matrix)
  735. fit3 = eBayes(fit3)
  736. #提取差异分析数据
  737. DEG_limma = topTable(fit3, coef=constrasts, n=Inf)
  738. DEG_limma = na.omit(DEG_limma)
  739. #生成显著上下调gene标签列
  740. DEG_limma$group <- case_when(DEG_limma$logFC > 0.5 & DEG_limma$P.Value < 0.05 ~ "Up",
  741. DEG_limma$logFC < -0.5 & DEG_limma$P.Value < 0.05 ~ "Down",
  742. abs(DEG_limma$logFC) <= 0.5 ~ "None",
  743. DEG_limma$P.Value >= 0.05 ~ "None")
  744. table(DEG_limma$group)
  745. #E-MATE-3892, d,385,u,693
  746. #GSE108474, d,634,u,1102
  747. #GSE16011, d,501,u,1701
  748. #GSE4271, d,404,u,435
  749. #GSE4412, d,571,u,772
  750. #提取差异表达基因
  751. gene=DEG_limma[DEG_limma$group=="Up"|DEG_limma$group=="Down",]
  752. gene=as.data.frame(rownames(gene))
  753. colnames(gene)="emate3892"
  754. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.4 DEG")
  755. write.csv(gene,file="emate3892.csv",row.names = F)
  756. #差异基因的单因素cox分析
  757. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.4 DEG/co-gene")
  758. DEG=read.table("DEG_in_7_cohort.txt")
  759. a=DEG$V1
  760. #8个队列单因素cox回归分析
  761. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  762. library(forestplot)
  763. library(grid)
  764. library(magrittr)
  765. library(checkmate)
  766. library(data.table)
  767. library(survival)
  768. library(survminer)
  769. gene=a
  770. #TCGA
  771. load(file="TCGA.RData")
  772. dat=TCGA[gene,]
  773. dat=as.data.frame(t(dat))
  774. identical(rownames(dat),rownames(OS))
  775. data=cbind(OS,dat)
  776. univar_out = data.frame(matrix(NA,294,5))
  777. rownames(univar_out) = colnames(data)[-(1:2)]
  778. colnames(univar_out) = c("Coeffcient","HR","lower .95","upper .95","P-value")
  779. cox_data = data[,c(3:ncol(data))]
  780. cox_data = cbind(data[,c(1:2)],cox_data)
  781. str(cox_data)
  782. for(i in colnames(cox_data)[-(1:2)]){
  783. cox = coxph(Surv(OS.time, OS) ~ cox_data[,i], data = cox_data)
  784. cox_summ = summary(cox)
  785. univar_out[i,1] = cox_summ$coefficients[,1]
  786. univar_out[i,2] = cox_summ$coefficients[,2]
  787. univar_out[i,3] = cox_summ$conf.int[,3]
  788. univar_out[i,4] = cox_summ$conf.int[,4]
  789. univar_out[i,5] = cox_summ$coefficients[,5]
  790. }
  791. univar_out_0.05 = univar_out[univar_out[,5] < 0.05,]
  792. univar_out_TCGA=univar_out_0.05[,c(2,5)]
  793. #取交集
  794. intersects <- function (...) {
  795. Reduce(intersect, list(...))
  796. }
  797. b=intersects(rownames(univar_out_TCGA),rownames(univar_out_CGGA325),rownames(univar_out_CGGA693),rownames(univar_out_GSE16011),
  798. rownames(univar_out_GSE108474),rownames(univar_out_EMTAB3892),rownames(univar_out_GSE4271),rownames(univar_out_GSE4412))
  799. univar_out_TCGA=univar_out_TCGA[b,]
  800. univar_out_CGGA325=univar_out_CGGA325[b,]
  801. univar_out_CGGA693=univar_out_CGGA693[b,]
  802. univar_out_GSE16011=univar_out_GSE16011[b,]
  803. univar_out_GSE108474=univar_out_GSE108474[b,]
  804. univar_out_EMTAB3892=univar_out_EMTAB3892[b,]
  805. univar_out_GSE4271=univar_out_GSE4271[b,]
  806. univar_out_GSE4412=univar_out_GSE4412[b,]
  807. #汇总
  808. sum=cbind(univar_out_TCGA,univar_out_CGGA325,univar_out_CGGA693,univar_out_GSE16011,
  809. univar_out_GSE108474,univar_out_EMTAB3892,univar_out_GSE4271,univar_out_GSE4412)
  810. colnames(sum)=c("TCGA_HR","TCGA_pvalue","CGGA325_HR","CGGA325_pvalue",
  811. "CGGA693_HR","CGGA693_pvalue","GSE16011_HR","GSE16011_pvalue",
  812. "GSE108474_HR","GSE108474_pvalue","EMTAB3892_HR","EMTAB3892_pvalue",
  813. "GSE4271_HR","GSE4271_pvalue","GSE4412_HR","GSE4412_pvalue")
  814. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.4 DEG/co-gene")
  815. write.table(sum,file="cox_result.txt",quote=F,sep="\t")
  816. #可视化
  817. library(pheatmap)
  818. library(RColorBrewer)
  819. results=read.table(file="heatmap.txt")
  820. datacol<-read.table("anno_col.txt",sep = "\t",header=T,row.names=1)
  821. rownames(datacol)
  822. datarowcolor = list(cohort=c(TCGA = "#A6CEE3", CGGA325 = "#1F78B4",CGGA693 = "#B2DF8A", GSE16011 = "#33A02C",
  823. GSE108474 = "#FB9A99",EMTAB3892 = "#E31A1C",GSE4271 = "#FDBF6F",GSE4412 = "#FF7F00"))
  824. pheatmap(results,
  825. color = colorRampPalette(c("#B3DE69", "grey90", "#FF82A8"))(25),
  826. border_color="grey30",
  827. fontsize = 6,
  828. cluster_rows = F,cluster_cols = F,shown_colnames=F,
  829. annotation_col = datacol,annotation_colors = datarowcolor,
  830. gaps_col = c(1,2,3,4,5,6,7))
  831. #2.5 分簇的通路富集分析####
  832. library(limma)
  833. library(edgeR)
  834. library(dplyr)
  835. library(GSVA)
  836. library(clusterProfiler)
  837. library(tidyverse)
  838. library(msigdbr)
  839. library(GSEABase)
  840. library(pheatmap)
  841. library(BiocParallel)
  842. library(ggplot2)
  843. library(ggridges)
  844. library(RColorBrewer)
  845. library(org.Hs.eg.db)
  846. library(enrichplot)
  847. library(ggraph)
  848. library(ggrepel)
  849. library(qusage)
  850. library(tibble)
  851. library(stringr)
  852. #GSVA-hallmark(error)
  853. #表达矩阵
  854. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  855. load(file="TCGA.RData")
  856. gsva_data=TCGA
  857. #分组信息
  858. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  859. cluster=read.csv("tcga_cluster.csv")
  860. rownames(cluster)=cluster$sample
  861. cluster=cluster[colnames(TCGA),]
  862. #gsva
  863. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.5 function")
  864. hallmark_gmt <- read.gmt("h.all.v2023.2.Hs.symbols.gmt")
  865. gene_set<-split(hallmark_gmt$gene,hallmark_gmt$term)
  866. gsva_result <- gsva(as.matrix(gsva_data), gene_set, method = "gsva",min.sz=1,
  867. max.sz=Inf,kcdf="Gaussian",parallel.sz=11)
  868. #通路的差异分析
  869. gl
  870. Cluster1="Cluster1"
  871. Cluster2="Cluster2"
  872. group_list = cluster$group
  873. design <- model.matrix(~0+factor(group_list))
  874. colnames(design) <- levels(factor(group_list))
  875. rownames(design) <- colnames(gsva_result)
  876. contrast.matrix <- makeContrasts(contrasts=paste0(Cluster2,'-',Cluster1),
  877. levels = design)
  878. fit1 <- lmFit(gsva_result,design)
  879. fit2 <- contrasts.fit(fit1, contrast.matrix)
  880. efit <- eBayes(fit2)
  881. summary(decideTests(efit,lfc=0.5, p.value=0.05))
  882. tempOutput <- topTable(efit, coef=paste0(Cluster2,'-',Cluster1), n=Inf)
  883. degs <- na.omit(tempOutput)
  884. #火山图
  885. degs1 <- degs %>%
  886. rownames_to_column("pathway") %>%
  887. mutate(Type = if_else(P.Value > 0.05,"ns",if_else(logFC >= 0, "up", "down"))) %>%
  888. arrange(desc(abs(logFC)))
  889. deg_path <- degs1
  890. deg_path$pathway <- str_split_fixed(deg_path$pathway,"_",n=2)[,2]
  891. deg_path$pathway <- gsub(pattern = "_"," ",deg_path$pathway)
  892. dat_draw <- deg_path[,c(1,2)]
  893. dat_draw$group <- ifelse(dat_draw$logFC>0 ,1,-1)
  894. dat_draw$log <- -log10(deg_path$P.Value)*dat_draw$group
  895. dat_draw$Type <- deg_path$Type
  896. p <-ggplot(data = deg_path,
  897. aes(x = logFC,
  898. y = -log10(P.Value)
  899. ))+
  900. geom_point(alpha=0.7, size=4,
  901. aes(color=Type))+
  902. ylab("-log10(adj.p.Val)")+
  903. scale_color_manual(values=c("#56a902", "grey","#d62a9d"))+
  904. geom_vline(xintercept=0,lty=2,col="grey50",lwd=0.8)+
  905. geom_hline(yintercept = -log10(0.05),lty=2,col="grey50",lwd=0.8)+
  906. theme_bw()
  907. p
  908. #添加通路名称
  909. deg_path$symbol=deg_path$pathway
  910. deg_path=read.csv("deg_path.csv")
  911. p1 <- p+geom_text_repel(data = deg_path, aes(x = logFC ,
  912. y = -log10(P.Value),
  913. label = label),
  914. size = 3,box.padding = unit(0.5, "lines"),
  915. point.padding = unit(0.8, "lines"),
  916. segment.color = "black",
  917. show.legend = FALSE)
  918. p1
  919. #ssGSEA-10条经典癌症通路
  920. #表达矩阵
  921. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  922. load(file="TCGA.RData")
  923. gsva_data=TCGA
  924. #分组信息
  925. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  926. cluster=read.csv("tcga_cluster.csv")
  927. rownames(cluster)=cluster$sample
  928. cluster=cluster[colnames(TCGA),]
  929. #基因集信息
  930. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.5 function")
  931. cancer_pathway=read.csv("10_cancer_pathway_PMID30837276.csv")
  932. cancer_pathway <- separate(cancer_pathway, Pathway, into = c("Pathway", "Type"), sep = "_")
  933. activated=cancer_pathway[cancer_pathway$Type=="activated",]
  934. activated <- split(activated$Symbol, activated$Pathway)
  935. repressed=cancer_pathway[cancer_pathway$Type=="repressed",]
  936. repressed <- split(repressed$Symbol, repressed$Pathway)
  937. #ssgsea
  938. gsva_result_a <- gsva(as.matrix(gsva_data), activated, method = "ssgsea",min.sz=1,
  939. max.sz=Inf,kcdf="Gaussian",parallel.sz=11)
  940. gsva_result_r <- gsva(as.matrix(gsva_data), repressed, method = "ssgsea",min.sz=1,
  941. max.sz=Inf,kcdf="Gaussian",parallel.sz=11)
  942. #结果处理
  943. identical(colnames(gsva_result_a),colnames(gsva_result_r))
  944. original_row_names <- rownames(gsva_result_a)
  945. new_row_names <- paste(original_row_names, "_a", sep = "")
  946. rownames(gsva_result_a) <- new_row_names
  947. data=rbind(gsva_result_a,gsva_result_r)
  948. write.csv(data,file="dat.csv")
  949. #富集分数=激活分数-抑制分数
  950. result=read.csv(file="dat_result.csv",row.names = 1)
  951. identical(rownames(result),cluster$sample)
  952. result$group=cluster$group
  953. result_long <- gather(result, pathway, scores, -group)
  954. #山峦图
  955. ggplot(result_long, aes(x = scores, y = pathway, color = group, point_color = group, fill = group)) +
  956. geom_density_ridges(jittered_points = TRUE, scale = 0.95, rel_min_height = 0.01,
  957. point_shape = "|", point_size = 3, size = 0.25, position = position_points_jitter(height = 0)) +
  958. scale_y_discrete(expand = c(0, 0)) + scale_x_continuous(expand = c(0, 0), name = " ") +
  959. scale_fill_manual(values = c("#D55E0050", "#0072B250"), labels = c("Cluster1",
  960. "Cluster2")) +
  961. scale_color_manual(values = c("#D55E00", "#0072B2"), guide = "none") +
  962. scale_discrete_manual("point_color", values = c("#D55E00", "#0072B2"), guide = "none") +
  963. coord_cartesian(clip = "off") + guides(fill = guide_legend(override.aes = list(fill = c("#D55E00A0",
  964. "#0072B2A0"), color = NA, point_color = NA))) + ggtitle(" ") +
  965. theme_ridges(center = TRUE)+
  966. theme(legend.position = "top")
  967. #GSEA
  968. #表达矩阵
  969. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  970. load(file="TCGA.RData")
  971. #分组信息
  972. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  973. cluster=read.csv("tcga_cluster.csv")
  974. rownames(cluster)=cluster$sample
  975. cluster=cluster[colnames(TCGA),]
  976. Group = factor(cluster$group,levels = c("Cluster1","Cluster2"))
  977. table(Group)
  978. design = model.matrix(~0+Group)
  979. colnames(design)=levels(Group)
  980. rownames(design)=colnames(TCGA)
  981. dge = DGEList(counts=TCGA)
  982. dge = calcNormFactors(dge)
  983. v = voom(dge,design,normalize="quantile")
  984. fit = lmFit(v,design)
  985. constrasts = paste(rev(levels(Group)),collapse = "-")
  986. cont.matrix = makeContrasts(contrasts=constrasts,levels = design)
  987. fit3 = contrasts.fit(fit,cont.matrix)
  988. fit3 = eBayes(fit3)
  989. DEG_limma = topTable(fit3, coef=constrasts, n=Inf)
  990. DEG_limma = na.omit(DEG_limma)
  991. DEG_limma$group <- case_when(DEG_limma$logFC > 0.5 & DEG_limma$adj.P.Val < 0.01 ~ "Up",
  992. DEG_limma$logFC < -0.5 & DEG_limma$adj.P.Val < 0.01 ~ "Down",
  993. abs(DEG_limma$logFC) <= 0.5 ~ "None",
  994. DEG_limma$adj.P.Val >= 0.01 ~ "None")
  995. table(DEG_limma$group)
  996. #Down None Up
  997. #1828 54433 2126
  998. gene=DEG_limma[DEG_limma$group=="Up"|DEG_limma$group=="Down",]
  999. DEGfilter=rownames(gene)
  1000. eg <- bitr(DEGfilter, fromType = "SYMBOL",
  1001. toType = c("ENTREZID", "ENSEMBL", "SYMBOL"),
  1002. OrgDb = "org.Hs.eg.db")
  1003. gene_info <- gene[DEGfilter, ] %>%
  1004. rownames_to_column(var = "SYMBOL") %>%
  1005. inner_join(., eg[, 1:2], by = "SYMBOL") %>%
  1006. arrange(desc(logFC))
  1007. gene_info <- unique(gene_info)
  1008. geneList <- gene_info$logFC
  1009. names(geneList) <- as.character(gene_info$SYMBOL)
  1010. head(geneList)
  1011. #msigdb C2
  1012. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.5 function")
  1013. kegg_gmt <- read.gmt("c2.cp.kegg_legacy.v2023.2.Hs.symbols.gmt")
  1014. kegg_gmt_df <- data.frame(
  1015. TERM = rep(names(kegg_gmt), sapply(kegg_gmt, length)),
  1016. GENE = unlist(kegg_gmt))
  1017. #gsea
  1018. gsea <- GSEA(geneList, TERM2GENE = kegg_gmt)
  1019. gsea_result=gsea@result
  1020. rownames(gsea_result)=NULL
  1021. #Cluster1
  1022. gseaplot2(gsea, geneSetID = c(1,2,6,9,11,14),pvalue_table = F,
  1023. color = c("#E495A5", "#86B875", "#7DB0DD","#FF7F00","#C51B7D","#FF0033"),
  1024. base_size = 11)
  1025. #Cluster2
  1026. gseaplot2(gsea, geneSetID = c(3,4,7,8,10,12,15),pvalue_table = F,
  1027. color = c("#FFCC33", "#86B875", "#7DB0DD","#FF7F00","#C51B7D","#377EB8",
  1028. "#FF0033"),base_size = 11)
  1029. #2.6 分簇的免疫浸润分析####
  1030. library(tidyverse)
  1031. library(IOBR)
  1032. library(reshape2)
  1033. library(ggplot2)
  1034. library(ggpubr)
  1035. library(ggsci)
  1036. library(pheatmap)
  1037. library(cowplot)
  1038. library(ComplexHeatmap)
  1039. library(circlize)
  1040. library(scales)
  1041. library(RColorBrewer)
  1042. library(ggh4x)
  1043. library(GSVA)
  1044. library(tinyarray)
  1045. #IOBR的6种算法免疫浸润
  1046. #与4.0immune区别是分组不同
  1047. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR")
  1048. load(file="tme_combine.RData")
  1049. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1050. load("TCGA.RData")
  1051. data = TCGA
  1052. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  1053. group=read.csv("tcga_cluster.csv")
  1054. sample=colnames(TCGA)
  1055. rownames(group)=group$sample
  1056. group=group[sample,]
  1057. identical(group$sample,colnames(TCGA))
  1058. #准备可视化
  1059. #合并数据
  1060. immune=cbind(cibersort[,c(1:26)],quantiseq[,2:12],mcp[,c(2:11)],xcell[,c(2:68)],
  1061. epic[,c(2:9)],ips[,c(2:7)])
  1062. rownames(immune)=immune$ID
  1063. immune=immune[,-1]
  1064. immune=t(immune)
  1065. #构建列分组文件
  1066. library(stringr)
  1067. Methods=c(rep('CIBERSORT',25),rep('Quantiseq',11),rep('MCP-counter',10),
  1068. rep('xCELL',67),rep('EPIC',8),rep('IPS',6))
  1069. type=data.frame(Methods=Methods)
  1070. rownames(type)=rownames(immune)
  1071. #标准化函数
  1072. standarize.fun <- function(indata=NULL, halfwidth=NULL, centerFlag=T, scaleFlag=T) {
  1073. outdata=t(scale(t(indata), center=centerFlag, scale=scaleFlag))
  1074. if (!is.null(halfwidth)) {
  1075. outdata[outdata>halfwidth]=halfwidth
  1076. outdata[outdata<(-halfwidth)]= -halfwidth
  1077. }
  1078. return(outdata)
  1079. }
  1080. #标准化免疫浸润数据,便于绘制热图
  1081. plotdata <- standarize.fun(immune,halfwidth = 2)
  1082. type$Methods=factor(type$Methods,levels = c('CIBERSORT','Quantiseq','MCP-counter',
  1083. 'xCELL','EPIC','IPS'))
  1084. #分组信息
  1085. my2=group[order(group$group),]
  1086. rownames(my2)=my2$sample
  1087. #排序
  1088. order2=rownames(my2)
  1089. table(my2$group)
  1090. Method=c('#66C2A5','#FC8D62','#8DA0CB','#E78AC3','#A6D854',"#FFD92F","#E5C494")
  1091. names(Method)=c('CIBERSORT','Quantiseq','MCP-counter','xCELL','EPIC','IPS')
  1092. #绘图
  1093. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.5 immu")
  1094. pdf('6IOBR_heatmap.pdf',height = 14,width = 8)
  1095. Heatmap(plotdata[,order2],name='Z-score',
  1096. top_annotation = HeatmapAnnotation(foo=anno_block(gp=gpar(fill= c('#F1B6DA','#BC80BD')),
  1097. labels=c('Cluster1','Cluster2'),
  1098. labels_gp = gpar(col='white',fontsize=10,fontface='bold'))),
  1099. cluster_rows = F,
  1100. col=colorRamp2(c(-2,0,2),c('#47b8e0','white','#FDAE61')),
  1101. color_space = "RGB",
  1102. cluster_columns = FALSE,border = T,
  1103. row_order=NULL,
  1104. row_names_side = 'left',
  1105. column_order=NULL,
  1106. show_column_names = FALSE,
  1107. row_names_gp = gpar(fontsize = 9),
  1108. column_split = c(rep(1,428),rep(2,263)),
  1109. row_split = type$Methods,
  1110. left_annotation = rowAnnotation(foo=anno_block(gp=gpar(fill= c('#F46D43','#FDAE61','#FEE090','#ABD9E9','#74ADD1',"#4575B4")),
  1111. labels=c('CIBERSORT','Quantiseq','MCP-counter','xCELL','EPIC','IPS'),
  1112. labels_gp = gpar(col='white',fontsize=8,fontface='bold'))),
  1113. gap = unit(1, "mm"),
  1114. column_title = NULL,
  1115. column_title_gp = gpar(fontsize = 10),
  1116. show_heatmap_legend =T,
  1117. heatmap_legend_param=list(labels_gp = gpar(fontsize = 10), border = T,
  1118. title_gp = gpar(fontsize = 10, fontface = "bold")),
  1119. column_gap = unit(2,'mm'),
  1120. row_title = NULL
  1121. )
  1122. dev.off()
  1123. #estimate
  1124. estimate=column_to_rownames(estimate,"ID")
  1125. estimate=estimate[,1:3]
  1126. a <- estimate
  1127. identical(rownames(a),rownames(group))
  1128. a$group=as.factor(group$group)
  1129. a <- a %>% rownames_to_column("sample")
  1130. b <- gather(a,key=category,value = score,-c(group,sample))
  1131. b1=as.data.frame(lapply(b$score,as.numeric)) %>% t() %>% as.data.frame()
  1132. b$score <- b1$V1
  1133. library(ggpubr)
  1134. library(reshape2)
  1135. p=ggviolin(b, x="category", y="score",
  1136. fill="group",#填充
  1137. palette =c("#F1B6DA","#6A3D9A"),
  1138. alpha=0.3,
  1139. add ="boxplot",
  1140. xlab = F,
  1141. legend = "right",
  1142. size = 0.5)
  1143. p+stat_compare_means(aes(group = group),
  1144. method = "wilcox.test",
  1145. label = "p.signif",
  1146. label.y = 4500,
  1147. symnum.args=list(cutpoints = c(0, 0.001, 0.01, 0.05, 1),
  1148. symbols = c("***", "**", "*", "ns")))+
  1149. theme(text = element_text(size=10),axis.text.x = element_text(angle=0, hjust=0.5))
  1150. #CIBERSORT免疫细胞
  1151. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR")
  1152. load(file="tme_combine.RData")
  1153. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1154. load("TCGA.RData")
  1155. data = TCGA
  1156. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  1157. group=read.csv("tcga_cluster.csv")
  1158. rownames(group)=group$sample
  1159. group=group[colnames(TCGA),]
  1160. cibersort=cibersort[,1:23]
  1161. cibersort=column_to_rownames(cibersort,"ID")
  1162. cibersort=t(cibersort)
  1163. rownames_original <- rownames(cibersort)
  1164. rownames_cleaned <- sub("_CIBERSORT", "", rownames_original)
  1165. rownames(cibersort) <- rownames_cleaned
  1166. draw_boxplot(cibersort,group$group,color = c("#F1B6DA","#BC80BD"),
  1167. xlab = " ",ylab = "Scores")
  1168. #免疫周期
  1169. #表达矩阵
  1170. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1171. load("TCGA.RData")
  1172. exp=as.matrix(TCGA)
  1173. #分组信息
  1174. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  1175. group=read.csv("tcga_cluster.csv")
  1176. rownames(group)=group$sample
  1177. group=group[colnames(TCGA),]
  1178. #immu cycle
  1179. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune")
  1180. geneset=read.csv("IOBR_TIME.csv")
  1181. geneset=geneset[1:7,]
  1182. split_genes <- strsplit(geneset$genes, ",")
  1183. new_geneset <- data.frame(
  1184. genesymbol = unlist(split_genes),
  1185. cell = rep(geneset$cell, lengths(split_genes)))
  1186. geneset = split(new_geneset$genesymbol,new_geneset$cell)
  1187. #ssgsea
  1188. re <- gsva(exp, geneset, method="ssgsea",mx.diff=FALSE, verbose=FALSE,
  1189. kcdf="Gaussian")
  1190. draw_boxplot(re,group$group,color = c("#F1B6DA","#BC80BD"),
  1191. xlab = " ",ylab = "Scores")
  1192. #免疫功能
  1193. #表达矩阵
  1194. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1195. load("TCGA.RData")
  1196. exp=as.matrix(TCGA)
  1197. #分组信息
  1198. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  1199. group=read.csv("tcga_cluster.csv")
  1200. rownames(group)=group$sample
  1201. group=group[colnames(TCGA),]
  1202. #immu function
  1203. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/TISIDB")
  1204. geneset = rio::import("ssGSEA-PMID30594216-Signature-13.xlsx",skip = 1)
  1205. geneset <- apply(geneset,2,function(x){return(as.character(na.omit(as.character(x))))})
  1206. #ssgsea
  1207. re <- gsva(exp, geneset, method="ssgsea",mx.diff=FALSE, verbose=FALSE,kcdf="Gaussian")
  1208. draw_boxplot(re,group$group,color = c("#F1B6DA","#BC80BD"),
  1209. xlab = " ",ylab = "Scores")
  1210. #TIME-Kobayashi/Bagaev
  1211. #表达矩阵
  1212. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1213. load("TCGA.RData")
  1214. exp=as.matrix(TCGA)
  1215. #分组信息
  1216. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  1217. group=read.csv("tcga_cluster.csv")
  1218. rownames(group)=group$sample
  1219. group=group[colnames(TCGA),]
  1220. #免疫细胞基因集
  1221. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/TISIDB")
  1222. dat=read.csv("TIME-Kobayashi.csv") #TIME-Kobayashi.csv/TIME-Bagaev.csv
  1223. geneset = split(dat$gene,dat$type)
  1224. #ssgsea
  1225. re <- gsva(exp, geneset, method="ssgsea",mx.diff=FALSE, verbose=FALSE,kcdf="Gaussian")
  1226. identical(colnames(TCGA),colnames(re))
  1227. re=rbind(re,group=group$group)
  1228. re=as.data.frame(t(re))
  1229. re=re[order(re$group),]
  1230. Cluster1 <- subset(re, group == "Cluster1")
  1231. Cluster2 <- subset(re, group == "Cluster2")
  1232. #Kobayashi
  1233. features <- c("Glycolysis", "IFNG response", "Inhibitory cells MDSCs", "Inhibitory cells Tregs", "Inhibitory molecules",
  1234. "Innate immunity", "Priming & activation", "Proliferation", "Recognition of tumor cells", "T cells")
  1235. #Bagaev
  1236. features <- c("Angiogenesis", "Anti tumor microenvironment", "Antigen presentation", "B cells", "CAF",
  1237. "Checkpoint inhibition", "Cytotoxic T and NK cells", "Granulocytes", "MDSC", "Treg",
  1238. "Tumor features","Tumor promotive immune infiltrate")
  1239. Cluster1_means <- sapply(Cluster1[, features], function(x) mean(as.numeric(x)))
  1240. Cluster2_means <- sapply(Cluster2[, features], function(x) mean(as.numeric(x)))
  1241. group_means <- data.frame(Cluster1 = Cluster1_means, Cluster2 = Cluster2_means)
  1242. rownames(group_means) <- features
  1243. #雷达图
  1244. library(fmsb)
  1245. library(ggradar)
  1246. library(cols4all)
  1247. library(ggplot2)
  1248. data=as.data.frame(t(group_means))
  1249. range(data)
  1250. data=rownames_to_column(data,'group')
  1251. mycol2=c("#F1B6DA","#6A3D9A")
  1252. ggradar(data,
  1253. grid.min = 0,grid.mid = 0.6,grid.max = 1.2,
  1254. gridline.mid.colour = 'grey',
  1255. values.radar = NA,
  1256. axis.label.size = 2.5,
  1257. legend.text.size = 8,
  1258. legend.position = 'bottom',
  1259. group.point.size = 1.5,group.line.width = 1,
  1260. fill = TRUE,fill.alpha = 0.3,
  1261. group.colours = mycol2,
  1262. background.circle.colour = 'white',background.circle.transparency = 0.2)
  1263. #2.7 分簇的突变分析####
  1264. #SNV
  1265. #SNV样本信息
  1266. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.1 genomic")
  1267. load("TCGA-LGG_maf.rdata")
  1268. barcode=as.data.frame(unique(data$Tumor_Sample_Barcode))
  1269. colnames(barcode)="sample"
  1270. data1=data
  1271. load("TCGA-GBM_maf.rdata")
  1272. barcode2=as.data.frame(unique(data$Tumor_Sample_Barcode))
  1273. colnames(barcode2)="sample"
  1274. data2=data
  1275. #合并lgg和gbm
  1276. data <- rbind(data1,data2)
  1277. maf.coad <- data
  1278. class(maf.coad) #data.frame
  1279. dim(maf.coad) #87957 141
  1280. #分组信息
  1281. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  1282. group=read.csv("tcga_cluster.csv")
  1283. #匹配结果
  1284. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.5 mutation/snv")
  1285. clin <- read.csv("SNV_barcode-group.csv",header=TRUE) #987
  1286. del <- which(clin$group=="#N/A")
  1287. clin <- clin[-del,] #732
  1288. colnames(clin)=c("Tumor_Sample_Barcode","sample")
  1289. maf.coad=merge(data,clin,by="Tumor_Sample_Barcode") #63987 142
  1290. sample=unique(maf.coad$Tumor_Sample_Barcode)
  1291. #maf文件
  1292. maf <- read.maf(maf.coad,clinicalData = clin)
  1293. #tmb计算
  1294. tmb_table_wt_log = tmb(maf = maf)
  1295. #合并分组信息
  1296. dat=as.data.frame(tmb_table_wt_log[,c(1,4)])
  1297. rownames(dat)=dat$Tumor_Sample_Barcode
  1298. rownames(clin)=clin$Tumor_Sample_Barcode
  1299. dat2=merge(dat,clin,by=0)
  1300. #更新分组名称
  1301. dat2$sample <- factor(dat2$sample, levels = c("Cluster1","Cluster2"))
  1302. p=ggviolin(dat2, x="sample", y="total_perMB_log", fill="sample",
  1303. palette =c("#1F78B4","#E31A1C"),alpha = 0.5,
  1304. add ="boxplot",size = 0.5,
  1305. xlab = "TMB",
  1306. legend = "none")
  1307. p+stat_compare_means(aes(group = sample),
  1308. method = "wilcox.test",label = "p.signif",
  1309. label.x = 1.5,label.y = 1.5,
  1310. symnum.args=list(cutpoints = c(0, 0.001, 0.01, 0.05, 1),
  1311. symbols = c("***", "**", "*", "ns")))
  1312. #CNV
  1313. library(data.table)
  1314. #segment数据准备
  1315. #cnv数据
  1316. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.5 mutation/cnv")
  1317. load("TCGA-LGG_CNV.Rdata")
  1318. lgg=data[2:7]
  1319. load("TCGA-GBM_CNV.Rdata")
  1320. gbm=data[2:7]
  1321. gliomas=rbind(lgg,gbm)
  1322. gliomas = gliomas[,c('Sample','Chromosome','Start','End','Num_Probes','Segment_Mean')]
  1323. write.csv(gliomas,file="gliomas.csv")
  1324. #分组信息
  1325. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.3 K-meas/cohort")
  1326. group=read.csv("tcga_cluster.csv")
  1327. write.csv(group,file="group.csv")
  1328. #匹配分组的数据
  1329. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.5 mutation/cnv")
  1330. gliomas=read.csv(file="gliomas-group.csv")
  1331. del <- which(gliomas$group=="#N/A")
  1332. gliomas <- gliomas[-del,]
  1333. colnames(gliomas)=c('Sample','Chromosome','Start','End','Num_Probes','Segment_Mean','group')
  1334. #cluster1
  1335. cluster1=gliomas[gliomas$group=="Cluster1",]
  1336. cluster1=cluster1[,1:6]
  1337. write.table(cluster1,file="Cluster1 segment file.txt",sep="\t",quote=F,row.names=F)
  1338. #cluster2
  1339. cluster2=gliomas[gliomas$group=="Cluster2",]
  1340. cluster2=cluster2[,1:6]
  1341. write.table(cluster2,file="Cluster2 segment file.txt",sep="\t",quote=F,row.names=F)
  1342. #markfile数据准备
  1343. marker_file = read.delim("snp6.na35.remap.hg38.subset.txt")
  1344. marker_file=marker_file[marker_file$freqcnv=="FALSE",]
  1345. marker_file = marker_file[,c(1,2,3)]
  1346. colnames(marker_file)=c("Marker Name", "Chromosome", "Marker Position")
  1347. write.table(marker_file,"marker file.txt",sep="\t",col.names=TRUE,row.name=FALSE)
  1348. #可视化
  1349. library(BSgenome.Hsapiens.UCSC.hg38)
  1350. library(ggplot2)
  1351. library(ggsci)
  1352. library(ggprism)
  1353. #染色体信息
  1354. df <- data.frame(chromName = seqnames(BSgenome.Hsapiens.UCSC.hg38),
  1355. chromlength = seqlengths(BSgenome.Hsapiens.UCSC.hg38)
  1356. )
  1357. df$chromNum <- 1:length(df$chromName)
  1358. df <- df[1:22,]
  1359. df$chromlengthCumsum <- cumsum(as.numeric(df$chromlength))
  1360. df$chormStartPosFrom0 <- c(0,df$chromlengthCumsum[-nrow(df)])
  1361. tmp_middle <- diff(c(0,df$chromlengthCumsum)) / 2
  1362. df$chromMidelePosFrom0 <- df$chormStartPosFrom0 + tmp_middle
  1363. #读取结果
  1364. scores <- read.table("/home/data/t060432/HRT/Disulfidptosis/data/2.5 mutation/cnv/578326-Cluster1/scores.gistic",
  1365. sep="\t",header=T,stringsAsFactors = F)
  1366. chromID <- scores$Chromosome
  1367. scores$StartPos <- scores$Start + df$chormStartPosFrom0[chromID]
  1368. scores$EndPos <- scores$End + df$chormStartPosFrom0[chromID]
  1369. range(scores$frequency)
  1370. scores[scores$Type == "Del", "frequency"] <- scores[scores$Type == "Del", "frequency"] * -1
  1371. range(scores$frequency)
  1372. df$ypos <- rep(c(0.15,0.18),11)
  1373. df$rect_col=ifelse(df$chromNum %% 2 == 0,"grey","white")
  1374. p1=ggplot(scores, aes(x = StartPos,y = frequency))+
  1375. geom_area(aes(group=Type, fill=factor(Type,levels = c("Del","Amp"))))+
  1376. scale_fill_manual(values = c("#1F78B4","#E31A1C"), guide=guide_legend(reverse = T, position = "top"), name="Type")+
  1377. geom_vline(data = df ,mapping=aes(xintercept=chromlengthCumsum),linetype=2)+
  1378. geom_text(data = df,aes(x=chromMidelePosFrom0,y=ypos,label=chromName))+
  1379. scale_x_continuous(expand = c(0,0),limits = c(0,2.9e9),name = NULL,labels = NULL)+
  1380. scale_y_continuous(expand = c(0.02,0.02),limits = c(-1,1),guide = "prism_offset")+
  1381. theme_prism()+
  1382. theme( axis.ticks.x = element_blank(),
  1383. axis.line.x = element_blank())
  1384. p1
  1385. #Frequency的比较
  1386. cluster1 <- read.table("/home/data/t060432/HRT/Disulfidptosis/data/2.5 mutation/cnv/578326-Cluster1/scores.gistic",
  1387. sep="\t",header=T,stringsAsFactors = F)
  1388. cluster1$group=c(rep("cluster1",17374))
  1389. cluster2 <- read.table("/home/data/t060432/HRT/Disulfidptosis/data/2.5 mutation/cnv/578337-Cluster2/scores.gistic",
  1390. sep="\t",header=T,stringsAsFactors = F)
  1391. cluster2$group=c(rep("cluster2",18047))
  1392. gliomas=rbind(cluster1,cluster2)
  1393. ggviolin(gliomas, x = 'group', y = 'Frequency', fill = 'group',palette = c("#1F78B4","#E31A1C"),
  1394. add = 'boxplot', add.params = list(fill = "white")) +
  1395. stat_compare_means(aes(group=group), label = "p.signif", bracket.size=0.5,
  1396. tip.length = 0.01, method = 'wilcox.test')
  1397. #3.0 模型的构建和验证 DisulfidpScore####
  1398. #见ML.R
  1399. #3.1 与其他模型的比较 Compared####
  1400. #见COM.R
  1401. #3.2 临床特征圈图####
  1402. library(cols4all)
  1403. library(ggplot2)
  1404. #TCGA
  1405. #表达矩阵
  1406. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1407. load("TCGA.RData")
  1408. #分组信息
  1409. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  1410. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  1411. bestmodel="Enet[alpha=0.3]"
  1412. RS_mat2=RS_mat[,bestmodel]
  1413. RS_mat2=RS_mat2[1:691]
  1414. group=ifelse(RS_mat2>median(RS_mat2),"High","Low")
  1415. #临床信息
  1416. data=cbind(pheno[,c(3,5,6,8,9,10)],group)
  1417. colnames(data)[1:5]=c("Grade","Age","Gender","IDH","1P19Q")
  1418. dt=na.omit(data)
  1419. dt$Age=as.numeric(dt$Age)
  1420. dt$Age=ifelse(dt$Age > 47,">47","≤47")
  1421. dt$grade=ifelse(dt$Grade=="G2","2",
  1422. ifelse(dt$Grade=="G2","3","4"))
  1423. dt$gender=ifelse(dt$Gender=="male","1","2")
  1424. dt$age=ifelse(dt$Age==">47","2","1")
  1425. dt$idh=ifelse(dt$IDH=="WT","1","2")
  1426. dt$`1p19q`=ifelse(dt$`1P19Q`=="non-codel","1","2")
  1427. dt$mgmtp=ifelse(dt$MGMTp=="Unmethylated","1","2")
  1428. str(dt)
  1429. dt[,8:13] <- apply(dt[,8:13],2,as.numeric)
  1430. #计算p值
  1431. #分组计算百分比
  1432. mydata=dt
  1433. mydata_summary <- mydata %>%
  1434. group_by(group, MGMTp) %>%
  1435. summarise(count = n()) %>%
  1436. group_by(group) %>%
  1437. mutate(percent = count / sum(count) * 100)
  1438. #卡方检验
  1439. chi_square <- chisq.test(table(mydata$group, mydata$MGMTp))
  1440. p_value <- chi_square$p.value
  1441. p_value
  1442. #圆圈图可视化
  1443. #分成高风险组和低风险组
  1444. high_group <- subset(dt, group == "High")
  1445. low_group <- subset(dt, group == "Low")
  1446. #计算百分比
  1447. high_group$fraction = high_group$mgmtp / sum(high_group$mgmtp)
  1448. low_group$fraction = low_group$`1p19q` / sum(low_group$`1p19q`)
  1449. #颜色
  1450. mycol <- c("#F1B6DA","#E78AC3","#C51B7D") #grade
  1451. mycol <- c("#f28147","#fac074") #age
  1452. mycol <- c("#9EBCDA","#377EB8") #gender
  1453. mycol <- c("#4DAF4A","#B8E186") #idh
  1454. mycol <- c("#D73027","#F1766D") #1p19q
  1455. mycol <- c("#88419D","#DECBE4") #mgmtp
  1456. #绘图
  1457. p5=ggplot(low_group, aes(x = 3,
  1458. y = fraction,
  1459. fill = `1P19Q` )) +
  1460. geom_col(width = 1.5) +
  1461. facet_grid(. ~ group) +
  1462. coord_polar(theta = "y") +
  1463. xlim(c(0.2, 3.8)) +
  1464. scale_fill_manual(values = mycol) +
  1465. theme_void() +
  1466. theme(
  1467. strip.text.x = element_text(size = 14),
  1468. legend.title = element_text(size = 15),
  1469. legend.text = element_text(size = 14))
  1470. #3.3 不同评分组的免疫分析#####
  1471. #IOBR(免疫浸润TCGA)
  1472. library(tidyverse)
  1473. library(IOBR)
  1474. library(reshape2)
  1475. library(ggplot2)
  1476. library(ggpubr)
  1477. library(ggsci)
  1478. library(pheatmap)
  1479. library(cowplot)
  1480. library(ComplexHeatmap)
  1481. library(circlize)
  1482. library(scales)
  1483. library(RColorBrewer)
  1484. library(ggh4x)
  1485. library(tidyr)
  1486. library(dplyr)
  1487. library(tibble)
  1488. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1489. load("TCGA.RData")
  1490. data = TCGA
  1491. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune")
  1492. #CIBERSORT
  1493. cibersort <- deconvo_tme(eset = data, method = "cibersort",
  1494. arrays = FALSE, perm = 1000)
  1495. #quantiseq
  1496. quantiseq <- deconvo_tme(eset = data,tumor = TRUE,arrays = FALSE,
  1497. scale_mrna = TRUE, method = "quantiseq")
  1498. #epic
  1499. epic <- deconvo_tme(eset = data, method = "epic", tumor = T, arrays = FALSE)
  1500. #mcp
  1501. mcp <- deconvo_tme(eset = data, method = "mcpcounter")
  1502. #xcell
  1503. xcell <- deconvo_tme(eset = data, method = "xcell", arrays = FALSE)
  1504. #estimate
  1505. estimate <- deconvo_tme(eset = data, method = "estimate")
  1506. #ips
  1507. ips<-deconvo_tme(eset = data, method = "ips", plot= FALSE)
  1508. #timer
  1509. timer <- deconvo_tme(eset = data, method = "timer", group_list = rep("glioma", dim(data)[2]))
  1510. #合并所有分析结果
  1511. tme_combine <- cibersort %>%
  1512. inner_join(quantiseq, "ID") %>%
  1513. inner_join(mcp, "ID") %>%
  1514. inner_join(xcell, "ID") %>%
  1515. inner_join(epic, "ID") %>%
  1516. inner_join(estimate, "ID") %>%
  1517. inner_join(ips, "ID")
  1518. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR")
  1519. save(cibersort,quantiseq,epic,mcp,xcell,estimate,ips,
  1520. tme_combine,file = 'tme_combine.RData')
  1521. load(file="tme_combine.RData")
  1522. #提取cibersort前22列数据
  1523. cibersort_data <- as.data.frame(cibersort[,1:23])
  1524. #分组信息
  1525. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  1526. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  1527. bestmodel="Enet[alpha=0.3]"
  1528. RS_mat2=RS_mat[,bestmodel]
  1529. RS_mat2=RS_mat2[1:691]
  1530. group=ifelse(RS_mat2>median(RS_mat2),"High","Low")
  1531. group=as.data.frame(cbind(ID=colnames(TCGA),group=group))
  1532. cibersort <- left_join(cibersort_data,group,by="ID")
  1533. cibersort <- melt(cibersort,id.vars=c("ID","group"))
  1534. colnames(cibersort)=c("sample","status1","variable","value")
  1535. cibersort=cibersort[order(cibersort$status1),]
  1536. cibersort$variable <- gsub("_CIBERSORT", "", cibersort$variable)
  1537. cols = c(brewer.pal(12, "Paired"),brewer.pal(8, "Dark2"),brewer.pal(12, "Set3"))
  1538. cols <- IOBR::palettes(category = "random", palette = 4,show_col = F,show_message = F)
  1539. cols=c("#FD8D3C","#FEB24C","#FED976","#FFED6F","#FFFF99","#EDF8B1","#C7E9B4","#A1D99B",
  1540. "#74C476","#7BCCC4","#4EB3D3","#4292C6","#2B8CBE","#9ECAE1","#C6DBEF","#9EBCDA",
  1541. "#8C96C6","#7570B3","#BEBADA","#DECBE4","#FCC5C0","#F768A1","#E7298A","#DD3497")
  1542. plot_tme = function(meltdf){
  1543. p_stack_df = ggplot(meltdf,aes(x = sample, y = value, fill = variable)) +
  1544. geom_bar(stat = "identity")+ theme_test() +
  1545. scale_fill_manual(values = cols) +
  1546. theme(legend.position = 'bottom')+
  1547. theme(plot.title = element_text(size = rel(2),hjust = 0.5),
  1548. axis.text.x = element_blank())+
  1549. theme(axis.ticks =element_blank() )+
  1550. scale_y_continuous(expand = c(0,0))+
  1551. facet_nested(.~status1,drop=T,scale="free",space="free",switch="x",
  1552. strip =strip_nested(background_x = elem_list_rect(fill =c('#C51B7D','#377EB8')),by_layer_x = F))
  1553. # p_stack_df
  1554. p_box_df = ggplot(meltdf,aes(x = variable, y = value,
  1555. fill = variable)) +
  1556. geom_boxplot(width=0.4,lwd=0.2,color='black',outlier.shape=NA,
  1557. position = position_dodge(width = 0.8))+
  1558. theme_bw()+
  1559. theme(axis.text.x = element_text(angle = 90,hjust = 1,vjust = .5))+
  1560. theme(legend.position = 'none')+
  1561. scale_fill_manual(values = cols)
  1562. # p_box_df
  1563. p_box_comp = ggplot(meltdf,aes(x = variable, y = value,
  1564. fill = status1,color = status1)) +
  1565. geom_boxplot(width=0.5,lwd=0.2,color='black',outlier.shape=NA,
  1566. position = position_dodge(width = 0.8))+
  1567. theme_bw()+
  1568. theme(legend.position = 'top')+
  1569. theme(axis.text.x = element_text(angle = 90,hjust = 1,vjust = .5))+
  1570. stat_compare_means(aes(group=status1,label = after_stat(p.signif)),hide.ns = FALSE,
  1571. method = "t.test")+
  1572. scale_fill_manual(values = c('#C51B7D','#377EB8'))
  1573. # p_box_comp
  1574. p_heat = ggplot(meltdf,aes(x = sample, y =variable ,fill=value))+
  1575. geom_tile()+
  1576. scale_fill_gradientn(colors = c('white','#C51B7D','#377EB8'))+
  1577. theme(axis.text.x = element_blank(),
  1578. axis.ticks.x = element_blank(),
  1579. panel.border = element_rect(fill = 'NA',color = 'black'))+
  1580. labs(fill="Z score", x = NULL, y = NULL)
  1581. # p_heat
  1582. #plot_comb = (p_stack_df)/(p_box_df|p_box_comp)/p_heat
  1583. plot_comb = (p_box_comp)
  1584. return(plot_comb)
  1585. }
  1586. plot_exist_cib = plot_tme(cibersort)
  1587. print(plot_exist_cib)
  1588. #TME signature(TCGA)
  1589. #表达矩阵
  1590. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1591. load("TCGA.RData")
  1592. exp=as.matrix(TCGA)
  1593. #分组信息
  1594. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  1595. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  1596. bestmodel="Enet[alpha=0.3]"
  1597. RS_mat2=RS_mat[,bestmodel]
  1598. RS_mat2=RS_mat2[1:691]
  1599. group=ifelse(RS_mat2>median(RS_mat2),"High","Low")
  1600. group=as.data.frame(cbind(sample=colnames(TCGA),group=group))
  1601. group=group[order(group$group),]
  1602. rownames(group)=group$sample
  1603. #IOBR中的TME特征
  1604. library(IOBR)
  1605. library(tidyr)
  1606. data=signature_collection
  1607. data2=signature_tme
  1608. #提取需要的特征
  1609. expr_matrix <- matrix(nrow = 119, ncol = 2)
  1610. for (i in 1:length(data2)) {
  1611. expr_matrix[i, 1] <- names(data2)[i]
  1612. expr_matrix[i, 2] <- paste(data2[[i]], collapse = ",") )
  1613. }
  1614. expr_df <- as.data.frame(expr_matrix)
  1615. colnames(expr_df) <- c("cell", "genes")
  1616. needata=expr_df[c(1,2,3,4,5,6,8,9,10,13,14,15,16,17,18,19,20,
  1617. 29,30,31,32,33,34,35,36,37,38,39,40,
  1618. 41,42,43,55,56,57,58,59,60,
  1619. 61,62,63,64,65,66,
  1620. 94,97,98,99,100,101,102,103,104,
  1621. 111,112,113,114,115,116,117),]
  1622. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR_TIME")
  1623. write.csv(needata,file="TIME.csv")
  1624. #获得geneset
  1625. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR_TIME")
  1626. geneset=read.csv("IOBR_TIME.csv")
  1627. split_genes <- strsplit(geneset$genes, ",")
  1628. new_geneset <- data.frame(
  1629. genesymbol = unlist(split_genes),
  1630. cell = rep(geneset$cell, lengths(split_genes)))
  1631. geneset = split(new_geneset$genesymbol,new_geneset$cell)
  1632. #ssgsea
  1633. re <- gsva(exp, geneset, method="ssgsea",mx.diff=FALSE, verbose=FALSE)
  1634. re=as.data.frame(re)
  1635. type=unique(new_geneset$cell)
  1636. re=re[type,]
  1637. write.csv(re,file="TIMEresult.csv")
  1638. identical(colnames(re),colnames(TCGA))
  1639. #IOBR免疫浸润(meta-LGG-GBM)
  1640. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  1641. load("GBM.RData")
  1642. data = GBM
  1643. #CIBERSORT
  1644. cibersort <- deconvo_tme(eset = data, method = "cibersort",
  1645. arrays = FALSE, perm = 1000)
  1646. #quantiseq
  1647. quantiseq <- deconvo_tme(eset = data,tumor = TRUE,arrays = FALSE,
  1648. scale_mrna = TRUE, method = "quantiseq")
  1649. #epic
  1650. epic <- deconvo_tme(eset = data, method = "epic", tumor = T, arrays = FALSE)
  1651. #mcp
  1652. mcp <- deconvo_tme(eset = data, method = "mcpcounter")
  1653. #xcell
  1654. xcell <- deconvo_tme(eset = data, method = "xcell", arrays = FALSE)
  1655. #estimate
  1656. estimate <- deconvo_tme(eset = data, method = "estimate")
  1657. #ips
  1658. ips<-deconvo_tme(eset = data, method = "ips", plot= FALSE)
  1659. #合并所有分析结果
  1660. tme_combine <- cibersort %>%
  1661. inner_join(quantiseq, "ID") %>%
  1662. inner_join(mcp, "ID") %>%
  1663. inner_join(xcell, "ID") %>%
  1664. inner_join(epic, "ID") %>%
  1665. inner_join(estimate, "ID") %>%
  1666. inner_join(ips, "ID")
  1667. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR")
  1668. save(cibersort,quantiseq,epic,mcp,xcell,estimate,ips,
  1669. tme_combine,file = 'tme_combine_GBM.RData')
  1670. #TME signature(meta-LGG-GBM)
  1671. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  1672. load("GBM.RData")
  1673. #分组信息
  1674. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  1675. sample=read.table("sample.txt")
  1676. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  1677. bestmodel="Enet[alpha=0.3]"
  1678. RS_mat2=RS_mat[,bestmodel]
  1679. group=RS_mat2
  1680. group_list=as.data.frame(cbind(sample=sample$sample,group=group))
  1681. rownames(group_list)=group_list$sample
  1682. sample=colnames(GBM)
  1683. group_list=group_list[sample,]
  1684. group_list$group=as.numeric(group_list$group)
  1685. group_list=na.omit(group_list)
  1686. group_list$group=ifelse(group_list$group>median(group_list$group),"High","Low")
  1687. sample=rownames(group_list)
  1688. GBM=GBM[,sample]
  1689. exp=as.matrix(GBM)
  1690. #IOBR中的TME特征
  1691. library(IOBR)
  1692. library(tidyr)
  1693. library(GSVA)
  1694. #获得geneset
  1695. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune")
  1696. geneset=read.csv("IOBR_TIME.csv")
  1697. split_genes <- strsplit(geneset$genes, ",")
  1698. new_geneset <- data.frame(
  1699. genesymbol = unlist(split_genes),
  1700. cell = rep(geneset$cell, lengths(split_genes)))
  1701. geneset = split(new_geneset$genesymbol,new_geneset$cell)
  1702. #ssgsea
  1703. re <- gsva(exp, geneset, method="ssgsea",mx.diff=FALSE, verbose=FALSE)
  1704. re=as.data.frame(re)
  1705. type=unique(new_geneset$cell)
  1706. re=re[type,]
  1707. write.csv(re,file="TIMEresult_meta.csv")
  1708. identical(colnames(re),colnames(meta))
  1709. #结果整合(meta-LGG-GBM)
  1710. #cibersort&estimate
  1711. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR")
  1712. load("tme_combine_GBM.RData")
  1713. cibersort=cibersort[,1:23]
  1714. cibersort=column_to_rownames(cibersort,"ID")
  1715. cibersort=cibersort[sample,]
  1716. estimate=estimate[,1:4]
  1717. estimate=column_to_rownames(estimate,"ID")
  1718. estimate=estimate[sample,]
  1719. #TIME
  1720. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune")
  1721. TIME=read.csv("TIMEresult_GBM.csv",check.names=F,row.names = 1)
  1722. TIME=as.data.frame(t(TIME))
  1723. identical(rownames(estimate),rownames(cibersort))
  1724. identical(rownames(TIME),rownames(cibersort))
  1725. #合并
  1726. data=as.data.frame(t(cbind(cibersort,estimate,TIME)))
  1727. data=as.data.frame(t(data))
  1728. data$group=group_list$group
  1729. library(dplyr)
  1730. #高低风险组组的平均值
  1731. grouped_data <- data %>%
  1732. group_by(group) %>%
  1733. summarize(across(everything(), mean, na.rm = TRUE))
  1734. grouped_data=t(grouped_data)
  1735. write.csv(grouped_data,"heatmap_GBM.csv")
  1736. #总体可视化
  1737. #cibersort&estimate
  1738. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR")
  1739. load("tme_combine.RData")
  1740. cibersort=cibersort[,1:23]
  1741. cibersort=column_to_rownames(cibersort,"ID")
  1742. estimate=estimate[,1:4]
  1743. estimate=column_to_rownames(estimate,"ID")
  1744. #TIME
  1745. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune")
  1746. TIME=read.csv("TIMEresult.csv",check.names=F,row.names = 1)
  1747. TIME=as.data.frame(t(TIME))
  1748. identical(rownames(cibersort),rownames(estimate))
  1749. identical(rownames(TIME),rownames(cibersort))
  1750. data=as.data.frame(t(cbind(cibersort,estimate,TIME)))
  1751. standarize.fun <- function(indata=NULL, halfwidth=NULL, centerFlag=T, scaleFlag=T) {
  1752. outdata=t(scale(t(indata), center=centerFlag, scale=scaleFlag))
  1753. if (!is.null(halfwidth)) {
  1754. outdata[outdata>halfwidth]=halfwidth
  1755. outdata[outdata<(-halfwidth)]= -halfwidth}
  1756. return(outdata)}
  1757. data <- standarize.fun(data,halfwidth = 2)
  1758. types=read.csv("type.csv",check.names = F)
  1759. rownames(types)=types$celltype
  1760. table(types$type)
  1761. types$type=factor(types$type,levels = c('cibersort','estimate','cancer immunity cycle',
  1762. 'immune functions','TME signatures'))
  1763. order2=rownames(group)
  1764. table(group$group)
  1765. type=c('#E64B35FF','#4DBBD5FF','#00A087FF','#3C5488FF','#F39B7FFF',"orange","yellow")
  1766. names(type)=c('cibersort','estimate','cancer immunity cycle','immune functions',
  1767. 'TME signatures')
  1768. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune")
  1769. pdf('TIME_heatmap.pdf',height = 8,width = 6)
  1770. Heatmap(data[,order2],name='Z-score',
  1771. top_annotation = HeatmapAnnotation(foo=anno_block(gp=gpar(fill= c('lightgreen','#FB9A99')),
  1772. labels=c('High','Low'),
  1773. labels_gp = gpar(col='white',fontsize=10,fontface='bold'))),
  1774. cluster_rows = F,
  1775. col=colorRamp2(c(-2,0,2),c('lightblue','white','pink')),
  1776. color_space = "RGB",
  1777. cluster_columns = FALSE,border = T,
  1778. row_order=NULL,
  1779. row_names_side = 'left',
  1780. column_order=NULL,
  1781. show_column_names = FALSE,
  1782. row_names_gp = gpar(fontsize = 9),
  1783. column_split = c(rep(1,345),rep(2,346)),
  1784. row_split = types$type,
  1785. left_annotation = rowAnnotation(foo=anno_block(gp=gpar(fill= c("#FF7F00",'#FDAE61','#FED976','#74ADD1',"#4575B4")),
  1786. labels=c('cibersort','estimate','cancer immunity cycle','immune functions',
  1787. 'TME signatures'),
  1788. labels_gp = gpar(col='white',fontsize=8,fontface='bold'))),
  1789. gap = unit(1, "mm"),
  1790. column_title = NULL,
  1791. column_title_gp = gpar(fontsize = 10),
  1792. show_heatmap_legend =T,
  1793. heatmap_legend_param=list(labels_gp = gpar(fontsize = 10), border = T,
  1794. title_gp = gpar(fontsize = 10, fontface = "bold")),
  1795. column_gap = unit(2,'mm'),
  1796. row_title = NULL)
  1797. dev.off()
  1798. #免疫细胞相关性
  1799. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/IOBR")
  1800. load("tme_combine.RData")
  1801. immu_data=column_to_rownames(cibersort,"ID")
  1802. immu_data=immu_data[,1:22]
  1803. #去除cibersort后缀
  1804. col_names <- colnames(immu_data)
  1805. new_col_names <- gsub("_CIBERSORT", "", col_names)
  1806. colnames(immu_data) <- new_col_names
  1807. #分组信息
  1808. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  1809. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  1810. bestmodel="Enet[alpha=0.3]"
  1811. RS_mat2=RS_mat[,bestmodel]
  1812. y=RS_mat2[1:691]
  1813. correlation <- data.frame()
  1814. for(i in 1:length(colnames(immu_data))){
  1815. print(i)
  1816. dd = cor.test(as.numeric(immu_data[,i]),y,method="spearman")
  1817. correlation[i,1] = colnames(immu_data)[i]
  1818. correlation[i,2] = dd$estimate
  1819. correlation[i,3] = dd$p.value}
  1820. colnames(correlation) <- c("Cell","cor","pvalue")
  1821. #定义圆圈颜色的函数
  1822. p.col = c('pink','gold','orange','LimeGreen','darkgreen')
  1823. fcolor = function(x,p.col){
  1824. color = ifelse(x>0.8,p.col[1],ifelse(x>0.6,p.col[2],ifelse(x>0.4,p.col[3],
  1825. ifelse(x>0.2,p.col[4], p.col[5])
  1826. )))
  1827. return(color)
  1828. }
  1829. #定义设置圆圈大小的函数
  1830. p.cex = seq(2.5, 5.5, length=5)
  1831. fcex = function(x){
  1832. x=abs(x)
  1833. cex = ifelse(x<0.1,p.cex[1],ifelse(x<0.2,p.cex[2],ifelse(x<0.3,p.cex[3],
  1834. ifelse(x<0.4,p.cex[4],p.cex[5]))))
  1835. return(cex)
  1836. }
  1837. data=correlation
  1838. #根据pvalue定义圆圈的颜色
  1839. points.color = fcolor(x=data$pvalue,p.col=p.col)
  1840. data$points.color = points.color
  1841. points.cex = fcex(x=data$cor)
  1842. data$points.cex = points.cex
  1843. data=data[order(data$cor),]
  1844. #可视化
  1845. xlim = ceiling(max(abs(data$cor))*10)/10
  1846. layout(mat=matrix(c(1,1,1,1,1,0,2,0,3,0),nc=2),width=c(8,2.2),heights=c(1,2,1,2,1))
  1847. par(bg="white",las=1,mar=c(5,18,2,4),cex.axis=1.5,cex.lab=2)
  1848. plot(1,type="n",xlim=c(-xlim,xlim),ylim=c(0.5,nrow(data)+0.5),xlab="Correlation Coefficient",ylab="",yaxt="n",yaxs="i",axes=F)
  1849. rect(par('usr')[1],par('usr')[3],par('usr')[2],par('usr')[4],col="#F5F5F5",border="#F5F5F5")
  1850. grid(ny=nrow(data),col="white",lty=1,lwd=2)
  1851. #绘制图形的线段
  1852. segments(x0=data$cor,y0=1:nrow(data),x1=0,y1=1:nrow(data),lwd=4)
  1853. #绘制图形的圆圈
  1854. points(x=data$cor,y = 1:nrow(data),col = data$points.color,pch=16,cex=data$points.cex)
  1855. #展示免疫细胞的名称
  1856. text(par('usr')[1],1:nrow(data),data$Cell,adj=1,xpd=T,cex=1.5)
  1857. #展示pvalue
  1858. pvalue.text=ifelse(data$pvalue<0.001,'<0.001',sprintf("%.03f",data$pvalue))
  1859. redcutoff_cor=0
  1860. redcutoff_pvalue=0.05
  1861. text(par('usr')[2],1:nrow(data),pvalue.text,adj=0,xpd=T,col=ifelse(abs(data$cor)>redcutoff_cor & data$pvalue<redcutoff_pvalue,"red","black"),cex=1.5)
  1862. axis(1,tick=F)
  1863. #绘制圆圈大小的图例
  1864. par(mar=c(0,4,3,4))
  1865. plot(1,type="n",axes=F,xlab="",ylab="")
  1866. legend("left",legend=c(0.1,0.2,0.3,0.4,0.5),col="black",pt.cex=p.cex,pch=16,bty="n",cex=2,title="abs(cor)")
  1867. #绘制圆圈颜色的图例
  1868. par(mar=c(0,6,4,6),cex.axis=1.5,cex.main=2)
  1869. barplot(rep(1,5),horiz=T,space=0,border=NA,col=p.col,xaxt="n",yaxt="n",xlab="",ylab="",main="pvalue")
  1870. axis(4,at=0:5,c(1,0.8,0.6,0.4,0.2,0),tick=F)
  1871. #免疫表型比例(TCGA-meta-LGG-GBM)
  1872. library(ImmuneSubtypeClassifier)
  1873. library(dplyr)
  1874. #表达矩阵
  1875. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1876. load("TCGA.RData")
  1877. tpm=TCGA
  1878. #分组信息
  1879. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  1880. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  1881. bestmodel="Enet[alpha=0.3]"
  1882. RS_mat2=RS_mat[,bestmodel]
  1883. RS_mat2=RS_mat2[1:691]
  1884. group=ifelse(RS_mat2>median(RS_mat2),"High","Low")
  1885. group_list=as.data.frame(cbind(sample=colnames(TCGA),group=group))
  1886. rownames(group_list)=group_list$sample
  1887. Isubtype <- callEnsemble(X = tpm, geneids = 'symbol')[,1:2]
  1888. Isubtype=column_to_rownames(Isubtype,"SampleIDs")
  1889. Isubtype$BestCall=paste0('C',Isubtype$BestCall)
  1890. #查看为匹配的基因有多少
  1891. geneMatchErrorReport(X=tpm, geneid='symbol')
  1892. #可视化
  1893. df=cbind(group_list[rownames(Isubtype),],Isubtype)%>%
  1894. select(ncol(.)-1,ncol(.))%>%
  1895. group_by(group,BestCall)%>%
  1896. summarise(count=n())
  1897. df$group <- factor(df$group, levels = c("Low","High"))
  1898. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/immuphenotype")
  1899. save(df,file="df.RData")
  1900. load("df.RData")
  1901. library(ggplot2)
  1902. library(paletteer)
  1903. ggplot()+
  1904. geom_bar(data =df, aes(x = group, y = count, fill = BestCall),
  1905. stat = "identity",
  1906. position = "fill")+
  1907. theme_classic()+
  1908. scale_fill_paletteer_d("RColorBrewer::Paired")
  1909. #3.4 不同评分组的突变分析####
  1910. library(broom)
  1911. library(maftools)
  1912. library(ggpubr)
  1913. library(stringr)
  1914. #SNV样本信息
  1915. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.1 genomic")
  1916. load("TCGA-LGG_maf.rdata")
  1917. barcode=as.data.frame(unique(data$Tumor_Sample_Barcode))
  1918. colnames(barcode)="sample"
  1919. data1=data
  1920. load("TCGA-GBM_maf.rdata")
  1921. barcode2=as.data.frame(unique(data$Tumor_Sample_Barcode))
  1922. colnames(barcode2)="sample"
  1923. data2=data
  1924. #合并lgg和gbm
  1925. data <- rbind(data1,data2)
  1926. maf.coad <- data
  1927. class(maf.coad) #data.frame
  1928. dim(maf.coad) #87957 141
  1929. #匹配结果
  1930. clin <- read.csv("TCGA_SNV_barcode.csv",header=TRUE) #732
  1931. clin <- clin[-c(499,586),] #去除2个异常样本 TCGA-06-5416-01A-01D-1486-08,TCGA-DU-6392-01A-11D-1705-08
  1932. maf.coad=merge(data,clin,by="Tumor_Sample_Barcode") #36059 142
  1933. sample=unique(maf.coad$Tumor_Sample_Barcode)
  1934. #提取low risk组
  1935. low=maf.coad[maf.coad$sample=="Low",]
  1936. maf <- read.maf(low,clinicalData = clin)
  1937. #提取high risk组
  1938. high=maf.coad[maf.coad$sample=="High",]
  1939. maf <- read.maf(high,clinicalData = clin)
  1940. #瀑布图
  1941. vc_cols = c("#8DD3C7","#80B1D3","#B2DF8A","#33A02C","#FB9A99","#E31A1C","#FDBF6F","#FF7F00",'#CAB2D6')
  1942. names(vc_cols) = c('Multi_Hit','Missense_Mutation','Frame_Shift_Del','Nonsense_Mutation',
  1943. 'Frame_Shift_Ins','In_Frame_Ins','Splice_Site','In_Frame_Del','Translation_Start_Site')
  1944. col = c("#E31A1C","#1F78B4")
  1945. names(col) = c('High','Low')
  1946. oncoplot(maf = maf, top=30, draw_titv = F,fontSize = 0.75 ,
  1947. clinicalFeatures = 'sample',annotationColor = list(sample=col),
  1948. colors = vc_cols,bgCol = "transparent",annoBorderCol = "white",
  1949. sortByAnnotation = TRUE,borderCol=NULL)
  1950. #合并lgg和gbm
  1951. maf <- read.maf(maf.coad,clinicalData = clin)
  1952. #突变数目与risk的相关性
  1953. mutation_count=[email hidden]
  1954. #TCGA分组信息
  1955. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  1956. load(file="TCGA.RData")
  1957. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  1958. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  1959. bestmodel="Enet[alpha=0.3]"
  1960. RS_mat2=RS_mat[,bestmodel]
  1961. RS_mat2=RS_mat2[1:691]
  1962. group=RS_mat2
  1963. group=as.data.frame(cbind(ID=colnames(TCGA),group=group))
  1964. clin$ID <- substr(clin$Tumor_Sample_Barcode, 1, 16)
  1965. #匹配好risk的clin
  1966. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.1 genomic")
  1967. clin_new=read.csv("clin_new.csv")
  1968. clin_new=clin_new[order(clin_new$Tumor_Sample_Barcode),]
  1969. mutation_count=mutation_count[order(mutation_count$Tumor_Sample_Barcode),]
  1970. identical(mutation_count$Tumor_Sample_Barcode,clin_new$Tumor_Sample_Barcode)
  1971. mutation_count$risk=clin_new$X
  1972. #相关性分析
  1973. ggscatter(mutation_count, x = 'risk', y = 'total', size = 4,add = "reg.line",
  1974. color="lightblue",
  1975. add.params = list(color = "#77C034", fill = "#C5E99B", size = 1),
  1976. conf.int = TRUE)+
  1977. stat_cor(method = "spearman", label.x = 0, label.y = 1300, label.sep = "\n") +
  1978. ggtitle("")+
  1979. xlab("DisulfidpScore") +
  1980. ylab("Total mutation count")+
  1981. theme_classic()+
  1982. theme(legend.position = "none")
  1983. #risk组在TMB中的差异
  1984. tmb_table_wt_log = tmb(maf = maf)
  1985. head(tmb_table_wt_log)
  1986. #合并分组信息
  1987. dat=as.data.frame(tmb_table_wt_log[,c(1,4)])
  1988. rownames(dat)=dat$Tumor_Sample_Barcode
  1989. rownames(clin_new)=clin_new$Tumor_Sample_Barcode
  1990. dat2=merge(dat,clin_new,by=0)
  1991. #更新分组名称
  1992. dat2$sample=ifelse(dat2$X>median(dat2$X),"High","Low")
  1993. dat2$sample <- factor(dat2$sample, levels = c("Low","High"))
  1994. p=ggviolin(dat2, x="sample", y="total_perMB_log", fill="sample",
  1995. palette =c("#1F78B4","#E31A1C"),alpha = 0.5,
  1996. add ="boxplot",size = 0.5,
  1997. xlab = "TMB",
  1998. legend = "none")
  1999. p+stat_compare_means(aes(group = sample),
  2000. method = "wilcox.test",label = "p.signif",
  2001. label.x = 1.5,label.y = 1.5,
  2002. symnum.args=list(cutpoints = c(0, 0.001, 0.01, 0.05, 1),
  2003. symbols = c("***", "**", "*", "ns")))
  2004. #TMB的生存分析
  2005. library(data.table)
  2006. clinical=OS
  2007. clinical=rownames_to_column(clinical,"patient")
  2008. surv.df <- tmb_table_wt_log %>%
  2009. mutate(patient = str_sub(as.character(.$Tumor_Sample_Barcode),1,16)) %>%
  2010. distinct(patient, .keep_all = T) %>%
  2011. inner_join(clinical, by = "patient") %>%
  2012. mutate(group = if_else(total_perMB > median(total_perMB), "H-TMB","L-TMB")) %>%
  2013. select(patient,OS.time,OS,group)
  2014. colnames(surv.df)[2:3]=c(" times","status")
  2015. library(survival)
  2016. library(survminer)
  2017. times=surv.df$` times`
  2018. f <- survfit(Surv(times,status) ~ group, data = surv.df)
  2019. col=c("#E31A1C","#1F78B4")
  2020. ggsurvplot(f,pval=T,conf.int=F,xlab="Time(years)",palette=col,
  2021. legend.labs = c("H-TMB", "L-TMB"),legend=c(0.8,0.8))
  2022. #TMB结合risk的生存分析
  2023. clinical=OS
  2024. clinical=rownames_to_column(clinical,"patient")
  2025. surv.df <- tmb_table_wt_log %>%
  2026. mutate(patient = str_sub(as.character(.$Tumor_Sample_Barcode),1,16)) %>%
  2027. distinct(patient, .keep_all = T) %>%
  2028. inner_join(clinical, by = "patient") %>%
  2029. select(patient,OS.time,OS,total_perMB)
  2030. sample=surv.df$patient
  2031. group=group[group$ID %in% sample,]
  2032. surv.df$risk=group$group
  2033. colnames(surv.df)[4]="TMB"
  2034. rt=surv.df
  2035. #根据基因表达,对数据分组
  2036. a=if_else(surv.df$TMB > median(surv.df$TMB), "H-TMB","L-TMB")
  2037. b=ifelse(surv.df$risk >median(surv.df$risk), "High-risk", "Low-risk")
  2038. Type=paste(a,"+",b)
  2039. rt=cbind(rt,Type)
  2040. head(rt)
  2041. #生存差异统计
  2042. length=length(levels(factor(Type)))
  2043. diff=survdiff(Surv(OS.time, OS) ~Type,data = rt)
  2044. pValue=1-pchisq(diff$chisq,df=length-1)
  2045. if(pValue<0.001){
  2046. pValue="p<0.001"
  2047. }else{
  2048. pValue=paste0("p=",sprintf("%.03f",pValue))
  2049. }
  2050. fit <- survfit(Surv(OS.time, OS) ~ Type, data = rt)
  2051. head(fit)
  2052. #绘制生存曲线
  2053. col=c("#E31A1C","#FA9FB5","#1F78B4","lightblue")
  2054. surPlot=ggsurvplot(fit,
  2055. data=rt,
  2056. conf.int=F,
  2057. pval=pValue,pval.size=5,
  2058. palette=col,
  2059. legend = c(0.75,0.75),
  2060. xlab="Time(years)",
  2061. break.time.by = 1,
  2062. risk.table.title="",
  2063. risk.table=F,
  2064. risk.table.height=.25)
  2065. surPlot
  2066. #关键基因的互斥/共现
  2067. #High/Low
  2068. par(oma = c(3, 4, 5, 1))
  2069. somaticInteractions(maf = maf, top = 25,
  2070. genes=c("IDH1","TP53","EGFR","PTEN","TTN","ATRX","CIC","FUBP1"),
  2071. pvalue = c(0.01, 0.05),
  2072. colPal = "PiYG")
  2073. #关键基因的突变数量比较
  2074. gene=c("IDH1","TP53","EGFR","PTEN","TTN","ATRX","CIC","FUBP1")
  2075. #提取low risk组
  2076. low=maf.coad[maf.coad$sample=="Low",]
  2077. low=low[low$Hugo_Symbol %in% gene,]
  2078. low <- read.maf(low,clinicalData = clin)
  2079. #提取high risk组
  2080. high=maf.coad[maf.coad$sample=="High",]
  2081. high=high[high$Hugo_Symbol %in% gene,]
  2082. high <- read.maf(high,clinicalData = clin)
  2083. High.vs.Low <- mafCompare(m1 = high, m2 = low, m1Name = 'High',m2Name = 'Low', minMut = 5)
  2084. a=High.vs.Low[[1]]
  2085. forestPlot(mafCompareRes = High.vs.Low, pVal = 1, color = c('royalblue', 'maroon'), geneFontSize = 0.8)
  2086. #3.5 不同评分组的免疫治疗反应预测####
  2087. library(tidyverse)
  2088. library(ggplot2)
  2089. library(ggsci)
  2090. library(ggpubr)
  2091. library(ggsignif)
  2092. #基因矩阵
  2093. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  2094. load("TCGA.RData")
  2095. identical(colnames(TCGA),rownames(OS))
  2096. dat = TCGA
  2097. #标准化
  2098. exp<-t(apply(dat,1,function(x){x-(mean(x))}))
  2099. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/TIDE")
  2100. write.table(exp,file="TIDE.txt",sep="\t",quote=F)
  2101. #读取TIDE结果文件
  2102. TIDE<-read.csv("export.csv",header=T,check.names=F)
  2103. rownames(TIDE)=TIDE$Patient
  2104. sample=colnames(TCGA)
  2105. TIDE=TIDE[sample,]
  2106. #分组信息
  2107. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  2108. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  2109. bestmodel="Enet[alpha=0.3]"
  2110. RS_mat2=RS_mat[,bestmodel]
  2111. RS_mat2=RS_mat2[1:691]
  2112. group=ifelse(RS_mat2>median(RS_mat2),"High","Low")
  2113. TIDE$group=group
  2114. result=TIDE
  2115. #小提琴图展示结果
  2116. #1.TIDE小提琴图
  2117. my_comparisons <- list( c("Low", "High"))
  2118. p1 <- ggviolin(result, x = 'group', y = 'TIDE', fill = 'group',
  2119. palette = c("#A6D854","#FF1493"),alpha = 0.8,
  2120. add = 'boxplot', add.params = list(fill = "white")) +
  2121. stat_compare_means(comparisons = my_comparisons, label = "p.signif", bracket.size=0.5, tip.length = 0.01, method = 'wilcox.test')
  2122. p1
  2123. #2.Dysfunction小提琴图
  2124. p2 <- ggviolin(result, x = 'group', y = 'Dysfunction', fill = 'group',
  2125. palette = c("#A6D854","#FF1493"),alpha = 0.8,
  2126. add = 'boxplot', add.params = list(fill = "white")) +
  2127. stat_compare_means(comparisons = my_comparisons, label = "p.signif", bracket.size=0.5, tip.length = 0.02, method = 'wilcox.test')
  2128. p2
  2129. #3.Exclusion小提琴图
  2130. p3 <- ggviolin(result, x = 'group', y = 'Exclusion', fill = 'group',
  2131. palette = c("#A6D854","#FF1493"),alpha = 0.8,
  2132. add = 'boxplot', add.params = list(fill = "white")) +
  2133. stat_compare_means(comparisons = my_comparisons, label = "p.signif", bracket.size=0.5, tip.length = 0.02, method = 'wilcox.test')
  2134. p3
  2135. #4.MSI小提琴图
  2136. colnames(result)[6]
  2137. colnames(result)[6] <- c('MSI')
  2138. p4 <- ggviolin(result, x = 'group', y = 'MSI', fill = 'group',
  2139. palette = c("#A6D854","#FF1493"),alpha = 0.8,
  2140. add = 'boxplot', add.params = list(fill = "white")) +
  2141. stat_compare_means(comparisons = my_comparisons, label = "p.signif", bracket.size=0.5, tip.length = 0.02, method = 'wilcox.test')
  2142. p4
  2143. #百分比图
  2144. #分组计算百分比
  2145. mydata_summary <- TIDE %>%
  2146. group_by(group, Responder) %>%
  2147. summarise(count = n()) %>%
  2148. group_by(group) %>%
  2149. mutate(percent = count / sum(count) * 100)
  2150. #卡方检验
  2151. chi_square <- chisq.test(table(TIDE$group, TIDE$Responder))
  2152. p_value <- chi_square$p.value
  2153. p_value
  2154. #绘制百分比柱状堆叠图
  2155. mydata_summary$group <- factor(mydata_summary$group, levels = c("Low","High"))
  2156. ggplot(mydata_summary, aes(x = group, y = percent, fill = Responder)) +
  2157. geom_bar(stat = "identity", position = "stack",color = "#f3f4f4") +
  2158. annotate("text", x = 1.5, y = 105, label=expression(""~italic("P=1.204292e-29")), size = 4)+
  2159. geom_text(data = subset(mydata_summary, group == "High"), aes(label = paste0(round(percent), "%")),
  2160. position = position_stack(vjust = 0.5), color = "black", size = 3) +
  2161. geom_text(data = subset(mydata_summary, group == "Low"), aes(label = paste0(round(percent), "%")),
  2162. position = position_stack(vjust = 0.5), color = "black", size = 3) +
  2163. labs(title = "TCGA",x = "",y = "Percentage(%)") +
  2164. scale_fill_manual(values = c("True" = "#FF1493", "False" = "#A6D854")) +
  2165. theme_bw()+
  2166. theme(panel.grid = element_blank(),
  2167. plot.title = element_text(hjust = 0.5, face = "bold"),
  2168. plot.subtitle = element_text(hjust = 0.5, face = "italic"))+
  2169. guides(fill=guide_legend(reverse=TRUE))
  2170. #生存曲线
  2171. rt=cbind(OS,Responder=TIDE$Responder)
  2172. colnames(rt)[1:2]=c("fustat","futime")
  2173. diff=survdiff(Surv(futime, as.numeric(fustat)) ~ Responder, data=rt)
  2174. pValue=1-pchisq(diff$chisq, df=1)
  2175. if(pValue<0.001){
  2176. pValue="p<0.001"
  2177. }else{
  2178. pValue=paste0("p=", sprintf("%.03f",pValue))
  2179. }
  2180. fit <- survfit(Surv(futime, fustat) ~ Responder, data = rt)
  2181. surPlot=ggsurvplot(fit,
  2182. data=rt,
  2183. conf.int=F,
  2184. pval=pValue,
  2185. pval.size=6,
  2186. xlab="Time(years)",
  2187. legend.title="Cluster",
  2188. break.time.by = 5,
  2189. palette=c("#DECBE4", "#B3CDE3"))
  2190. #风险评分与Response
  2191. result$risk=RS_mat2
  2192. my_comparisons <- list( c("True", "False"))
  2193. #风险评分小提琴图
  2194. p12 <- ggviolin(result, x = 'Responder', y = 'risk', fill = 'Responder',
  2195. palette = c("#FF1493","#A6D854"),alpha = 0.8,
  2196. add = 'boxplot', add.params = list(fill = "white")) +
  2197. stat_compare_means(comparisons = my_comparisons, label = "p.signif", bracket.size=0.5, tip.length = 0.02, method = 'wilcox.test')
  2198. p12
  2199. #TIDE分析(meta-LGG-GBM)
  2200. library(tidyverse)
  2201. library(ggplot2)
  2202. library(ggsci)
  2203. library(ggpubr)
  2204. library(ggsignif)
  2205. #基因矩阵
  2206. setwd("/home/data/t060432/HRT/Disulfidptosis/data/2.2 meta")
  2207. load("meta.RData")
  2208. identical(colnames(meta),rownames(meta_pheno))
  2209. dat = meta
  2210. #标准化
  2211. exp<-t(apply(dat,1,function(x){x-(mean(x))}))
  2212. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.0 immune/TIDE")
  2213. write.table(exp,file="TIDE_LGG.txt",sep="\t",quote=F)
  2214. #读取TIDE结果文件
  2215. TIDE<-read.csv("TIDEresult_meta.csv",header=T,check.names=F)
  2216. rownames(TIDE)=TIDE$Patient
  2217. sample=colnames(meta)
  2218. TIDE=TIDE[sample,]
  2219. #分组信息
  2220. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  2221. sample=read.table("sample.txt")
  2222. RS_mat <- read.table("RS_mat.txt",sep = "\t",header = T,stringsAsFactors = F,check.names = F,row.names=1)
  2223. bestmodel="Enet[alpha=0.3]"
  2224. RS_mat2=RS_mat[,bestmodel]
  2225. group=RS_mat2
  2226. group_list=as.data.frame(cbind(sample=sample$sample,group=group))
  2227. rownames(group_list)=group_list$sample
  2228. sample=colnames(meta)
  2229. group_list=group_list[sample,]
  2230. group_list$group=as.numeric(group_list$group)
  2231. group_list=na.omit(group_list)
  2232. group_list$group=ifelse(group_list$group>median(group_list$group),"High","Low")
  2233. sample=rownames(group_list)
  2234. TIDE=TIDE[sample,]
  2235. TIDE$group=group_list$group
  2236. result=TIDE
  2237. #免疫治疗队列
  2238. library(dplyr)
  2239. library(tidyr)
  2240. library(ggpubr)
  2241. library(ggplot2)
  2242. library(survivalsvm)
  2243. library(survminer)
  2244. library(survival)
  2245. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.2 immutherapy")
  2246. load("GBM-PRJNA482620.RData")
  2247. risk=read.table("GBM-PRJNA482620_risk.txt",header=T)
  2248. identical(rownames(pdata),rownames(risk))
  2249. #有无响应百分堆叠图
  2250. mydata=as.data.frame(cbind(risk=risk,type=pdata$response))
  2251. mydata$group=ifelse(mydata[,1]>median(mydata[,1]), "High risk", "Low risk")
  2252. #分组计算百分比
  2253. mydata_summary <- mydata %>%
  2254. group_by(group, type) %>%
  2255. summarise(count = n()) %>%
  2256. group_by(group) %>%
  2257. mutate(percent = count / sum(count) * 100)
  2258. str(mydata_summary)
  2259. #卡方检验
  2260. chi_square <- chisq.test(table(mydata$group, mydata$type))
  2261. p_value <- chi_square$p.value
  2262. p_value
  2263. #绘制百分比柱状堆叠图
  2264. mydata_summary$group <- factor(mydata_summary$group, levels = c("Low risk","High risk"))
  2265. ggplot(mydata_summary, aes(x = group, y = percent, fill = type)) +
  2266. geom_bar(stat = "identity", position = "stack",color = "#f3f4f4") +
  2267. annotate("text", x = 1.5, y = 105, label=expression(""~italic("P=0.03288")), size = 4)+
  2268. geom_text(data = subset(mydata_summary, group == "High risk"), aes(label = paste0(round(percent), "%")),
  2269. position = position_stack(vjust = 0.5), color = "black", size = 3) +
  2270. geom_text(data = subset(mydata_summary, group == "Low risk"), aes(label = paste0(round(percent), "%")),
  2271. position = position_stack(vjust = 0.5), color = "black", size = 3) +
  2272. labs(title = "GBM-PRJNA482620",x = "",y = "Percentage(%)") +
  2273. scale_fill_manual(values = c("R" = "#FF1493", "N" = "#A6D854")) +
  2274. theme_bw()+
  2275. theme(panel.grid = element_blank(),
  2276. plot.title = element_text(hjust = 0.5, face = "bold"),
  2277. plot.subtitle = element_text(hjust = 0.5, face = "italic"))+
  2278. guides(fill=guide_legend(reverse=TRUE))
  2279. #生存曲线
  2280. rt=cbind(pdata[,c(1:2)],risk)
  2281. colnames(rt)[1:2]=c("fustat","futime")
  2282. Type=ifelse(rt$risk>median(rt$risk), "High", "Low")
  2283. rt=cbind(as.data.frame(rt), Type)
  2284. diff=survdiff(Surv(futime, as.numeric(fustat)) ~ Type, data=rt)
  2285. pValue=1-pchisq(diff$chisq, df=1)
  2286. if(pValue<0.001){
  2287. pValue="p<0.001"
  2288. }else{
  2289. pValue=paste0("p=", sprintf("%.03f",pValue))
  2290. }
  2291. fit <- survfit(Surv(futime, fustat) ~ Type, data = rt)
  2292. surPlot=ggsurvplot(fit,
  2293. data=rt,
  2294. conf.int=F,
  2295. pval=pValue,
  2296. pval.size=6,
  2297. xlab="Time(years)",
  2298. #ylab="Overall survival",
  2299. legend.title="Cluster",
  2300. break.time.by = 5,
  2301. palette=c("#FF1493", "#A6D854"))
  2302. #密度分布图
  2303. #计算中位数
  2304. median_risk_N <- median(mydata$risk[mydata$type == "N"])
  2305. median_risk_R <- median(mydata$risk[mydata$type == "R"])
  2306. type=c("N","R")
  2307. grp.mean=c(0.13,-0.095)
  2308. mu=as.data.frame(cbind(type,grp.mean))
  2309. p=ggplot(data=mydata, aes(x=risk, group=type, fill=type)) +
  2310. geom_density(#adjust=1.5,
  2311. alpha=0.5) +
  2312. ggprism::theme_prism(border = T)
  2313. p+scale_fill_manual(values=c("#A6D854","#FF1493"))
  2314. #3.6 不同评分组的药物敏感性预测####
  2315. #CGGA队列化疗比例
  2316. library(dplyr)
  2317. library(tidyr)
  2318. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  2319. load("CGGA693.RData")
  2320. pheno=CGGA693_pheno[,9:10]
  2321. colnames(pheno)=c("Radio_status","Chemo_status")
  2322. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  2323. RS_mat=read.table("RS_mat.txt",sep = "\t", row.names = 1,header = T,check.names = F)
  2324. best_mod = "Enet[alpha=0.3]"
  2325. RS_mat2=data.frame(RS_mat[,best_mod])
  2326. rownames(RS_mat2)=rownames(RS_mat)
  2327. colnames(RS_mat2)="risk"
  2328. pheno2 <- pheno %>% filter(!is.na(Chemo_status)) #Chemo_status/Radio_status
  2329. sample=rownames(pheno2)
  2330. mydata=as.data.frame(cbind(risk=RS_mat2[sample,],type=pheno2[,2]))
  2331. rownames(mydata)=sample
  2332. mydata$group=ifelse(mydata[,1]>median(mydata[,1]), "High risk", "Low risk")
  2333. mydata$type=ifelse(mydata$type=="0","No","Yes")
  2334. #分组计算百分比
  2335. mydata_summary <- mydata %>%
  2336. group_by(group, type) %>%
  2337. summarise(count = n()) %>%
  2338. group_by(group) %>%
  2339. mutate(percent = count / sum(count) * 100)
  2340. #卡方检验
  2341. chi_square <- chisq.test(table(mydata$group, mydata$type))
  2342. p_value <- chi_square$p.value
  2343. p_value
  2344. #绘制百分比柱状堆叠图
  2345. mydata_summary$group <- factor(mydata_summary$group, levels = c("Low risk","High risk"))
  2346. ggplot(mydata_summary, aes(x = group, y = percent, fill = type)) +
  2347. geom_bar(stat = "identity", position = "stack",color = "#f3f4f4") +
  2348. annotate("text", x = 1.5, y = 105, label=expression(""~italic("P=6.305645e-06")), size = 4)+
  2349. geom_text(data = subset(mydata_summary, group == "High risk"), aes(label = paste0(round(percent), "%")),
  2350. position = position_stack(vjust = 0.5), color = "black", size = 3) +
  2351. geom_text(data = subset(mydata_summary, group == "Low risk"), aes(label = paste0(round(percent), "%")),
  2352. position = position_stack(vjust = 0.5), color = "black", size = 3) +
  2353. labs(title = "CGGA693 Chemo_treated",x = "",y = "Percentage%") +
  2354. scale_fill_manual(values = c("Yes" = "#FF1493", "No" = "#A6D854")) +
  2355. theme_bw()+
  2356. theme(panel.grid = element_blank(),
  2357. plot.title = element_text(hjust = 0.5, face = "bold"),
  2358. plot.subtitle = element_text(hjust = 0.5, face = "italic"))+
  2359. guides(fill=guide_legend(reverse=TRUE))
  2360. library(pRRophetic)
  2361. library(ggplot2)
  2362. library(cowplot)
  2363. library(ggsignif)
  2364. library(ggsci)
  2365. library(tidyr)
  2366. library(dplyr)
  2367. library(ggpubr)
  2368. library(ggsci)
  2369. library(ggforce)
  2370. library(tidyverse)
  2371. library(ggpubr)
  2372. library(ggprism)
  2373. library(paletteer)
  2374. setwd("/home/data/t060432/HRT/Disulfidptosis/data/0. RData")
  2375. load("TCGA.RData")
  2376. dat=TCGA
  2377. data(PANCANCER_IC_Tue_Aug_9_15_28_57_2016)
  2378. GCP.drug <- unique(drugData2016$Drug.name)
  2379. #利用pRRopheticPredict函数进行药物敏感性分析
  2380. drug_list <- GCP.drug
  2381. results <- list()
  2382. for (drug in drug_list) {
  2383. tryCatch({
  2384. predictedPtype <- pRRopheticPredict(
  2385. testMatrix = as.matrix(dat),
  2386. drug = drug,
  2387. tissueType = "nervous_system",
  2388. selection = 1,
  2389. batchCorrect = "eb",
  2390. powerTransformPhenotype = T,
  2391. dataset = "cgp2016")
  2392. results[[drug]] <- predictedPtype
  2393. }, error = function(e) {
  2394. cat("Skipping drug:", drug, "\n")
  2395. })
  2396. }
  2397. #保存
  2398. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.3 drug sensitivity")
  2399. save(results,file="pRRophetic.RData")
  2400. load("pRRophetic.RData")
  2401. #整合结果
  2402. res.df <- do.call('rbind',results)
  2403. #提取风险评分分组
  2404. setwd("/home/data/t060432/HRT/Disulfidptosis/data/3.0 DisulfidpScore/Results")
  2405. RS_mat=read.table("RS_mat.txt",check.names = F)
  2406. best_mod = "Enet[alpha=0.3]"
  2407. RS_mat2 = RS_mat[,best_mod][1:691]
  2408. group=ifelse(RS_mat2>median(RS_mat2), "High", "Low")
  2409. data=rbind(res.df,group)
  2410. data=as.data.frame(t(data))
  2411. data[, 1:237] <- apply(data[, 1:237], 2, as.numeric)
  2412. #可视化
  2413. #Temozolomide\Cisplatin
  2414. ggboxplot(data, x = "group", y = "Vinblastine",
  2415. color = "group", notch = TRUE,
  2416. palette = c("#A6D854", "#FF1493"),alpha = 0.75,
  2417. legend = "none",size = 1,fill = "group")+
  2418. stat_compare_means(aes(group=group),label = "p.signif") +
  2419. labs(title = " ", x = NULL, y = "Vinblastine") +
  2420. theme(plot.title = element_text(hjust = 0.5))
  2421. #循环237个药物
  2422. drug <- colnames(data)[1:237]
  2423. p_value_results <- data.frame(drug = character(), p_value = numeric(),
  2424. group = character(), high_mean = numeric(),
  2425. low_mean = numeric(), stringsAsFactors = FALSE)
  2426. for (i in drug) {
  2427. ic50_high <- data[data$group == "High", i]
  2428. ic50_low <- data[data$group == "Low", i]
  2429. high_mean <- mean(ic50_high)
  2430. low_mean <- mean(ic50_low)
  2431. t_test_result <- t.test(ic50_high, ic50_low)
  2432. p_value <- t_test_result$p.value
  2433. if (high_mean > low_mean) {
  2434. group <- "High"} else {
  2435. group <- "Low"}
  2436. p_value_results <- rbind(p_value_results, data.frame(drug = i, p_value = p_value,
  2437. group = group, high_mean = high_mean,
  2438. low_mean = low_mean))}
  2439. #提取p<0.01的结果
  2440. significant_results <- p_value_results[p_value_results$p_value < 0.01, ] #199/209(交集后结果一致)
  2441. #相关性分析
  2442. data=rbind(res.df,risk=RS_mat2)
  2443. data=as.data.frame(t(data))
  2444. data_use=data
  2445. target_gene <- 'risk'
  2446. target_column <- data_use[,target_gene]
  2447. #单基因
  2448. cor_R <- cor(x = target_column,y = data_use[,1],method = 'pearson')
  2449. cor_P <- cor.test(x = target_column,y = data_use[,1])$p.value
  2450. result_1 <- data.frame(target_gene = target_gene,
  2451. gene_symbol = 'risk', #对应基因名
  2452. cor_R = cor_R,
  2453. cor_P = cor_P)
  2454. #批量计算基因间的相关性
  2455. result <- data.frame("target_gene" = character(),
  2456. "gene_symbol" = character(),
  2457. "cor_R" = numeric(),
  2458. "cor_P" = numeric())
  2459. gene_list <- colnames(data_use)[1:237]
  2460. for (gene in gene_list) {
  2461. print(gene)
  2462. cor_R <- cor(x = target_column,y = data_use[,gene],method = 'pearson')
  2463. cor_P <- cor.test(x = target_column,y = data_use[,gene])$p.value
  2464. temp_result <- data.frame(target_gene = target_gene,
  2465. gene_symbol = gene,
  2466. cor_R = cor_R,
  2467. cor_P = cor_P)
  2468. result <- rbind(result, temp_result)
  2469. }
  2470. resCor <- na.omit(result[(result$cor_R > 0.5|result$cor_R < -0.5 & result$cor_P < 0.01), ]) #95
  2471. drugnames=resCor$gene_symbol
  2472. selected_drugs <- significant_results[significant_results$drug %in% drugnames, ] #95
  2473. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.3 drug sensitivity")
  2474. write.table(selected_drugs,file="ic50.txt",quote=F,sep="\t")
  2475. #相关性散点图
  2476. ggscatter(data, x = 'risk', y = 'Vinblastine', size = 4,add = "reg.line",
  2477. color="lightblue",
  2478. add.params = list(color = "#77C034", fill = "#C5E99B", size = 1),
  2479. conf.int = TRUE)+
  2480. stat_cor(method = "spearman", label.x = 0, label.y = -3.5, label.sep = "\n") +
  2481. ggtitle("")+
  2482. xlab("DisulfidpScore") +
  2483. ylab("IC50(Vinblastine)")+
  2484. theme_classic()+
  2485. theme(legend.position = "none")
  2486. #可视化
  2487. setwd("/home/data/t060432/HRT/Disulfidptosis/data/4.3 drug sensitivity")
  2488. dat=read.table("ic50plot.txt",sep = "\t", header = TRUE)
  2489. dat_sorted <- arrange(dat, group, ic50)
  2490. ggplot(dat_sorted, aes(x = reorder(drug, ic50), y = ic50, fill = group)) +
  2491. geom_col() +
  2492. labs(y="IC50(H)/IC50(L)-1",x="")+
  2493. scale_fill_manual(values = c("High" = "#FF1493", "Low" = "#A6D854"))+
  2494. theme_classic() +
  2495. theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
  2496. #筛选IC50最低的10个药物(差异箱式图)
  2497. needata=selected_drugs[order(selected_drugs$low_mean),]
  2498. top10drug=needata$drug[1:10]
  2499. top10data=data[,top10drug]
  2500. group=ifelse(RS_mat2>median(RS_mat2), "High", "Low")
  2501. info=as.data.frame(cbind(sample=rownames(data),group))
  2502. colnames(info)=c("Sample","Type")
  2503. Exp_plot=top10data
  2504. Exp_plot$sam=info$Type
  2505. Exp_plot$sam <- factor(Exp_plot$sam, levels = c("Low","High"))
  2506. expr_use <- na.omit(Exp_plot)
  2507. expr_use <-as.data.frame(expr_use)
  2508. expr_use_long <- gather(expr_use, gene, Expression, -sam)
  2509. table(expr_use_long$gene)
  2510. colnames(expr_use_long) <- c("Group","gene","Expression")
  2511. my_comparisons <- list(c("Low","High"))
  2512. #可视化
  2513. ggboxplot(expr_use_long, x = "gene", y = "Expression",
  2514. color = "Group",
  2515. palette = c("#A6D854", "#FF1493"),alpha = 0.7,notch = TRUE,
  2516. #legend = "top",
  2517. size = 1,fill = NULL)+
  2518. stat_compare_means(aes(group=Group),label = "p.signif") +
  2519. labs(title = " ", x = NULL, y = "IC50") +
  2520. theme(plot.title = element_text(hjust = 0.5)) +
  2521. theme_bw() +
  2522. theme(panel.grid.major = element_blank(),
  2523. panel.grid.minor = element_blank(),
  2524. axis.title.x = element_blank(),
  2525. legend.position = "top")
  2526. #筛选IC50最低的10个药物(相关性)
  2527. cordata=resCor[resCor$gene_symbol %in% top10drug,]
  2528. cordata=cordata[,c(2:4)]
  2529. cordata$cor_P=-log10(cordata$cor_P)
  2530. ggplot(cordata, aes(x = gene_symbol, y = cor_R)) +
  2531. geom_col(width = 0.04, fill = '#FF1493') +
  2532. geom_point(aes(size = abs(cor_P)), color = '#FF1493') +
  2533. theme_bw() +
  2534. theme(panel.grid.major = element_blank(),
  2535. panel.grid.minor = element_blank(),
  2536. axis.title.x = element_blank(),
  2537. legend.position = "top") +
  2538. scale_fill_manual(values = unique(cordata$gene_symbol)) +
  2539. geom_hline(yintercept = 0, linetype = "dashed", color = "gray") +
  2540. labs(size = "-log10(pvalue)")

workline2.R at commit 64e79df, no license · at the source

Overview

Authors: Ruiting Huang1, Hailin Li1, Yijing Zhong1, Paimin Zhuo1, Yibei Wang1, Aoting Yang1, Yu Zhang2, Jiao Li3, Ruiquan Xu4,5, Quhuan Li1
  1. School of Biology and Biological Engineering, South China University of Technology, Guangzhou, Guangdong 510006, China
  2. The First Clinical School of Gannan Medical University, Ganzhou, Jiangxi 341000, China
  3. Gannan Medical University, Ganzhou, Jiangxi province 341000, China
  4. Department of Urology, First Affiliated Hospital of Gannan Medical University, Ganzhou, Jiangxi 341000, China
  5. Longnan First People's Hospital, Longnan, Jiangxi 341700, China
Journal: iScience, volume 29, issue 5, article 115657
Dates: received 6 September 2025; accepted 6 April 2026; published online 8 April 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1016/j.isci.2026.115657 · PMID 42164521 · PMCID PMC13185775 · OpenAlex W7151849519
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), other condition (population), clinical / translational (subfield)
Methods: Connectivity, Statistics, Smoothing, state filtering, decompositions, Machine learning, Preprocessing
Keywords: bioinformatics, cancer, artificial intelligence applications
Topic: Glioma Diagnosis and Treatment (Genetics, Medicine), according to OpenAlex
Funding: Natural Science Foundation of Guangdong Province (2023A1515010829, 2021A1515010040); National Natural Science Foundation of China (32271360, 31870928)
Citations: not cited yet (Europe PMC); 47 references in the paper

Abstract

Glioma prognosis is challenged by tumor heterogeneity and lack of biomarkers. Disulfidptosis, a novel cell death mechanism induced by disulfide stress, remains poorly understood in gliomas. This study analyzed eight glioma cohorts, identifying two disulfidptosis patterns with distinct genomic alterations, immune microenvironments, and clinical outcomes. A prognostic model—DisulfidpScore—was developed using machine learning, demonstrating robust predictive ability for survival. Crucially, single-cell profiling and virtual knockout analysis revealed elevated disulfidptosis in glioblastoma astrocytes and identified IQGAP1 as a key driver that modulates gene networks governing the cell cycle and neuron-glia interactions. High DisulfidpScore scores correlated with immunosuppressive microenvironments and poorer prognosis but increased chemotherapy sensitivity, whereas low scores indicated better survival and immunotherapy response. The model supports prognostic stratification and personalized treatment for glioma patients.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above, with 27 matches between paragraphs and lines of code.

clarozhong/Rdata

License: none: the authors keep all their rights
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 64e79df796231c4bb8b95430241efb84860dd453, 29 January 2026
Languages: R (4)
Size: 5 files, 4 scripts
Software Heritage: not archived
Found in: “Data and code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: ggplot2 (3 files), clusterProfiler (2 files), cowplot (2 files), ggpubr (2 files), survival (2 files), tidyverse (2 files), broom (1 file), circlize (1 file), ComplexHeatmap (1 file), data.table (1 file), edgeR (1 file), Harmony (1 file), igraph (1 file), limma (1 file), pheatmap (1 file), reshape2 (1 file), Seurat (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
5 files

IOBR/IOBR

License: GPL
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 635effe4d05f37a244c04f2d5cf2a5e73c38a798, 23 July 2026
Languages: R (98)
Size: 310 files, 98 scripts
Software Heritage: not archived
Found in: the resources table
Holds: README, environment (DESCRIPTION, Dockerfile), continuous integration, documentation, 2 notebooks
Not found: license file, CITATION.cff, tests
Tools: tidyverse (42 files), ggplot2 (21 files), survival (9 files), reshape2 (5 files), glmnet (4 files), ComplexHeatmap (3 files), DESeq2 (3 files), ggpubr (3 files), limma (3 files), Seurat (3 files), clusterProfiler (2 files), patchwork (2 files), circlize (1 file), pROC (1 file), psych (1 file), WGCNA (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
99 files
At the source: github.com/IOBR/IOBR

paulgeeleher/pRRophetic

License: none: the authors keep all their rights
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 0be5ac3c49e4f34ea563e12a79572e7460423c4f, 16 December 2023
Languages: R (8)
Size: 40 files, 8 scripts
Software Heritage: not archived
Found in: the resources table
Holds: README, environment (pRRophetic/DESCRIPTION), documentation
Not found: license file, CITATION.cff, tests, continuous integration
Tools: car (3 files), ggplot2 (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
9 files

cailab-tamu/scTenifoldKnk

License: GPL
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: e46221bc988b9db878c84df979fd636b55b59861, 24 September 2026
Languages: R (49), Python (5), Shell (2), MATLAB (1)
Size: 428 files, 57 scripts
Software Heritage: not archived
Found in: the resources table
Holds: README, environment (DESCRIPTION), documentation
Not found: license file, CITATION.cff, tests, continuous integration
Tools: ggplot2 (27 files), igraph (13 files), ComplexHeatmap (9 files), patchwork (8 files), reshape2 (7 files), Seurat (6 files), circlize (4 files), Harmony (3 files), NumPy (3 files), NetworkX (1 file), SciPy (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
58 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 4 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 167 scripts, each with its path and the digest of its content;
  • 27 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data and code availability

This paper analyzes existing, publicly available data, accessible at TCGA: TCGA-Gliomas; GTEx: Normal brain; CGGA: CGGA325, CGGA693; GlioVis: GSE16011 (https://ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE16011), GSE108474 (https://ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE108474), GSE4271 (https://ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE4271), GSE4412 (https://ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE4412), and E_MATE_3892; and TIGER: GBM-PRJNA482620.

The code supporting the findings of this study is available in GitHub at https://github.com/clarozhong/Rdata.git.

Any additional information required to reanalyze the data reported in this paper is available from the lead contact upon request.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 29 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 10 authors, 3 keywords, 2 funders, 45 references.

Cite

This paper

Huang, R., Li, H., Zhong, Y., Zhuo, P., Wang, Y., Yang, A., Zhang, Y., Li, J., Xu, R., & Li, Q. (2026). Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug. iScience, 29(5), 115657. https://doi.org/10.1016/j.isci.2026.115657

BibTeX

@article{huang2026integration,
author = {Huang, Ruiting and Li, Hailin and Zhong, Yijing and Zhuo, Paimin and Wang, Yibei and Yang, Aoting and Zhang, Yu and Li, Jiao and Xu, Ruiquan and Li, Quhuan},
title = {{Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug}},
journal = {iScience},
year = {2026},
month = apr,
volume = {29},
number = {5},
pages = {115657},
publisher = {Elsevier},
issn = {2589-0042},
doi = {10.1016/j.isci.2026.115657},
url = {https://doi.org/10.1016/j.isci.2026.115657},
pmid = {42164521},
pmcid = {PMC13185775}
}

RIS

TY - JOUR
AU - Huang, Ruiting
AU - Li, Hailin
AU - Zhong, Yijing
AU - Zhuo, Paimin
AU - Wang, Yibei
AU - Yang, Aoting
AU - Zhang, Yu
AU - Li, Jiao
AU - Xu, Ruiquan
AU - Li, Quhuan
TI - Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug
T2 - iScience
J2 - iScience
PY - 2026
DA - 2026/04/08
VL - 29
IS - 5
SP - 115657
SN - 2589-0042
PB - Elsevier
DO - 10.1016/j.isci.2026.115657
UR - https://doi.org/10.1016/j.isci.2026.115657
LA - en
ER -

CSL-JSON

{
"id": "10.1016/j.isci.2026.115657",
"type": "article-journal",
"title": "Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug",
"container-title": "iScience",
"author": [
{
"family": "Huang",
"given": "Ruiting"
},
{
"family": "Li",
"given": "Hailin"
},
{
"family": "Zhong",
"given": "Yijing"
},
{
"family": "Zhuo",
"given": "Paimin"
},
{
"family": "Wang",
"given": "Yibei"
},
{
"family": "Yang",
"given": "Aoting"
},
{
"family": "Zhang",
"given": "Yu"
},
{
"family": "Li",
"given": "Jiao"
},
{
"family": "Xu",
"given": "Ruiquan"
},
{
"family": "Li",
"given": "Quhuan"
}
],
"container-title-short": "iScience",
"volume": "29",
"issue": "5",
"page": "115657",
"DOI": "10.1016/j.isci.2026.115657",
"PMID": "42164521",
"PMCID": "PMC13185775",
"ISSN": "2589-0042",
"publisher": "Elsevier",
"URL": "https://doi.org/10.1016/j.isci.2026.115657",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
8
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1093/bioinformatics/btag592 [code]
Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.
Journal: Bioinformatics (Oxford, England)
In common: pROC, survival, WGCNA, 20 other tools, other condition
[2] doi:10.1016/j.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: pROC, WGCNA, Harmony, 20 other tools, other condition
[3] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: glmnet, survival, WGCNA, 19 other tools
[4] doi:10.1016/j.xcrm.2026.102682 [code]
TET CpG sequence-context-specific DNA demethylation shapes progression of IDH-mutant gliomas.
Journal: Cell reports. Medicine
In common: glmnet, pROC, survival, 17 other tools, other condition
[5] doi:10.3390/ijms27093997 [code]
Coordinated Multicellular Immune Programs and Drug Targets Revealed by Single-Cell Analysis in Driver-Mutated NSCLC.
Journal: International journal of molecular sciences
In common: glmnet, survival, Harmony, 15 other tools, other condition
[6] doi:10.1038/s41593-026-02367-0 [code]
A reproducible three-dimensional model of human brain tissue to investigate physiological and disease-associated microglia phenotypes.
Journal: Nature neuroscience
In common: WGCNA, Harmony, edgeR, 15 other tools
[7] doi:10.1038/s41586-026-10214-2 [code]
Multidimensional profiling of heterogeneity in supratentorial ependymomas.
Journal: Nature
In common: Harmony, edgeR, car, 16 other tools, other condition
[8] doi:10.1002/imt2.70163 [code]
Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.
Journal: iMeta
In common: Harmony, edgeR, limma, 16 other tools
[9] doi:10.1016/j.isci.2026.115573 [code]
Female cortical cellular mosaicism underlies shared MeCP2 and PCB impacted gene pathways.
Journal: iScience
In common: WGCNA, edgeR, limma, 15 other tools
[10] doi:10.1038/s41593-026-02300-5 [code]
Integrated single-cell and spatial transcriptomic profiling in ALS uncovers peripheral-to-central immune infiltration and reprogramming.
Journal: Nature neuroscience
In common: Harmony, edgeR, car, 15 other tools, other condition

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.