library(ggplot2)
library(dplyr)
library(magrittr)
library(plyr)
library(cowplot)
library(reshape2)
options(stringsAsFactors = FALSE)
library(graper)
library(tidyverse)
library("wesanderson")
library(ggbeeswarm)
source("../util_defs.R") # contains color schemes and defines which methods to include
Set input/output paths.
datadir <- "data"
outdir <- "2018-11-04"
knitr::opts_chunk$set(fig.path = "figs/", dev = c('png',"pdf"))
Load data used for fitting.
load(file.path(datadir, "dataCLL.RData"))
dim(data$X)
## [1] 121 9553
Load summarised results.
load(file.path(outdir,"result_CLL.RData"))
Colors for omics
cols4groups <- c(wes_palette("GrandBudapest1"),
wes_palette("GrandBudapest2")[1])
names(cols4groups) <- c("Drugs", "Methylation","mRNA")
Compare prediciton performance between the methods in terms of root mean squared error.
df_RMSE <- melt(sapply(resultList, function(l) l$RMSE),
varnames = c("method", "run"), value.name="RMSE")
df_RMSE %<>% mutate(method = make_nicenames(method))
df_RMSE %<>% mutate(method_type=ifelse(method%in% methods2compare_sparse,
"sparse", "dense"))
df_RMSE %<>% filter(method %in% methods2compare_sparse |
method %in% methods2compare_dense)
# plot
ggRMSE <- ggplot(df_RMSE, aes(x=method, y=RMSE, fill=method)) +
geom_boxplot(alpha=0.5, outlier.shape = NA) +
# ggtitle ("Prediction of ibrutinib response") +
geom_beeswarm(cex=2.5) + facet_wrap(~method_type, scale="free_x") +
scale_fill_manual(values = cols4methods) +
theme(axis.text.x = element_text(angle=60, vjust=1, hjust=1),
axis.title.x = element_blank()) + guides(fill= FALSE)+
coord_cartesian(ylim = c(0.03,0.16))
ggRMSE
df_pf <- melt(lapply(resultList, function(l) l$pf_mat[, "graper_SS", drop=F]),
varnames = c("omic", "method"))
df_pf$omic <- c("Drugs", "Methylation","mRNA")[df_pf$omic]
df_pf$value <- as.numeric(df_pf$value)
gg1 <- ggplot(df_pf,aes(x=omic, y=value)) + geom_boxplot(alpha=0.5, outlier.shape = NA) +
ylab(expression(hat(gamma))) + geom_beeswarm(aes(col=omic),cex=2.5) +
guides(col=FALSE) + xlab("omic type") +
theme_bw(base_size = 15) + scale_color_manual(values = cols4groups) +
guides(col=FALSE)
df_pf <- melt(lapply(resultList, function(l) l$sparsity_mat[, "graper_SS", drop=F]),
varnames = c("omic", "method"))
df_pf$omic <- c("Drugs", "Methylation","mRNA")[df_pf$omic]
gg2 <- ggplot(df_pf,aes(x=omic, y=value)) + geom_boxplot(alpha=0.5, outlier.shape = NA) +
ylab(expression(hat(pi))) + geom_beeswarm(aes(col=omic),cex=2.5)+ xlab("omic type") +
theme_bw(base_size = 15) +
scale_color_manual(values = cols4groups) +
guides(col=FALSE)
ggPF <- plot_grid(gg1,gg2, rel_widths = c(1,1), nrow=1, align = "hv", axis = "lb")
ggPF
plot_grid(ggRMSE, ggPF, ncol=1, labels = letters[1:2],
label_size = 18, rel_heights = c(2,1))
SessionInfo
sessionInfo()
## R version 3.5.3 (2019-03-11)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Mojave 10.14.4
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_IE.UTF-8/en_IE.UTF-8/en_IE.UTF-8/C/en_IE.UTF-8/en_IE.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] RColorBrewer_1.1-2 ggbeeswarm_0.6.0 wesanderson_0.3.6
## [4] forcats_0.3.0 stringr_1.4.0 purrr_0.3.2
## [7] readr_1.3.1 tidyr_0.8.3 tibble_2.1.1
## [10] tidyverse_1.2.1 graper_0.99.0 reshape2_1.4.3
## [13] cowplot_0.9.4 plyr_1.8.4 magrittr_1.5
## [16] dplyr_0.8.0.1 ggplot2_3.1.0 BiocStyle_2.10.0
##
## loaded via a namespace (and not attached):
## [1] beeswarm_0.2.3 tidyselect_0.2.5 xfun_0.4
## [4] haven_2.0.0 lattice_0.20-38 colorspace_1.4-1
## [7] generics_0.0.2 htmltools_0.3.6 yaml_2.2.0
## [10] rlang_0.3.2 pillar_1.3.1 glue_1.3.1
## [13] withr_2.1.2 modelr_0.1.2 readxl_1.2.0
## [16] matrixStats_0.54.0 munsell_0.5.0 gtable_0.2.0
## [19] cellranger_1.1.0 rvest_0.3.2 evaluate_0.12
## [22] labeling_0.3 knitr_1.21 vipor_0.4.5
## [25] broom_0.5.1 Rcpp_1.0.1 scales_1.0.0
## [28] backports_1.1.3 BiocManager_1.30.4 jsonlite_1.6
## [31] hms_0.4.2 digest_0.6.18 stringi_1.4.3
## [34] bookdown_0.9 grid_3.5.3 cli_1.1.0
## [37] tools_3.5.3 lazyeval_0.2.2 crayon_1.3.4
## [40] pkgconfig_2.0.2 Matrix_1.2-15 xml2_1.2.0
## [43] lubridate_1.7.4 rstudioapi_0.9.0 assertthat_0.2.1
## [46] rmarkdown_1.11 httr_1.4.0 R6_2.4.0
## [49] nlme_3.1-137 compiler_3.5.3