-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ways_of_ranking_HM_results_to_remove_ties.R
873 lines (848 loc) · 41 KB
/
test_ways_of_ranking_HM_results_to_remove_ties.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
# Experimenting with ways around limitation of having lots of equal minimum p-values for HM(M).
# Here, trying combining LFC with p-values by taking 10^-x where x is absolute value of LFC multiplied
# by -log10 p-value, so measure used is p-value multiplied by 10^LFC.
# Another possibility is to use LFC purely as a tie-breaker: add a very small multiple of absolute LFC
# to p-values - small enough that it won't change any ranking other than those with equal p-values.
library(here)
# Import p-value ranking and MDSeq results for comparison
folder <- "Results/TCGA all results Sept 2020"
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
for (j in c("HM.HM", "MDSeq.MDSeq", "voom.HM")) {
assign(
paste0(i, "_", j, "_mean_v_disp_known.genes"),
read.csv(
here(folder, paste0(i, "_mean_v_disp_", j, "_known.genes.csv")),
)
)
}
}
rm(folder,i,j)
# Get p-values and calls
folder <- "Results/TCGA all results Sept 2020"
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
assign(paste0("calls.", i),
read.csv(here(folder, paste0("calls.", i, ".csv")),
stringsAsFactors=F, header=T, row.names=1))
assign(paste0("pvals.", i),
read.csv(here(folder, paste0("pvals.", i, ".csv")),
stringsAsFactors=F, header=T, row.names=1))
}
# Get cancer-related genes
folder <- "Data sources/Cancer-related genes"
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
assign(paste0("genes.", i),
readRDS(here(folder, paste0(i, "_genes_info.rds"))))
assign(paste0(i, "_related"),
rownames(get(paste0("pvals.", i))) %in% get(paste0("genes.", i))$ENSEMBL)
}
rm(i)
# Get LFCs for HM (lnHM long chain only; can do others if/when need to, but probably won't need to)
folder <- "Results/TCGA long chain results Aug 2020"
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
res <- readRDS(here(folder, paste0("results.TCGA_20k_iter_", i, "_lnHM.rds")))
assign(paste0("lfc.lnHMmean_", i), res$lfc.mean)
assign(paste0("lfc.lnHMdisp_", i), res$lfc.disp)
}
rm(i,res,folder)
## Rank genes by 10^-(|lfc| * (-log10(p))) = 10^-|lfc| * p for HM ####
# Keeps ranking variable in (0,1) but has potential to change rankings in a way that isn't easy to
# predict, so almost certain to reverse some rankings compared to p-values alone.
# Only makes sense to do like-for-like comparisons, so if want to do this for voom-HM then need to
# transform voom p-values in the same way. For now just do for HM because immediately interested in
# comparing DE v DD for HM with DE v DD for MDSeq.
for (j in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
assign(paste0("p.explfc.", j, ".lnHMmean"),
get(paste0("pvals.", j))$mean.lnHM.log.20k * 10^-abs(get(paste0("lfc.lnHMmean_", j))))
assign(paste0("p.explfc.", j, ".lnHMdisp"),
get(paste0("pvals.", j))$disp.lnHM.log.20k * 10^-abs(get(paste0("lfc.lnHMdisp_", j))))
p.explfc <- sort(unique(c(get(paste0("p.explfc.", j, ".lnHMmean")), get(paste0("p.explfc.", j, ".lnHMdisp")))))
res <- data.frame(
p.explfc = p.explfc,
listDE = numeric(length(p.explfc)),
listDD = numeric(length(p.explfc)),
overlap = numeric(length(p.explfc)),
p.hyper = numeric(length(p.explfc)),
exp.overlap = numeric(length(p.explfc)),
union = numeric(length(p.explfc)),
p.cor = numeric(length(p.explfc)),
cor = numeric(length(p.explfc)),
TP_DE = numeric(length(p.explfc)),
TP_DD = numeric(length(p.explfc)),
TP_both = numeric(length(p.explfc)),
TP_DEonly = numeric(length(p.explfc)),
TP_DDonly = numeric(length(p.explfc))
)
for (i in seq_len(length(p.explfc))) {
res$listDE[i] <- sum(get(paste0("p.explfc.", j, ".lnHMmean")) < res$p.explfc[i])
res$listDD[i] <- sum(get(paste0("p.explfc.", j, ".lnHMdisp")) < res$p.explfc[i])
res$overlap[i] <- sum(get(paste0("p.explfc.", j, ".lnHMmean")) < res$p.explfc[i] &
get(paste0("p.explfc.", j, ".lnHMdisp")) < res$p.explfc[i])
res$p.hyper[i] <- phyper(res$overlap[i],
res$listDE[i],
nrow(get(paste0("pvals.", j))) - res$listDE[i],
res$listDD[i])
res$exp.overlap[i] <- mean(get(paste0("p.explfc.", j, ".lnHMmean")) < res$p.explfc[i]) *
mean(get(paste0("p.explfc.", j, ".lnHMdisp")) < res$p.explfc[i]) * nrow(get(paste0("pvals.", j)))
res$union[i] <- sum(get(paste0("p.explfc.", j, ".lnHMmean")) < res$p.explfc[i] |
get(paste0("p.explfc.", j, ".lnHMdisp")) < res$p.explfc[i])
if (sum(get(paste0("p.explfc.", j, ".lnHMmean")) < res$p.explfc[i] |
get(paste0("p.explfc.", j, ".lnHMdisp")) < res$p.explfc[i]) > 1) {
cortest <-
cor.test(get(paste0("p.explfc.", j, ".lnHMmean"))[get(paste0("p.explfc.", j, ".lnHMmean")) < res$p.explfc[i] |
get(paste0("p.explfc.", j, ".lnHMdisp")) < res$p.explfc[i]],
get(paste0("p.explfc.", j, ".lnHMdisp"))[get(paste0("p.explfc.", j, ".lnHMmean")) < res$p.explfc[i] |
get(paste0("p.explfc.", j, ".lnHMdisp")) < res$p.explfc[i]],
method="spearman", alt="less")
res$p.cor[i] <- cortest$p.val
res$cor[i] <- cortest$estimate
rm(cortest)
}
res$TP_DE[i] <- sum(get(paste0("p.explfc.", j, ".lnHMmean"))[get(paste0(j, "_related"))] < res$p.explfc[i])
res$TP_DD[i] <- sum(get(paste0("p.explfc.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$p.explfc[i])
res$TP_both[i] <- sum(get(paste0("p.explfc.", j, ".lnHMmean"))[get(paste0(j, "_related"))] < res$p.explfc[i] &
get(paste0("p.explfc.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$p.explfc[i])
res$TP_DEonly[i] <- sum(get(paste0("p.explfc.", j, ".lnHMmean"))[get(paste0(j, "_related"))] < res$p.explfc[i] &
get(paste0("p.explfc.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] >= res$p.explfc[i])
res$TP_DDonly[i] <- sum(get(paste0("p.explfc.", j, ".lnHMmean"))[get(paste0(j, "_related"))] >= res$p.explfc[i] &
get(paste0("p.explfc.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$p.explfc[i])
}
assign(paste0(j, ".HM_HM_p.explfc"), res)
# write.csv(get(paste0(j, ".HM_HM_p.explfc")),
# here("Results/TCGA all results Sept 2020",
# paste0(j, "_mean_v_disp_HM.HM_known.genes_p.explfc.csv")),
# row.names=F)
rm(p.explfc, res)
}
# Compare HM using p-values (red) and p.explfc (blue)
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$cor,
type="l",
xlim=c(0,1e-4),
ylim=c(-1,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$cor,
col="blue")
}
# On full scale, correlation generally lower using p-values, especially near zero.
# Showing up to 1e-4, correlation using p.explfc is negative except extremely close to
# zero where it doesn't exist using p-values.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$p.cor,
type="l",
xlim=c(0,1e-4),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$p.cor,
col="blue")
}
# On full scale, correlation p-values close to zero for longer using p-values.
# Showing up to 1e-4, correlation p-values are at or very close to zero along the whole
# scale using p.explfc, where they don't exist using p-values.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,1e-4),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$overlap / dat_p.explfc$union,
col="blue")
}
# On full scale, less overlap using p-values.
# Showing up to 1e-4, overlap using p.explfc starts at zero but increases quite quickly,
# and is always higher than using p-values from around 5e-5 where overlap can be defined
# using p-values.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$p.hyper,
type="l",
xlim=c(0,1e-4),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$p.hyper,
col="blue")
}
# On full scale, no consistent differences in hypergeometric p-values.
# Showing up to 1e-4, hypergeometric p-values are nearly always 1 across the range, but zero
# for kirc and coad, for which they start at 1 and drop to zero at around 5e-5 using p-values.
# Compare MDSeq (red) with HM using p.explfc (blue)
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$cor,
type="l",
xlim=c(0,1e-4),
ylim=c(-1,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$cor,
col="blue")
}
# On full scale, correlation lower across whole range for HM except for thca, where they're
# almost identical.
# Showing up to 1e-4, correlation still looks to be lower across the whole range for HM.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$p.cor,
type="l",
xlim=c(0,1e-4),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$p.cor,
col="blue")
}
# On full scale, often no difference in correlation p-values, but lower for HM for small
# p-values for brca and prad, and over the whole range for kirc.
# Showing up to 1e-4, correlation p-values lower across whole range for HM.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,1e-4),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$overlap / dat_p.explfc$union,
col="blue")
}
# On full scale, overlap nearly always higher for HM.
# Showing up to 1e-4, not much difference in overlap, but where there's a difference it's
# always lower for HM.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$pvals,
dat_pval$p.hyper,
type="l",
xlim=c(0,1e-4),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$p.explfc,
dat_p.explfc$p.hyper,
col="blue")
}
# On full scale, hypergeometric p-values look to always be lower for HM, which is very
# strange given there's nearly always greater overlap between DE and DD lists for HM.
# Showing up to 1e-4, for most cancers there's no difference in hypergeometric p-values,
# but zero across the whole range for HM for kirc and coad, where it's 1 for MDSeq, and
# zero very close to zero for HM for brca where it's 1 for MDSeq.
# Compare HM using p-values (red) and p.explfc (blue) based on number of genes
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$cor,
type="l",
xlim=c(0,1000),
ylim=c(-1,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$cor,
col="blue")
}
# On full scale, correlation nearly always negative using p.explfc where it doesn't
# exist using p-values, and crosses over to higher at a point where the ranking doesn't
# really matter any more (at least 5000 genes).
# Showing up to 1000 genes, correlation is generally positive at start using p.explfc then
# drops below zero between about 100 and 600 genes.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$p.cor,
type="l",
xlim=c(0,1000),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$p.cor,
col="blue")
}
# On full scale, correlation p-values look to be high using p.explfc at the very low end
# and for thca and lihc at the high end, and where there's a difference, they look to be
# always higher using p.explfc than p-values, but that's only at the extreme high end.
# Showing up to 1000 genes, correlation p-values are always higher using p.explfc over
# the entire low end except a very very small bit at the start, which could just be one or
# two genes, where both are zero.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,1000),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$overlap / dat_p.explfc$union,
col="blue")
}
# On full scale, overlap starts off low using p.explfc where it isn't defined using p-values,
# and where it is defined using p-values they're very similar, but that's only for at least
# about 10,000 genes.
# Showing up to 1000 genes, overlap is generally very low using p.explfc, and at or nearly at
# zero at the start, except for thca. This is probably because there are no discoveries for
# one test (probably DD since DE seems to go to much smaller values).
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$p.hyper,
type="l",
xlim=c(0,1000),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$p.hyper,
col="blue")
}
# On full scale, hypergeometric p-values look to start at 1 using both p.explfc and p-values,
# and for most cancers stay around there, but for kirc and coad, both drop to zero but on a
# finer scale using p.explfc, and for brca there is a point where the hypergeometric p-value
# drops to nearly zero using p.explfc but stays at 1 using p-values, but there's no difference
# for reasonable numbers of genes.
# Showing up to 1000 genes, hypergeometric p-value is 1 over the whole range except for tiny
# bits for a couple of cancers. It's very strange that the p-value is so close to 1 when the
# overlap/union is so small. It could just be the small numbers, but the numbers aren't really
# small for up to 1000 genes, so need to check whether I'm doing the test properly. Looking at
# all the numbers for some over the range where the overlap/union is low but p-value 1, it
# looks like it's just because for these relatively small numbers of genes, the expected overlap
# is extremely small, so looking at overlap/union alone doesn't really say anything about
# whether there's less overlap than expected.
# Compare MDSeq (red) with HM using p.explfc (blue) based on number of genes
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$cor,
type="l",
xlim=c(0,1000),
ylim=c(-1,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$cor,
col="blue")
}
# On full scale, correlation lower across most of range for HM for most cancers, but for
# most looks like it's lower for MDSeq at the very low end.
# Showing up to 1000 genes, correlation is lower at low end for all genes for MDSeq, and
# generally similar or lower for HM after around 300-600 genes, except for luad and prad, for
# which it's lower for MDSeq across the whole range. MDSeq seems to have a higher minimum
# number of genes identified than HM when using p.explfc, so correlation jumps from zero to
# something negative at around 100-400 genes for most cancers, whereas for HM it starts off
# around zero or slightly positive, and more slowly drops off. Strangely though, looking at
# kirc as an example, there is a correlation and a correlation p-value for MDSeq at a point
# where there is no overlap between the DE and DD lists. This is because the correlation I've
# used is between all genes in the union. I wonder if it makes more sense to use that or all
# genes in the intersection (which would mean it's not defined for a longer period at the
# beginning).
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$p.cor,
type="l",
xlim=c(0,1000),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$p.cor,
col="blue")
}
# On full scale, correlation p-values look to be always the same or lower for HM, but
# possibly stays at zero at the very low end for MDSeq where it's high for HM.
# Showing up to 1000 genes, the correlation p-value is always lower for MDSeq at the low end,
# up to from 100 to 600 genes.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,1000),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$overlap / dat_p.explfc$union,
col="blue")
}
# On full scale, overlap generally lower for HM across most of range, but looks to
# usually be lower near the low end for MDSeq, but low for both.
# Showing up to 1000 genes, overlap is generally similar for HM and MDSeq, but where it's
# different it's usually lower for MDSeq.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_p.explfc <- get(paste0(i, ".HM_HM_p.explfc"))
plot(dat_pval$union,
dat_pval$p.hyper,
type="l",
xlim=c(0,1000),
ylim=c(0,1),
col="red", main=i)
lines(dat_p.explfc$union,
dat_p.explfc$p.hyper,
col="blue")
}
# On full scale, hypergeometric p-values usually same, but more often lower for HM than
# MDSeq, except at very low end seems to often be lower for MDSeq, but still close to 1.
# Showing up to 1000 genes, hypergeometric p-values are at or very close to 1 for both HM
# and MDSeq across the whole range.
## Rank genes by p-value with lfc as tie-breaker for HM ####
# Easiest way to do it is to subtract a multiple of absolute lfc from p-values such that it's
# guaranteed not to change the ranking of any pairs of genes with different p-values. That
# means the factor subtracted needs to be guaranteed to be less than 1/21,000. Dividing
# absolute lfc by 1e6 should do it but gives some negative numbers, so use 1e7.
for (j in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
assign(paste0("modp.", j, ".lnHMmean"),
get(paste0("pvals.", j))$mean.lnHM.log.20k - abs(get(paste0("lfc.lnHMmean_", j)))/1e7)
assign(paste0("modp.", j, ".lnHMdisp"),
get(paste0("pvals.", j))$disp.lnHM.log.20k - abs(get(paste0("lfc.lnHMdisp_", j)))/1e7)
modp <- sort(unique(c(get(paste0("modp.", j, ".lnHMmean")), get(paste0("modp.", j, ".lnHMdisp")))))
res <- data.frame(
modp = modp,
listDE = numeric(length(modp)),
listDD = numeric(length(modp)),
overlap = numeric(length(modp)),
p.hyper = numeric(length(modp)),
exp.overlap = numeric(length(modp)),
union = numeric(length(modp)),
p.cor = numeric(length(modp)),
cor = numeric(length(modp)),
TP_DE = numeric(length(modp)),
TP_DD = numeric(length(modp)),
TP_both = numeric(length(modp)),
TP_DEonly = numeric(length(modp)),
TP_DDonly = numeric(length(modp))
)
for (i in seq_len(length(modp))) {
res$listDE[i] <- sum(get(paste0("modp.", j, ".lnHMmean")) < res$modp[i])
res$listDD[i] <- sum(get(paste0("modp.", j, ".lnHMdisp")) < res$modp[i])
res$overlap[i] <- sum(get(paste0("modp.", j, ".lnHMmean")) < res$modp[i] &
get(paste0("modp.", j, ".lnHMdisp")) < res$modp[i])
res$p.hyper[i] <- phyper(res$overlap[i],
res$listDE[i],
nrow(get(paste0("pvals.", j))) - res$listDE[i],
res$listDD[i])
res$exp.overlap[i] <- mean(get(paste0("modp.", j, ".lnHMmean")) < res$modp[i]) *
mean(get(paste0("modp.", j, ".lnHMdisp")) < res$modp[i]) * nrow(get(paste0("pvals.", j)))
res$union[i] <- sum(get(paste0("modp.", j, ".lnHMmean")) < res$modp[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$modp[i])
if (sum(get(paste0("modp.", j, ".lnHMmean")) < res$modp[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$modp[i]) > 1) {
cortest <-
cor.test(get(paste0("modp.", j, ".lnHMmean"))[get(paste0("modp.", j, ".lnHMmean")) < res$modp[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$modp[i]],
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0("modp.", j, ".lnHMmean")) < res$modp[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$modp[i]],
method="spearman", alt="less")
res$p.cor[i] <- cortest$p.val
res$cor[i] <- cortest$estimate
rm(cortest)
}
res$TP_DE[i] <- sum(get(paste0("modp.", j, ".lnHMmean"))[get(paste0(j, "_related"))] < res$modp[i])
res$TP_DD[i] <- sum(get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$modp[i])
res$TP_both[i] <- sum(get(paste0("modp.", j, ".lnHMmean"))[get(paste0(j, "_related"))] < res$modp[i] &
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$modp[i])
res$TP_DEonly[i] <- sum(get(paste0("modp.", j, ".lnHMmean"))[get(paste0(j, "_related"))] < res$modp[i] &
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] >= res$modp[i])
res$TP_DDonly[i] <- sum(get(paste0("modp.", j, ".lnHMmean"))[get(paste0(j, "_related"))] >= res$modp[i] &
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$modp[i])
}
assign(paste0(j, ".HM_HM_modp"), res)
# write.csv(get(paste0(j, ".HM_HM_modp")),
# here("Results/TCGA all results Sept 2020",
# paste0(j, "_mean_v_disp_HM.HM_known.genes_lfc.tiebreaker.csv")),
# row.names=F)
rm(modp, res)
}
# Compare HM using p-values (red) and modp (blue)
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$cor,
type="l",
xlim=c(0,1),
ylim=c(-1,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$cor,
col="blue")
}
# On full scale, very similar using modp and p-values.
# Showing up to 1e-4, for most cancers, using modp correlation is low very close to the
# start but higher than using p-values after about 5e-5.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$p.cor,
type="l",
xlim=c(0,1),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$p.cor,
col="blue")
}
# On full scale, correlation p-values generally stay close to zero for longer using p-values,
# but at or very close to zero using both methods for low p-values.
# Showing up to 1e-4, correlation p-values using modp are zero nearly from the very start,
# and can't see lines using p-values, so either same as using modp or don't exist.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,1),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$overlap / dat_modp$union,
col="blue")
}
# On full scale, overlap appears identical using modp and p-values.
# Showing up to 1e-4, overlap starts at zero using modp and quickly increases to same
# point where it starts using p-values, and then almost exactly same.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$p.hyper,
type="l",
xlim=c(0,1),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$p.hyper,
col="blue")
}
# On full scale, hypergeometric p-values appear identical using modp and p-values.
# Showing up to 1e-4, hypergeometric p-values nearly always 1 using modp except for kirc
# and coad, where they start at 1 and drop to zero immediately, whereas using p-values it
# also drops from 1 to zero, but isn't defined between zero and about 5e-5.
# Compare MDSeq (red) with HM using modp (blue)
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$cor,
type="l",
xlim=c(0,1),
ylim=c(-1,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$cor,
col="blue")
}
# On full scale, correlation always lower for HM.
# Showing up to 1e-4, where the correlation is defined, it's always lower for HM except at
# the very beginning.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$p.cor,
type="l",
xlim=c(0,1),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$p.cor,
col="blue")
}
# On full scale, correlation p-values always same or lower for HM.
# Showing up to 1e-4, correlation p-values are nearly always lower for HM from where they
# exist, starting at 1 and dropping immediately to zero.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,1),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$overlap / dat_modp$union,
col="blue")
}
# On full scale, overlap very similar but where it's different it's lower for HM
# Showing up to 1e-4, overlap is always lower for HM where it's defined, except at the very
# start for thca.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$pvals,
dat_pval$p.hyper,
type="l",
xlim=c(0,1),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$modp,
dat_modp$p.hyper,
col="blue")
}
# On full scale, hypergeometric p-values always lower for HM.
# Showing up to 1e-4, hypergeometric p-values are generally the same for HM and MDSeq, but
# for kirc and coad, they're 1 across nearly the whole range for MDSeq and zero for HM.
# Compare HM using p-values (red) and modp (blue) based on number of genes
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$cor,
type="l",
xlim=c(0,20000),
ylim=c(-1,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$cor,
col="blue")
}
# On full scale, correlation using modp has positive peaks at the very start, but over most
# of the range is lower than using p-values, and negative.
# Showing up to 1000 genes, correlation generally starts higher using modp, around zero or
# positive, but drops to negative and below line using p-values before about 500 genes.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$p.cor,
type="l",
xlim=c(0,20000),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$p.cor,
col="blue")
}
# On full scale, correlation p-values identical and at or very close to zero across most of
# range using modp and p-values.
# Showing up to 1000 genes, correlation p-value starts of high using modp where it's on
# a straight line from (0,0) using p-values. Drops to zero using modp between about 100
# and 600 genes.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,20000),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$overlap / dat_modp$union,
col="blue")
}
# On full scale, overlap identical using modp and p-values.
# Showing up to 1000 genes, overlap is low across the whole range using modp, where it's
# not defined using p-values.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_HM.HM_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$p.hyper,
type="l",
xlim=c(0,20000),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$p.hyper,
col="blue")
}
# On full scale, hypergeometric p-values usually the same using modp and p-values, but
# sometimes lower using modp.
# Showing up to 1000 genes, hypergeometric p-value is 1 across nearly whole range using
# modp, same as using p-values for most genes.
# Compare MDSeq (red) with HM using modp (blue) based on number of genes
par(mfrow=c(4,8), mar=c(2,2,2,0.5), mgp=c(3,0.7,0))
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$cor,
type="l",
xlim=c(0,20000),
ylim=c(-1,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$cor,
col="blue")
}
# On full scale, correlations usually the same or lower for HM across most of the range,
# but often lower for MDSeq near the start.
# Showing up to 1000 genes, correlation generally starts higher for HM than MDSeq but
# for most genes lower for HM by 1000 genes, and generally similar. It's never lower
# for HM than MDSeq at the start, but similar (and nearly always negative) for thca,
# thca, lihc and coad.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$p.cor,
type="l",
xlim=c(0,20000),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$p.cor,
col="blue")
}
# On full scale, correlation p-values nraly always lower for HM.
# Showing up to 1000 genes, correlation p-value is always lower for MDSeq than HM at
# the start (up to 100-600 genes), then generally zero for both, but for brca and lusc
# it goes down to zero for HM and increases for MDSeq.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$overlap / dat_pval$union,
type="l",
xlim=c(0,20000),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$overlap / dat_modp$union,
col="blue")
}
# On full scale, overlap nearly always lower for HM, but for some cancers lower for
# MDSeq near the start.
# Showing up to 1000 genes, overlap very similar for HM and MDSeq but where it's
# different, generally lower for MDSeq.
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat_pval <- get(paste0(i, "_MDSeq.MDSeq_mean_v_disp_known.genes"))
dat_modp <- get(paste0(i, ".HM_HM_modp"))
plot(dat_pval$union,
dat_pval$p.hyper,
type="l",
xlim=c(0,20000),
ylim=c(0,1),
col="red", main=i)
lines(dat_modp$union,
dat_modp$p.hyper,
col="blue")
}
# On full scale, hypergeometric p-values generally the same for MDSeq and HM, but where
# they're different they're usually lower for HM.
# Showing up to 1000 genes, hypergeometric p-values very similar, and at or very close
# to 1 across the whole range for both.
## HM DD v voom DE with lfc as tiebreaker for HM ####
for (j in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
assign(paste0("modp.", j, ".lnHMdisp"),
get(paste0("pvals.", j))$disp.lnHM.log.20k - abs(get(paste0("lfc.lnHMdisp_", j)))/1e7)
pvals <- sort(unique(c(get(paste0("pvals.", j))$voom, get(paste0("modp.", j, ".lnHMdisp")))))
res <- data.frame(
pvals = pvals,
listDE = numeric(length(pvals)),
listDD = numeric(length(pvals)),
overlap = numeric(length(pvals)),
p.hyper = numeric(length(pvals)),
exp.overlap = numeric(length(pvals)),
union = numeric(length(pvals)),
p.cor = numeric(length(pvals)),
cor = numeric(length(pvals)),
TP_DE = numeric(length(pvals)),
TP_DD = numeric(length(pvals)),
TP_both = numeric(length(pvals)),
TP_DEonly = numeric(length(pvals)),
TP_DDonly = numeric(length(pvals))
)
for (i in seq_len(length(pvals))) {
res$listDE[i] <- sum(get(paste0("pvals.", j))$voom < res$pvals[i])
res$listDD[i] <- sum(get(paste0("modp.", j, ".lnHMdisp")) < res$pvals[i])
res$overlap[i] <- sum(get(paste0("pvals.", j))$voom < res$pvals[i] &
get(paste0("modp.", j, ".lnHMdisp")) < res$pvals[i])
res$p.hyper[i] <- phyper(res$overlap[i],
res$listDE[i],
nrow(get(paste0("pvals.", j))) - res$listDE[i],
res$listDD[i])
res$exp.overlap[i] <- mean(get(paste0("pvals.", j))$voom < res$pvals[i]) *
mean(get(paste0("modp.", j, ".lnHMdisp")) < res$pvals[i]) * nrow(get(paste0("pvals.", j)))
res$union[i] <- sum(get(paste0("pvals.", j))$voom < res$pvals[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$pvals[i])
if (sum(get(paste0("pvals.", j))$voom < res$pvals[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$pvals[i]) > 1) {
cortest <-
cor.test(get(paste0("pvals.", j))$voom[get(paste0("pvals.", j))$voom < res$pvals[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$pvals[i]],
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0("pvals.", j))$voom < res$pvals[i] |
get(paste0("modp.", j, ".lnHMdisp")) < res$pvals[i]],
method="spearman", alt="less")
res$p.cor[i] <- cortest$p.val
res$cor[i] <- cortest$estimate
rm(cortest)
}
res$TP_DE[i] <- sum(get(paste0("pvals.", j))$voom[get(paste0(j, "_related"))] < res$pvals[i])
res$TP_DD[i] <- sum(get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$pvals[i])
res$TP_both[i] <- sum(get(paste0("pvals.", j))$voom[get(paste0(j, "_related"))] < res$pvals[i] &
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$pvals[i])
res$TP_DEonly[i] <- sum(get(paste0("pvals.", j))$voom[get(paste0(j, "_related"))] < res$pvals[i] &
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] >= res$pvals[i])
res$TP_DDonly[i] <- sum(get(paste0("pvals.", j))$voom[get(paste0(j, "_related"))] >= res$pvals[i] &
get(paste0("modp.", j, ".lnHMdisp"))[get(paste0(j, "_related"))] < res$pvals[i])
}
assign(paste0(j, ".voom_HM_lfc.tiebreaker"), res)
# write.csv(get(paste0(j, ".voom_HM_lfc.tiebreaker")),
# here("Results/TCGA all results Sept 2020",
# paste0(j, "_mean_v_disp_voom.HM_known.genes_lfc.tiebreaker.csv")),
# row.names=F)
rm(pvals, res)
}
## Compare true positives between voom and lnHM disp using lfc as tiebreaker ####
# Not really any way of comparing unique TPs for each method on the same scale unless the
# p-values from each method are on the same scale, since when they're very different, if
# using the union or overlap as the common scale, the method with smaller p-values idenitifies
# hundreds genes before the method with larger p-values identifies any.
par(mfrow=c(4,4), mar=c(0.2,1,0.2,0), mgp=c(2,0,0))
# TP from DE (red), DD (blue) by modified p-value
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat <- get(paste0(i, ".voom_HM_lfc.tiebreaker"))
plot(dat$pvals, dat$TP_DE, type="l", col="red", xaxt="n", ann=F, tcl=0)
lines(dat$pvals, dat$TP_DD, col='blue')
lines(dat$pvals, dat$TP_both, col='grey')
lines(dat$pvals, dat$TP_DEonly, col='red', lty=2)
lines(dat$pvals, dat$TP_DDonly, col='blue', lty=2)
legend('top', legend=i, bty="n")
}
# TP from DE (red), DD (blue) by number of discoveries
for (i in c("brca", "kirc", "thca", "luad", "lihc", "lusc", "prad", "coad")) {
dat <- get(paste0(i, ".voom_HM_lfc.tiebreaker"))
plot(dat$listDE, dat$TP_DE, type="l", col="red", xaxt="n", ann=F, tcl=0)
lines(dat$listDD, dat$TP_DD, col='blue')
legend('top', legend=i, bty="n")
}
rm(i,dat)
# Look pretty similar to previous results on full scale, except low end by number of
# discoveries, where there now isn't a big jump for HM. There are no cases where DD
# identifies more TPs than DE consistently, but for thca it looks like DD identifies
# more at the very low end and the two methods are very similar all the way along, and
# for luad and lusc they're quite similar all the way along, and for lihc at the low end.