enhanced metadata handler

This commit is contained in:
Tanushree Tunstall 2022-09-04 17:03:56 +01:00
parent 70a3d6a907
commit f3d6513181

View file

@ -46,7 +46,7 @@ split_map = data.frame(
"_70_30_complete", "_70_30_complete",
"_80_20_complete", "_80_20_complete",
"_sl_complete", "_sl_complete",
"_none" "_none_complete"
), ),
splits=c( splits=c(
"cd_7030", "cd_7030",
@ -75,7 +75,7 @@ for (x in gene) {
#print(c(filename)) #print(c(filename))
#load_name=paste0(combo[gene==x,"drug"],'_',split_map['splits'][split_map['files']==split]) #load_name=paste0(combo[gene==x,"drug"],'_',split_map['splits'][split_map['files']==split])
load_name=paste0(x,'_baselineC_',split_map['splits'][split_map['files']==split]) load_name=paste0(x,'_baselineC_',split_map['splits'][split_map['files']==split])
#print(load_name) print(load_name)
# try() on its own is fine here because we don't need to do anything if it fails # try() on its own is fine here because we don't need to do anything if it fails
try({loaded_files[[load_name]] = read.csv(filename)}) try({loaded_files[[load_name]] = read.csv(filename)})
} }
@ -120,7 +120,7 @@ makeplot = function(x, # the DataFrame to plot
y_coord_min = 0 y_coord_min = 0
} }
if (display_infobox) { if (display_infobox) {
metadata=t(plot_data[1,metadata_cols]) metadata=t(plot_data[1,colnames(plot_data)[colnames(plot_data) %in% metadata_cols]])
if (display_combined){ if (display_combined){
metatext=paste0("Train/Test: ", metatext=paste0("Train/Test: ",
metadata[1], "/", metadata[2], metadata[1], "/", metadata[2],
@ -159,8 +159,8 @@ makeplot = function(x, # the DataFrame to plot
, position=position_dodge2(padding=0.1, preserve='total', reverse=TRUE) , position=position_dodge2(padding=0.1, preserve='total', reverse=TRUE)
) + ) +
coord_cartesian(ylim = c(y_coord_min, 1)) + coord_cartesian(ylim = c(y_coord_min, 1)) +
scale_fill_manual(values = c("BT" = "#605ca8", #scale_fill_manual(values = c("BT" = "#605ca8",
"CV" = "#bebddb") ) + # "CV" = "#bebddb") ) +
#guides=guide_legend(reverse=TRUE) + #guides=guide_legend(reverse=TRUE) +
annotation_custom(grob) + annotation_custom(grob) +
# doesn't work with plotly but looks nice :-( # doesn't work with plotly but looks nice :-(