-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgene-expression.html
1611 lines (1472 loc) · 141 KB
/
gene-expression.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="Chun-Hui Gao, Hui Cao, Peng Cai, et.al." />
<meta name="date" content="2021-07-23" />
<title>Emergent transcriptional adaption facilitates the convergent succession within a synthetic community</title>
<script src="gene-expression_files/header-attrs-2.9/header-attrs.js"></script>
<script src="gene-expression_files/jquery-3.5.1/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="gene-expression_files/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="gene-expression_files/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="gene-expression_files/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="gene-expression_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="gene-expression_files/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="gene-expression_files/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="gene-expression_files/tocify-1.9.1/jquery.tocify.js"></script>
<script src="gene-expression_files/navigation-1.1/tabsets.js"></script>
<link href="gene-expression_files/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="gene-expression_files/highlightjs-9.12.0/highlight.js"></script>
<script src="gene-expression_files/htmlwidgets-1.5.3/htmlwidgets.js"></script>
<script src="gene-expression_files/plotly-binding-4.9.4.1/plotly.js"></script>
<script src="gene-expression_files/typedarray-0.1/typedarray.min.js"></script>
<link href="gene-expression_files/crosstalk-1.1.1/css/crosstalk.css" rel="stylesheet" />
<script src="gene-expression_files/crosstalk-1.1.1/js/crosstalk.min.js"></script>
<link href="gene-expression_files/plotly-htmlwidgets-css-1.57.1/plotly-htmlwidgets.css" rel="stylesheet" />
<script src="gene-expression_files/plotly-main-1.57.1/plotly-latest.min.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;}</style>
<script type="text/javascript">
if (window.hljs) {
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
if (document.readyState && document.readyState === "complete") {
window.setTimeout(function() { hljs.initHighlighting(); }, 0);
}
}
</script>
<style type="text/css">
/* for pandoc --citeproc since 2.11 */
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
</style>
<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">Emergent transcriptional adaption facilitates the convergent succession within a synthetic community</h1>
<h4 class="author">Chun-Hui Gao, Hui Cao, Peng Cai, et.al.</h4>
<h4 class="date">2021-07-23</h4>
</div>
<div id="growth-of-e.-coli-and-p.-putida-in-monoculture-and-cocultures" class="section level2">
<h2>Growth of <em>E. coli</em> and <em>P. putida</em> in monoculture and cocultures</h2>
<p><code>qPCR_data</code> contains the result of species-specific quantitative PCR. It has five columns:</p>
<ul>
<li>sample: Sample name</li>
<li>condition: monoculture and coculture names. The two-species coculture system has five different initial abundance, two of which were monocultures, and the other three had the initial ratio (EC/PP) of 1:1000, 1:1, 1000:1, respectively. For convenience, we named the <em>P. putida</em> monoculture, 1:1000, 1:1, 1000:1 cocultures and <em>E. coli</em> monoculture as related to the proportion of <em>E. coli</em> to five groups of “none,” “less,” “equal,” “more” and “all,” respectively.</li>
<li>time: sample time.</li>
<li>species: species name. In cocultures, the quantity was related to two species, respectively.</li>
<li>quantity: the quantity of species, as calculated from the qPCR CT value and standard curves.</li>
</ul>
<p>For example:</p>
<pre class="r"><code>qPCR_data <- read.csv("data/qPCR-data.csv")
qPCR_data$condition <- factor(qPCR_data$condition,
levels = c("none","less","equal","more","all"))
head(qPCR_data)</code></pre>
<pre><code>## sample condition time species quantity
## 1 Sample 1 all 0 EC 150753360
## 2 Sample 1 all 0 EC 179451379
## 3 Sample 1 all 0 EC 197309047
## 4 Sample 1 all 0 EC 325275685
## 5 Sample 1 all 0 EC 389286192
## 6 Sample 1 all 0 EC 299844026</code></pre>
<pre class="r"><code>organism <- c("EC","PP")
organsim_fullname <- c("EC"="E. coli","PP"="P. putida")</code></pre>
<div id="comparision-of-coculture-and-monoculture-quantities" class="section level3">
<h3>Comparision of coculture and monoculture quantities</h3>
<p>Figure <a href="#fig:monoculture-vs-coculture">1</a> shows Growth curves of <em>E. coli</em> and <em>P. putida</em> in monoculture (A) and the “1:1000,” “1:1,” “1000:1” cocultures (B-D). The quantities were determined using species-specific qPCR as described in methods. In B-D subplots, the growth curves of monocultures were placed on the background layer (dashed lines), shows the variance analysis of the species abundances between monoculture and the “1:1000” (b), “1:1” (d), and “1000:1” (d) cocultures. The significance of p-values were showed by “*” (p<0.05), “**” (p<0.01) or “ns” (p>0.05).</p>
<pre class="r"><code># stats
growth_data <- qPCR_data %>% group_by(species,time,condition) %>%
summarise(y=median(log10(quantity)),std=sd(log10(quantity),na.rm = T))
# separate monoculture and coculture
monoculture <- growth_data %>%
filter(condition %in% c("none","all"))
coculture <- growth_data %>%
filter(condition %in% c("less","equal","more"))
# plot
growth_curve_mono <- ggplot(monoculture,aes(time,y,color=species)) +
geom_line(lty="dashed",size=1) +
geom_errorbar(aes(ymin=y-std,ymax=y+std),size=.5) +
geom_point(data = monoculture)</code></pre>
<pre class="r"><code>library(rstatix)
qPCR_stat <- qPCR_data %>% mutate(
condition = fct_other(condition,
keep=c("less","equal","more"),
other_level = "mono")) %>%
group_by(time,species) %>%
wilcox_test(.,quantity ~ condition,ref.group = "mono") %>%
mutate(condition = group2) %>%
select(time,species,condition,p.adj,p.adj.signif)
# significance
variance <- qPCR_data %>%
filter(condition %in% c("less","equal","more")) %>%
group_by(time,condition,species) %>%
summarise(y=max(log10(quantity))) %>%
ungroup() %>%
left_join(qPCR_stat)
variance_plot <- function(cond){
qPCR_stat %>% filter(condition == cond) %>%
left_join(filter(coculture, condition==cond)) %>%
ggplot(aes(time,y,color=species)) +
geom_line(size=1,alpha=1/2) +
geom_point(size=2,alpha=1/2) +
geom_line(lty="dashed",size=1,alpha=1/3,data = monoculture) +
geom_errorbar(aes(ymin=y-std,ymax=y+std),size=.5,data = monoculture,alpha=1/3) +
ggrepel::geom_text_repel(aes(label=p.adj.signif),
max.overlaps = 20,
segment.colour = "black",
show.legend = F)
}
plots <- lapply(c("less","equal","more"), variance_plot)
plots = lapply(c(list(growth_curve_mono),plots), function(p){
p +
ylab("Log(quantity)") + xlab("Time (h)") +
scale_y_continuous(limits = c(5,11),breaks = 5:10) +
scale_color_discrete(labels=organsim_fullname,name="Species") +
theme_bw() +
theme(legend.position = c(0.7,0.3),
legend.text = element_text(face = "italic"))
})
plot_grid(plotlist = plots,labels = "auto", ncol = 3)</code></pre>
<div class="figure" style="text-align: center"><span id="fig:monoculture-vs-coculture"></span>
<img src="gene-expression_files/figure-html/monoculture-vs-coculture-1.png" alt="Analysis the variance of the species abundances between monoculture and cocultures" width="75%" />
<p class="caption">
Figure 1: Analysis the variance of the species abundances between monoculture and cocultures
</p>
</div>
<pre class="r"><code>export::graph2ppt(append = TRUE)</code></pre>
</div>
<div id="ratio-ecpp-changes-in-cocultures" class="section level3">
<h3>Ratio (EC/PP) changes in cocultures</h3>
<p>Ratios of EC/PP in cocultures were calculated, and ratio changes in cocultures were compared in Figure <a href="#fig:ratio-change">2</a>.</p>
<pre class="r"><code># calculate ratio in cocultures
ratio <- qPCR_data %>%
filter(condition %in% c("less","equal","more")) %>%
group_by(sample, condition, species, time) %>%
mutate(rep = row_number()) %>%
ungroup() %>%
pivot_wider(names_from = species, values_from = quantity) %>%
mutate(ratio = EC/PP) %>%
filter(!is.na(ratio))</code></pre>
<p>Figure <a href="#fig:ratio-change">2</a> shows the deterministic assembly of <em>E. coli</em> and <em>P. putida</em> cocultures. (A) the real-time ratio of EC: PP after 0, 0.5, 1, 2, 4, 8 and 24 h cultivation. (B) Analysis of the variances of EC/PP ratios (24h) between cocultures.</p>
<pre class="r"><code>ratio.sum <- ratio %>%
group_by(sample) %>%
mutate(y=mean(ratio,na.rm=TRUE),std=sd(ratio,na.rm=TRUE)) %>%
dplyr::select(sample,condition, time, y, std) %>%
unique()
ratio.sum$condition <- factor(ratio.sum$condition,
levels = c("less","equal","more"),
labels = c("1:1000","1:1","1000:1"))
plot_ratio <- ggplot(ratio.sum, aes(time,y,shape=condition,color=condition)) +
geom_rect(aes(xmin=23,xmax=25,ymin=0.02,ymax=0.3),
fill="lightyellow",color="black",alpha=0.1) +
geom_line(size=1,show.legend = F) +
geom_point(size=2,show.legend = F) +
geom_errorbar(aes(ymin=y-std,ymax=y+std),show.legend = F) +
geom_text(aes(x=9,label=condition),hjust=0,vjust=c(0,0,1),
data = filter(ratio.sum,time==8),
show.legend = F) +
scale_y_log10(labels=formatC,breaks=10^(-3:3),
expand = expansion(0.1)) +
geom_bracket(xmin = 0, xmax = 2,y.position=3.5,label = "ns",inherit.aes = FALSE) +
geom_bracket(xmin = 0, xmax = 4,y.position=1,label = "ns",inherit.aes = FALSE) +
geom_bracket(xmin = 0, xmax = 4,y.position=0.001,label = "ns",inherit.aes = FALSE) +
labs(x="Time (h)", y="Ratio (EC/PP)") +
theme(legend.position = c(0.8,0.75))
ratio_24h <- ratio %>% filter(time==24)
plot_ratio_stats <- ggplot(ratio_24h,aes(condition,ratio,color=condition)) +
geom_boxplot(fill="lightyellow") +
geom_jitter() +
stat_compare_means(
comparisons = list(c("less","equal"),c("less","more"),c("equal","more")),
label="p.format") +
scale_x_discrete(breaks=c("less","equal","more"),
labels=c("1:1000","1:1","1000:1"))+
xlab("Condition") + ylab("Ratio (EC/PP)") +
scale_y_continuous(expand = expansion(0.2)) +
theme(legend.position = "none",
panel.background = element_rect(fill="lightyellow"))
plot_grid(plot_ratio,plot_ratio_stats,labels = "auto", ncol = 3, rel_widths = c(2,1.2,2))</code></pre>
<div class="figure" style="text-align: center"><span id="fig:ratio-change"></span>
<img src="gene-expression_files/figure-html/ratio-change-1.png" alt="Deterministic assembly of E. coli and P. putida cocultures. (A) the real-time ratio of EC: PP after 0, 0.5, 1, 2, 4, 8 and 24 h cultivation. (B) Analysis of the variances of EC/PP ratios (24h) between cocultures." width="75%" />
<p class="caption">
Figure 2: Deterministic assembly of <em>E. coli</em> and <em>P. putida</em> cocultures. (A) the real-time ratio of EC: PP after 0, 0.5, 1, 2, 4, 8 and 24 h cultivation. (B) Analysis of the variances of EC/PP ratios (24h) between cocultures.
</p>
</div>
<pre class="r"><code>export::graph2ppt(append = TRUE)</code></pre>
<p>Notably, the ratio differences were non-significant by time in the logarithmic phase, but were all significant in the stationary phase for every coculture (Figure <a href="#fig:comparison-by-time">3</a>).</p>
<p>For each coculture, significance of variances between each sample were as follows:</p>
<ul>
<li>the 1:1000 coculture</li>
</ul>
<pre class="r"><code>### stats
ratio1 <- ratio %>% filter(condition=="less")
(p1 <- pairwise.wilcox.test(ratio1$ratio,ratio1$time,p.adjust.method = "BH"))</code></pre>
<pre><code>##
## Pairwise comparisons using Wilcoxon rank sum exact test
##
## data: ratio1$ratio and ratio1$time
##
## 0 0.5 1 2 4 8
## 0.5 0.5359 - - - - -
## 1 0.9372 0.4596 - - - -
## 2 0.0785 0.4062 0.1049 - - -
## 4 0.1848 0.4596 0.1848 0.7341 - -
## 8 0.0045 0.0045 0.0045 0.0045 0.0045 -
## 24 0.0045 0.0045 0.0045 0.0045 0.0045 0.1049
##
## P value adjustment method: BH</code></pre>
<ul>
<li>the 1:1 coculture</li>
</ul>
<pre class="r"><code>ratio2 <- ratio %>% filter(condition=="equal")
(p2 <- pairwise.wilcox.test(ratio2$ratio,ratio2$time,p.adjust.method = "BH"))</code></pre>
<pre><code>##
## Pairwise comparisons using Wilcoxon rank sum exact test
##
## data: ratio2$ratio and ratio2$time
##
## 0 0.5 1 2 4 8
## 0.5 0.7727 - - - - -
## 1 0.2902 0.2197 - - - -
## 2 0.7273 0.7922 0.3364 - - -
## 4 0.6364 0.7922 0.3364 0.7727 - -
## 8 0.0051 0.0083 0.0051 0.0051 0.0051 -
## 24 0.0051 0.0083 0.0051 0.0051 0.0051 0.0051
##
## P value adjustment method: BH</code></pre>
<ul>
<li>and the 1000:1 coculture</li>
</ul>
<pre class="r"><code>ratio3 <- ratio %>% filter(condition=="more")
(p3 <- pairwise.wilcox.test(ratio3$ratio,ratio3$time,p.adjust.method = "BH"))</code></pre>
<pre><code>##
## Pairwise comparisons using Wilcoxon rank sum exact test
##
## data: ratio3$ratio and ratio3$time
##
## 0 0.5 1 2 4 8
## 0.5 0.2968 - - - - -
## 1 0.6991 0.2358 - - - -
## 2 0.3636 0.1152 0.4500 - - -
## 4 0.0070 0.0070 0.0130 0.3636 - -
## 8 0.0051 0.0051 0.0051 0.0070 0.0051 -
## 24 0.0051 0.0051 0.0051 0.0070 0.0051 0.0051
##
## P value adjustment method: BH</code></pre>
<p>Figure <a href="#fig:comparison-by-time">3</a> shows P-values of pairwise comparison of real-time EC/PP ratios in the “1:1000” (A), “1:1” (B) and “1000:1” (C) cocultures. Circles showed the adjusted p-value for the comparison of the EC/PP ratios between two samples, which were indicated on the top and left (large circle mean large p-value). On this plot, a cross mark was given if the p-value is non-significant (P > 0.05).</p>
<pre class="r"><code>par(mfrow=c(1,3))
pvalues <- list(p1,p2,p3)
line = 0
cex = 1.2
side = 3
adj=0.15
plots <- lapply(seq_along(pvalues), function(i){
x <- pvalues[[i]]
corrplot(x$p.value,
type = "lower",
col = "grey",
cl.pos = "n",
is.corr = FALSE,
method = "circle",
p.mat = x$p.value,
sig.level = 0.05)
mtext(LETTERS[[i]], side = side, line = line, cex = cex, adj = adj)
})</code></pre>
<div class="figure" style="text-align: center"><span id="fig:comparison-by-time"></span>
<img src="gene-expression_files/figure-html/comparison-by-time-1.png" alt="P-values of pairwise comparison of real-time EC/PP ratios in the “1:1000” (A), “1:1” (B) and “1000:1” (C) cocultures." width="75%" />
<p class="caption">
Figure 3: P-values of pairwise comparison of real-time EC/PP ratios in the “1:1000” (A), “1:1” (B) and “1000:1” (C) cocultures.
</p>
</div>
</div>
</div>
<div id="gene-expression-analysis" class="section level2">
<h2>Gene expression analysis</h2>
<p>To reveal the mechanism of community assembly in cocultures, we investigated the transcriptomic changes in cocultures using RNA-seq analysis.</p>
<p>Totally 60 samples were sequences. After sequencing quality control, each sample has 2.6 – 3.9 M paired reads, and 3.9 – 5.9 G base pairs, having an overall coverage of 300 X at least. After filtration, high-quality reads were aligned against the P. putida (<a href="https://www.ncbi.nlm.nih.gov/genome/?term=pseudomonas+putida+kt2440" class="uri">https://www.ncbi.nlm.nih.gov/genome/?term=pseudomonas+putida+kt2440</a>) and E.coli reference genome (<a href="https://www.ncbi.nlm.nih.gov/genome/?term=Escherichia+coli+K-12" class="uri">https://www.ncbi.nlm.nih.gov/genome/?term=Escherichia+coli+K-12</a>) using hisat2 and gene expression changes were quantified using DESeq2 software <span class="citation">(Herberg et al. 2016; Love, Huber, and Anders 2014)</span>. While aligning to reference genomes, the overall aligned rates are ranging from 97.23% to 98.43%.</p>
<pre class="r"><code>tableS1 <- read.xlsx("./data/tableS1.xlsx")
summary(tableS1)</code></pre>
<pre><code>## Condition Time Sample Raw_Read_Number
## Length:60 Min. : 0 Length:60 Min. :26331150
## Class :character 1st Qu.: 3 Class :character 1st Qu.:30196483
## Mode :character Median : 6 Mode :character Median :32429121
## Mean : 9 Mean :32696008
## 3rd Qu.:12 3rd Qu.:34950975
## Max. :24 Max. :39576900
## Raw_Bases Raw_N_rate Raw_GC_content Raw_Q20_rate
## Min. :3.976e+09 Min. :0.000965 Min. :51.10 Min. :95.75
## 1st Qu.:4.560e+09 1st Qu.:0.002455 1st Qu.:51.74 1st Qu.:96.39
## Median :4.897e+09 Median :0.004755 Median :55.62 Median :96.56
## Mean :4.937e+09 Mean :0.005884 Mean :55.54 Mean :96.63
## 3rd Qu.:5.278e+09 3rd Qu.:0.005086 3rd Qu.:59.09 3rd Qu.:96.95
## Max. :5.976e+09 Max. :0.016776 Max. :60.07 Max. :97.30
## Raw_Q30_rate Trimmed_Read_Number Trimmed_Bases Useful_read%
## Min. :89.66 Min. :26217232 Min. :3.943e+09 Min. :99.17
## 1st Qu.:90.98 1st Qu.:29991340 1st Qu.:4.511e+09 1st Qu.:99.38
## Median :91.43 Median :32249039 Median :4.859e+09 Median :99.46
## Mean :91.59 Mean :32514927 Mean :4.896e+09 Mean :99.44
## 3rd Qu.:92.41 3rd Qu.:34741486 3rd Qu.:5.234e+09 3rd Qu.:99.50
## Max. :93.06 Max. :39286830 Max. :5.921e+09 Max. :99.64
## Useful_bases% align_rate%
## Min. :98.40 Min. :97.23
## 1st Qu.:99.12 1st Qu.:97.98
## Median :99.21 Median :98.10
## Mean :99.15 Mean :98.03
## 3rd Qu.:99.27 3rd Qu.:98.22
## Max. :99.34 Max. :98.43</code></pre>
<p>Figure <a href="#fig:reads-count">4</a> shows the reads count of <em>E. coli</em> and <em>P. putida</em> in each RNA-seq library. Samples were taken with each condition at indicated times (at 0, 4, 8 and 24h). (A-D) <em>P. putida</em> monoculture samples; (E-H) <em>E. coli</em> and <em>P. putida</em> “1:1000” coculture; (I-L) the “1:1” coculture; (M-P) the “1000:1” coculture; and (Q-T) the <em>E. coli</em> monoculture samples. Each sample has three replicates. Only aligned reads to either <em>E. coli</em> or <em>P. putida</em> genome were used in this calculation. Plots showed the proportion of reads which have aligned to corresponding genome by different colors, as indicated on the top.</p>
<pre class="r"><code>ht_counts <- readRDS(file = "./data/ht_counts.rds")
ht_counts$group <- factor(ht_counts$group,
levels = c("none_0h","none_4h","none_8h","none_24h","less_0h","less_4h","less_8h","less_24h","equal_0h","equal_4h","equal_8h","equal_24h","more_0h","more_4h","more_8h","more_24h","all_0h","all_4h","all_8h","all_24h"),
labels = c("P. putida_0h","P. putida_4h","P. putida_8h","P. putida_24h","1:1000_0h","1:1000_4h","1:1000_8h","1:1000_24h","1:1_0h","1:1_4h","1:1_8h","1:1_24h","1000:1_0h","1000:1_4h","1000:1_8h","1000:1_24h","E. coli_0h","E. coli_4h","E. coli_8h","E. coli_24h"))
ht_counts_total <- ht_counts %>% group_by(sample_id, group, organism) %>%
summarise(sum_of_reads=sum(count)) %>%
group_by(sample_id) %>%
mutate(proportion=sum_of_reads/sum(sum_of_reads))
samples <- levels(ht_counts_total$group)
plots <- lapply(1:length(samples),function(i){
sample_group <- samples[[i]]
df <- filter(ht_counts_total,group==sample_group)
ggplot(df,aes(x=sample_id, y=proportion,fill=organism)) +
geom_bar(stat = "identity",position = "stack") +
scale_y_continuous(labels = function(l)paste(format(l*100,digits = 2),"%",sep="")) +
scale_x_discrete(labels=c("Rep1","Rep2","Rep3")) +
scale_fill_discrete(name="Organism: ",labels=c("EC"="E. coli","PP"="P. putida")) +
labs(title = sample_group) +
theme(legend.text = element_text(face = "italic"),
legend.position = "none",
axis.title = element_blank())
})
legend <- get_legend(plots[[1]] + theme(legend.position = "top",legend.direction = "horizontal"))
plot_grid(legend, plot_grid(plotlist = plots,labels = "auto",ncol=4),rel_heights = c(1,15),ncol=1)</code></pre>
<div class="figure" style="text-align: center"><span id="fig:reads-count"></span>
<img src="gene-expression_files/figure-html/reads-count-1.png" alt="Reads count of *E. coli* and *P. putida* in each RNA-seq library" width="75%" />
<p class="caption">
Figure 4: Reads count of <em>E. coli</em> and <em>P. putida</em> in each RNA-seq library
</p>
</div>
<div id="identify-gene-expression-changes" class="section level3">
<h3>Identify gene expression changes</h3>
<p>This step is a time consuming step. Use the precalculated DEG if possible.</p>
<pre class="r"><code># load precalculated DEG results.
dds.EC <- readRDS("data/dds.EC.2.rds")
dds.PP <- readRDS("data/dds.PP.2.rds")
DEG_results.EC <- readRDS("data/DEG_results.EC.rds")
DEG_results.PP <- readRDS("data/DEG_results.PP.rds")</code></pre>
</div>
<div id="rna-seq-clustering" class="section level3">
<h3>RNA-seq clustering</h3>
<p>First of all, we compared the gene expression profiles between monoculture and cocultures at genome level. Figure <a href="#fig:RNA-seq-PCA">5</a> shows the Principle coordinate analysis (PCA) of the gene expression profiles of <em>E. coli</em> (A) and <em>P. putida</em> (B) in different samples.</p>
<pre class="r"><code>list_of_vsd <- lapply(list(dds.EC,dds.PP),function(dds){
vst(dds,blind = F)
})
list_of_vsd[[1]]$ratio0 <- factor(list_of_vsd[[1]]$ratio0,
levels = c("none","less","equal","more","all"),
labels = c("P. putida","1:1000","1:1","1000:1","E. coli"))
list_of_vsd[[2]]$ratio0 <- factor(list_of_vsd[[2]]$ratio0,
levels = c("none","less","equal","more","all"),
labels = c("P. putida","1:1000","1:1","1000:1","E. coli"))</code></pre>
<p>The results showed that the gene expression profiles were different between monoculture and cocultures in the beginning, and became more consistent in the later (Fig. <a href="#fig:RNA-seq-PCA">5</a>A). Differences in gene expression appeared immediately after mixing of <em>E. coli</em> and <em>P. putida</em>, which has been described by 0h data (due to the time required for manual operation, this is of course not the real 0h). The expression profiles (0h) of <em>E. coli</em> monoculture, “1:1” and “1000:1” cocultures are close, but the “1:1000” coculture is distinct from the others. At 4h and 8h, we can still visually separate the “less” samples and the others on the plots. However, the expression profiles of <em>E. coli</em> became closer by time. After 24h cultivation, there was no obvious boundary between <em>E. coli</em> monoculture and three cocultures. Likewise, the expression profiles of <em>P. putida</em> has a similar pattern, except that the distance between “1000:1” coculture and other three samples was more obvious (Fig. <a href="#fig:RNA-seq-PCA">5</a>B).</p>
<pre class="r"><code>myPlotPCA <- function(object,
intgroup = c("time","ratio0"),
show.label = FALSE,
return_data = FALSE) {
require(dplyr,quietly = T)
require(DESeq2,quietly = T)
require(vegan,quietly = T)
pca <- rda(t(assay(object)))
percent_var <- pca$CA$eig/pca$tot.chi
if (!all(intgroup %in% names(colData(object)))) {
stop("the argument 'intgroup' should specify columns of colData(dds)")
}
intgroup_df <- as.data.frame(colData(object)[, intgroup,
drop = FALSE]) %>%
tibble::rownames_to_column(var = "sample_id")
df <- scores(pca)$sites %>%
as.data.frame() %>%
tibble::rownames_to_column(var="sample_id") %>%
left_join(intgroup_df,by="sample_id") %>%
mutate(time=factor(time,levels = sort(unique(as.numeric(time)))))
if (return_data){
attr(df, "percentvar") <- percent_var
return(df)
}
mapping <- aes(PC1, PC2, color=ratio0, label=sample_id)
p <- ggplot(df,mapping) +
geom_point(size=2) +
xlab(paste0("PC1: ", round(percent_var[1] * 100), "% variance")) +
ylab(paste0("PC2: ", round(percent_var[2] * 100), "% variance"))
if (show.label) {
return(p + geom_text_repel(show.legend = F))
} else {
return(p)
}
}</code></pre>
<pre class="r"><code>list_of_PCA_plot <- lapply(list_of_vsd, function(vsd) {
myPlotPCA(vsd) +
facet_wrap(~time,ncol=4) +
directlabels::geom_dl(aes(label=ratio0),method = "smart.grid",size=2) + #文本代替标签 位置标注的不好,改size没用
scale_color_manual(limits=c("E. coli","1:1000","1:1","1000:1","P. putida"),
values = brewer.pal(5,"Dark2")) +
theme(legend.position = "none")
})
plot_grid(plotlist = list_of_PCA_plot,labels = "auto",ncol=1)</code></pre>
<div class="figure" style="text-align: center"><span id="fig:RNA-seq-PCA"></span>
<img src="gene-expression_files/figure-html/RNA-seq-PCA-1.png" alt="Principle coordinate analysis (PCA) of the gene expression profiles of *E. coli* (A) and *P. putida* (B) in different samples." width="75%" />
<p class="caption">
Figure 5: Principle coordinate analysis (PCA) of the gene expression profiles of <em>E. coli</em> (A) and <em>P. putida</em> (B) in different samples.
</p>
</div>
</div>
<div id="beta-dispersion" class="section level3">
<h3>Beta-dispersion</h3>
<p>According to one of the reviewers’ suggestions, we <strong>use the beta-dispersion</strong> to compare the significance of gene expression change within different time points.</p>
<pre class="r"><code>models = lapply(list_of_vsd, function(object){
dist = vegdist(t(assay(object)), method = "euclidean")
group_data = colData(object) %>%
as_tibble() %>%
dplyr::mutate(group=paste0(ratio0," (",time,"h)"))
mod = with(group_data, betadisper(dist, group = group))
return(mod)
})</code></pre>
<p>We define a function <code>ggplot.betadisper()</code> to plot <em>betadisper</em> object with ggplot2 methods.</p>
<pre class="r"><code># group meta data
group_meta = tableS1 %>%
dplyr::rename_all(tolower) %>%
dplyr::select(sample, condition, time) %>%
dplyr::mutate(condition = factor(condition,
levels = c("none","less","equal","more","all"),
labels = c("P. putida","1:1000","1:1","1000:1","E. coli"))) %>%
dplyr::mutate(group = paste0(condition," (",time,"h)"))
ggplot.betadisper = function(x){
percent_var = x$eig/sum(x$eig)
xylab = paste0("PCoA ", 1:2, ": ", round(percent_var[1:2] * 100), "% variance")
sites = scores(x, display = "sites", choices = c(1,2)) %>%
as.data.frame() %>%
tibble::rownames_to_column(var="sample")
sites$group = x$group
sites = left_join(sites, group_meta)
centroids = scores(x, display = "centroids", choices = 1:2) %>%
as.data.frame() %>%
tibble::rownames_to_column(var="group")
centroids = left_join(centroids, group_meta %>% select(-sample) %>% unique())
ggplot() +
aes_string(x="PCoA1",y="PCoA2") +
geom_point(aes(color = condition), shape = 21, alpha = 1/2,data = sites) +
geom_polygon(aes(fill=condition, group=group), data=sites, alpha=1/2) +
geom_point(aes(color=condition, fill=condition), shape=21, size = 3, data=centroids ) +
ggrepel::geom_label_repel(aes(label = group, color = condition),
data=centroids,
alpha=1/2,
label.size = NA,
segment.color = "grey",
fontface = "bold.italic") +
scale_color_manual(limits=c("E. coli","1:1000","1:1","1000:1","P. putida"),
values = brewer.pal(5,"Dark2")) +
scale_fill_manual(limits=c("E. coli","1:1000","1:1","1000:1","P. putida"),
values = brewer.pal(5,"Dark2")) +
labs(x = xylab[[1]],
y = xylab[[2]]) +
theme(legend.position = "none")
}</code></pre>
<pre class="r"><code>p1 = ggplot.betadisper(models[[1]])
p1</code></pre>
<div class="figure" style="text-align: center"><span id="fig:betadisper-ec"></span>
<img src="gene-expression_files/figure-html/betadisper-ec-1.png" alt="0.5" width="75%" />
<p class="caption">
Figure 6: 0.5
</p>
</div>
<pre class="r"><code>export::graph2ppt(append = TRUE)</code></pre>
<pre class="r"><code>p2 = ggplot.betadisper(models[[2]])
p2</code></pre>
<div class="figure" style="text-align: center"><span id="fig:betadisper-pp"></span>
<img src="gene-expression_files/figure-html/betadisper-pp-1.png" alt="0.5" width="75%" />
<p class="caption">
Figure 7: 0.5
</p>
</div>
<pre class="r"><code>export::graph2ppt(append = TRUE)</code></pre>
<div id="comparison-of-dispersion" class="section level4">
<h4>Comparison of dispersion</h4>
<ul>
<li>For the dispersion of <em>E. coli</em></li>
</ul>
<p>The gene expression dispersion of 1:1000 is the highest at 0 and 4 h.</p>
<pre class="r"><code>par(mar = c(7,5,2,1))
boxplot(models[[1]], las = 2, xlab = NA,
main = expression( italic(E.~coli )))</code></pre>
<p><img src="gene-expression_files/figure-html/unnamed-chunk-13-1.png" width="75%" style="display: block; margin: auto;" /></p>
<ul>
<li>For the dispersion of <em>P. putida</em></li>
</ul>
<p>The gene expression dispersion of 1000:1 is the highest at 0, 4 and 8 h.</p>
<pre class="r"><code>par(mar = c(7,5,2,1))
boxplot(models[[2]], las = 2, xlab = NA,
main = expression(italic(P.~putida)))</code></pre>
<p><img src="gene-expression_files/figure-html/unnamed-chunk-14-1.png" width="75%" style="display: block; margin: auto;" /></p>
</div>
</div>
<div id="number-of-degs" class="section level3">
<h3>Number of DEGs</h3>
<p>Figure <a href="#fig:number-of-deg">8</a> shows the numbers of differentially expressed genes (DEGs) in three cocultures, in <em>E. coli</em> (A) and <em>P. putida</em> (B). The DEGs were identified by comparison with the corresponding monoculture at the same time. Up- and down-regulation of genes were colored by red and cyan, respectively.</p>
<pre class="r"><code>## count DEG
deg_count <- function(data){
do.call("rbind",lapply(data, function(x) table(x$expression))) %>%
as.data.frame() %>%
rownames_to_column(var = "name") %>%
separate(name, into = c("ratio","time"), sep = "_", extra = "drop") %>%
mutate(time = as.numeric(str_extract(time, "[0-9]+"))) %>%
pivot_longer(cols = c("dn","up"), names_to = "type", values_to = "count") %>%
mutate(count = ifelse(type == "dn", -count, count)) %>%
complete(ratio, time, type, fill = list(count = 0)) %>%
mutate(ratio = factor(ratio,
levels = c("less","equal","more"),
labels = c("1:1000","1:1","1000:1")),
type = factor(type,
levels = c("up","dn"),
labels = c("Up","Down")))
}
deg_count_EC <- deg_count(DEG_results.EC)
deg_count_PP <- deg_count(DEG_results.PP)
count <- list(deg_count_EC, deg_count_PP)
library(ggtext)
deg_count_plots <- lapply(seq_along(count), function(i){
x <- count[[i]]
ggplot(x, aes(x = time, y = count, color = type)) +
geom_point() +
geom_line(size = 1) +
scale_y_continuous(labels = function(x){abs(x)}) +
facet_wrap(~ratio) +
labs(x="Time(h)",y="Number of DEGs",
color = "Gene expression:",
title= paste0("DEGs in *",organsim_fullname[[i]],"*")) +
theme(legend.position = c(0.618,1),
legend.justification = c(0.5,-0.65),
legend.direction = "horizontal",
plot.title = element_markdown())
})
plot_grid(plotlist = deg_count_plots,labels = "auto",ncol = 1)</code></pre>
<div class="figure" style="text-align: center"><span id="fig:number-of-deg"></span>
<img src="gene-expression_files/figure-html/number-of-deg-1.png" alt="numbers of differentially expressed genes (DEGs) in three cocultures, in *E. coli* (A) and *P. putida* (B)." width="75%" />
<p class="caption">
Figure 8: numbers of differentially expressed genes (DEGs) in three cocultures, in <em>E. coli</em> (A) and <em>P. putida</em> (B).
</p>
</div>
</div>
<div id="specific-degs-in-e.-coli-and-p.-putida" class="section level3">
<h3>Specific DEGs in <em>E. coli</em> and <em>P. putida</em></h3>
<p>Figure <a href="#fig:deg-venn">9</a> shows the comparision of differentially expressed genes by time in <em>E. coli</em> (A-C) and <em>P. putida</em> (D-F). Although DEGs overlapped for different time, specific genes are the majority in almost every time point. For instance, 57 out of 93 DEGs are specific in 1:1000 coculture in <em>E. coli</em> (Fig. <a href="#fig:deg-venn">9</a>A).</p>
<pre class="r"><code>library(ggVennDiagram)
ratio0 <- c("1:1000","1:1","1000:1")
deg_Venn_plot_EC <- lapply(seq_along(ratio0), function(i){
gene_list <- lapply(DEG_results.EC[(i*4-3):(i*4)], function(x){x$gene})
ggVennDiagram(gene_list,label = "count",
category.names = c("0h","4h","8h","24h")) +
scale_fill_gradient(low="white",high="red",limits=c(0,310)) +
labs(title=paste0(ratio0[[i]]," - *E. coli*")) +
theme(legend.position = "none",
plot.title = element_markdown(hjust=0.5))
})
deg_Venn_plot_PP <- lapply(seq_along(ratio0), function(i){
gene_list <- lapply(DEG_results.PP[(i*4-3):(i*4)], function(x){x$gene})
ggVennDiagram(gene_list,label = "count",
category.names = c("0h","4h","8h","24h")) +
scale_fill_gradient(low="white",high="red",limits=c(0,310)) +
labs(title=paste0(ratio0[[i]]," - *P. putida*")) +
theme(legend.position = "none",
plot.title = element_markdown(hjust=0.5))
})
plot_grid(plotlist = c(deg_Venn_plot_EC,deg_Venn_plot_PP),
labels = "auto")</code></pre>
<div class="figure" style="text-align: center"><span id="fig:deg-venn"></span>
<img src="gene-expression_files/figure-html/deg-venn-1.png" alt="Comparision of differentially expressed genes by time" width="75%" />
<p class="caption">
Figure 9: Comparision of differentially expressed genes by time
</p>
</div>
</div>
</div>
<div id="enrichment-analysis-of-degs" class="section level2">
<h2>Enrichment analysis of DEGs</h2>
<p>We use <strong>clusterProfiler</strong> to perform KEGG enrichment analysis.</p>
<pre class="r"><code>kegg_path_tree <- function(df, pathway_name, gene_id, sep="/"){
pathway <- df %>%
separate_rows(all_of(gene_id), sep = sep) %>%
dplyr::select(all_of(c(pathway_name, gene_id))) %>%
unique() %>%
mutate(value = 1) %>%
pivot_wider(id_cols = pathway_name,
names_from = gene_id,
values_from = value,
values_fill = list(value = 0))
library(vegan)
matrix <- as.matrix(column_to_rownames(pathway, pathway_name))
dist <- vegdist(matrix, method = "jaccard")
library(ape)
library(ggtree)
tree <- bionj(dist)
p <- ggtree(tree,branch.length = "none")
p$data %>%
filter(isTip) %>%
arrange(y) %>%
pull(label)
}
ck_plot <- function(ck,
mapping = aes(time, Description, size = GeneRatio)){
df <- data.frame(ck) %>%
mutate(ratio = factor(ratio, levels = c("less","equal","more"),
labels = c("1:1000","1:1","1000:1")),
time = factor(time, levels = c("0h","4h","8h","24h")))
df$Description <- factor(df$Description,
levels =
kegg_path_tree(df,
pathway_name = "Description",
gene_id = "geneID"))
df$GeneRatio <- sapply(df$GeneRatio, function(x) eval(parse(text = x)))
ggplot(df, mapping = mapping) +
geom_point() +
facet_grid(~ ratio, scales = "free_y") +
labs(y="KEGG pathway")
}
grid_panel_autoheight <- function(p){
# 调整panel的高度
require(gtable)
gp <- ggplotGrob(p)
# gtable_show_layout(gp)
facet.rows <- gp$layout$t[grepl("panel",gp$layout$name)]
y.var <- sapply(ggplot_build(p)$layout$panel_scales_y,
function(l) length(l$range$range))
gp$heights[facet.rows] <- gp$heights[facet.rows] * y.var
return(gp)
}
reset_facet_width <- function(p, rel_width = c(1)){
gp <- ggplotGrob(p)
facet.cols <- gp$layout$l[grepl("panel",gp$layout$name)]
gp$widths[facet.cols] <- gp$widths[facet.cols] * rel_width
return(gp)
}</code></pre>
<div id="kegg-enrichment-in-e.-coli" class="section level3">
<h3>KEGG enrichment in <em>E. coli</em></h3>
<pre class="r"><code>deg1 <- do.call("rbind", DEG_results.EC) %>%
separate(comparison, into = c("ratio","time"), extra = "drop")
ck1 <- compareCluster(gene ~ ratio + time,
data = deg1,
fun = "enrichKEGG",
organism = "eco",
use_internal_data = TRUE)
p1 <- ck_plot(ck1)
p1 <- grid_panel_autoheight(p1)</code></pre>
</div>
<div id="kegg-enrichment-in-p.-putida" class="section level3">
<h3>KEGG enrichment in <em>P. putida</em></h3>
<pre class="r"><code>deg2 <- do.call("rbind", DEG_results.PP) %>%
separate(comparison, into = c("ratio","time"), extra = "drop")
ck2 <- compareCluster(gene ~ ratio + time,
data = deg2,
fun = "enrichKEGG",
organism = "ppu",
use_internal_data = TRUE)
p2 <- ck_plot(ck2)
p2 <- grid_panel_autoheight(p2)</code></pre>
</div>
<div id="dotplot-of-kegg-enrichment-results" class="section level3">
<h3>Dotplot of KEGG enrichment results</h3>
<pre class="r"><code>plot_grid(p1,p2, rel_heights = c(1,0.3), ncol = 1, labels = "auto",align = "v")</code></pre>
<pre><code>## Warning: Graphs cannot be vertically aligned unless the axis parameter is set.
## Placing graphs unaligned.</code></pre>
<div class="figure" style="text-align: center"><span id="fig:kegg-ora"></span>
<img src="gene-expression_files/figure-html/kegg-ora-1.png" alt="A dot plot shows the KEGG enrichment result of E. coli (A) and P. putida (B) in the three coculture as a function of time. " width="75%" />
<p class="caption">
Figure 10: A dot plot shows the KEGG enrichment result of <em>E. coli</em> (A) and <em>P. putida</em> (B) in the three coculture as a function of time.
</p>
</div>
</div>
</div>
<div id="get-set-enrichment-analysis-gsea-of-gene-expression-profile" class="section level2">
<h2>Get set enrichment analysis (GSEA) of gene expression profile</h2>
<p>Enrichment analysis of DEGs is a common approach in analyzing gene expression profiles. This approach will find genes where the difference is large, but it will not detect a situation where the difference is small, but evidenced in coordinated way in a set of related genes. Gene Set Enrichment Analysis (GSEA) <span class="citation">(Subramanian et al. 2005)</span> directly addresses this limitation. All genes can be used in GSEA; GSEA aggregates the per gene statistics across genes within a gene set, therefore making it possible to detect situations where all genes in a predefined set change in a small but coordinated way. Since it is likely that many relevant phenotypic differences are manifested by small but consistent changes in a set of genes.</p>
<pre class="r"><code># load pre-calculated result
gene_expression.EC <- readRDS("data/gene_expression.EC.rds")
gene_expression.PP <- readRDS("data/gene_expression.PP.rds")</code></pre>
<pre class="r"><code># define a function to extract and prepare formatted data for GSEA
get_genelist <- function(x){
if (nrow(x) < 1) return(NULL)
geneList <- x$log2FoldChange
names(geneList) <- x$gene
geneList <- sort(geneList,decreasing = T)
return(geneList)
}
set.seed(1234)</code></pre>
<div id="e.-coli-gsea-kegg-result" class="section level3">
<h3><em>E. coli</em> GSEA KEGG result</h3>
<pre class="r"><code>gseKEGG_results.EC <- lapply(gene_expression.EC, function(x){
geneList <- get_genelist(x)
tryCatch(gseKEGG(geneList,
organism = "eco",
eps = 1e-20,
pvalueCutoff = 1, # all results
use_internal_data = TRUE),
error=function(e) NULL)
})
count.EC.pathways = nrow(data.frame(gseKEGG_results.EC[[1]]))</code></pre>
<p>The GSEA analysis of <em>E. coli</em> included 81 pathways.</p>
</div>
<div id="p.-putida-gsea-kegg-result" class="section level3">
<h3><em>P. putida</em> GSEA KEGG result</h3>
<pre class="r"><code>gseKEGG_results.PP <- lapply(gene_expression.PP, function(x){
geneList <- get_genelist(x)
tryCatch(gseKEGG(geneList,
organism = "ppu",
eps = 1e-20,