Skip to content

Commit

Permalink
changing heatmap color gradient
Browse files Browse the repository at this point in the history
  • Loading branch information
HUCHON Mélanie committed Jan 29, 2024
1 parent 0f8bfe3 commit 05a9422
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ $run_dev.*
^appveyor\.yml$
^cran-comments\.md$
^\.github$
^CRAN-SUBMISSION$
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 0.7.0
Date: 2023-04-26 14:46:04 UTC
SHA: 47a6512dd7df6e86075b3247994562e3bd39e449
19 changes: 10 additions & 9 deletions R/heatmap_VICI.R
Original file line number Diff line number Diff line change
Expand Up @@ -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() +
Expand All @@ -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) +
Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions R/mod_modelfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 05a9422

Please sign in to comment.