hly89 / synergyfinder

Other
4 stars 3 forks source link

Bug in the PlotDoseResponse function #3

Open MathurinD opened 5 years ago

MathurinD commented 5 years ago

The heatmap generated in the PlotDoseResponse function does not behave correctly when the number of conditions for each inhibitor is different. Example:

test = tibble(block_id=1, drug_col="d1", conc_c=c(0, 10, 100, 0, 10, 100), conc_c_unit="nM", drug_row="d2", conc_r=c(0, 10, 0, 10, 0, 10), conc_r_unit="nM", response=runif(6, 0, 100)) %>% ReshapeData

test %>% PlotDoseResponse

The dimension of the heatmap is wrong, it is 3x2 instead of 2x3, one row name becomes NA and the last concentration name for 'd1' is omitted.

MathurinD commented 5 years ago

The lines responsible for the bug are 83-84 in Plot_dose_response.R

data.plot$Inhibition <- round(c(response.mat), 2) reads response.mat by colum and data.plot$x <- rep(seq_len(nrow(response.mat)), each = ncol(response.mat)) and data.plot$y <- rep(c(seq_len(ncol(response.mat))), nrow(response.mat)) does a transpose so all ncol and nrow should be inverted.