Commit 1a767716 authored by Carine Rey's avatar Carine Rey
Browse files

update figures

parent 8839c5a0
......@@ -697,7 +697,7 @@ plot_out = function(df_out, df_d , df_auc, df_recall_sup09_per_meth, meths = NUL
print(couple_i [!couple_i %in% df_out$couple])
print(all( couple_i %in% df_out$couple))
if (length(meths) <= 9 & all( couple_i %in% df_out$couple)) {
if (length(meths) <= 9 & sum( couple_i %in% df_out$couple)>= 1) {
plot = ggplot(df_out, aes(x=sensitivity, y=precision98_02, col = methode))
plot = plot + theme_bw()
plot = plot + labs(x="Sensitivity (= Recall)", y="Precision (98/2)")
......@@ -736,6 +736,8 @@ plot_out = function(df_out, df_d , df_auc, df_recall_sup09_per_meth, meths = NUL
)
plot_PR_c = function(couple_l) {
if (sum(couple_l%in%df_out$couple) > 0) {
print ("PAS OK")
tmp_df = subset(df_out,couple%in%couple_l)
tmp_df$couple = factor( tmp_df$couple, levels=c(levels( tmp_df$couple),"to_be_rm","to_be_rm2","to_be_rm3","to_be_rm4"))
......@@ -755,16 +757,16 @@ plot_out = function(df_out, df_d , df_auc, df_recall_sup09_per_meth, meths = NUL
tmp_df[dim(tmp_df)[1]+1,] = tmp_df[dim(tmp_df)[1],]
tmp_df$couple[dim(tmp_df)[1]] = "to_be_rm4"
}
from_m=c("PCOC","Mutinomial_1MinusLRT", "Msd_0.05_1MinusP", "Identical_LG08", "Tdg09_1MinusLRT","Topological_LG08","diffsel_mean")
from_m=c("PCOC","Mutinomial_1MinusLRT", "Msd_0.05_1MinusP", "Identical_LG08", "Tdg09_1MinusLRT","Topological_LG08","Diffsel_mean")
to_m=c("PCOC","Mutinomial", "msd", "Identical", "TDG09","Topological","diffsel")
tmp_df$methode = mapvalues(tmp_df$methode, from=from_m, to=to_m)
tmp_df$methode = factor(tmp_df$methode, levels=to_m)
from_c= c(couple_plot1,couple_plot2,couple_plot3,couple_plot4)
couple_plot1_to = c("PC NeSG1","PC NeSG4","PC NeSG8")
couple_plot2_to = c("CCSE NeSG1 NeSG1 NeSC 4","CCSE NeSG4 NeSC 8","CCSE NeSG8 NeSC 1")
couple_plot3_to = c("PC & GCSE NeSG1 NeSC 4","PC & GCSE NeSG4 NeSC 8","PC & GCSE NeSG8 NeSC 1")
couple_plot4_to = c("PC & CCSE NeSG1 NeSC 4","PC & CCSE NeSG4 NeSC 8","PC & CCSE NeSG8 NeSC 1")
couple_plot1_to = c("PC NeS 1","PC NeS 4","PC NeS 8")
couple_plot2_to = c("CCSE NeSA1 NeSC 4","CCSE NeSA4 NeSC 8","CCSE NeSA8 NeSC 1")
couple_plot3_to = c("PC & GCSE NeSA1 NeSC 4","PC & GCSE NeSA4 NeSC 8","PC & GCSE NeSA8 NeSC 1")
couple_plot4_to = c("PC & CCSE NeSA1 NeSC 4","PC & CCSE NeSA4 NeSC 8","PC & CCSE NeSA8 NeSC 1")
to_c= c(couple_plot1_to,couple_plot2_to,couple_plot3_to,couple_plot4_to)
tmp_df$coupleF = mapvalues(tmp_df$couple, from=from_c, to=to_c)
tmp_df$coupleF = factor(tmp_df$coupleF, levels =unique(c(couple_plot1_to,couple_plot2_to,couple_plot4_to,couple_plot3_to)))
......@@ -797,48 +799,88 @@ plot_out = function(df_out, df_d , df_auc, df_recall_sup09_per_meth, meths = NUL
plot = plot + facet_grid(. ~ coupleF )
plot = plot + theme(axis.text.x = element_text(angle = 45, hjust = 1))
plot
} else {
print ("OK")
plot = NULL
}
plot
}
plot_AUC_c = function(couple_l) {
plot_AUC_c = function(couple_l,noA=F) {
if (sum(couple_l%in%df_out$couple) > 0) {
tmp_df = subset(df_auc,couple%in%couple_l)
tmp_df$group = "group0"
couple_NeSG1 = couple_l[grep("NeG1",couple_l)]
couple_NeSG4 = couple_l[grep("NeG4",couple_l)]
couple_NeSG8 = couple_l[grep("NeG8",couple_l)]
tmp_df$group[tmp_df$couple%in%couple_NeSG1] = "NeSG1"
tmp_df$group[tmp_df$couple%in%couple_NeSG4] = "NeSG4"
tmp_df$group[tmp_df$couple%in%couple_NeSG8] = "NeSG8"
#couple_NeSG1 = couple_l[grep("NeG1",couple_l)]
#couple_NeSG4 = couple_l[grep("NeG4",couple_l)]
#couple_NeSG8 = couple_l[grep("NeG8",couple_l)]
#tmp_df$group[tmp_df$couple%in%couple_NeSG1] = "NeSG1"
#tmp_df$group[tmp_df$couple%in%couple_NeSG4] = "NeSG4"
#tmp_df$group[tmp_df$couple%in%couple_NeSG8] = "NeSG8"
couple_simuA = c("H0/HaPC NeG1","H0/HaPC NeG4","H0/HaPC NeG8")
couple_simuB = c("H0/H0 NeG1/NeG1_NeC_4","H0/H0 NeG4/NeG4_NeC_8","H0/H0 NeG8/NeG8_NeC_1")
couple_simuC = c("H0/HaPC NeG1","H0/HaPC NeG8_NeC_1","H0/HaPC NeG4","H0/HaPC NeG1_NeC_4","H0/HaPC NeG8", "H0/HaPC NeG4_NeC_8")
couple_simuD = c("H0/HaPC NeG1","H0/HaPC NeG4","H0/HaPC NeG8", "H0 NeG1/HaPC NeG1_NeC_4","H0 NeG4/HaPC NeG4_NeC_8","H0 NeG8/HaPC NeG8_NeC_1")
tmp_df$group[tmp_df$couple%in%couple_simuA] = "PC"
tmp_df2 = tmp_df[tmp_df$couple%in%couple_simuA,]
if (all(couple_simuB%in%tmp_df$couple)) {
tmp_df$group[tmp_df$couple%in%couple_simuB] = "CCSE"
tmp_df2 = rbind(tmp_df2,tmp_df[tmp_df$couple%in%couple_simuB,])
}
if (all(couple_simuC%in%tmp_df$couple)) {
tmp_df$group[tmp_df$couple%in%couple_simuC] = "PC & GWCSE"
if (noA) {
tmp_df2 = tmp_df[tmp_df$couple%in%couple_simuC,]
} else {
tmp_df2 = rbind(tmp_df2,tmp_df[tmp_df$couple%in%couple_simuC,])
}
}
if (all(couple_simuD%in%tmp_df$couple)) {
tmp_df$group[tmp_df$couple%in%couple_simuD] = "PC & CCSE"
tmp_df2 = rbind(tmp_df2,tmp_df[tmp_df$couple%in%couple_simuD,])
}
tmp_df = tmp_df2
from_c= c(couple_plot1,couple_plot2,couple_plot3,couple_plot4)
couple_plot1_to = c("PC","PC","PC")
couple_plot2_to = c("CCSE NeSC 4","CCSE NeSC 8","CCSE NeSC 1")
couple_plot3_to = c("PC & GCSE NeSC 4","PC & GCSE NeSC 8","PC & GCSE NeSC 1")
couple_plot4_to = c("PC & CCSE NeSC 4","PC & CCSE NeSC 8","PC & CCSE NeSC 1")
couple_plot1_to = c("NeS 1","NeS 4","NeS 8")
couple_plot2_to = c("NeSA 1\nNeSC 4","NeSA 4\nNeSC 8","NeSA 8\nNeSC 1")
couple_plot3_to = c("NeSA 1\nNeSC 4","NeSA 4\nNeSC 8","NeSA 8\nNeSC 1")
couple_plot4_to = c("NeSA 1\nNeSC 4","NeSA 4\nNeSC 8","NeSA 8\nNeSC 1")
to_c= c(couple_plot1_to,couple_plot2_to,couple_plot3_to,couple_plot4_to)
tmp_df$coupleX = mapvalues(tmp_df$couple, from=from_c, to=to_c)
tmp_df$coupleX = factor(tmp_df$coupleX, levels =unique(c(couple_plot1_to,couple_plot2_to,couple_plot4_to,couple_plot3_to)))
tmp_df$coupleX = factor(tmp_df$coupleX, levels =c("NeS 1","NeSA 8\nNeSC 1","NeS 4","NeSA 1\nNeSC 4","NeS 8","NeSA 4\nNeSC 8"))
from_m=c("PCOC","Mutinomial_1MinusLRT", "Msd_0.05_1MinusP", "Identical_LG08", "Tdg09_1MinusLRT","Topological_LG08","diffsel_mean")
from_m=c("PCOC","Mutinomial_1MinusLRT", "Msd_0.05_1MinusP", "Identical_LG08", "Tdg09_1MinusLRT","Topological_LG08","Diffsel_mean")
to_m=c("PCOC","Mutinomial", "msd", "Identical", "TDG09","Topological","diffsel")
tmp_df$methode = mapvalues(tmp_df$methode, from=from_m, to=to_m)
tmp_df$methode = factor(tmp_df$methode, levels=to_m)
plot = ggplot(tmp_df, aes(x=coupleX, y=auc2, col = methode))
plot = ggplot(tmp_df, aes(x=coupleX, y=auc2, col = methode, shape = methode, fill=methode))
plot = plot + theme_bw()
plot = plot + labs(x="", y="AUC")
plot = plot + theme(legend.position="top")
plot = plot + ylim(c(0,1))
plot = plot + guides(fill=FALSE)
plot = plot + scale_color_manual(values=colors2)
plot = plot + scale_fill_manual(values=colors2)
#plot = plot + geom_point(size=1, alpha=alpha)
plot = plot + geom_point(na.rm=TRUE, position=position_dodge(width=0.5),size=1.5,alpha=1)
plot = plot + theme(axis.text.x = element_text(angle =45, hjust = 1))
plot = plot + geom_point(na.rm=TRUE, position=position_dodge(width=0.5),size=3,alpha=1)
plot = plot + scale_shape_manual(values=c(16,18,10,7,17,25,15))
#plot = plot + theme(axis.text.x = element_text(angle =45, hjust = 1))
plot = plot + facet_grid(. ~ group, scales = "free", space = "free")
} else {
plot = NULL
}
plot
}
plot_Best_R_c = function(couple_l) {
if (sum(couple_l%in%df_out$couple) == 0) {return(NULL)}
tmp_df = subset(df_auc,couple%in%couple_l)
tmp_df$group = "group0"
couple_NeSG1 = couple_l[grep("NeG1",couple_l)]
......@@ -851,13 +893,13 @@ plot_out = function(df_out, df_d , df_auc, df_recall_sup09_per_meth, meths = NUL
from_c= c(couple_plot1,couple_plot2,couple_plot3,couple_plot4)
couple_plot1_to = c("PC","PC","PC")
couple_plot2_to = c("CCSE NeSC 4","CCSE NeSC 8","CCSE NeSC 1")
couple_plot3_to = c("PC & GCSE NeSC 4","PC & GCSE NeSC 8","PC & GCSE NeSC 1")
couple_plot3_to = c("PC & GWCSE NeSC 4","PC & GWCSE NeSC 8","PC & GWCSE NeSC 1")
couple_plot4_to = c("PC & CCSE NeSC 4","PC & CCSE NeSC 8","PC & CCSE NeSC 1")
to_c= c(couple_plot1_to,couple_plot2_to,couple_plot3_to,couple_plot4_to)
tmp_df$coupleX = mapvalues(tmp_df$couple, from=from_c, to=to_c)
tmp_df$coupleX = factor(tmp_df$coupleX, levels =unique(c(couple_plot1_to,couple_plot2_to,couple_plot4_to,couple_plot3_to)))
from_m=c("PCOC","Mutinomial_1MinusLRT", "Msd_0.05_1MinusP", "Identical_LG08", "Tdg09_1MinusLRT","Topological_LG08","diffsel_mean")
from_m=c("PCOC","Mutinomial_1MinusLRT", "Msd_0.05_1MinusP", "Identical_LG08", "Tdg09_1MinusLRT","Topological_LG08","Diffsel_mean")
to_m=c("PCOC","Mutinomial", "msd", "Identical", "TDG09","Topological","diffsel")
tmp_df$methode = mapvalues(tmp_df$methode, from=from_m, to=to_m)
tmp_df$methode = factor(tmp_df$methode, levels=to_m)
......@@ -880,10 +922,12 @@ plot_out = function(df_out, df_d , df_auc, df_recall_sup09_per_meth, meths = NUL
plot = plot_PR_c(couple_i)
plot1 = plot_PR_c(couple_plot1)
plot1 = plot_PR_c(c("H0/HaPC NeG4","NULL2","NULL"))
plot2 = plot_PR_c(couple_plot2)
plot3 = plot_PR_c(couple_plot3)
plot4 = plot_PR_c(couple_plot4)
plot5 = plot_AUC_c(couple_i)
plot5 = plot_AUC_c(c(couple_plot1,couple_plot2))
plot52 = plot_AUC_c(c(couple_plot1,couple_plot3,couple_plot4), noA = T)
plot6 = plot_Best_R_c(couple_i)
legend_PR = get_legend(plot + theme(legend.position="top",
......@@ -927,10 +971,10 @@ plot_out = function(df_out, df_d , df_auc, df_recall_sup09_per_meth, meths = NUL
rel_heights = c( 0.2, 0.7,0.05,0.7,0.05,0.7,0.05,0.7,0.05,0.7),
hjust = 0, vjust = 0)
plot_recall_precision_papier_ok = plot_grid(legend_PR,
plot_recall_precision_papier_ok = plot_grid(legend_AUC,
plot1 + theme(legend.position="none"),
plot5 + theme(legend.position="none"),
plot6 + theme(legend.position="none"),
plot52 + theme(legend.position="none"),
ncol = 1, scale = 1,
labels = c("",
"A",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment