From 05a94224e6f34613778de3ad82bceb8151f1057b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?HUCHON=20M=C3=A9lanie?= Date: Mon, 29 Jan 2024 10:31:52 +0100 Subject: [PATCH] changing heatmap color gradient --- .Rbuildignore | 1 + CRAN-SUBMISSION | 3 +++ R/heatmap_VICI.R | 19 ++++++++++--------- R/mod_modelfit.R | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 CRAN-SUBMISSION diff --git a/.Rbuildignore b/.Rbuildignore index cbdca98..69d0258 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ $run_dev.* ^appveyor\.yml$ ^cran-comments\.md$ ^\.github$ +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..829785c --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 0.7.0 +Date: 2023-04-26 14:46:04 UTC +SHA: 47a6512dd7df6e86075b3247994562e3bd39e449 diff --git a/R/heatmap_VICI.R b/R/heatmap_VICI.R index ed892c7..6904a01 100644 --- a/R/heatmap_VICI.R +++ b/R/heatmap_VICI.R @@ -18,6 +18,7 @@ heatmap_vici <- function(res_2plot, inter=TRUE, baseline=NULL){ if(inter){ + p <- ggplot(data = res_2plot) + geom_tile(aes_string(x="Stimulation", y="response", fill="pvalue"), color="white") + theme_minimal() + @@ -26,11 +27,11 @@ heatmap_vici <- function(res_2plot, inter=TRUE, baseline=NULL){ subtitle = "taking into account background response levels") + labs(caption = "made with VICI") + ylab("ICS response") + - scale_fill_manual(values = c("red4", "red2", "coral2", "grey70", "grey75", "grey80", "grey85","grey90", "grey95"), - breaks = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.2)", "[0.2,0.3)", "[0.3,0.4)", "[0.4,0.5)", "[0.5,1)"), - labels = c("[0,0.001[", "[0.001,0.01[", "[0.01,0.05[", "[0.05,0.1[", "[0.1,0.2[", "[0.2,0.3[", "[0.3,0.4[", "[0.4,0.5[", "[0.5,1]"), + scale_fill_manual(values = c("red4", "red3", "coral2", "grey80", "grey90", "grey95"), + breaks = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.5)", "[0.5,1)"), + labels = c("[0,0.001[", "[0.001,0.01[", "[0.01,0.05[", "[0.05,0.1[", "[0.1,0.5[", "[0.5,1]"), name="P-value", - limits = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.2)", "[0.2,0.3)", "[0.3,0.4)", "[0.4,0.5)", "[0.5,1)") + limits = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.5)", "[0.5,1)") ) + facet_wrap(c("Arm"), labeller = "label_both") }else{ p <- ggplot(data = res_2plot) + @@ -41,13 +42,13 @@ heatmap_vici <- function(res_2plot, inter=TRUE, baseline=NULL){ subtitle = "taking into account background response levels") + labs(caption = "made with VICI") + ylab("ICS response") + - scale_fill_manual(values = c("red4", "red2", "coral2", "grey70", "grey75", "grey80", "grey85","grey90", "grey95"), - breaks = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.2)", "[0.2,0.3)", "[0.3,0.4)", "[0.4,0.5)", "[0.5,1)"), - labels = c("[0,0.001[", "[0.001,0.01[", "[0.01,0.05[", "[0.05,0.1[", "[0.1,0.2[", "[0.2,0.3[", "[0.3,0.4[", "[0.4,0.5[", "[0.5,1]"), + scale_fill_manual(values = c("red4", "red3", "coral2", "grey80", "grey90", "grey95"), + breaks = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.5)", "[0.5,1)"), + labels = c("[0,0.001[", "[0.001,0.01[", "[0.01,0.05[", "[0.05,0.1[", "[0.1,0.5[", "[0.5,1]"), name="P-value", - limits = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.2)", "[0.2,0.3)", "[0.3,0.4)", "[0.4,0.5)", "[0.5,1)") + limits = c("[0,0.001)", "[0.001,0.01)", "[0.01,0.05)", "[0.05,0.1)", "[0.1,0.5)", "[0.5,1)") ) + facet_wrap(c("Timepoint"), labeller = "label_both") } - + return(p) } diff --git a/R/mod_modelfit.R b/R/mod_modelfit.R index 4a70cf8..53bfe61 100644 --- a/R/mod_modelfit.R +++ b/R/mod_modelfit.R @@ -88,7 +88,7 @@ mod_modelfit_server <- function(input, output, session, datas,parent,origin){ heatmap_data2plot[[response]] <- responses_res[[response]]$postprocess_res$res_2plot heatmap_data2plot[[response]]$response <- response heatmap_data2plot[[response]]$pvalue <- cut(heatmap_data2plot[[response]]$pvalue, - breaks = c(0, 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 1), + breaks = c(0, 0.001, 0.01, 0.05, 0.1, 0.5, 1), right = FALSE) responses_res[[response]]$res_tab <- fit_res$res_tab @@ -156,7 +156,7 @@ mod_modelfit_server <- function(input, output, session, datas,parent,origin){ for(l in 1:length(heatmap_data2plot[[response]])){ heatmap_data2plot[[response]][[l]]$response <- response heatmap_data2plot[[response]][[l]]$pvalue <- cut(heatmap_data2plot[[response]][[l]]$pvalue, - breaks = c(0, 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 1), + breaks = c(0, 0.001, 0.01, 0.05, 0.1, 0.5, 1), right = FALSE) } heatmap_data2plot[[response]] <- do.call(rbind.data.frame,