Commits

Giovanni Marco Dall'Olio  committed 4c2d0de

SIMS: quick&dirty script to compare neutral and selection simulations

  • Participants
  • Parent commits bfca6e1

Comments (0)

Files changed (3)

File results/plots/selection_vs_neutral/simulations_NeutralVsSelection.pdf

Binary file modified.

File src/compare_neutral_selection_sims.R

+
+
+sel = read.table("data/simulations_selection_incomplete/background/background_by_gene_w11.csv", header=T)
+neu = read.table("data/simulations_5000/background/background_by_gene_w11.csv", header=T)
+
+neu.glob = subset(neu, continent == 'glob')
+sel.glob = subset(sel, continent == 'glob')
+
+for (prop in c("n_vertices", "av_path_length", "n_components", "av_degree")) { print(ks.test(neu.glob[[prop]], sel.glob[[prop]]))}
+
+

File src/plot_simulations_NeutralVsSelection.R

     require(plyr)
     datac <- ddply(data, groupvars, 
                    .fun = function (xx, col, na.rm=T) {
-                       print(summary(xx))
-                       print(col)
-                       print(datasetvar)
-                       print(unique(xx[[datasetvar]]))
-                       print(levels(xx[[datasetvar]]))
-                       print(length(levels(xx[[datasetvar]])))
+#                       print(summary(xx))
+#                       print(col)
+#                       print(datasetvar)
+#                       print(unique(xx[[datasetvar]]))
+#                       print(levels(xx[[datasetvar]]))
+#                       print(length(levels(xx[[datasetvar]])))
 #                       res = wilcox.test(xx[[col]], xx[[datasetvar]], subset=datasetvar %in% c("neutral", "recent"))
                        res = wilcox.test(xx[datasetvar=="neutral", col], xx[datasetvar=="recent", col])
                        c(
     # WILCOXON TEST
     print(summary(current_data))
     current_data.onlytwodatasets = subset(current_data, dataset %in% c("neutral", "recent"))
+    current_data.onlytwodatasets = subset(current_data.onlytwodatasets, continent == 'glob')
+    print(head(current_data.onlytwodatasets))
 #    print(wilcox.test(value~dataset, data=current_data.onlytwodatasets, alternative='t'))
-#    do_wilcox_test(current_data.onlytwodatasets, measurevar="value", groupvars=c("continent", "network_property"), datasetvar="dataset")
+#    print("wilcoxon")
+#    print(ddply(current_data.onlytwodatasets, .(network_property), .fun=wilcox.test, value~dataset, alternative=T))
+##    print(do_wilcox_test(current_data.onlytwodatasets, measurevar="value", groupvars="network_property", datasetvar="dataset"))
+#    print("nowilcoxon")
 
     base_neutralVsSelectionPlot = list(
                         ggtitle(current_pop),
 #plot_boxplot_allannotations_manypropertiesperpage(properties_to_plot, current_pop="glob")
 plot_boxplot_allannotations_manypropertiesperpage(properties_to_plot, current_pop="EUR")
 
+
+wilcoxtest_wrapper <- function(df){
+        print(summary(df))
+}
+# Wilcoxon test
+print("wilcoxon")
+#print(head(results_and_annotations.long))
+#    print(wilcox.test(value~dataset, data=current_data.onlytwodatasets, alternative='t'))
+print(ddply(results_and_annotations.long, .variables=c("network_property", "continent"), .fun=wilcox.test, value~dataset))
+
+print("no wilcoxon")
+
 print(paste("saved plots to", arg_values$outputfile))
 dev.off()