diff --git a/.DS_Store b/.DS_Store index b8cc137..5f332ba 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/GOSemSim.R b/GOSemSim.R index 5af3602..8aa5930 100644 --- a/GOSemSim.R +++ b/GOSemSim.R @@ -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]) @@ -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 = "") @@ -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") -} \ No newline at end of file + 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") \ No newline at end of file diff --git a/GOSemSim_table.csv b/GOSemSim_table.csv new file mode 100644 index 0000000..03b8b7a --- /dev/null +++ b/GOSemSim_table.csv @@ -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 \ No newline at end of file