Created
May 15, 2020 20:38
-
-
Save cplaisier/bd06063579c0ea430a13f41ca88b503f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Semantic similarity | |
library(GOSim) | |
l1 = list() | |
#l1$Adaptive_Response = c('GO:0002250','GO:0002819') | |
l1$Akt_Signalling = c('GO:0043491','GO:0051896') | |
l1$Antigen_Presentation = c('GO:0019882','GO:0002472','GO:0002625','GO:0019886') | |
l1$Apoptosis = c('GO:0006915','GO:0033028','GO:0071888','GO:2000110','GO:2000111','GO:0012501','GO:0048102') # ,'GO:2001242' | |
l1$Cell_Cycle = c('GO:0007050','GO:0051726','GO:0006260','GO:0000075') | |
l1$Cell_Cycle_Checkpoint = c('GO:0000075') | |
l1$M_Phase = c('GO:0000279') | |
l1$S_Phase = c('GO:0051320') | |
l1$G1_Phase = c('GO:0051318') | |
l1$G2_Phase = c('GO:0051319') | |
#l1$Interphase = c('GO:0051325') | |
#l1$Cell_Proliferation = c('GO:0008283') # GO:0061517 | |
l1$Cytokine = c('GO:0050663','GO:0001816','GO:0010936','GO:0060907','GO:0032640') | |
l1$Innate_Response = c('GO:0006952','GO:0045087','GO:0002221','GO:0002775','GO:0046209','GO:0051001','GO:0051769','GO:0002237') # ,'GO:0035325','GO:0035663' | |
l1$Lymphocyte_Activation = c('GO:0046649') | |
l1$Mitochondrial = c('GO:0042775') | |
l1$Necrosis = c('GO:0070265') # ,'GO:0008220' | |
l1$Phagocytosis_Recognition = c('GO:0006910','GO:0006909','GO:0045728','GO:0010506') | |
#l1$TLR_Signalling = c('GO:0035661') | |
#d3 = getTermSim(l1$Mitochondrial,method='JiangConrath') | |
#d3[is.infinite(d3)] = NA | |
#d3[is.nan(d3)] = NA | |
#heatmap.2(as.matrix(d3),trace='none',col=colorpanel(256,'blue','black','yellow'),Colv=T,Rowv=T,density.info='none',margins=c(15,15),keysize=1) #,scale='row') | |
# To look at the overlap between terms | |
setOntology('BP') | |
# Testing overlap of terms we chose | |
hallmarks = matrix(ncol=length(names(l1)), nrow=length(names(l1)), dimnames=list(names(l1), names(l1))) | |
for(cluster in names(l1)) { | |
for(hallmark in names(l1)) { | |
if (!(cluster==hallmark)) { | |
d2 = getTermSim(c(l1[[cluster]],l1[[hallmark]]),method='JiangConrath') | |
d2[is.infinite(d2)] = NA | |
hallmarks[cluster,hallmark] = max(d2[1:length(l1[[cluster]]),-(1:length(l1[[cluster]]))],na.rm=T) | |
} | |
} | |
} | |
heatmap.2(as.matrix(hallmarks),trace='none',col=colorpanel(256,'blue','black','yellow'),Colv=T,Rowv=T,dendrogram='none',density.info='none',margins=c(15,15),keysize=1) #,scale='row') | |
write.csv(hallmarks,'similarityOfHallmarks_VALL.csv') | |
# Doing the comparison with the enriched GOBP terms from meta-clusters | |
d1 = read.csv('clusterEnrichment_GOBP_classic_0.05_VALL.csv',header=T,row.names=1) | |
l2 = list() | |
for(cluster in rownames(d1)) { | |
l2[[cluster]] = strsplit(as.character(d1[cluster,2]),';')[[1]] | |
} | |
hallmarks = matrix(ncol=length(names(l1)), nrow=length(names(l2)), dimnames=list(names(l2), names(l1))) | |
for(cluster in names(l2)) { | |
if (!(length(l2[[cluster]])==0)) { | |
for(hallmark in c('Cell_Cycle_Checkpoint')) { | |
#for(hallmark in names(l1)) { | |
d2 = getTermSim(c(l2[[cluster]],l1[[hallmark]]),method='JiangConrath') | |
d2[is.infinite(d2)] = NA | |
hallmarks[cluster,hallmark] = max(d2[1:length(l2[[cluster]]),-(1:length(l2[[cluster]]))],na.rm=T) | |
} | |
} | |
} | |
write.csv(hallmarks,'jiangConrath_hallmarks_classic_0.05_VALL.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment