-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlab_meta-analayses-v2.html
1409 lines (1325 loc) · 92.4 KB
/
lab_meta-analayses-v2.html
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
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<meta name="author" content="Ashfaq Ali • 23-Jul-2021" />
<title>Meta analyses of omics data</title>
<script src="lab_meta-analayses-v2_files/header-attrs-2.9/header-attrs.js"></script>
<script src="lab_meta-analayses-v2_files/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="lab_meta-analayses-v2_files/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
<script src="lab_meta-analayses-v2_files/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="lab_meta-analayses-v2_files/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="lab_meta-analayses-v2_files/bootstrap-3.3.5/shim/respond.min.js"></script>
<style>h1 {font-size: 34px;}
h1.title {font-size: 38px;}
h2 {font-size: 30px;}
h3 {font-size: 24px;}
h4 {font-size: 18px;}
h5 {font-size: 16px;}
h6 {font-size: 12px;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="lab_meta-analayses-v2_files/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="lab_meta-analayses-v2_files/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="lab_meta-analayses-v2_files/tocify-1.9.1/jquery.tocify.js"></script>
<script src="lab_meta-analayses-v2_files/navigation-1.1/tabsets.js"></script>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<style type="text/css">
code {
white-space: pre;
}
.sourceCode {
overflow: visible;
}
</style>
<style type="text/css" data-origin="pandoc">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ background-color: #f8f8f8; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ef2929; } /* Alert */
code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #c4a000; } /* Attribute */
code span.bn { color: #0000cf; } /* BaseN */
code span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4e9a06; } /* Char */
code span.cn { color: #000000; } /* Constant */
code span.co { color: #8f5902; font-style: italic; } /* Comment */
code span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */
code span.dt { color: #204a87; } /* DataType */
code span.dv { color: #0000cf; } /* DecVal */
code span.er { color: #a40000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #0000cf; } /* Float */
code span.fu { color: #000000; } /* Function */
code span.im { } /* Import */
code span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #204a87; font-weight: bold; } /* Keyword */
code span.op { color: #ce5c00; font-weight: bold; } /* Operator */
code span.ot { color: #8f5902; } /* Other */
code span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */
code span.sc { color: #000000; } /* SpecialChar */
code span.ss { color: #4e9a06; } /* SpecialString */
code span.st { color: #4e9a06; } /* String */
code span.va { color: #000000; } /* Variable */
code span.vs { color: #4e9a06; } /* VerbatimString */
code span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */
</style>
<script>
// apply pandoc div.sourceCode style to pre.sourceCode instead
(function() {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
try { var rules = sheets[i].cssRules; } catch (e) { continue; }
for (var j = 0; j < rules.length; j++) {
var rule = rules[j];
// check if there is a div.sourceCode rule
if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue;
var style = rule.style.cssText;
// check if color or background-color is set
if (rule.style.color === '' && rule.style.backgroundColor === '') continue;
// replace div.sourceCode by a pre.sourceCode rule
sheets[i].deleteRule(j);
sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
}
}
})();
</script>
<link rel="stylesheet" href="assets/lab.css" type="text/css" />
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
img {
max-width:100%;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
pre code {
padding: 0;
}
</style>
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
border: 1px solid #ddd;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "";
border: none;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs > li.active {
display: block;
}
.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
border: none;
display: inline-block;
border-radius: 4px;
background-color: transparent;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<!-- code folding -->
<style type="text/css">
#TOC {
margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
position: relative;
width: 100%;
}
}
@media print {
.toc-content {
/* see https://github.com/w3c/csswg-drafts/issues/4434 */
float: right;
}
}
.toc-content {
padding-left: 30px;
padding-right: 40px;
}
div.main-container {
max-width: 1200px;
}
div.tocify {
width: 20%;
max-width: 260px;
max-height: 85%;
}
@media (min-width: 768px) and (max-width: 991px) {
div.tocify {
width: 25%;
}
}
@media (max-width: 767px) {
div.tocify {
width: 100%;
max-width: none;
}
}
.tocify ul, .tocify li {
line-height: 20px;
}
.tocify-subheader .tocify-item {
font-size: 0.90em;
}
.tocify .list-group-item {
border-radius: 0px;
}
</style>
</head>
<body>
<div class="container-fluid main-container">
<!-- setup 3col/9col grid for toc_float and main content -->
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-3">
<div id="TOC" class="tocify">
</div>
</div>
<div class="toc-content col-xs-12 col-sm-8 col-md-9">
<div id="header">
<h1 class="title toc-ignore">Meta analyses of omics data</h1>
<h3 class="subtitle">Workshop on Omics Integration</h3>
<h4 class="author"><b>Ashfaq Ali</b> • 23-Jul-2021</h4>
</div>
<!-- rmd lab header -->
<!-- custom fonts -->
<p><link href="https://fonts.googleapis.com/css?family=Roboto|Source+Sans+Pro:300,400,600|Ubuntu+Mono&subset=latin-ext" rel="stylesheet"></p>
<p><br></p>
<div class="block-title-parent">
<div class="block-title small">
Output
</div>
</div>
<div id="installation-and-setup" class="section level2" number="0.1">
<h2><span class="header-section-number">0.1</span> Installation and setup</h2>
<p>Installation for this session can be achieved by following two alternatives.</p>
<ol style="list-style-type: decimal">
<li>**Using “renv” package by building an environment from the “.lock” file using</li>
</ol>
<p>Navigate to the “session_meta/” directory of the workshop and run following code chunk.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="do">## make sure that the renv.lock file for the session exists and do following.</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">install.packages</span>(<span class="st">"renv"</span>)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">restore</span>(<span class="at">lockfile =</span> <span class="st">"./Meta_tutorial/renv_r_4_1_0.lock"</span>, <span class="at">prompt =</span> <span class="cn">TRUE</span>) </span></code></pre></div>
</div>
<ol start="2" style="list-style-type: decimal">
<li>Using the docker image</li>
</ol>
<div class="block-title-parent">
<div class="block-title small">
bash
</div>
<div class="sourceCode" id="cb2"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co">########### Rstudio image for meta analyses ###########</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># Your user is 'omics' (without the quotes)</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="co"># Replace <yourpassword> with your desired password</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="ex">docker</span> run <span class="at">-d</span> <span class="at">--rm</span> <span class="at">-p</span> 8787:8787 <span class="at">-e</span> PASSWORD=<span class="op"><</span>yourpassword<span class="op">></span> ash706/omicsint_r</span></code></pre></div>
</div>
</div>
<div id="introduction" class="section level1" number="1">
<h1><span class="header-section-number">1</span> Introduction</h1>
<p>Meta analyses are commonly used in clinical studies to assess the effect
of a treatment or a genetic locus on a phenotype. With the advent of
GWAS (Genome wide association studies), various studies report summary
statistics on associated effects of genetic loci on phenotype. Meta
analyses can be useful in determining whether the effect size is
consistent across the body of data</p>
<p>The goal of a synthesis is to understand the results of any study in the
context of all the other studies. First, we need to know whether or not
the effect size is consistent across the body of data. If it is
consistent, then we want to estimate the effect size as accurately as
possible and to report that it is robust across the kinds of studies
included in the synthesis. On the other hand, if it varies substantially
from study to study, we want to quantify the extent of the variance and
consider the implications. Meta-analysis is able to address these issues
whereas the narrative review is not. We start with an example to show
how meta-analysis and narrative review would approach the same question,
and then use this example to highlight the key differences between the
two.</p>
</div>
<div id="meta-analyses-methods" class="section level1" number="2">
<h1><span class="header-section-number">2</span> Meta analyses Methods</h1>
<ol style="list-style-type: decimal">
<li><strong>p-value</strong></li>
</ol>
<!-- -->
<ol style="list-style-type: lower-alpha">
<li><a href="https://link.springer.com/chapter/10.1007%2F978-1-4612-4380-9_6"><strong>Fisher</strong></a>:
Sum of minus log-transformed <em>P</em>-values where larger Fisher score
reflects stronger aggregated differential expression evidence.</li>
<li><a href="https://cutt.ly/rc53t31"><strong>Stouffer</strong></a>: Sum of inverse normal
transformed <em>P</em>-values where larger Stouffer score to reflect
stronger aggregated statistical evidence.</li>
<li><a href="https://doi.org/10.1214/10-AOAS393"><strong>adaptively weighted
Fisher(AW)</strong></a><strong>, <a href="https://ui.adsabs.harvard.edu/abs/2011arXiv1108.3180L/abstract">original
publication</a></strong>
: assigns different weights to each individual study and it
searches through all possible weights to find the best adaptive
weight with the smallest derived <em>p</em>-value. One significant
advantage of this method is its ability to indicate which studies
contribute to the evidence aggregation and elucidates heterogeneity
in the meta-analysis.</li>
<li><a href="https://psycnet.apa.org/record/1951-06623-001"><strong>minimum p-value
(minP)</strong></a><strong>:</strong> The
minP method takes the minimum <em>p</em>-value among the <em>K</em> studies as the
test statistic</li>
<li><a href="https://psycnet.apa.org/record/1951-06623-001"><strong>maximum p-value
(maxP)</strong></a><strong>:</strong> The
maxP method takes maximum <em>p</em>-value as the test statistic</li>
<li><a href="https://pubmed.ncbi.nlm.nih.gov/25383132/"><strong>rth ordered p-value
(rOP)</strong></a><strong>:</strong> The rOP
method takes the <em>r-</em>th order statistic among sorted <em>p</em>-values
of <em>K</em>combined studies</li>
</ol>
<blockquote>
<p>Note: The assumption of uniformly distributed <em>P</em>-values under the
null hypothesis or can be done non-parametrically by permutation-based
analysis</p>
</blockquote>
<!-- -->
<ol start="2" style="list-style-type: decimal">
<li><strong>Effect Size based</strong></li>
</ol>
<!-- -->
<ol style="list-style-type: lower-alpha">
<li><a href="https://pubmed.ncbi.nlm.nih.gov/12855442/"><strong>fixed effects model
(FEM)</strong></a>:FEM combines the
effect size across <em>K</em> studies by assuming a simple linear model
with an underlying true effect size plus a random error in each
study</li>
<li><a href="https://pubmed.ncbi.nlm.nih.gov/12855442/"><strong>random effects model
(REM)</strong></a>: REM extends FEM
by allowing random effects for the inter-study heterogeneity in the
model. </li>
</ol>
<!-- -->
<ol start="3" style="list-style-type: decimal">
<li><strong>Rank based</strong></li>
</ol>
<!-- -->
<ol style="list-style-type: lower-alpha">
<li><a href="https://pubmed.ncbi.nlm.nih.gov/16982708/"><strong>rank product
(rankProd)</strong></a>RankProd and
RankSum are based on the common biological belief that if a gene is
repeatedly at the top of the lists ordered by up- or down-regulation
fold change in replicate experiments, the gene is more likely a DE
gene.</li>
<li><a href="https://pubmed.ncbi.nlm.nih.gov/16982708/"><strong>naive sum of ranks and naive product of
ranks</strong></a><strong>:</strong> These two
methods apply a naïve product or sum of the DE evidence ranks across
studies.</li>
</ol>
<div id="statistical-considerations" class="section level2" number="2.1">
<h2><span class="header-section-number">2.1</span> Statistical considerations</h2>
<p>In addition to statistical methods mentioned above, a number of factors
need to be considered for the choice of method. Different test
statistics maybe used depending on the type of outcome variable (e.g.
t-statistic or moderated t-statistic for binary outcome, F-statistic for
multi-class outcome, regression or correlation coefficient for
continuous outcome and log-rank statistic for survival outcome).</p>
<p>Here we will be using
<a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3463115/">MetaDE</a> package
that has implemented above mentioned methods.</p>
<p>A summary of the methods and their implementations for respective
outcome variables are listed in the table below as presented in the
original publication.</p>
<p><img src="images/Statistical_methods_MetaDE.png" /></p>
<p>For a detailed review of the applied methods for meta analyses, related
benchmarks and</p>
</div>
<div id="required-packages" class="section level2" number="2.2">
<h2><span class="header-section-number">2.2</span> Required packages</h2>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(magrittr)</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(plyr)</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(preproc)</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(MetaQC)</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(MetaDE)</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(MetaPath)</span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(MetaDCN)</span></code></pre></div>
</div>
</div>
</div>
<div id="summary-of-the-session" class="section level1" number="3">
<h1><span class="header-section-number">3</span> Summary of the session</h1>
<p>I this session we will be working with the “prostate8.rda” data set that
is located in the data directory of the “session_meta” directory of the
github repository for the course.</p>
<p>Some of the R packages packages we are using here are not available
through conda repositories and therefore need to be install from the
github repositories for the respective packages</p>
<p>The session comprises of following main steps</p>
<ol style="list-style-type: decimal">
<li>Explore the data and the packages</li>
<li>Filter the data based on QC</li>
<li>Perform differential expression analyses and meta analyses</li>
<li>Perfrom pathway analyses for meta analyses results</li>
<li>Perfrom pathway meta analyses</li>
<li>Network meta analyses (optional)</li>
<li>Exercise: compare different meta analyses methods including
AW-Fisher, REM, FEM ## Perform QC</li>
</ol>
</div>
<div id="data-for-the-session" class="section level1" number="4">
<h1><span class="header-section-number">4</span> Data for the session</h1>
<p>We will using prostate dataset</p>
<p>Load the protaste data set</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">load</span>(<span class="at">file =</span> <span class="st">"./data/prostate8.rda"</span>)</span></code></pre></div>
</div>
<p>The prostate data is comprised of 8 microarray studies from different
microarray platforms. Here it is provided in a list format where data
matrices and corresponding labels are provided.</p>
<p>Let us take a quick look at the data.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">names</span>(prostate8)</span></code></pre></div>
<pre><code>## [1] "data" "dataLabel"</code></pre>
</div>
<p>We can have a look at the structure of each data sets and evaluate what
sort of filtering steps we need to take.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(magrittr)</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">lapply</span>(prostate8<span class="sc">$</span>data, dim) <span class="sc">%>%</span> <span class="fu">as.data.frame</span>(<span class="at">row.names =</span> <span class="fu">c</span>(<span class="st">"genes"</span>, <span class="st">"samples"</span>))</span></code></pre></div>
<pre><code>## Welsh Yu Lapointe Varambally Singh Wallace Nanni Tomlins
## genes 8798 8799 13579 19738 8799 12689 12688 9703
## samples 34 146 103 13 102 89 30 57</code></pre>
</div>
<p>As we can see, the studies have different number of genes measured and
contain different number of samples. In a meta analyses, studies can
have different samples sizes but genes should match between different
studies. To be able to merge data sets, all data matrices should have
the same annotations</p>
<p>Let us look at the row names which are already set to gene names.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="fu">lapply</span>(prostate8<span class="sc">$</span>data, row.names) <span class="sc">%>%</span> <span class="fu">lapply</span>(.,head, <span class="dv">5</span>) <span class="sc">%>%</span> <span class="fu">as.data.frame</span>()</span></code></pre></div>
<pre><code>## Welsh Yu Lapointe Varambally Singh Wallace Nanni Tomlins
## 1 ACTB MAPK3 ITGB2 DDR1 MAPK3 DDR1 DDR1 ZFX
## 2 GLRA1 TIE1 HMBS PAX8 TIE1 RFC2 RFC2 PIGS
## 3 KCNB2 CXCR5 GATA6 THRA CXCR5 PAX8 HSPA6 ZPBP
## 4 MGAT5 DUSP1 ICAM5 CCL5 DUSP1 ESRRA PAX8 NOTCH3
## 5 BMP3 MMP10 RIN2 ESRRA MMP10 GAS6 PTPN21 IGSF11</code></pre>
</div>
<p>It is clear that the gene names are set to gene symbols for all data
sets and we can merge theses data set.</p>
<p>The second element of the lists corresponds to data labels where each
value corresponds to disease status of the individual where the sample
came from.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>prostate8<span class="sc">$</span>dataLabel <span class="sc">%>%</span> <span class="fu">lapply</span>(. ,table) <span class="sc">%>%</span> <span class="fu">as.data.frame</span>() <span class="sc">%>%</span> t</span></code></pre></div>
<pre><code>## [,1] [,2]
## Welsh.Var1 "0" "1"
## Welsh.Freq " 9" "25"
## Yu.Var1 "0" "1"
## Yu.Freq "81" "65"
## Lapointe.Var1 "0" "1"
## Lapointe.Freq "41" "62"
## Varambally.Var1 "0" "1"
## Varambally.Freq "6" "7"
## Singh.Var1 "0" "1"
## Singh.Freq "50" "52"
## Wallace.Var1 "0" "1"
## Wallace.Freq "20" "69"
## Nanni.Var1 "0" "1"
## Nanni.Freq " 7" "23"
## Tomlins.Var1 "0" "1"
## Tomlins.Freq "27" "30"</code></pre>
</div>
<p>Data labels indicate “0” as control and “1” as disease groups. We can
set these values to character format for convenience.</p>
<p>If everything looks good, we are good to go to the next step.</p>
<blockquote>
<p>Take a moment to explore the data in your own ways and fimilarise
yourself wit it.</p>
</blockquote>
<hr />
</div>
<div id="data-preprocessing" class="section level1" number="5">
<h1><span class="header-section-number">5</span> Data preprocessing</h1>
<div id="gene-matching" class="section level2" number="5.1">
<h2><span class="header-section-number">5.1</span> Gene matching</h2>
<p>Usually different microarray platforms use their own probe IDs or
experiments from different omics platforms can have annotations for
transcripts of proteins. To perform meta-analysis, one needs to match
probe/transcript IDs from different platforms to the unique official
gene ID, such as ENTREZ ID or gene symbol.</p>
<p>Options for situations for microarray data include</p>
<ul>
<li>take the average value of expression values across multiple probe
IDs to represent the corresponded gene symbol</li>
<li>select the probe ID with the largest interquartile range (IQR) of
expression</li>
<li>Or some version of summary at the gene level depending on the omics
platform.</li>
</ul>
<p>We do not cover the pre-processing steps for different omics
technologies at the moment but the workshop participants are encouraged
to apply the domain specific knowledge when setting up a meta analyses
study.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>MetaQC<span class="sc">::</span><span class="fu">metaOverlap</span>(prostate8<span class="sc">$</span>data) <span class="sc">%>%</span> </span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">lapply</span>(dim) <span class="sc">%>%</span> <span class="fu">as.data.frame</span>(<span class="at">row.names =</span> <span class="fu">c</span>(<span class="st">"genes"</span>, <span class="st">"samples"</span>))</span></code></pre></div>
<pre><code>## Welsh Yu Lapointe Varambally Singh Wallace Nanni Tomlins
## genes 4241 4241 4241 4241 4241 4241 4241 4241
## samples 34 146 103 13 102 89 30 57</code></pre>
</div>
<p>As you can see here, only 4241 genes are present in all studies and if
we are to filter out this way, we lose a lot of data.</p>
<blockquote>
<p>Biologically, it is likely that most genes are either un-expressed or
un-informative. In gene expression analysis to find DE genes, these
genes contribute to the false discoveries, so it is desirable to
filter out these genes prior to analysis. After genes are matched
across studies, the unique gene symbols are available across all
studies. Two sequential steps of gene filtering can be performed. In
the first step, we filter out genes with very low gene expression that
are identified with small average expression values across majority of
studies. And then we can remove genes that are not variable in your data sets
using variance estimates as they are not useful in comparisons.</p>
</blockquote>
<p>You can take a look at <a href="">preproc</a> package for some of the functions
available for filtering the data and the intuition behind the methods.
Here <code>Annotate(), Impute(), Filter() and Merge()</code> maybe useful for
pre-processing steps of the data analyses.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>data2 <span class="ot"><-</span> prostate8<span class="sc">$</span>data</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a>data2 <span class="ot"><-</span> preproc<span class="sc">::</span><span class="fu">Merge</span>(data2)</span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a>data.type <span class="ot">=</span> <span class="fu">rep</span>(<span class="st">"microarray"</span>, <span class="fu">length</span>(data2)) <span class="co"># a character vector for each study type</span></span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a>data2_filt <span class="ot"><-</span> preproc<span class="sc">::</span><span class="fu">Filter</span>(data2, <span class="at">del.perc =</span> <span class="fu">c</span>(<span class="fl">0.1</span>, <span class="fl">0.1</span>),<span class="at">data.type =</span> data.type ) <span class="co"># Here we specify the percentage of genes to be filtere, and specify the type of data for each study</span></span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a>summary_preproc <span class="ot"><-</span> <span class="fu">rbind</span>(<span class="fu">as.data.frame</span>(<span class="fu">lapply</span>(prostate8<span class="sc">$</span>data, dim))[<span class="dv">1</span>,],</span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.data.frame</span>(<span class="fu">lapply</span>(data2, dim))[<span class="dv">1</span>,], </span>
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.data.frame</span>(<span class="fu">lapply</span>(data2_filt, dim))</span>
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a> )</span>
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true" tabindex="-1"></a><span class="fu">rownames</span>(summary_preproc) <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"orginal"</span>, <span class="st">"merged"</span>, <span class="st">"mergeFiltered"</span>, <span class="st">"samples"</span>)</span>
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-14"><a href="#cb15-14" aria-hidden="true" tabindex="-1"></a>summary_preproc</span></code></pre></div>
<pre><code>## Welsh Yu Lapointe Varambally Singh Wallace Nanni Tomlins
## orginal 8798 8799 13579 19738 8799 12689 12688 9703
## merged 4241 4241 4241 4241 4241 4241 4241 4241
## mergeFiltered 3434 3434 3434 3434 3434 3434 3434 3434
## samples 34 146 103 13 102 89 30 57</code></pre>
</div>
<p>Note that the multiple gene expression data sets may not be very well
aligned by genes, and the number of genes in each study maybe different.
When we combine a large number of studies, the number of common genes
may be very small, so we need to allow for genes appearing in most
studies and missing in few studies etc.</p>
</div>
<div id="load-pathway-database" class="section level2" number="5.2">
<h2><span class="header-section-number">5.2</span> Load pathway database</h2>
<p>Let us perform quality control of the data for this meta analyses. We
are using the
<a href="https://academic.oup.com/nar/article/40/2/e15/2408973">“MetaQC”</a> that
identifies ways to objectively perform quality control for the
microarray studies.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="fu">load</span>(<span class="at">file =</span> <span class="st">"./data/pathways.rda"</span>)</span>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true" tabindex="-1"></a>DList<span class="ot">=</span>prostate8<span class="sc">$</span>data</span>
<span id="cb17-4"><a href="#cb17-4" aria-hidden="true" tabindex="-1"></a>colLabel<span class="ot">=</span>prostate8<span class="sc">$</span>dataLabel</span>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true" tabindex="-1"></a><span class="co">#GList=pathway[[1]]</span></span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true" tabindex="-1"></a><span class="co">#GList=pathwayDatabase</span></span>
<span id="cb17-7"><a href="#cb17-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb17-8"><a href="#cb17-8" aria-hidden="true" tabindex="-1"></a>filterGenes<span class="ot">=</span><span class="cn">TRUE</span></span>
<span id="cb17-9"><a href="#cb17-9" aria-hidden="true" tabindex="-1"></a>cutRatioByMean<span class="ot">=</span><span class="fl">0.3</span> <span class="co">#</span></span>
<span id="cb17-10"><a href="#cb17-10" aria-hidden="true" tabindex="-1"></a>cutRatioByVar<span class="ot">=</span><span class="fl">0.3</span></span>
<span id="cb17-11"><a href="#cb17-11" aria-hidden="true" tabindex="-1"></a><span class="co">#tic() not run</span></span>
<span id="cb17-12"><a href="#cb17-12" aria-hidden="true" tabindex="-1"></a>QCresult<span class="ot">=</span><span class="fu">MetaQC</span>(DList, colLabel, <span class="at">GList=</span><span class="fu">c</span>(Hallmark.genesets, KEGG.genesets, Immunologic.genesets),filterGenes,cutRatioByMean,cutRatioByVar ) <span class="do">## This will take some time depending on the number of studies and the type of data</span></span>
<span id="cb17-13"><a href="#cb17-13" aria-hidden="true" tabindex="-1"></a><span class="co">#toc()</span></span></code></pre></div>
</div>
<blockquote>
<p>If you are unable to run the above steps, please load the “QC.rda” from
the results directory of the session.</p>
</blockquote>
<div class="block-title-parent">
<div class="block-title small">
Output
</div>
</div>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>QCresult<span class="sc">$</span>scoreTable</span></code></pre></div>
<pre><code>## IQC EQC AQCg AQCp CQCg CQCp
## Welsh 4.6297212 5.0993305 28.269084964 0.000000 1.671669e+02 1.434671e+02
## Yu 9.4947631 9.4876742 21.725636675 0.000000 1.594930e+02 1.383082e+02
## Lapointe 3.5445936 3.9678407 24.326120224 0.000000 9.159887e+01 2.045790e+01
## Varambally 4.2482870 3.7655707 4.272765763 0.000000 1.858428e+01 3.795110e+01
## Singh 0.8946880 2.0302734 14.740646685 6.945533 4.447641e+01 5.839619e+01
## Wallace 8.1666052 8.9729647 0.003464049 0.000000 4.453816e-05 3.183405e-04
## Nanni 0.8134973 0.6480432 0.000000000 0.000000 3.324084e-01 2.562951e-04
## Tomlins 0.9366496 0.4514895 0.984994108 0.000000 7.892800e+00 1.767292e+01</code></pre>
</div>
<p>IQC, EQC, AQCg, AQCp, CQCg, CQCp</p>
<blockquote>
<p>Internal quality control index:small IQC indicated that the study had
heterogeneous coexpression structure with other studies and was
considered a candidate problematic study that should be excluded from
meta-analysis</p>
<p>the external quality control (EQC): small <em>EQC</em> indicated that the
study had low association with pathway in terms of gene pairwise
correlation structure and maybe considered a candidate problematic
study.</p>
<p>accuracy quality control (<em>AQC</em>) and a consistency quality control
(<em>CQC</em>).</p>
<p>Large <em>AQCg</em> measure for a given study indicate that DE genes produced
by study were reproducible compared to DE genes detected by
meta-analysis excluding study</p>
<p>Having a large CQCg measure for a given study indicated that DE
evidence produced by study was consistent with DE evidence generated
by meta-analysis excluding study. Please read the original <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3898528/#B14">MetQC
publication</a>
for a better understanding of the measures.</p>
</blockquote>
<p>We can now look at the two dimensional biplot based on PCA analyses and
get an idea of any studies that may not be of great quality.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>MetaQC<span class="sc">::</span><span class="fu">plotMetaQC</span>(QCresult<span class="sc">$</span>scoreTable)</span></code></pre></div>
<img src="lab_meta-analayses-v2_files/figure-html/qc-plot-1.svg" width="672" style="display: block; margin: auto auto auto 0;" />
</div>
<p>Although the <code>plotMetaQC()</code> function is a useful tool for visualization,
it does not necessarily allow automatic inclusion/exclusion criteria.</p>
<p>Note that our visualization and summarization tools were not meant for
an automated recommendation for inclusion/exclusion decision. In the
examples we explored, there were roughly three categories in the QC
results: definite exclusion cases with poor quality, definite inclusion
cases with good quality and borderline cases. </p>
<div id="update-based-on-the-qc" class="section level3" number="5.2.1">
<h3><span class="header-section-number">5.2.1</span> Update based on the QC</h3>
<p>Here Nanni and Tomlins are the two studies that maybe of low quality and
should perhaps be excluded from the analyses.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a>filterGenes<span class="ot">=</span><span class="cn">TRUE</span></span>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a>cutRatioByMean<span class="ot">=</span><span class="fl">0.3</span> <span class="co">#</span></span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a>cutRatioByVar<span class="ot">=</span><span class="fl">0.3</span></span>
<span id="cb21-4"><a href="#cb21-4" aria-hidden="true" tabindex="-1"></a>to_remove <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"Nanni"</span>, <span class="st">"Tomlins"</span>)</span>
<span id="cb21-5"><a href="#cb21-5" aria-hidden="true" tabindex="-1"></a>prostate6 <span class="ot"><-</span> <span class="fu">list</span>(<span class="at">data =</span> <span class="fu">within</span>(prostate8<span class="sc">$</span>data, <span class="fu">rm</span>(Nanni, Tomlins)), <span class="at">dataLabel=</span><span class="fu">within</span>(prostate8<span class="sc">$</span>dataLabel, <span class="fu">rm</span>(Nanni, Tomlins)))</span>
<span id="cb21-6"><a href="#cb21-6" aria-hidden="true" tabindex="-1"></a>prostate_fil <span class="ot"><-</span> <span class="fu">list</span>(<span class="at">data =</span> MetaQC<span class="sc">::</span><span class="fu">metaOverlap</span>(prostate6<span class="sc">$</span>data), <span class="at">dataLabel=</span>prostate6<span class="sc">$</span>data)</span>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true" tabindex="-1"></a>prostate6<span class="sc">$</span>data <span class="ot"><-</span>MetaQC<span class="sc">::</span><span class="fu">metaFilterData</span>(prostate_fil<span class="sc">$</span>data,<span class="at">cutRatioByVar =</span> cutRatioByVar, <span class="at">cutRatioByMean =</span> cutRatioByMean)</span>
<span id="cb21-8"><a href="#cb21-8" aria-hidden="true" tabindex="-1"></a><span class="fu">lapply</span>(prostate6, names)</span>
<span id="cb21-9"><a href="#cb21-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb21-10"><a href="#cb21-10" aria-hidden="true" tabindex="-1"></a><span class="fu">as.data.frame</span>(<span class="fu">lapply</span>(prostate6<span class="sc">$</span>data, dim))</span></code></pre></div>
<pre><code>## $data
## [1] "Welsh" "Yu" "Lapointe" "Varambally" "Singh"
## [6] "Wallace"
##
## $dataLabel
## [1] "Welsh" "Yu" "Lapointe" "Varambally" "Singh"
## [6] "Wallace"
##
## Welsh Yu Lapointe Varambally Singh Wallace
## 1 3399 3399 3399 3399 3399 3399
## 2 34 146 103 13 102 89</code></pre>
</div>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a>DList<span class="ot">=</span>prostate6<span class="sc">$</span>data</span>
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a>colLabel<span class="ot">=</span>prostate6<span class="sc">$</span>dataLabel</span>
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a><span class="co">#GList=pathway[[1]]</span></span>
<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a><span class="co">#GList=pathwayDatabase</span></span>
<span id="cb23-5"><a href="#cb23-5" aria-hidden="true" tabindex="-1"></a>filterGenes<span class="ot">=</span><span class="cn">TRUE</span></span>
<span id="cb23-6"><a href="#cb23-6" aria-hidden="true" tabindex="-1"></a>cutRatioByMean<span class="ot">=</span><span class="fl">0.3</span> <span class="co">#</span></span>
<span id="cb23-7"><a href="#cb23-7" aria-hidden="true" tabindex="-1"></a>cutRatioByVar<span class="ot">=</span><span class="fl">0.3</span></span>
<span id="cb23-8"><a href="#cb23-8" aria-hidden="true" tabindex="-1"></a>QCresult2<span class="ot">=</span><span class="fu">MetaQC</span>(DList, colLabel, <span class="at">GList=</span><span class="fu">c</span>(Hallmark.genesets, KEGG.genesets, Immunologic.genesets), filterGenes, cutRatioByMean, cutRatioByVar)</span></code></pre></div>
</div>
<blockquote>
<p>AGAIN, if you are unable to run the code, please load</p>
</blockquote>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="fu">load</span>(<span class="st">"results/QC_step2.rda"</span>)</span></code></pre></div>
</div>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>QCresult2<span class="sc">$</span>scoreTable</span></code></pre></div>
<pre><code>## IQC EQC AQCg AQCp CQCg CQCp
## Welsh 4.3956311 3.9486143 38.42833030 0 1.913178e+02 4.028780e-02
## Yu 7.0164906 6.8265364 42.25733812 0 1.964917e+02 1.920686e-14
## Lapointe 1.5414898 1.7423903 16.70625993 0 9.884958e+01 0.000000e+00
## Varambally 3.5800781 2.9649972 7.18472473 0 2.391464e+01 0.000000e+00
## Singh 0.4912204 0.3180309 12.36863835 0 4.555982e+01 0.000000e+00
## Wallace 6.4044351 6.7765190 0.02200338 0 2.785632e-03 0.000000e+00</code></pre>
</div>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="fu">plotMetaQC</span>(<span class="at">scoreTable =</span> QCresult2<span class="sc">$</span>scoreTable)</span></code></pre></div>
<img src="lab_meta-analayses-v2_files/figure-html/qc-plot-2-1.svg" width="672" style="display: block; margin: auto auto auto 0;" />
</div>
</div>
</div>
</div>
<div id="meta-differential-expression-analyses" class="section level1" number="6">
<h1><span class="header-section-number">6</span> Meta Differential Expression analyses</h1>
<p>We have listed the methods for differential expression meta analyses in
the introduction section that are implemented in the MetaDE package.
Here we will try the best performing methods including AW Fischer, REM
and rOP. A detailed comparison of relative performances of each of the
statistical methods is descibed <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3898528/#B14">Lun-Ching
etal</a>.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>data <span class="ot"><-</span> prostate6<span class="sc">$</span>data <span class="co"># Extract the expression matrices</span></span>
<span id="cb28-2"><a href="#cb28-2" aria-hidden="true" tabindex="-1"></a>clin.data <span class="ot"><-</span> prostate6<span class="sc">$</span>dataLabel <span class="co"># extract lables for each sample</span></span>
<span id="cb28-3"><a href="#cb28-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-4"><a href="#cb28-4" aria-hidden="true" tabindex="-1"></a>K <span class="ot"><-</span> <span class="fu">length</span>(data)</span>
<span id="cb28-5"><a href="#cb28-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-6"><a href="#cb28-6" aria-hidden="true" tabindex="-1"></a>clin.data <span class="ot"><-</span> <span class="fu">lapply</span>(clin.data, <span class="cf">function</span>(x) {<span class="fu">data.frame</span>(x)} )</span>
<span id="cb28-7"><a href="#cb28-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-8"><a href="#cb28-8" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span> (k <span class="cf">in</span> <span class="dv">1</span><span class="sc">:</span><span class="fu">length</span>(clin.data)){</span>
<span id="cb28-9"><a href="#cb28-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">colnames</span>(clin.data[[k]]) <span class="ot"><-</span> <span class="st">"label"</span></span>
<span id="cb28-10"><a href="#cb28-10" aria-hidden="true" tabindex="-1"></a> clin.data[[k]] <span class="ot"><-</span> (<span class="fu">ifelse</span>(clin.data[[k]]<span class="sc">==</span><span class="dv">0</span>, <span class="st">"Control"</span>, <span class="st">"Cancer"</span>))</span>
<span id="cb28-11"><a href="#cb28-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-12"><a href="#cb28-12" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb28-13"><a href="#cb28-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-14"><a href="#cb28-14" aria-hidden="true" tabindex="-1"></a><span class="co">#clin.data <- lapply(clin.data, function(x) {data.frame(x)} )</span></span>
<span id="cb28-15"><a href="#cb28-15" aria-hidden="true" tabindex="-1"></a>select.group <span class="ot"><-</span> <span class="fu">c</span>(<span class="st">"Control"</span>, <span class="st">"Cancer"</span>)</span>
<span id="cb28-16"><a href="#cb28-16" aria-hidden="true" tabindex="-1"></a>ref.level <span class="ot"><-</span> <span class="st">"Control"</span></span>
<span id="cb28-17"><a href="#cb28-17" aria-hidden="true" tabindex="-1"></a>data.type <span class="ot"><-</span> <span class="st">"continuous"</span></span>
<span id="cb28-18"><a href="#cb28-18" aria-hidden="true" tabindex="-1"></a>ind.method <span class="ot"><-</span> <span class="fu">rep</span>(<span class="st">'limma'</span>,<span class="fu">length</span>(data))</span>
<span id="cb28-19"><a href="#cb28-19" aria-hidden="true" tabindex="-1"></a>resp.type <span class="ot"><-</span> <span class="st">"twoclass"</span></span>
<span id="cb28-20"><a href="#cb28-20" aria-hidden="true" tabindex="-1"></a>paired <span class="ot"><-</span> <span class="fu">rep</span>(<span class="cn">FALSE</span>,<span class="fu">length</span>(data))</span>
<span id="cb28-21"><a href="#cb28-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-22"><a href="#cb28-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-23"><a href="#cb28-23" aria-hidden="true" tabindex="-1"></a>meta.method <span class="ot"><-</span> <span class="st">"Fisher"</span></span>
<span id="cb28-24"><a href="#cb28-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-25"><a href="#cb28-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb28-26"><a href="#cb28-26" aria-hidden="true" tabindex="-1"></a>meta.res <span class="ot"><-</span> <span class="fu">MetaDE</span>(<span class="at">data=</span>data,<span class="at">clin.data =</span> clin.data,</span>
<span id="cb28-27"><a href="#cb28-27" aria-hidden="true" tabindex="-1"></a> <span class="at">data.type=</span>data.type,<span class="at">resp.type =</span> resp.type,</span>
<span id="cb28-28"><a href="#cb28-28" aria-hidden="true" tabindex="-1"></a> <span class="at">response=</span><span class="st">'label'</span>,</span>
<span id="cb28-29"><a href="#cb28-29" aria-hidden="true" tabindex="-1"></a> <span class="at">ind.method=</span>ind.method, <span class="at">meta.method=</span>meta.method,</span>
<span id="cb28-30"><a href="#cb28-30" aria-hidden="true" tabindex="-1"></a> <span class="at">select.group =</span> select.group, <span class="at">ref.level=</span>ref.level,</span>
<span id="cb28-31"><a href="#cb28-31" aria-hidden="true" tabindex="-1"></a> <span class="at">paired=</span>paired,<span class="at">tail=</span><span class="st">'abs'</span>,<span class="at">parametric=</span><span class="cn">TRUE</span>)</span>
<span id="cb28-32"><a href="#cb28-32" aria-hidden="true" tabindex="-1"></a>meta.res.summary <span class="ot"><-</span> MetaDE<span class="sc">::</span><span class="fu">summary.meta</span>(meta.res, <span class="at">resp.type =</span> resp.type, <span class="at">meta.method =</span> meta.method)</span>
<span id="cb28-33"><a href="#cb28-33" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(meta.res.summary)</span>
<span id="cb28-34"><a href="#cb28-34" aria-hidden="true" tabindex="-1"></a><span class="co"># save(meta.res, meta.res.summary, file = "./results/resMetaDE.rda")</span></span></code></pre></div>
<pre><code>## Please make sure the following is correct:
## *You input 6 studies
## *You selected limma limma limma limma limma limma for your 6 studies respectively
## * Fisher was chosen to combine the 6 studies,respectively
## dataset 1 is done
## dataset 2 is done
## dataset 3 is done
## dataset 4 is done
## dataset 5 is done
## dataset 6 is done
## Parametric method was used instead of permutation
## ind.stat.Welsh ind.stat.Yu ind.stat.Lapointe ind.stat.Varambally
## GPR12 -0.01447604 0.37943628 0.28513849 0.1086048
## RPS19 0.20673665 0.23162454 0.77668332 0.1880854
## GALNT2 -0.11916266 0.11168920 0.36585563 0.3870752
## MSI1 0.29758865 0.02367612 0.37455130 0.6647996
## FCGRT -0.36240927 -0.10877216 -0.53210661 -0.3114009
## CD163 0.15648617 0.08638936 0.08651916 1.2875034
## ind.stat.Singh ind.stat.Wallace ind.p.Welsh ind.p.Yu ind.p.Lapointe
## GPR12 -0.106957489 -0.3301548 0.978695463 0.006504890 2.762384e-01
## RPS19 1.026749249 -0.4766147 0.016116661 0.002484948 3.768341e-10
## GALNT2 0.005348824 0.2825572 0.428375201 0.437773064 8.001044e-02
## MSI1 -0.180755089 -0.2662394 0.669863110 0.860595368 2.907234e-03
## FCGRT 0.022247198 0.1003269 0.000154019 0.155941050 4.359881e-06
## CD163 -0.211345323 -0.2461299 0.464836081 0.624141614 6.057858e-01
## ind.p.Varambally ind.p.Singh ind.p.Wallace stat pval
## GPR12 0.81888709 0.0354446198 5.153568e-02 25.69660 1.184580e-02
## RPS19 0.14991966 0.0005284280 6.684494e-06 106.36720 3.121382e-17
## GALNT2 0.05198725 0.9191733351 2.091679e-02 22.21530 3.517649e-02
## MSI1 0.26369912 0.0002454798 3.765074e-01 34.02685 6.679961e-04
## FCGRT 0.13151895 0.8052767733 4.739980e-01 51.94301 6.345524e-07
## CD163 0.04866036 0.0040981743 2.567059e-01 23.23721 2.577828e-02
## FDR
## GPR12 1.563039e-02
## RPS19 5.358373e-16
## GALNT2 4.258009e-02
## MSI1 1.116283e-03
## FCGRT 1.846613e-06
## CD163 3.195602e-02</code></pre>
</div>
<blockquote>
<p>If you were unable to run the MetaDE analyses, you can load the results of the above
commands to review the output by usingh <code>load("./results/resMetaDE.rda")</code></p>
</blockquote>
<div id="plot-meta-analyses-results-in-a-heatmap." class="section level2" number="6.1">
<h2><span class="header-section-number">6.1</span> Plot meta analyses results in a heatmap.</h2>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>fdr.cut <span class="ot"><-</span> <span class="fl">1e-7</span></span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a><span class="fu">pdf</span>(<span class="st">'./results/heatmap.DE.pdf'</span>)</span>
<span id="cb30-3"><a href="#cb30-3" aria-hidden="true" tabindex="-1"></a><span class="fu">heatmap.sig.genes</span>(meta.res, <span class="at">meta.method=</span>meta.method,</span>
<span id="cb30-4"><a href="#cb30-4" aria-hidden="true" tabindex="-1"></a> <span class="at">fdr.cut=</span>fdr.cut,<span class="at">color=</span><span class="st">"GR"</span>)</span>
<span id="cb30-5"><a href="#cb30-5" aria-hidden="true" tabindex="-1"></a><span class="fu">dev.off</span>()</span></code></pre></div>
</div>
<div class="figure">
<img src="images/heatmap-sig-genes.png" style="height:150.0%" alt="" />
<p class="caption">heatmap</p>
</div>
</div>
<div id="pathway-analyses-based-on-meta-analyses" class="section level2" number="6.2">
<h2><span class="header-section-number">6.2</span> Pathway analyses based on meta analyses</h2>
<p>At this stage, one can do pathway analyses directly on the genes that
appear to be differentially regulated based on the meta analyses
performed above.</p>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb31"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a>meta.p <span class="ot"><-</span> meta.res<span class="sc">$</span>meta.analysis<span class="sc">$</span>pval</span>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a>ks.result <span class="ot"><-</span> <span class="fu">PathAnalysis</span>(<span class="at">meta.p =</span> meta.p, <span class="at">enrichment =</span> <span class="st">"KS"</span>)</span>
<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a>fisher.result <span class="ot"><-</span> <span class="fu">PathAnalysis</span>(<span class="at">meta.p =</span> meta.p, <span class="at">enrichment =</span> <span class="st">"Fisher's exact"</span>)</span>
<span id="cb31-4"><a href="#cb31-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-5"><a href="#cb31-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-6"><a href="#cb31-6" aria-hidden="true" tabindex="-1"></a><span class="do">## One can customize pathway datbase to update the results like following</span></span>
<span id="cb31-7"><a href="#cb31-7" aria-hidden="true" tabindex="-1"></a><span class="fu">load</span>(<span class="at">file =</span> <span class="st">"./data/pathwayDatabase.rda"</span>)</span>
<span id="cb31-8"><a href="#cb31-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-9"><a href="#cb31-9" aria-hidden="true" tabindex="-1"></a><span class="do">## Let us look into the database</span></span>
<span id="cb31-10"><a href="#cb31-10" aria-hidden="true" tabindex="-1"></a>pathway_names <span class="ot"><-</span> pathwayDatabase <span class="sc">%>%</span> <span class="fu">names</span>() <span class="sc">%>%</span> stringr<span class="sc">::</span><span class="fu">str_split</span>(<span class="at">pattern =</span> <span class="st">"_"</span>, <span class="at">simplify =</span> <span class="cn">TRUE</span>) <span class="sc">%>%</span> {.[,<span class="dv">1</span>]} <span class="sc">%>%</span> <span class="fu">unique</span>()</span>
<span id="cb31-11"><a href="#cb31-11" aria-hidden="true" tabindex="-1"></a><span class="fu">print</span>(pathway_names)</span>
<span id="cb31-12"><a href="#cb31-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-13"><a href="#cb31-13" aria-hidden="true" tabindex="-1"></a>path.res <span class="ot"><-</span> MetaDE<span class="sc">::</span><span class="fu">PathAnalysis</span>(meta.p ,<span class="at">pathway =</span> pathwayDatabase, <span class="at">p.cut =</span> <span class="fl">0.05</span>,</span>
<span id="cb31-14"><a href="#cb31-14" aria-hidden="true" tabindex="-1"></a> <span class="at">enrichment =</span> <span class="st">"Fisher's exact"</span>, <span class="at">DEgene.number =</span> <span class="dv">400</span>, <span class="at">size.min =</span> <span class="dv">10</span>, <span class="at">size.max =</span> <span class="dv">500</span>)</span></code></pre></div>
</div>
<blockquote>
<p>The pathway analyses performed here is based on the p-values obtained
after the joint meta analyses of all the studies in your data. Some
time individual study level pathway analyses is reported and we are
interested in combining pathway level summary statistics. We will
explore that in our next session where we will perform the analyses
using <strong>“MetaPath”</strong> package.</p>
</blockquote>
</div>
<div id="exercise" class="section level2" number="6.3">
<h2><span class="header-section-number">6.3</span> Exercise</h2>
<ul>
<li><p>Perform DE meta analyses using any two methods among “AW-Fisher”,
“FEM,”REM and “minMCC” and compare the number of differentially
expressed genes detected at FDR <0.05. Take a look at the
<code>?MetaDE::MetaD</code> function to change the parameters.</p></li>
<li><p>Perform pathway analyses based one of the methods you tried and see
whether any differences at pathway level were detected.</p></li>
</ul>
<div class="block-title-parent">
<div class="block-title small">
R
</div>
<div class="sourceCode" id="cb32"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a>meta.method <span class="ot"><-</span> <span class="st">"AW"</span></span>