Diff of /vignettes/src/part04.Rmd [000000] .. [226bc8]

Switch to unified view

a b/vignettes/src/part04.Rmd
1
---
2
title: "Part 4"
3
output:
4
  BiocStyle::html_document
5
---
6
7
```{r, message=FALSE, include=!exists(".standalone"), eval=!exists(".standalone")}
8
library("BloodCancerMultiOmics2017")
9
library("Biobase")
10
library("ggplot2")
11
library("grid")
12
```
13
14
```{r echo=FALSE}
15
plotDir = ifelse(exists(".standalone"), "", "part04/")
16
if(plotDir!="") if(!file.exists(plotDir)) dir.create(plotDir)
17
```
18
19
```{r}
20
options(stringsAsFactors=FALSE)
21
```
22
23
# Single associations of drug response with gene mutation or type of disease (IGHV included)
24
25
We univariantly tested different features (explained in detail below) for their associations with the drug response using Student t-test (two-sided, with equal variance). Each concentration was tested separately. The minimal size of the compared groups was set to 3. p-values were adjusted for multiple testing by applying the Benjamini-Hochberg procedure. Adjusted p-values were then used for setting the significance threshold.
26
27
Loading the data.
28
```{r}
29
data(list=c("drpar", "patmeta", "drugs", "mutCOM", "conctab"))
30
```
31
32
## Function which test associations of interest
33
34
Below is a general function with which all the tests for single associations were performed.
35
```{r}
36
testFactors = function(msrmnt, factors, test="student", batch=NA) {
37
  
38
  # cut out the data
39
  tmp = colnames(factors)
40
  factors = data.frame(factors[rownames(msrmnt),], check.names=FALSE)
41
  colnames(factors) = tmp
42
  for(cidx in 1:ncol(factors))
43
    factors[,cidx] = factor(factors[,cidx], levels=c(0,1))
44
  
45
  # calculate the group size
46
  groupSizes = do.call(rbind, lapply(factors, function(tf) {
47
    tmp = table(tf)
48
    data.frame(n.0=tmp["0"], n.1=tmp["1"])
49
  }))
50
  
51
  # remove the factors with less then 2 cases per group
52
  factors = factors[,names(which(apply(groupSizes, 1,
53
                                       function(i) all(i>2)))), drop=FALSE]
54
  
55
  # calculate the effect
56
  effect = do.call(rbind, lapply(colnames(factors), function(tf) {
57
    tmp = aggregate(msrmnt ~ fac, data=data.frame(fac=factors[,tf]), mean)
58
    rownames(tmp) = paste("mean", tmp$fac, sep=".")
59
    tmp = t(tmp[2:ncol(tmp)])
60
    data.frame(TestFac=tf,
61
               DrugID=rownames(tmp),
62
               FacDr=paste(tf, rownames(tmp), sep="."),
63
               n.0=groupSizes[tf,"n.0"], n.1=groupSizes[tf,"n.1"],
64
               tmp, WM=tmp[,"mean.0"]-tmp[,"mean.1"])
65
  }))
66
  
67
  # do the test
68
  T = if(test=="student") {
69
    do.call(rbind, lapply(colnames(factors), function(tf) {
70
      tmp = do.call(rbind, lapply(colnames(msrmnt), function(dr) {
71
        res = t.test(msrmnt[,dr] ~ factors[,tf], var.equal=TRUE)
72
        data.frame(DrugID=dr, TestFac=tf,
73
                   pval=res$p.value, t=res$statistic,
74
                   conf1=res$conf.int[1], conf2=res$conf.int[2])
75
      }))
76
      tmp
77
    }))
78
  } else if(test=="anova") {
79
    do.call(rbind, lapply(colnames(factors), function(tf) {
80
      tmp = do.call(rbind, lapply(colnames(msrmnt), function(dr) {
81
        # make sure that the order in batch is the same as in msrmnt
82
        stopifnot(identical(rownames(msrmnt), names(batch)))
83
        res = anova(lm(msrmnt[,dr] ~ factors[,tf]+batch))
84
        data.frame(DrugID=dr, TestFac=tf, pval=res$`Pr(>F)`[1],
85
                   f=res$`F value`[1], meanSq1=res$`Mean Sq`[1],
86
                   meanSq2=res$`Mean Sq`[2])
87
      }))
88
      tmp
89
    }))
90
  } else {
91
    NA
92
  }
93
  
94
  enhanceObject = function(obj) {
95
    # give nice drug names
96
    obj$Drug = giveDrugLabel(obj$DrugID, conctab, drugs)
97
    # combine the testfac and drug id
98
    obj$FacDr = paste(obj$TestFac, obj$DrugID, sep=".")
99
    # select just the drug name
100
    obj$DrugID2 = substring(obj$DrugID, 1, 5)
101
    obj
102
  }
103
  
104
  list(effect=effect, test=enhanceObject(T))
105
}
106
```
107
108
## Associations of *ex vivo* drug responses with genomic features in CLL
109
110
### Prepare objects for testing
111
112
```{r}
113
## VIABILITIES
114
## list of matrices; one matrix per screen/day
115
## each matrix contains all CLL patients
116
measurements=list()
117
118
### Main Screen
119
patM = colnames(drpar)[which(patmeta[colnames(drpar),"Diagnosis"]=="CLL")]
120
measurements[["main"]] =
121
  do.call(cbind,
122
          lapply(list("viaraw.1","viaraw.2","viaraw.3","viaraw.4","viaraw.5"),
123
                 function(viac) {
124
  tmp = t(assayData(drpar)[[viac]][,patM])
125
  colnames(tmp) = paste(colnames(tmp), conctab[colnames(tmp),
126
            paste0("c",substring(viac,8,8))], sep="-")
127
  tmp
128
}))
129
130
pats = sort(unique(patM))
131
132
## TESTING FACTORS
133
testingFactors = list()
134
# ighv
135
ighv = setNames(patmeta[pats, "IGHV"], nm=pats)
136
# mutations
137
tmp = cbind(IGHV=ifelse(ighv=="U",1,0), assayData(mutCOM)$binary[pats,])
138
testingFactors[["mutation"]] = tmp[,-grep("Chromothripsis", colnames(tmp))]
139
140
# BATCHES
141
j = which(pData(drpar)[patM, "ExpDate"] < as.Date("2014-01-01"))
142
k = which(pData(drpar)[patM, "ExpDate"] < as.Date("2014-08-01") &
143
            pData(drpar)[patM, "ExpDate"] > as.Date("2014-01-01"))
144
l = which(pData(drpar)[patM, "ExpDate"] > as.Date("2014-08-01"))
145
146
measurements[["main"]] = measurements[["main"]][c(patM[j], patM[k], patM[l]),]
147
batchvec = factor(
148
  setNames(c(rep(1, length(j)), rep(2, length(k)), rep(3, length(l))),
149
           nm=c(patM[j], patM[k], patM[l])))
150
151
# LABELS FOR GROUPING
152
beelabs = t(sapply(colnames(testingFactors[["mutation"]]), function(fac) {
153
  if(fac=="IGHV")
154
    c(`0`="IGHV mut", `1`="IGHV unmut")
155
  else if(grepl("[[:upper:]]",fac)) # if all letters are uppercase
156
    c(`0`=paste(fac, "wt"),`1`=paste(fac, "mt"))
157
  else
158
    c(`0`="wt",`1`=fac)
159
}))
160
```
161
162
163
### Assesment of importance of batch effect
164
165
We first used the approach explained in the introduction section to test for associations between drug viability assay results and genomic features, which comprised: somatic mutations (aggregated at the gene level), copy number aberrations and IGHV status. 
166
167
```{r}
168
allresultsT = testFactors(msrmnt=measurements[["main"]],
169
                          factors=testingFactors[["mutation"]],
170
                          test="student", batch=NA)
171
172
resultsT = allresultsT$test
173
resultsT$adj.pval = p.adjust(resultsT$pval, method="BH")
174
```
175
176
However, we ware aware that the main screen was performed in three groups of batches over a time period of 1.5 years; these comprise, respectively, the samples screened in 2013, in 2014 before August and in 2014 in August and September. Therefore, to control for confounding by the different batch groups we repeated the drug-feature association tests using batch group as a blocking factor and a two-way ANOVA test.
177
178
```{r}
179
allresultsA = testFactors(msrmnt=measurements[["main"]],
180
                          factors=testingFactors[["mutation"]],
181
                          test="anova", batch=batchvec)
182
183
resultsA = allresultsA$test
184
resultsA$adj.pval = p.adjust(resultsA$pval, method="BH")
185
```
186
187
We then compared the p-values from both tests. 
188
189
```{r batchEffect, results='asis', echo=FALSE, fig.path=plotDir, dev=c('png','pdf'), fig.height=20, fig.width=14}
190
#FIG# S30
191
xylim = 1e-8
192
tmp = merge(resultsT[,c("FacDr","Drug","DrugID","DrugID2","FacDr","pval")],
193
            resultsA[,c("FacDr","pval")], by.x="FacDr", by.y="FacDr")
194
tmp$DrugName = toCaps(drugs[tmp$DrugID2, "name"])
195
tmp$Shape = ifelse(tmp$pval.x < xylim | tmp$pval.y < xylim, "tri", "dot")
196
tmp$pval.cens.x = ifelse(tmp$pval.x < xylim, xylim, tmp$pval.x)
197
tmp$pval.cens.y = ifelse(tmp$pval.y < xylim, xylim, tmp$pval.y)
198
199
ggplot(tmp) + geom_abline(intercept=0, slope=1, colour="hotpink") +
200
  geom_point(aes(x=pval.cens.x, y=pval.cens.y, shape=Shape), alpha=0.6) +
201
  facet_wrap(~DrugName, ncol=7) +
202
  scale_x_log10(labels=scientific_10, limits=c(xylim,1)) +
203
  scale_y_log10(labels=scientific_10, limits=c(xylim,1)) +
204
  theme_bw() + coord_fixed() + xlab("P-value from Student t-test") +
205
  ylab("P-value from ANOVA (including batch group factor)") +
206
  theme(axis.text.x=element_text(angle=0, hjust=1, vjust=0.5, size=rel(1.5)),
207
        axis.title=element_text(size=18)) + guides(shape=FALSE)
208
```
209
210
Only one drug, bortezomib, showed discrepant p-values, and exploration of its data suggested that it lost its activity during storage. The data for this drug and NSC 74859 were discarded from further analysis.
211
212
```{r}
213
badrugs = c("D_008", "D_025")
214
215
measurements = lapply(measurements, function(drres) {
216
  drres[,-grep(paste(badrugs, collapse="|"), colnames(drres))]
217
})
218
```
219
220
For all remaining associations, testing with and without batch as a blocking factor yielded equivalent results. Therefore, all reported p-values for associations come from the t-tests without using blocking for batch effects.
221
222
223
### Associations of drug response with mutations in CLL
224
225
We tested for associations between drug viability assay results and genomic features (43 features for the pilot screen and 63 for the main screen). p-values were adjusted for multiple testing by applying the Benjamini-Hochberg procedure, separately for the main screen and for each of the two incubation times of the pilot screen.
226
227
```{r}
228
allresults1 = lapply(measurements, function(measurement) {
229
  testFactors(msrmnt=measurement, factors=testingFactors[["mutation"]],
230
              test="student", batch=NA)
231
})
232
233
effects1 = lapply(allresults1, function(res) res[["effect"]])
234
results1 = lapply(allresults1, function(res) res[["test"]])
235
236
results1 = lapply(results1, function(res) {
237
  res$adj.pval = p.adjust(res$pval, method="BH")
238
  res
239
})
240
```
241
242
```{r}
243
measurements1 = measurements
244
testingFactors1 = testingFactors
245
beelabs1 = beelabs
246
```
247
248
249
### Volcano plots: summary of the results
250
251
In this section we summarize all significant associations for a given mutation in a form of volcano plots. The pink color spectrum indicates a resistant phenotype and the blue color spectrum a sensitive phenotype in the presence of the tested mutation. FDR of 10 % was used.
252
253
```{r echo=FALSE}
254
## CREATE THE PLOTS
255
plotmp01 = BloodCancerMultiOmics2017:::run.ggvolcGr2(results=results1, effects=effects1,
256
                                screen="main", mts="IGHV", fdr=0.1, maxX=0.75,
257
                                maxY=NA, expY=0.05, hghBox=0.15, axisMarkY=4,
258
                                breaksX=c(-0.75,-0.5,-0.25,0,0.25,0.5,0.75),
259
                                arrowLength=0.5, Xhang=0.3, minConc=3)
260
261
plotmp02 = BloodCancerMultiOmics2017:::run.ggvolcGr2(results=results1, effects=effects1,
262
                                screen="main", mts="trisomy12", fdr=0.1,
263
                                maxX=0.75, maxY=NA, expY=0.05, hghBox=0.15,
264
                                axisMarkY=4,
265
                                breaksX=c(-0.75,-0.5,-0.25,0,0.25,0.5,0.75),
266
                                arrowLength=0.5, Xhang=0.3, minConc=1)
267
```
268
269
IGHV.
270
```{r volc_IGHV, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp01$IGHV$figure$width, fig.height=plotmp01$IGHV$figure$height}
271
#FIG# 4B
272
grid.draw(plotmp01$IGHV$figure$plot)
273
```
274
275
```{r volc_IGHV_legend, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp01$IGHV$legend$width, fig.height=plotmp01$IGHV$legend$height, out.height=300, out.width=150}
276
#FIG# 4B legend
277
grid.draw(plotmp01$IGHV$legend$plot)
278
```
279
280
Trisomy 12.
281
```{r volc_trisomy12, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp02$trisomy12$figure$width, fig.height=plotmp02$trisomy12$figure$height}
282
#FIG# 4C
283
grid.draw(plotmp02$trisomy12$figure$plot)
284
```
285
286
```{r volc_trisomy12_legend, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp02$trisomy12$legend$width, fig.height=plotmp02$trisomy12$legend$height, out.height=300, out.width=150}
287
#FIG# 4C legend
288
grid.draw(plotmp02$trisomy12$legend$plot)
289
```
290
291
## Associations of drug responses with genomic features in CLL independently of IGHV status
292
293
To assess associations between drug effects and genomic features independently of IGHV status, we performed the analyses separately within U-CLL and M-CLL samples. These analyses were only performed if 3 or more samples carried the analyzed feature within both M-CLL and U-CLL subgroups.
294
295
Find out which factors we will be testing (with threshold >2 patients in each of the four groups).
296
```{r}
297
fac2test = lapply(measurements, function(mea) {
298
  tf = testingFactors[["mutation"]][rownames(mea),]
299
  names(which(apply(tf,2,function(i) {
300
    if(length(table(i,tf[,1]))!=4)
301
      FALSE
302
    else
303
      all(table(i,tf[,1])>2)
304
  })))
305
})
306
```
307
308
Construct the table with drug responses.
309
```{r}
310
measurements2 = setNames(lapply(names(measurements), function(mea) {
311
  ig = testingFactors[["mutation"]][rownames(measurements[[mea]]),"IGHV"]
312
  patU = names(which(ig==1))
313
  patM = names(which(ig==0))
314
  list(U=measurements[[mea]][patU,], M=measurements[[mea]][patM,])
315
}), nm=names(measurements))
316
```
317
318
Testing.
319
```{r}
320
allresults2 = setNames(lapply(names(measurements2), function(mea) {
321
  list(U = testFactors(msrmnt=measurements2[[mea]]$U,
322
                       factors=testingFactors[["mutation"]][
323
                         rownames(measurements2[[mea]]$U),fac2test[[mea]]]),
324
  M = testFactors(msrmnt=measurements2[[mea]]$M,
325
                  factors=testingFactors[["mutation"]][
326
                    rownames(measurements2[[mea]]$M),fac2test[[mea]]]))
327
}), nm=names(measurements2))
328
```
329
330
Divide results to list of effects and list of results.
331
```{r}
332
results2 = lapply(allresults2, function(allres) {
333
  list(U=allres[["U"]][["test"]], M=allres[["M"]][["test"]])
334
})
335
336
effects2 = lapply(allresults2, function(allres) {
337
  list(U=allres[["U"]][["effect"]], M=allres[["M"]][["effect"]])
338
})
339
```
340
341
p-values were adjusted for multiple testing by applying the Benjamini-Hochberg procedure to joined results for M-CLL and U-CLL for each screen separately.
342
```{r}
343
results2 = lapply(results2, function(res) {
344
  tmp = p.adjust(c(res$U$pval,res$M$pval), method="BH")
345
  l = length(tmp)
346
  res$U$adj.pval = tmp[1:(l/2)]
347
  res$M$adj.pval = tmp[(l/2+1):l]
348
  res
349
})
350
```
351
352
```{r}
353
testingFactors2 = testingFactors
354
beelabs2 = beelabs
355
```
356
357
As an example we show the summary of the results for trisomy 12.
358
```{r echo=FALSE}
359
## CREATE THE PLOTS
360
plotmp03 = BloodCancerMultiOmics2017:::run.ggvolcGr2(results=results2$main, effects=effects2$main,
361
                                screen="U", mts="trisomy12", fdr=0.1,
362
                                maxX=0.75, maxY=7, expY=0.05, hghBox=NA,
363
                                axisMarkY=4,
364
                                breaksX=c(-0.75,-0.5,-0.25,0,0.25,0.5,0.75),
365
                                arrowLength=0.5, Xhang=0.3, minConc=1,
366
                                fixedHght=6)
367
368
plotmp04 = BloodCancerMultiOmics2017:::run.ggvolcGr2(results=results2$main, effects=effects2$main,
369
                                screen="M", mts="trisomy12", fdr=0.1,
370
                                maxX=0.75, maxY=7, expY=0.05, hghBox=NA,
371
                                axisMarkY=4,
372
                                breaksX=c(-0.75,-0.5,-0.25,0,0.25,0.5,0.75),
373
                                arrowLength=0.5, Xhang=0.3, minConc=1,
374
                                fixedHght=6)
375
```
376
377
Trisomy 12 - IGHV unmutated.
378
```{r volc_trisomy12_U, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp03$trisomy12$figure$width, fig.height=plotmp03$trisomy12$figure$height}
379
#FIG# S21 right
380
grid.draw(plotmp03$trisomy12$figure$plot)
381
```
382
383
```{r volc_trisomy12_U_legend, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp03$trisomy12$legend$width, fig.height=plotmp03$trisomy12$legend$height, out.height=300, out.width=150}
384
#FIG# S21 right legend
385
grid.draw(plotmp03$trisomy12$legend$plot)
386
```
387
388
Trisomy 12 - IGHV mutated.
389
```{r volc_trisomy12_M, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp04$trisomy12$figure$width, fig.height=plotmp04$trisomy12$figure$height}
390
#FIG# S21 left
391
grid.draw(plotmp04$trisomy12$figure$plot)
392
```
393
394
```{r volc_trisomy12_M_legend, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=plotmp04$trisomy12$legend$width, fig.height=plotmp04$trisomy12$legend$height, out.height=300, out.width=150}
395
#FIG# S21 left legend
396
grid.draw(plotmp04$trisomy12$legend$plot)
397
```
398
399
400
## Drug response dependance on cell origin of disease
401
402
We tested for drug sensitivity differences between different disease entities. The largest group, the CLL samples, was used as the baseline for these comparisons. Here, we compared drug sensitivities across studied diseases entities against all CLL samples Only groups with 3 or more data points were considered (T-PLL, AML, MZL, MCL, B-PLL, HCL, LPL and healthy donor cells hMNC). p-values were adjusted for multiple testing by applying the Benjamini-Hochberg procedure to results for each disease entity separately.
403
404
Here we prepare the data for testing the drug response dependence on cell origin of disease.
405
```{r}
406
## VIABILITIES
407
### main
408
pats = colnames(drpar)
409
# make the big matrix with viabilities
410
measureTMP = do.call(cbind,
411
                     lapply(list("viaraw.1","viaraw.2","viaraw.3",
412
                                 "viaraw.4","viaraw.5"), function(viac) {
413
  tmp = t(assayData(drpar)[[viac]][,pats])
414
  colnames(tmp) = paste(colnames(tmp),
415
                        conctab[colnames(tmp),
416
                                paste0("c",substring(viac,8,8))], sep="-")
417
  tmp
418
}))
419
420
# select diagnosis to work on
421
pats4diag = tapply(pats, patmeta[pats,"Diagnosis"], function(i) i)
422
423
diags = names(which(table(patmeta[pats,"Diagnosis"])>2))
424
diags = diags[-which(diags=="CLL")]
425
# there will be two lists: one with CLL and the second with other diagnosis
426
# (first one is passed as argument to the createObjects function)
427
pats4diag2 = pats4diag[diags]
428
429
# function that creates testingFactors, measurements and beelabs
430
createObjects = function(pats4diag1, beefix="") {
431
  
432
  measurements=list()
433
  testingFactors=list()
434
  # make the list for testing
435
  for(m in names(pats4diag1)) {
436
    for(n in names(pats4diag2)) {
437
      p1 = pats4diag1[[m]]
438
      p2 = pats4diag2[[n]]
439
      measurements[[paste(m,n,sep=".")]] = measureTMP[c(p1, p2),]
440
      testingFactors[[paste(m,n,sep=".")]] = setNames(c(rep(0,length(p1)),
441
                                                        rep(1,length(p2))),
442
                                                      nm=c(p1,p2))
443
    }
444
  }
445
  
446
  # reformat testingFactors to the df
447
  pats=sort(unique(c(unlist(pats4diag1),unlist(pats4diag2))))
448
  testingFactors = as.data.frame(
449
    do.call(cbind, lapply(testingFactors, function(tf) {
450
    setNames(tf[pats], nm=pats)
451
  })))
452
  
453
  # Labels for beeswarms
454
  beelabs = t(sapply(colnames(testingFactors), function(fac) {
455
    tmp = unlist(strsplit(fac, ".", fixed=TRUE))
456
    c(`0`=paste0(tmp[1], beefix),`1`=tmp[2])
457
  }))
458
  
459
  return(list(msrmts=measurements, tf=testingFactors, bl=beelabs))
460
}
461
462
# all CLL together
463
res = createObjects(pats4diag1=pats4diag["CLL"])
464
measurements3 = res$msrmts
465
testingFactors3 = res$tf
466
beelabs3 = res$bl
467
```
468
469
Testing.
470
```{r, results='hide'}
471
allresults3 = setNames(lapply(names(measurements3), function(mea) {
472
  tmp = data.frame(testingFactors3[,mea])
473
  colnames(tmp) = mea
474
  rownames(tmp) = rownames(testingFactors3)
475
  testFactors(msrmnt=measurements3[[mea]], factors=tmp)
476
}), nm=names(measurements3))
477
```
478
479
Divide results to list of effects and list of t-test results.
480
```{r}
481
results3 = lapply(allresults3, function(res) res[["test"]])
482
effects3 = lapply(allresults3, function(res) res[["effect"]])
483
```
484
485
Adjust p-values.
486
```{r}
487
results3 = lapply(results3, function(res) {
488
  res$adj.pval = p.adjust(res$pval, method="BH")
489
  res
490
})
491
```
492
493
We summarize the result as a heat map.
494
```{r echo=FALSE}
495
tmpheat = BloodCancerMultiOmics2017:::ggheat(results3, effects3)
496
```
497
498
```{r cll.diag, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=tmpheat$figure$width, fig.height=tmpheat$figure$height}
499
#FIG# S7 plot
500
grid.draw(tmpheat$figure$plot)
501
```
502
503
```{r cll.diag.legend, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=tmpheat$legend$width, fig.height=tmpheat$legend$height}
504
#FIG# S7 legend
505
grid.draw(tmpheat$legend$plot)
506
```
507
508
# Effect of mutation on drug response - examples
509
510
```{r}
511
data(drugs, lpdAll, mutCOM, conctab)
512
```
513
514
```{r}
515
lpdCLL = lpdAll[ , lpdAll$Diagnosis %in% "CLL"]
516
```
517
518
Here we highlight the selection of mutation-drug response associations within the different disease subtypes.
519
520
```{r beesMutMain, fig.path=plotDir, dev=c("png", "pdf"), fig.width=8, fig.height=10, out.width=280, out.height=350}
521
#FIG# 4D
522
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_010_2", "TP53", cs=T, y1=0, y2=1.2, custc=T)
523
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_006_3", "TP53", cs=T,y1=0, y2=1.2, custc=T)
524
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_063_5", "CREBBP", cs=T, y1=0, y2=1.2, custc=T)
525
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_056_5", "PRPF8", cs=T, y1=0, y2=1.2, custc=T)
526
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_012_5", "trisomy12", cs=F,y1=0.6, y2=1.2, custc=T)
527
```
528
529
```{r beesMutSupp, fig.path=plotDir, fig.width = 18, fig.height = 20, dev = c("png", "pdf")}
530
#FIG# S17
531
par(mfrow = c(3,4), mar=c(5,4.5,5,2))
532
533
BloodCancerMultiOmics2017:::beeF(diag="CLL", drug="D_159_3", mut="TP53", cs=T, y1=0, y2=1.2, custc=T)
534
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_006_2", "del17p13", cs=T, y1=0, y2=1.2, custc=T)
535
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_159_3", "del17p13", cs=T, y1=0, y2=1.2, custc=T)
536
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_010_2", "del17p13", cs=T, y1=0, y2=1.2, custc=T)
537
BloodCancerMultiOmics2017:::beeF(diag="MCL", "D_006_2", "TP53", cs=T,  y1=0, y2=1.2, custc=T)
538
BloodCancerMultiOmics2017:::beeF(diag="MCL", "D_010_2", "TP53", cs=T,  y1=0, y2=1.2, custc=T)
539
BloodCancerMultiOmics2017:::beeF(diag=c("HCL", "HCL-V"), "D_012_3", "BRAF", cs=T, y1=0, y2=1.2,
540
            custc=F)
541
BloodCancerMultiOmics2017:::beeF(diag=c("HCL", "HCL-V"), "D_083_4", "BRAF", cs=T, y1=0, y2=1.2,
542
            custc=F)
543
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_012_5", "KRAS", cs=T, y1=0.6, y2=1.2, custc=T)
544
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_083_5", "KRAS", cs=T, y1=0.6, y2=1.45, custc=T)
545
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_081_4", "UMODL1", cs=T,  y1=0, y2=1.2, custc=T)
546
BloodCancerMultiOmics2017:::beeF(diag="CLL", "D_001_4", "UMODL1", cs=T,  y1=0, y2=1.2, custc=T)
547
```
548
549
```{r colorbar, echo=FALSE, fig.path=plotDir, dev=c("png", "pdf"), fig.width=2, fig.height=4, out.height=200, out.width=100}
550
551
# the below function comes from the CRAN package named monogeneaGM
552
colorBar <-function(colpalette=NULL, min, max=-min, nticks=11, ticks=seq(min, max, len=nticks), 
553
 tit="") {
554
    
555
    if(is.null(colpalette)) {
556
      scale <- (length(colpalette)-1)/(max-min)
557
    rwb <- c("#99000D","#FB6A4A","white","#6BAED6","#084594")
558
    colpalette<- colorRampPalette(rwb, space="Lab")(101)
559
    }
560
561
    scale <- (length(colpalette)-1)/(max-min)
562
    plot(c(0,10), c(min,max), type="n", bty="n", xaxt="n", xlab="", yaxt="n", ylab="", main=tit)
563
    axis(2, ticks, las=1)
564
    for (i in 1:(length(colpalette)-1)) {
565
    y = (i-1)/scale + min
566
    rect(0,y,10,y+1/scale, col=colpalette[i], border=NA)
567
    }
568
}
569
570
colorBar(colorRampPalette(c('coral1','blue4'))(100), min=0, max = 1,
571
         ticks=c(0,0.5,1))
572
```
573
574
575
Bee swarms for pretreatment.
576
```{r bee-pretreatment, fig.path=plotDir, fig.width=15, fig.height=10, dev = c("png", "pdf")}
577
#FIG# S18
578
par(mfrow = c(2,3), mar=c(5,4.5,2,2)) 
579
580
BloodCancerMultiOmics2017:::beePretreatment(lpdCLL, "D_006_1:5", y1=0.2, y2=1.3, fac="TP53",
581
                       val=c(0,1), name="Fludarabine")
582
BloodCancerMultiOmics2017:::beePretreatment(lpdCLL, "D_006_1:5", y1=0.2, y2=1.3, fac="TP53",
583
                       val=c(0),   name="p53 wt:  Fludarabine")
584
BloodCancerMultiOmics2017:::beePretreatment(lpdCLL, "D_006_1:5", y1=0.2, y2=1.3, fac="TP53",
585
                       val=c(1),   name="p53 mut: Fludarabine")
586
587
BloodCancerMultiOmics2017:::beePretreatment(lpdCLL, "D_002_4:5", y1=0.4, y2=1.3,
588
                       fac="IGHV Uppsala U/M", val=c(0,1), name="Ibrutinib")
589
BloodCancerMultiOmics2017:::beePretreatment(lpdCLL, "D_002_4:5", y1=0.4, y2=1.3,
590
                       fac="IGHV Uppsala U/M", val=c(0), name="U-CLL: Ibrutinib")
591
BloodCancerMultiOmics2017:::beePretreatment(lpdCLL, "D_002_4:5", y1=0.4, y2=1.3,
592
                       fac="IGHV Uppsala U/M", val=c(1), name="M-CLL: Ibrutinib")
593
```
594
595
```{r, include=!exists(".standalone"), eval=!exists(".standalone")}
596
sessionInfo()
597
```
598
599
```{r, message=FALSE, warning=FALSE, include=FALSE}
600
rm(list=ls())
601
```