-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14- Top15_lower ASV rank.Rmd
2203 lines (2109 loc) · 95.6 KB
/
14- Top15_lower ASV rank.Rmd
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
##Load the required packages
```{r}
library(tidyverse)
library(cowplot)
library(patchwork)
library(ggh4x)
##library(ggtext)
library(PerformanceAnalytics)
library(RColorBrewer)
#library(MicrobeR)
library(microbiome)
##library(speedyseq)
library(flextable)
##library(webshot2)
library(officer)
library(DT)
library(ggsignif)
library(Rcpp)
library(dada2)
library(phyloseq)
library(permute)
library(lattice)
library(vegan)
library(ggplot2)
library(tidyverse)
library(ggstatsplot)
library(dplyr)
library(tidyr)
library(microbiome)
library(microbiomeutilities)
library(knitr)
library(RColorBrewer)
library(DT)
library(gt)
library(cowplot)
library(PerformanceAnalytics)
#library(venn)
#library(philr)
#library(MicrobeR)
library(ape)
library(Biostrings)
library(gridExtra)
library(ggsignif)
library(lmerTest)
library(ggResidpanel)
library(emmeans)
library(picante)
set.seed(1910)
library(ggpubr)
```
##Set the working driectory and read the saved phyloseq object
```{r}
ps.prev <- readRDS("phyobjects/STEP 14/ps.prev.f.rds")
ps.prev.intes <- readRDS("phyobjects/STEP 15/ps.prev.intes.f.rds")
ps.prev.feed <- readRDS("phyobjects/STEP 15'/ps.prev.feed.f.rds")
ps.prev.water <- readRDS("phyobjects/STEP 15'/ps.prev.water.f.rds")
# # filter samples
# ps.prev <- ps.prev %>%
# # remove the control samples
# subset_samples(!Sample_type %in% c("control", "Positive_control"))
# change OTU names for easy display
indx <- formatC(1:ntaxa(ps.prev), width = nchar(ntaxa(ps.prev)), format = "d", flag = "0")
taxa_names(ps.prev) <- paste0("OTU", indx)
# extract otu table, taxonomy and metadata
otu <- as.data.frame(t(otu_table(ps.prev)))
txnm <- tax_table(ps.prev) %>% as("matrix") %>% as_tibble(rownames = NA)
mtd <- data.frame(sample_data(ps.prev), check.names = FALSE)
# intes
indx.intes <- formatC(1:ntaxa(ps.prev.intes), width = nchar(ntaxa(ps.prev.intes)), format = "d", flag = "0")
taxa_names(ps.prev.intes) <- paste0("OTU", indx.intes)
# extract otu.intes table, taxonomy and metadata
otu.intes <- as.data.frame(t(otu_table(ps.prev.intes)))
txnm.intes <- tax_table(ps.prev.intes) %>% as("matrix") %>% as_tibble(rownames = NA)
mtd.intes <- data.frame(sample_data(ps.prev.intes), check.names = FALSE)
# feed
indx.feed <- formatC(1:ntaxa(ps.prev.feed), width = nchar(ntaxa(ps.prev.feed)), format = "d", flag = "0")
taxa_names(ps.prev.feed) <- paste0("OTU", indx.feed)
# extract otu.feed table, taxonomy and metadata
otu.feed <- as.data.frame(t(otu_table(ps.prev.feed)))
txnm.feed <- tax_table(ps.prev.feed) %>% as("matrix") %>% as_tibble(rownames = NA)
mtd.feed <- data.frame(sample_data(ps.prev.feed), check.names = FALSE)
# water
indx.water <- formatC(1:ntaxa(ps.prev.water), width = nchar(ntaxa(ps.prev.water)), format = "d", flag = "0")
taxa_names(ps.prev.water) <- paste0("OTU", indx.water)
# extract otu.water table, taxonomy and metadata
otu.water <- as.data.frame(t(otu_table(ps.prev.water)))
txnm.water <- tax_table(ps.prev.water) %>% as("matrix") %>% as_tibble(rownames = NA)
mtd.water <- data.frame(sample_data(ps.prev.water), check.names = FALSE)
```
# Taxonomic assignment overview
First of all, let's look at the coverage of taxonomic assignments at different rank levels.
```{r}
txnm_assg <- txnm %>%
gather("Rank", "Name", rank_names(ps.prev)) %>%
group_by(Rank) %>%
# Empty taxonomic ranks may be na or strings containing "uncultured" or "Ambiguous_taxa"
summarize(OTUs_classified = sum(!is.na(Name) & !grepl("uncultured|Ambiguous|metagenome", Name))) %>%
mutate(
Frac_classified = OTUs_classified / ntaxa(ps.prev),
Frac_classified = ifelse(
Frac_classified == 1,
"100",
round(Frac_classified * 100, 1)),
Frac_classified = paste(Frac_classified, "%"),
Rank = factor(Rank, rank_names(ps.prev))) %>%
arrange(Rank)
txnm_assg %>%
datatable(options = list(columnDefs = list(list(className = 'dt-left', targets = c(0:3)))))
Rank OTUs_classified Frac_classified
1 Kingdom 4988 100 %
2 Phylum 4988 100 %
3 Class 4988 100 %
4 Order 4988 100 %
5 Family 4988 100 %
6 Genus 3914 78.5 %
7 Species 482 9.7 %
# intes
txnm.intes_assg <- txnm.intes %>%
gather("Rank", "Name", rank_names(ps.prev.intes)) %>%
group_by(Rank) %>%
# Empty taxonomic ranks may be na or strings containing "uncultured" or "Ambiguous_taxa"
summarize(OTUs_classified = sum(!is.na(Name) & !grepl("uncultured|Ambiguous|metagenome", Name))) %>%
mutate(
Frac_classified = OTUs_classified / ntaxa(ps.prev.intes),
Frac_classified = ifelse(
Frac_classified == 1,
"100",
round(Frac_classified * 100, 1)),
Frac_classified = paste(Frac_classified, "%"),
Rank = factor(Rank, rank_names(ps.prev.intes))) %>%
arrange(Rank)
txnm.intes_assg %>%
datatable(options = list(columnDefs = list(list(className = 'dt-left', targets = c(0:3)))))
Rank OTUs_classified Frac_classified
1 Kingdom 2150 100 %
2 Phylum 2150 100 %
3 Class 2150 100 %
4 Order 2150 100 %
5 Family 2150 100 %
6 Genus 1780 82.8 %
7 Species 273 12.7 %
# water
txnm.water_assg <- txnm.water %>%
gather("Rank", "Name", rank_names(ps.prev.water)) %>%
group_by(Rank) %>%
# Empty taxonomic ranks may be na or strings containing "uncultured" or "Ambiguous_taxa"
summarize(OTUs_classified = sum(!is.na(Name) & !grepl("uncultured|Ambiguous|metagenome", Name))) %>%
mutate(
Frac_classified = OTUs_classified / ntaxa(ps.prev.water),
Frac_classified = ifelse(
Frac_classified == 1,
"100",
round(Frac_classified * 100, 1)),
Frac_classified = paste(Frac_classified, "%"),
Rank = factor(Rank, rank_names(ps.prev.water))) %>%
arrange(Rank)
txnm.water_assg %>%
datatable(options = list(columnDefs = list(list(className = 'dt-left', targets = c(0:3)))))
Rank OTUs_classified Frac_classified
1 Kingdom 2474 100 %
2 Phylum 2474 100 %
3 Class 2474 100 %
4 Order 2474 100 %
5 Family 2474 100 %
6 Genus 1818 73.5 %
7 Species 156 6.3 %
# feed
txnm.feed_assg <- txnm.feed %>%
gather("Rank", "Name", rank_names(ps.prev.feed)) %>%
group_by(Rank) %>%
# Empty taxonomic ranks may be na or strings containing "uncultured" or "Ambiguous_taxa"
summarize(OTUs_classified = sum(!is.na(Name) & !grepl("uncultured|Ambiguous|metagenome", Name))) %>%
mutate(
Frac_classified = OTUs_classified / ntaxa(ps.prev.feed),
Frac_classified = ifelse(
Frac_classified == 1,
"100",
round(Frac_classified * 100, 1)),
Frac_classified = paste(Frac_classified, "%"),
Rank = factor(Rank, rank_names(ps.prev.feed))) %>%
arrange(Rank)
txnm.feed_assg %>%
datatable(options = list(columnDefs = list(list(className = 'dt-left', targets = c(0:3)))))
Rank OTUs_classified Frac_classified
1 Kingdom 1119 100 %
2 Phylum 1119 100 %
3 Class 1119 100 %
4 Order 1119 100 %
5 Family 1119 100 %
6 Genus 986 88.1 %
7 Species 203 18.1 %
```
## Biological samples
### Top15 genera
```{r}
taxa_tab <- Summarize.Taxa(otu, txnm)$Genus %>% Make.Percent()
taxa_tab <- taxa_tab[order(rowMeans(taxa_tab), decreasing = T), ]
Others <- colSums(taxa_tab[16:nrow(taxa_tab), ])
taxa_tab <- rbind(taxa_tab[1:15, ], Others)
# intes
taxa_tab.intes <- Summarize.Taxa(otu.intes, txnm.intes)$Genus %>% Make.Percent()
taxa_tab.intes <- taxa_tab.intes[order(rowMeans(taxa_tab.intes), decreasing = T), ]
OTHERS <- colSums(taxa_tab.intes[16:nrow(taxa_tab.intes), ])
taxa_tab.intes <- rbind(taxa_tab.intes[1:15, ], OTHERS)
# feed
taxa_tab.feed <- Summarize.Taxa(otu.feed, txnm.feed)$Genus %>% Make.Percent()
taxa_tab.feed <- taxa_tab.feed[order(rowMeans(taxa_tab.feed), decreasing = T), ]
others <- colSums(taxa_tab.feed[16:nrow(taxa_tab.feed), ])
taxa_tab.feed <- rbind(taxa_tab.feed[1:15, ], others)
# water
taxa_tab.water <- Summarize.Taxa(otu.water, txnm.water)$Genus %>% Make.Percent()
taxa_tab.water <- taxa_tab.water[order(rowMeans(taxa_tab.water), decreasing = T), ]
OTHERs <- colSums(taxa_tab.water[16:nrow(taxa_tab.water), ])
taxa_tab.water <- rbind(taxa_tab.water[1:15, ], OTHERs)
```
Tidy taxa table for making stacked box plots.
```{r}
taxa_tab <- as.data.frame(taxa_tab) %>%
rownames_to_column("Taxa") %>%
separate(
Taxa,
sep = ";",
c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus")) %>%
mutate(
Phylum = ifelse(
is.na(Phylum)|Phylum == "NA"|grepl("uncultured|Ambiguous|metagenome", Phylum),
Kingdom,
Phylum),
Class = ifelse(
is.na(Class)|Class == "NA"|grepl("uncultured|Ambiguous|metagenome", Class),
Phylum,
Class),
Order = ifelse(
is.na(Order)|Order == "NA"|grepl("uncultured|Ambiguous|metagenome", Order),
Class,
Order),
Family = ifelse(
is.na(Family)|Family == "NA"|grepl("uncultured|Ambiguous|metagenome", Family),
Order,
Family),
Genus = ifelse(
is.na(Genus)|Genus == "NA"|grepl("uncultured|Ambiguous|metagenome", Genus),
Family,
Genus)) %>%
select(-Kingdom, -(Class:Family))
taxa_tab1 <- taxa_tab %>%
mutate(
Phylum = gsub("p__", "", Phylum),
Phylum = factor(Phylum, levels = rev(unique(Phylum))),
Genus = gsub("g__", "", Genus),
Genus = factor(Genus, levels = rev(unique(Genus)))) %>%
arrange(Phylum, Genus) %>%
mutate(Genus = factor(Genus, levels = unique(Genus))) %>%
pivot_longer(-c(Phylum, Genus), names_to = "SampleID", values_to = "Abundance") %>%
inner_join(rownames_to_column(mtd, "SampleID"), by = "SampleID")
openxlsx::write.xlsx(taxa_tab1, file = "tables/taxatable for intestine.xlsx")
# intes
taxa_tab.intes <- as.data.frame(taxa_tab.intes) %>%
rownames_to_column("Taxa.intes") %>%
separate(
Taxa.intes,
sep = ";",
c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus")) %>%
mutate(
Phylum = ifelse(
is.na(Phylum)|Phylum == "NA"|grepl("uncultured|Ambiguous|metagenome", Phylum),
Kingdom,
Phylum),
Class = ifelse(
is.na(Class)|Class == "NA"|grepl("uncultured|Ambiguous|metagenome", Class),
Phylum,
Class),
Order = ifelse(
is.na(Order)|Order == "NA"|grepl("uncultured|Ambiguous|metagenome", Order),
Class,
Order),
Family = ifelse(
is.na(Family)|Family == "NA"|grepl("uncultured|Ambiguous|metagenome", Family),
Order,
Family),
Genus = ifelse(
is.na(Genus)|Genus == "NA"|grepl("uncultured|Ambiguous|metagenome", Genus),
Family,
Genus)) %>%
select(-Kingdom, -(Class:Family))
taxa_tab.intes1 <- taxa_tab.intes %>%
mutate(
Phylum = gsub("p__", "", Phylum),
Phylum = factor(Phylum, levels = rev(unique(Phylum))),
Genus = gsub("g__", "", Genus),
Genus = factor(Genus, levels = rev(unique(Genus)))) %>%
arrange(Phylum, Genus) %>%
mutate(Genus = factor(Genus, levels = unique(Genus))) %>%
pivot_longer(-c(Phylum, Genus), names_to = "SampleID", values_to = "Abundance") %>%
inner_join(rownames_to_column(mtd.intes, "SampleID"), by = "SampleID")
openxlsx::write.xlsx(taxa_tab.intes1, file = "tables/taxatable at level of intestine for intestine.xlsx")
# feed
taxa_tab.feed <- as.data.frame(taxa_tab.feed) %>%
rownames_to_column("Taxa.feed") %>%
separate(
Taxa.feed,
sep = ";",
c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus")) %>%
mutate(
Phylum = ifelse(
is.na(Phylum)|Phylum == "NA"|grepl("uncultured|Ambiguous|metagenome", Phylum),
Kingdom,
Phylum),
Class = ifelse(
is.na(Class)|Class == "NA"|grepl("uncultured|Ambiguous|metagenome", Class),
Phylum,
Class),
Order = ifelse(
is.na(Order)|Order == "NA"|grepl("uncultured|Ambiguous|metagenome", Order),
Class,
Order),
Family = ifelse(
is.na(Family)|Family == "NA"|grepl("uncultured|Ambiguous|metagenome", Family),
Order,
Family),
Genus = ifelse(
is.na(Genus)|Genus == "NA"|grepl("uncultured|Ambiguous|metagenome", Genus),
Family,
Genus)) %>%
select(-Kingdom, -(Class:Family))
taxa_tab.feed1 <- taxa_tab.feed %>%
mutate(
Phylum = gsub("p__", "", Phylum),
Phylum = factor(Phylum, levels = rev(unique(Phylum))),
Genus = gsub("g__", "", Genus),
Genus = factor(Genus, levels = rev(unique(Genus)))) %>%
arrange(Phylum, Genus) %>%
mutate(Genus = factor(Genus, levels = unique(Genus))) %>%
pivot_longer(-c(Phylum, Genus), names_to = "SampleID", values_to = "Abundance") %>%
inner_join(rownames_to_column(mtd.feed, "SampleID"), by = "SampleID")
openxlsx::write.xlsx(taxa_tab.feed1, file = "tables/taxatable at level of feed for feed.xlsx")
# water
taxa_tab.water <- as.data.frame(taxa_tab.water) %>%
rownames_to_column("Taxa.water") %>%
separate(
Taxa.water,
sep = ";",
c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus")) %>%
mutate(
Phylum = ifelse(
is.na(Phylum)|Phylum == "NA"|grepl("uncultured|Ambiguous|metagenome", Phylum),
Kingdom,
Phylum),
Class = ifelse(
is.na(Class)|Class == "NA"|grepl("uncultured|Ambiguous|metagenome", Class),
Phylum,
Class),
Order = ifelse(
is.na(Order)|Order == "NA"|grepl("uncultured|Ambiguous|metagenome", Order),
Class,
Order),
Family = ifelse(
is.na(Family)|Family == "NA"|grepl("uncultured|Ambiguous|metagenome", Family),
Order,
Family),
Genus = ifelse(
is.na(Genus)|Genus == "NA"|grepl("uncultured|Ambiguous|metagenome", Genus),
Family,
Genus)) %>%
select(-Kingdom, -(Class:Family))
taxa_tab.water1 <- taxa_tab.water %>%
mutate(
Phylum = gsub("p__", "", Phylum),
Phylum = factor(Phylum, levels = rev(unique(Phylum))),
Genus = gsub("g__", "", Genus),
Genus = factor(Genus, levels = rev(unique(Genus)))) %>%
arrange(Phylum, Genus) %>%
mutate(Genus = factor(Genus, levels = unique(Genus))) %>%
pivot_longer(-c(Phylum, Genus), names_to = "SampleID", values_to = "Abundance") %>%
inner_join(rownames_to_column(mtd.water, "SampleID"), by = "SampleID")
openxlsx::write.xlsx(taxa_tab.water1, file = "tables/taxatable at level of water for water.xlsx")
```
### Boxplot to abundance of individual dominant taxa in the intestine samples grouped by Regime
```{r, fig.width=10}
# define color scheme
# col <- c("grey", brewer.pal(n = 12, name = "Paired"))
mtd$Regime <- factor(mtd$Regime, levels = c("M", "V", "MM", "VM", "MMV", "VMV"))
taxa_tab1$Genus2 <- factor(taxa_tab1$Genus, levels = c("Ruminococcaceae", "Bifidobacteriaceae", "Pseudomonas", "Photobacterium", "Pediococcus", "Lactobacillus", "Lactococcus","Leuconostoc", "Sphaerotilus", "Enterococcus", "Flavobacterium", "Yersinia", "Aeromonas", "Polaromonas","Pseudorhodobacter", "Others"))
# intestine samples
taxa_boxplot_intestine <- filter(taxa_tab1, sample == "intestine") %>%
ggplot(aes(x = factor(Regime, c("M", "V", "MM", "VM", "MMV", "VMV")), y = Abundance, color = Phase)) +
geom_boxplot(alpha = 0.5, width = 0.5) +
labs(x = "Regime", y = "Relative abundance (%)") +
##scale_y_continuous(breaks = 0:10*10, expand = c(0,0)) +
#scale_fill_manual(values = col) +
facet_wrap(
~ Genus2,nrow = 4,
scale = "free"
) +
theme_bw() +
theme(##axis.text.x = element_blank(),
##strip.background = element_blank(),
legend.position = "bottom")
# Export the plot
ggsave("figures/top15_intes.tiff", width = 10, height = 6,
units = "in", dpi = 300, compression = "lzw")
```
```{r}
# intes
unique(taxa_tab.intes1$Genus)
# define color scheme
# col <- c("grey", brewer.pal(n = 12, name = "Paired"))
mtd.intes$Regime <- factor(mtd.intes$Regime, levels = c("M", "V", "MM", "VM", "MMV", "VMV"))
taxa_tab.intes1$Genus2 <- factor(taxa_tab.intes1$Genus, levels = c("Ruminococcaceae", "Bifidobacteriaceae", "Pseudomonas", "Photobacterium", "Pediococcus", "Lactobacillus", "Lactococcus","Leuconostoc", "Acinetobacter", "Enterococcus", "Escherichia-Shigella", "Staphylococcus", "Cutibacterium", "Yersinia","Aeromonas", "OTHERS"))
# intestine samples
taxa_boxplot_intestine.intes <- filter(taxa_tab.intes1, sample == "intestine") %>%
ggplot(aes(x = factor(Regime, c("M", "V", "MM", "VM", "MMV", "VMV")), y = Abundance, color = Phase)) +
geom_boxplot(alpha = 0.5, width = 0.5) +
labs(x = "Regime", y = "Relative abundance (%)") +
##scale_y_continuous(breaks = 0:10*10, expand = c(0,0)) +
#scale_fill_manual(values = col) +
facet_wrap(
~ Genus2,nrow = 4,
scale = "free"
) +
theme_bw() +
theme(##axis.text.x = element_blank(),
##strip.background = element_blank(),
legend.position = "bottom")
# Export the plot
ggsave("figures/top15.intes_intes.tiff", width = 10, height = 6,
units = "in", dpi = 300, compression = "lzw")
```
```{r}
# intes colored manually!
unique(taxa_tab.intes1$Genus)
# define color scheme
col <- c("#F8766D", "#00BFC4", "#F8766D", "#00BFC4", "#F8766D", "#00BFC4")
names(col) <- c("M", "V", "MM", "VM", "MMV", "VMV")
mtd.intes$Regime <- factor(mtd.intes$Regime, levels = c("M", "V", "MM", "VM", "MMV", "VMV"))
taxa_tab.intes1$Genus2 <- factor(taxa_tab.intes1$Genus, levels = c("Ruminococcaceae", "Bifidobacteriaceae", "Pseudomonas", "Photobacterium", "Pediococcus", "Lactobacillus", "Lactococcus","Leuconostoc", "Acinetobacter", "Enterococcus", "Escherichia-Shigella", "Staphylococcus", "Cutibacterium", "Yersinia","Aeromonas", "OTHERS"))
# intestine samples
taxa_boxplot_intestine.intes <- filter(taxa_tab.intes1, sample == "intestine") %>%
ggplot(aes(x = factor(Regime, c("M", "V", "MM", "VM", "MMV", "VMV")), y = Abundance, color = Regime)) +
geom_boxplot(alpha = 0.5, width = 0.5) +
scale_color_manual(values = col) +
labs(x = "Regime", y = "Relative abundance (%)") +
##scale_y_continuous(breaks = 0:10*10, expand = c(0,0)) +
facet_wrap(
~ Genus2,nrow = 4,
scale = "free"
) +
theme_bw() +
theme(##axis.text.x = element_blank(),
##strip.background = element_blank(),
legend.position = "bottom")
# Export the plot
ggsave("figures/top15.intes_intes1.tiff", width = 10, height = 6,
units = "in", dpi = 300, compression = "lzw")
```
## Boxplot to abundance of individual dominant taxa in the feed samples grouped by Regime
```{r, fig.width=10}
# feed
unique(taxa_tab1$Genus)
# define color scheme
# col <- c("grey", brewer.pal(n = 12, name = "Paired"))
mtd$Regime <- factor(mtd$Regime, levels = c("M", "V"))
taxa_tab1$Genus2 <- factor(taxa_tab1$Genus, levels = c("Ruminococcaceae", "Bifidobacteriaceae", "Pseudomonas", "Photobacterium", "Pediococcus", "Lactobacillus", "Lactococcus","Leuconostoc", "Sphaerotilus", "Enterococcus", "Flavobacterium", "Yersinia", "Aeromonas", "Polaromonas","Pseudorhodobacter", "Others"))
# intestine samples
taxa_boxplot_feed <- filter(taxa_tab1, sample == "feed") %>%
ggplot(aes(x = factor(Regime, c("M", "V")), y = Abundance)) +
geom_boxplot(alpha = 0.5, width = 0.5) +
labs(x = "Regime", y = "Relative abundance (%)") +
##scale_y_continuous(breaks = 0:10*10, expand = c(0,0)) +
#scale_fill_manual(values = col) +
facet_wrap(
~ Genus2,nrow = 4,
scale = "free"
) +
theme_bw() +
theme(##axis.text.x = element_blank(),
##strip.background = element_blank(),
legend.position = "bottom")
# Export the plot
ggsave("figures/top15_feed.tiff", width = 10, height = 6,
units = "in", dpi = 300, compression = "lzw")
```
```{r}
# feed at level of feed
unique(taxa_tab.feed1$Genus)
# define color scheme
# col <- c("grey", brewer.pal(n = 12, name = "Paired"))
mtd.feed$Regime <- factor(mtd.feed$Regime, levels = c("M", "V"))
taxa_tab.feed1$Genus2 <- reorder(taxa_tab.feed1$Genus, taxa_tab.feed1$Abundance)
# feed samples
taxa_boxplot_feed <- filter(taxa_tab.feed1, sample == "feed") %>%
ggplot(aes(x = factor(Regime, c("M", "V")), y = Abundance)) +
geom_boxplot(alpha = 0.5, width = 0.5) +
labs(x = "Regime", y = "Relative abundance (%)") +
##scale_y_continuous(breaks = 0:10*10, expand = c(0,0)) +
#scale_fill_manual(values = col) +
facet_wrap(
~ Genus2,nrow = 4,
scale = "free"
) +
theme_bw() +
theme(##axis.text.x = element_blank(),
##strip.background = element_blank(),
legend.position = "none")
# Export the plot
ggsave("figures/top15.feed_feed.tiff", width = 10, height = 6,
units = "in", dpi = 300, compression = "lzw")
```
## Boxplot to abundance of individual dominant taxa in the water samples grouped by Regime
```{r, fig.width=10}
# water
# define color scheme
# col <- c("grey", brewer.pal(n = 12, name = "Paired"))
mtd$Regime <- factor(mtd$Regime, levels = c("M", "V", "MM", "VM", "MMV", "VMV"))
taxa_tab1$Genus2 <- factor(taxa_tab1$Genus, levels = c("Ruminococcaceae", "Bifidobacteriaceae", "Pseudomonas", "Photobacterium", "Pediococcus", "Lactobacillus", "Lactococcus","Leuconostoc", "Sphaerotilus", "Enterococcus", "Flavobacterium", "Yersinia", "Aeromonas", "Polaromonas","Pseudorhodobacter", "Others"))
# intestine samples
taxa_boxplot_intestine <- filter(taxa_tab1, sample == "water") %>%
ggplot(aes(x = factor(Regime, c("M", "V", "MM", "VM", "MMV", "VMV")), y = Abundance, color = Phase)) +
geom_boxplot(alpha = 0.5, width = 0.5) +
labs(x = "Regime", y = "Relative abundance (%)") +
##scale_y_continuous(breaks = 0:10*10, expand = c(0,0)) +
#scale_fill_manual(values = col) +
facet_wrap(
~ Genus2,nrow = 4,
scale = "free"
) +
theme_bw() +
theme(##axis.text.x = element_blank(),
##strip.background = element_blank(),
legend.position = "bottom")
# Export the plot
ggsave("figures/top15_wtr.tiff", width = 10, height = 6,
units = "in", dpi = 300, compression = "lzw")
```
```{r}
# water at level of water
unique(taxa_tab.water1$Genus)
# define color scheme
# col <- c("grey", brewer.pal(n = 12, name = "Paired"))
mtd.water$Regime <- factor(mtd.water$Regime, levels = c("M", "V", "MM", "VM", "MMV", "VMV"))
taxa_tab.water1$Genus2 <- reorder(taxa_tab.water1$Genus, taxa_tab.water1$Abundance)
# watertine samples
taxa_boxplot_watertine.water <- filter(taxa_tab.water1, sample == "water") %>%
ggplot(aes(x = factor(Regime, c("M", "V", "MM", "VM", "MMV", "VMV")), y = Abundance, color = Phase)) +
geom_boxplot(alpha = 0.5, width = 0.5) +
labs(x = "Regime", y = "Relative abundance (%)") +
##scale_y_continuous(breaks = 0:10*10, expand = c(0,0)) +
#scale_fill_manual(values = col) +
facet_wrap(
~ Genus2,nrow = 4,
scale = "free"
) +
theme_bw() +
theme(##axis.text.x = element_blank(),
##strip.background = element_blank(),
legend.position = "bottom")
# Export the plot
ggsave("figures/top15.water_wtr.tiff", width = 10, height = 6,
units = "in", dpi = 300, compression = "lzw")
```
##Flitering the dataframe into each individual taxonomic
```{r}
# intestine
##Filter only the dataframe for only intestine
intes.taxa_tab2 <- filter(taxa_tab1, sample == "intestine")
##Filter taxa_tab2 dataframe for only Ruminococcaceae
intes.taxa_r <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Ruminococcaceae")
##Filter taxa_tab2 dataframe for only the Bifidobacteriaceae
intes.taxa_b <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Bifidobacteriaceae")
##Filter taxa_tab2 dataframe for only the Pseudomonas
intes.taxa_p <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Pseudomonas")
##Filter taxa_tab2 dataframe for only the Photobacterium
intes.taxa_ph <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Photobacterium")
##Filter taxa_tab2 dataframe for only the Pediococcus
intes.taxa_ped <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Pediococcus")
##Filter taxa_tab2 dataframe for only the Lactobacillus
intes.taxa_l <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Lactobacillus")
##Filter taxa_tab2 dataframe for only the Lactococcus
intes.taxa_la <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Lactococcus")
##Filter taxa_tab2 dataframe for only the Leuconostoc
intes.taxa_le <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Leuconostoc")
##Filter taxa_tab2 dataframe for only Sphaerotilus
intes.taxa_s <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Sphaerotilus")
##Filter taxa_tab2 dataframe for only Enterococcus
intes.taxa_e <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Enterococcus")
##Filter taxa_tab2 dataframe for only Flavobacterium
intes.taxa_f <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Flavobacterium")
##Filter taxa_tab2 dataframe for only the Yersinia
intes.taxa_y <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Yersinia")
##Filter taxa_tab2 dataframe for only the Aeromonas
intes.taxa_a <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Aeromonas")
##Filter taxa_tab2 dataframe for only the Polaromonas
intes.taxa_po <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Polaromonas")
##Filter taxa_tab2 dataframe for only the Pseudorhodobacter
intes.taxa_ps <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Pseudorhodobacter")
##Filter taxa_tab2 dataframe for only Others
intes.taxa_o <- intes.taxa_tab2 %>%
filter(intes.taxa_tab2$Genus == "Others")
```
```{r}
# intes at intestine level
##Filter only the dataframe for only intestine
intes.taxa_tab.intes2 <- filter(taxa_tab.intes1, sample == "intestine")
##Filter taxa_tab.intes2 dataframe for only Ruminococcaceae
intes.taxa.intes_r <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Ruminococcaceae")
##Filter taxa_tab.intes2 dataframe for only the Bifidobacteriaceae
intes.taxa.intes_b <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Bifidobacteriaceae")
##Filter taxa_tab.intes2 dataframe for only the Pseudomonas
intes.taxa.intes_p <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Pseudomonas")
##Filter taxa_tab.intes2 dataframe for only the Photobacterium
intes.taxa.intes_ph <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Photobacterium")
##Filter taxa_tab.intes2 dataframe for only the Pediococcus
intes.taxa.intes_ped <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Pediococcus")
##Filter taxa_tab.intes2 dataframe for only the Lactobacillus
intes.taxa.intes_l <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Lactobacillus")
##Filter taxa_tab.intes2 dataframe for only the Lactococcus
intes.taxa.intes_la <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Lactococcus")
##Filter taxa_tab.intes2 dataframe for only the Leuconostoc
intes.taxa.intes_le <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Leuconostoc")
##Filter taxa_tab.intes2 dataframe for only the Acinetobacter
intes.taxa.intes_ac <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Acinetobacter")
##Filter taxa_tab.intes2 dataframe for only Enterococcus
intes.taxa.intes_e <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Enterococcus")
##Filter taxa_tab.intes2 dataframe for only Escherichia-Shigella
intes.taxa.intes_es <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Escherichia-Shigella")
##Filter taxa_tab.intes2 dataframe for only the Staphylococcus
intes.taxa.intes_st <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Staphylococcus")
##Filter taxa_tab.intes2 dataframe for only Cutibacterium
intes.taxa.intes_cut <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Cutibacterium")
##Filter taxa_tab.intes2 dataframe for only the Yersinia
intes.taxa.intes_y <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Yersinia")
##Filter taxa_tab.intes2 dataframe for only the Aeromonas
intes.taxa.intes_a <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "Aeromonas")
##Filter taxa_tab.intes2 dataframe for only OTHERS
intes.taxa.intes_o <- intes.taxa_tab.intes2 %>%
filter(intes.taxa_tab.intes2$Genus == "OTHERS")
```
```{r}
# water
##Filter only the dataframe for only water
water.taxa_tab2 <- filter(taxa_tab1, sample == "water")
##Filter taxa_tab2 dataframe for only Ruminococcaceae
water.taxa_r <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Ruminococcaceae")
##Filter taxa_tab2 dataframe for only the Bifidobacteriaceae
water.taxa_b <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Bifidobacteriaceae")
##Filter taxa_tab2 dataframe for only the Pseudomonas
water.taxa_p <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Pseudomonas")
##Filter taxa_tab2 dataframe for only the Photobacterium
water.taxa_ph <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Photobacterium")
##Filter taxa_tab2 dataframe for only the Pediococcus
water.taxa_ped <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Pediococcus")
##Filter taxa_tab2 dataframe for only the Lactobacillus
water.taxa_l <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Lactobacillus")
##Filter taxa_tab2 dataframe for only the Lactococcus
water.taxa_la <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Lactococcus")
##Filter taxa_tab2 dataframe for only the Leuconostoc
water.taxa_le <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Leuconostoc")
##Filter taxa_tab2 dataframe for only Sphaerotilus
water.taxa_s <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Sphaerotilus")
##Filter taxa_tab2 dataframe for only Enterococcus
water.taxa_e <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Enterococcus")
##Filter taxa_tab2 dataframe for only Flavobacterium
water.taxa_f <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Flavobacterium")
##Filter taxa_tab2 dataframe for only the Yersinia
water.taxa_y <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Yersinia")
##Filter taxa_tab2 dataframe for only the Aeromonas
water.taxa_a <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Aeromonas")
##Filter taxa_tab2 dataframe for only the Polaromonas
water.taxa_po <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Polaromonas")
##Filter taxa_tab2 dataframe for only the Pseudorhodobacter
water.taxa_ps <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Pseudorhodobacter")
##Filter taxa_tab2 dataframe for only Others
water.taxa_o <- water.taxa_tab2 %>%
filter(water.taxa_tab2$Genus == "Others")
```
```{r}
# water at level of water
# unique(taxa_tab.water2)$Genus
# [1] OTHERs Microtrichaceae Luteolibacter Arsenicibacter
# [5] Sediminibacterium Saprospiraceae Flavobacterium Rubrivivax
# [9] Rhodoferax Leptothrix AAP99 Novosphingobium
# [13] Rhodobacter Sphaerotilus Polaromonas Pseudorhodobacter
# 16 Levels: OTHERs Microtrichaceae Luteolibacter Arsenicibacter ... Pseudorhodobacter
##Filter only the dataframe for only water
water.taxa_tab.water2 <- filter(taxa_tab.water1, sample == "water")
##Filter taxa_tab.water2 dataframe for only AAP99
water.taxa.water_aa <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "AAP99")
##Filter taxa_tab.water2 dataframe for only the Arsenicibacter
water.taxa.water_ar <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Arsenicibacter")
##Filter taxa_tab.water2 dataframe for only Flavobacterium
water.taxa.water_f <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Flavobacterium")
##Filter taxa_tab.water2 dataframe for only the Leptothrix
water.taxa.water_le <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Leptothrix")
##Filter taxa_tab.water2 dataframe for only the Luteolibacter
water.taxa.water_lu <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Luteolibacter")
##Filter taxa_tab.water2 dataframe for only the Microtrichaceae
water.taxa.water_m <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Microtrichaceae")
##Filter taxa_tab.water2 dataframe for only the Novosphingobium
water.taxa.water_n <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Novosphingobium")
##Filter taxa_tab.water2 dataframe for only the Polaromonas
water.taxa.water_po <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Polaromonas")
##Filter taxa_tab.water2 dataframe for only the Pseudorhodobacter
water.taxa.water_ps <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Pseudorhodobacter")
##Filter taxa_tab.water2 dataframe for only the Rhodobacter
water.taxa.water_rb <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Rhodobacter")
##Filter taxa_tab.water2 dataframe for only the Rhodoferax
water.taxa.water_rf <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Rhodoferax")
##Filter taxa_tab.water2 dataframe for only Rubrivivax
water.taxa.water_rx <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Rubrivivax")
##Filter taxa_tab.water2 dataframe for only the Saprospiraceae
water.taxa.water_sa <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Saprospiraceae")
##Filter taxa_tab.water2 dataframe for only the Sediminibacterium
water.taxa.water_sed <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Sediminibacterium")
##Filter taxa_tab.water2 dataframe for only Sphaerotilus
water.taxa.water_s <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "Sphaerotilus")
##Filter taxa_tab.water2 dataframe for only OTHERs
water.taxa.water_o <- water.taxa_tab.water2 %>%
filter(water.taxa_tab.water2$Genus == "OTHERs")
```
```{r}
# feed
##Filter only the dataframe for only feed
feed.taxa_tab2 <- filter(taxa_tab1, sample == "feed")
##Filter taxa_tab2 dataframe for only Ruminococcaceae
feed.taxa_r <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Ruminococcaceae")
##Filter taxa_tab2 dataframe for only the Bifidobacteriaceae
feed.taxa_b <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Bifidobacteriaceae")
##Filter taxa_tab2 dataframe for only the Pseudomonas
feed.taxa_p <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Pseudomonas")
##Filter taxa_tab2 dataframe for only the Photobacterium
feed.taxa_ph <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Photobacterium")
##Filter taxa_tab2 dataframe for only the Pediococcus
feed.taxa_ped <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Pediococcus")
##Filter taxa_tab2 dataframe for only the Lactobacillus
feed.taxa_l <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Lactobacillus")
##Filter taxa_tab2 dataframe for only the Lactococcus
feed.taxa_la <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Lactococcus")
##Filter taxa_tab2 dataframe for only the Leuconostoc
feed.taxa_le <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Leuconostoc")
##Filter taxa_tab2 dataframe for only Sphaerotilus
feed.taxa_s <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Sphaerotilus")
##Filter taxa_tab2 dataframe for only Enterococcus
feed.taxa_e <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Enterococcus")
##Filter taxa_tab2 dataframe for only Flavobacterium
feed.taxa_f <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Flavobacterium")
##Filter taxa_tab2 dataframe for only the Yersinia
feed.taxa_y <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Yersinia")
##Filter taxa_tab2 dataframe for only the Aeromonas
feed.taxa_a <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Aeromonas")
##Filter taxa_tab2 dataframe for only the Polaromonas
feed.taxa_po <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Polaromonas")
##Filter taxa_tab2 dataframe for only the Pseudorhodobacter
feed.taxa_ps <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Pseudorhodobacter")
##Filter taxa_tab2 dataframe for only Others
feed.taxa_o <- feed.taxa_tab2 %>%
filter(feed.taxa_tab2$Genus == "Others")
```
```{r}
# feed at level of feed
# unique(taxa_tab.feed1)$Genus
# [1] others Psychrilyobacter
# [3] Fusobacterium Bifidobacteriaceae
# [5] Janthinobacterium Shewanella
# [7] Photobacterium Tepidimicrobium
# [9] Clostridium sensu stricto 7 Clostridiaceae
# [11] Streptococcus Weissella
# [13] Pediococcus Leuconostoc
# [15] Lactococcus Lactobacillus
# 16 Levels: others Psychrilyobacter Fusobacterium ... Lactobacillus
##Filter only the dataframe for only feed
feed.taxa_tab.feed2 <- filter(taxa_tab.feed1, sample == "feed")
##Filter taxa_tab.feed2 dataframe for only Bifidobacteriaceae
feed.taxa.feed_b <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Bifidobacteriaceae")
##Filter taxa_tab.feed2 dataframe for only the Clostridium sensu stricto 7
feed.taxa.feed_c <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Clostridium sensu stricto 7")
##Filter taxa_tab.feed2 dataframe for only the Clostridiaceae
feed.taxa.feed_cc <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Clostridiaceae")
##Filter taxa_tab.feed2 dataframe for only Fusobacterium
feed.taxa.feed_f <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Fusobacterium")
##Filter taxa_tab.feed2 dataframe for only the Janthinobacterium
feed.taxa.feed_j <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Janthinobacterium")
##Filter taxa_tab.feed2 dataframe for only the Lactobacillus
feed.taxa.feed_l <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Lactobacillus")
##Filter taxa_tab.feed2 dataframe for only the Microtrichaceae
feed.taxa.feed_la <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Lactococcus")
##Filter taxa_tab.feed2 dataframe for only the Leuconostoc
feed.taxa.feed_le <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Leuconostoc")
##Filter taxa_tab.feed2 dataframe for only the Pediococcus
feed.taxa.feed_p <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Pediococcus")
##Filter taxa_tab.feed2 dataframe for only the Photobacterium
feed.taxa.feed_ph <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Photobacterium")
##Filter taxa_tab.feed2 dataframe for only the Psychrilyobacter
feed.taxa.feed_py <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Psychrilyobacter")
##Filter taxa_tab.feed2 dataframe for only the Shewanella
feed.taxa.feed_sh <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Shewanella")
##Filter taxa_tab.feed2 dataframe for only Streptococcus
feed.taxa.feed_st <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Streptococcus")
##Filter taxa_tab.feed2 dataframe for only the Tepidimicrobium
feed.taxa.feed_t <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Tepidimicrobium")
##Filter taxa_tab.feed2 dataframe for only Weissella
feed.taxa.feed_w <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "Weissella")
##Filter taxa_tab.feed2 dataframe for only others
feed.taxa.feed_o <- feed.taxa_tab.feed2 %>%
filter(feed.taxa_tab.feed2$Genus == "others")
```
##Test the Regime effect on individual taxonomy - Kruska-walis test
```{r}
# intes
##Statistics for 1. Ruminococcaceae
kruskal.test(Abundance ~ Regime, data = intes.taxa_r)
##Statistics for 2. Bifidobacteriaceae
kruskal.test(Abundance ~ Regime, data = intes.taxa_b)
##Statistics for 3. Pseudomonas
kruskal.test(Abundance ~ Regime, data = intes.taxa_p)
##Statistics for 4. Photobacterium
kruskal.test(Abundance ~ Regime, data = intes.taxa_ph)
##Statistics for 5. Pediococcus
kruskal.test(Abundance ~ Regime, data = intes.taxa_ped)
##Statistics for 6. Lactobacillus
kruskal.test(Abundance ~ Regime, data = intes.taxa_l)
##Statistics for 7. Lactococcus
kruskal.test(Abundance ~ Regime, data = intes.taxa_la)
##Statistics for 8. Leuconostoc
kruskal.test(Abundance ~ Regime, data = intes.taxa_le)
##Statistics for 9. Sphaerotilus
kruskal.test(Abundance ~ Regime, data = intes.taxa_s)
##Statistics for 10. Enterococcus
kruskal.test(Abundance ~ Regime, data = intes.taxa_e)
##Statistics for 11. Flavobacterium
kruskal.test(Abundance ~ Regime, data = intes.taxa_f)
##Statistics for 12. Yersinia
kruskal.test(Abundance ~ Regime, data = intes.taxa_y)
##Statistics for 13. Aeromonas
kruskal.test(Abundance ~ Regime, data = intes.taxa_a)
##Statistics for 14. Polaromonas
kruskal.test(Abundance ~ Regime, data = intes.taxa_po)
##Statistics for 15. Pseudorhodobacter
kruskal.test(Abundance ~ Regime, data = intes.taxa_ps)
##Statistics for 16. Others
kruskal.test(Abundance ~ Regime, data = intes.taxa_o)
# 1. Kruskal-Wallis rank sum test
#
# data: Abundance by Regime
# Kruskal-Wallis chi-squared = 42.159, df = 5, p-value = 5.469e-08
#
#
# 2. Kruskal-Wallis rank sum test
#
# data: Abundance by Regime