Skip to content

Commit

Permalink
I added GOSemSim Output table
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazzat Aibekova authored and Lazzat Aibekova committed Jun 26, 2019
1 parent d788911 commit 3e8f2db
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
20 changes: 15 additions & 5 deletions GOSemSim.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ library(org.Dm.eg.db)
#Reference for Fly
d = godata('org.Dm.eg.db', ont = "BP", computeIC = FALSE)
contrast = read.csv("contrasts_mite_life_stages.csv", header = F)
similarities_upregulated = c()
similarities_downregulated = c()

similarities_upregulated = list()
similarities_downregulated = list()
contrast_names = list()

for (id in 1:length(contrast$V1))
{
print(paste(id, "id"))
first_contrast = toString(contrast$V1[id])
second_contrast = toString(contrast$V2[id])

Expand All @@ -20,7 +23,9 @@ for (id in 1:length(contrast$V1))
GO2 = read.csv(filename, header = T)
GO2ID = as.character(GO2[,1])

similarities_upregulated[id] = mgoSim(GO1ID, GO2ID, semData = d, measure = "Wang", combine = "BMA")
name = paste(first_contrast, "_", second_contrast,sep = "")
contrast_names[length(contrast_names)+1] = name
similarities_upregulated[[length(similarities_upregulated)+1]] = mgoSim(GO1ID, GO2ID, semData = d, measure = "Wang", combine = "BMA")

#DOWN-REGULATED
filename = paste("./GO_enrichment_microbiome_output/contrast_", first_contrast, "_", second_contrast, "_downregulated", ".csv", sep = "")
Expand All @@ -31,5 +36,10 @@ for (id in 1:length(contrast$V1))
GO2 = read.csv(filename, header = T)
GO2ID = as.character(GO2[,1])

similarities_downregulated[id] = mgoSim(GO1ID, GO2ID, semData = d, measure = "Wang", combine = "BMA")
}
similarities_downregulated[[length(similarities_downregulated)+1]] = mgoSim(GO1ID, GO2ID, semData = d, measure = "Wang", combine = "BMA")
}

names(similarities_downregulated) = as.vector(unlist(contrast_names))
names(similarities_upregulated) = as.vector(unlist(contrast_names))
GOSemSim_table = do.call(rbind, Map(data.frame, A=similarities_upregulated, B=similarities_downregulated))
write.csv(GOSemSim_table, "GOSemSim_table.csv")
13 changes: 13 additions & 0 deletions GOSemSim_table.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
,Up_regulated,Down_regulated
young_males,0.763,0.917
young_phoretic,0.803,0.887
phoretic_phoreticCaged,0.798,0.866
phoretic_arresting,0.759,0.901
arresting_prelaying,0.793,0.892
prelaying_laying,0.799,0.899
laying_postlaying,0.782,0.911
postlaying_emerging,0.817,0.864
postlaying_nonlaying,0.811,0.884
laying_nonlaying,0.8,0.899
emerging_phoretic,0.785,0.891
emerging_young,0.816,0.881

0 comments on commit 3e8f2db

Please sign in to comment.