该文献的题目是:Identifying disease genes and module biomarkers by differential interactions
本文受益于R的开源,受限于本人的能力和水平,也没有在github等平台上找到作者的代码,故通过综合各种信息写了这些代码,至少我自己用R最新版是能跑出来的。
第七步获得specific GENE
rm(list = ls())
load(file = "early_control_PPIN.Rdata")
load(file = "early_disease_PPIN.Rdata")
#early阶段
#获得仅出现在PPIN_IN_early_disease而不出现在PPIN_IN_early_control,相当于在PPIN_IN_early_disease移除共同的
specific_PPIN_early_disease <- dplyr::setdiff(PPIN_IN_early_disease,PPIN_IN_early_control)
#。。。
specific_PPIN_early_control <- dplyr::setdiff(PPIN_IN_early_control,PPIN_IN_early_disease)
a <- c(specific_PPIN_early_control[,1],specific_PPIN_early_control[,2])
b <- c(specific_PPIN_early_disease[,1],specific_PPIN_early_disease[,2])
common_gene_early <- unique(intersect(a,b))
write.table(common_gene_early,file = "common_gene_early.csv",quote = F,sep = ",")
load(file = "late_PPIN.Rdata")
specific_PPIN_late_disease <- dplyr::setdiff(PPIN_IN_late_disease,PPIN_IN_late_control)
specific_PPIN_late_control <- dplyr::setdiff(PPIN_IN_late_control,PPIN_IN_late_disease)
c <- unique(c(specific_PPIN_late_control[,1],specific_PPIN_late_control[,2]))
d <- unique(c(specific_PPIN_late_disease[,1],specific_PPIN_late_disease[,2]))
common_gene_late <- intersect(c,d)
write.table(common_gene_late,file = "common_gene_late.csv",quote = F,sep = ",")
load(file = "middle_PPIN.Rdata")
specific_PPIN_middle_disease <- dplyr::setdiff(PPIN_IN_middle_disease,PPIN_IN_middle_control)
specific_PPIN_middle_control <- dplyr::setdiff(PPIN_IN_middle_control,PPIN_IN_middle_disease)
e <- unique(c(specific_PPIN_middle_control[,1],specific_PPIN_middle_control[,2]))
f <- unique(c(specific_PPIN_middle_disease[,1],specific_PPIN_middle_disease[,2]))
common_gene_middle <- intersect(e,f)
write.table(common_gene_middle,file = "common_gene_middle.csv")
#获得候选疾病基因candidate disease genes or module biomarkers
candidate_disease_genes <- Reduce(intersect,list(common_gene_early,common_gene_late,common_gene_middle))
#另一种方法,把上面这个取多个向量并集的方法写成一个新函数,如下
intersects <- function(...){
Reduce(intersect,list(...))
}
intersects(common_gene_early,common_gene_late,common_gene_middle)
#结果一样
write.table(candidate_disease_genes,file = "candidate_disease_genes.csv",quote = F,sep = ",")
save(common_gene_early,common_gene_middle,common_gene_late,candidate_disease_genes,file = "intersection_candidate_genes.Rdata")
目前复现到这,之后可能更新,也相当于我个人学习的总结,如有错误,请务必尽情指教