library(tidyverse)
library(phyloseq)
library(microbiome)
library(scales)
phy<-readRDS("D:/R/Masha/phy_cleaned.rds")
phy
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 2688 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 2688 taxa by 6 taxonomic ranks ]
## phy_tree() Phylogenetic Tree: [ 2688 tips and 2686 internal nodes ]
The first phyloseq object was cleaned by:
Removing NA phylum sequences.
Removing the phyla Cyanobacteria/Chloroplast, Deferribacteres, and Tenericutes which are comprised of low-prevalence features.
This phyloseq have 2688 sequences.
## There are 28 different families
get_taxa_unique(phy, "Family")
## [1] "Erysipelotrichaceae" "Muribaculaceae"
## [3] "Lactobacillaceae" "Streptococcaceae"
## [5] "Lachnospiraceae" "Peptostreptococcaceae"
## [7] "Clostridiales_Incertae_Sedis_XIII" "Ruminococcaceae"
## [9] "Bacteroidaceae" NA
## [11] "Sutterellaceae" "Atopobiaceae"
## [13] "Eggerthellaceae" "Clostridiaceae_1"
## [15] "Enterococcaceae" "Akkermansiaceae"
## [17] "Rikenellaceae" "Staphylococcaceae"
## [19] "Enterobacteriaceae" "Prevotellaceae"
## [21] "Odoribacteraceae" "Bifidobacteriaceae"
## [23] "Porphyromonadaceae" "Moraxellaceae"
## [25] "Erysipelatoclostridiaceae" "Eubacteriaceae"
## [27] "Bdellovibrionaceae" "Caulobacteraceae"
sample_data(phy)$group<-factor(sample_data(phy)$group)
sample_data(phy)$gender<-factor(sample_data(phy)$gender)
sample_data(phy)$vitamin<-factor(sample_data(phy)$vitamin)
sample_data(phy)$fiber<-factor(sample_data(phy)$fiber)
phy2 <- phy %>% aggregate_taxa(level = "Family") %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 28 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 28 taxa by 6 taxonomic ranks ]
We have 28 taxa because we have 28 different families.
head(otu_table(phy2))
## OTU Table: [6 taxa and 64 samples]
## taxa are rows
## MB101 MB102 MB103 MB104
## Bifidobacteriaceae 2.041358e-05 5.374755e-05 0.0000998602 0.0000000000
## Atopobiaceae 4.490987e-04 1.424310e-03 0.0002746155 0.0010271761
## Eggerthellaceae 1.428951e-04 8.599608e-04 0.0005492311 0.0004695662
## Bacteroidaceae 3.449895e-03 3.627959e-03 0.0045436389 0.0003521747
## Muribaculaceae 4.336048e-01 4.801268e-01 0.5088875574 0.3836649645
## Odoribacteraceae 0.000000e+00 0.000000e+00 0.0000000000 0.0000000000
## MB105 MB106 MB107 MB108
## Bifidobacteriaceae 0.0001798238 0.0001353258 2.190724e-05 0.0001660814
## Atopobiaceae 0.0013386881 0.0053743693 3.724232e-04 0.0024912214
## Eggerthellaceae 0.0003996084 0.0009472809 5.914956e-04 0.0004033406
## Bacteroidaceae 0.0002397650 0.0009279487 1.226806e-03 0.0059077536
## Muribaculaceae 0.4860436772 0.4489918225 4.715753e-01 0.4088450223
## Odoribacteraceae 0.0000000000 0.0000000000 0.000000e+00 0.0000000000
## MB109 MB110 MB111 MB112
## Bifidobacteriaceae 0.000000000 0.0000000000 0.0000000000 0.0000000000
## Atopobiaceae 0.002775067 0.0020189837 0.0022870016 0.0022775260
## Eggerthellaceae 0.000884362 0.0005506319 0.0009898962 0.0004033119
## Bacteroidaceae 0.001341791 0.0016256752 0.0003072092 0.0092050011
## Muribaculaceae 0.484477921 0.4101158949 0.4454533042 0.4583995635
## Odoribacteraceae 0.000000000 0.0000000000 0.0000000000 0.0000000000
## MB113 MB114 MB115 MB116
## Bifidobacteriaceae 6.444683e-05 2.988911e-05 0.0000000000 0.0000000000
## Atopobiaceae 2.234157e-03 1.883014e-03 0.0022866083 0.0031315461
## Eggerthellaceae 7.303974e-04 5.081149e-04 0.0004513043 0.0006136138
## Bacteroidaceae 2.148228e-05 8.667842e-04 0.0002106087 0.0010579548
## Muribaculaceae 3.873899e-01 4.894940e-01 0.3985618437 0.4406381583
## Odoribacteraceae 0.000000e+00 0.000000e+00 0.0000000000 0.0000000000
## MB117 MB118 MB119 MB120
## Bifidobacteriaceae 0.0000000000 0.0000000000 0.0000000000 0.000000e+00
## Atopobiaceae 0.0023391813 0.0006456056 0.0001538766 4.291477e-05
## Eggerthellaceae 0.0013599891 0.0021520186 0.0010771361 8.153807e-04
## Bacteroidaceae 0.0002991976 0.0086080744 0.0151678354 4.548966e-03
## Muribaculaceae 0.3960832313 0.0234139623 0.0474819195 2.360312e-02
## Odoribacteraceae 0.0000000000 0.0000000000 0.0000000000 0.000000e+00
## MB121 MB122 MB123 MB124
## Bifidobacteriaceae 0.0000000000 0.000000000 0.000000000 0.000000000
## Atopobiaceae 0.0008569911 0.000000000 0.000000000 0.000000000
## Eggerthellaceae 0.0030417149 0.004771212 0.002630605 0.001528935
## Bacteroidaceae 0.0112253766 0.014974707 0.009700358 0.022513569
## Muribaculaceae 0.0165725183 0.244366521 0.096387028 0.158091889
## Odoribacteraceae 0.0000000000 0.000000000 0.000000000 0.000000000
## MB125 MB126 MB127 MB128
## Bifidobacteriaceae 0.0000000000 0.000000e+00 0.000000e+00 1.546695e-05
## Atopobiaceae 0.0000000000 6.636911e-05 3.133028e-04 2.165373e-04
## Eggerthellaceae 0.0069591305 2.156996e-04 8.772479e-05 1.392025e-04
## Bacteroidaceae 0.0106231250 3.484378e-03 2.067799e-03 3.975005e-03
## Muribaculaceae 0.1771750357 1.831953e-01 1.447584e-01 1.830823e-01
## Odoribacteraceae 0.0004918113 0.000000e+00 0.000000e+00 0.000000e+00
## MB129 MB130 MB131 MB132
## Bifidobacteriaceae 1.499835e-05 2.029715e-05 3.072621e-05 0.0000000000
## Atopobiaceae 2.999670e-04 3.409921e-03 5.300272e-03 0.0073129435
## Eggerthellaceae 2.099769e-04 2.029715e-04 1.382680e-04 0.0001681136
## Bacteroidaceae 6.329304e-03 8.524803e-03 7.481833e-03 0.0098586645
## Muribaculaceae 1.954285e-01 3.474669e-01 1.951729e-01 0.2483398778
## Odoribacteraceae 0.000000e+00 0.000000e+00 0.000000e+00 0.0000000000
## MB133 MB134 MB135 MB136 MB137
## Bifidobacteriaceae 0.0000000000 0.00000000 0.000000000 0.000000000 0.0000000000
## Atopobiaceae 0.0072202166 0.00000000 0.000000000 0.000000000 0.0000000000
## Eggerthellaceae 0.0005014039 0.01077980 0.005603577 0.008639599 0.0077461981
## Bacteroidaceae 0.0128359406 0.02707421 0.007213115 0.002462062 0.0086575155
## Muribaculaceae 0.2554552748 0.07529236 0.054664680 0.089171404 0.0451386911
## Odoribacteraceae 0.0000000000 0.00000000 0.006477894 0.001253413 0.0009967534
## MB138 MB139 MB140 MB141
## Bifidobacteriaceae 0.000000000 0.000000000 0.000000000 0.000000e+00
## Atopobiaceae 0.000000000 0.000000000 0.000000000 6.815936e-05
## Eggerthellaceae 0.003018927 0.007072136 0.002028842 5.367549e-03
## Bacteroidaceae 0.007481690 0.000261125 0.001617591 3.067171e-03
## Muribaculaceae 0.002782663 0.015689261 0.006360695 7.523089e-02
## Odoribacteraceae 0.000000000 0.000000000 0.000000000 0.000000e+00
## MB142 MB143 MB144 MB145
## Bifidobacteriaceae 0.0000000000 2.185219e-05 0.00000000 0.0000000000
## Atopobiaceae 0.0065174692 6.555658e-03 0.00390529 0.0067469600
## Eggerthellaceae 0.0002083209 2.185219e-05 0.00000000 0.0001159936
## Bacteroidaceae 0.0024105708 1.529653e-03 0.02608078 0.0154271464
## Muribaculaceae 0.1343372418 6.988331e-02 0.14359451 0.1237071549
## Odoribacteraceae 0.0000000000 0.000000e+00 0.00000000 0.0000000000
## MB146 MB147 MB148 MB149
## Bifidobacteriaceae 0.000000e+00 0.000000e+00 0.0000309205 2.800414e-05
## Atopobiaceae 3.568515e-03 5.490972e-03 0.0077455861 7.841160e-03
## Eggerthellaceae 5.097879e-05 4.946822e-05 0.0001236820 0.000000e+00
## Bacteroidaceae 8.589927e-03 1.770962e-02 0.0076064438 2.313142e-02
## Muribaculaceae 2.185206e-01 2.069503e-01 0.2632571658 4.064242e-01
## Odoribacteraceae 0.000000e+00 0.000000e+00 0.0000000000 0.000000e+00
## MB150 MB151 MB152 MB153
## Bifidobacteriaceae 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## Atopobiaceae 0.0002494241 0.0000456194 0.0003350084 0.0000286164
## Eggerthellaceae 0.0017606409 0.0020756826 0.0014688829 0.0013449707
## Bacteroidaceae 0.0041668501 0.0041513652 0.0005153975 0.0016025182
## Muribaculaceae 0.0126032543 0.0176318971 0.0020100503 0.0044355416
## Odoribacteraceae 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## MB154 MB155 MB156 MB157
## Bifidobacteriaceae 0.0000000000 0.0000000000 0.0000000000 0.0000261083
## Atopobiaceae 0.0000486476 0.0001496603 0.0000000000 0.0000000000
## Eggerthellaceae 0.0016053707 0.0014966027 0.0015349630 0.0001566498
## Bacteroidaceae 0.0007297140 0.0007483014 0.0008527572 0.0288496684
## Muribaculaceae 0.0087565674 0.0236163908 0.0289937464 0.1956294710
## Odoribacteraceae 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## MB158 MB159 MB160 MB161
## Bifidobacteriaceae 1.768597e-05 3.832299e-05 0.0000000000 3.965343e-05
## Atopobiaceae 5.305790e-05 7.664597e-05 0.0001021952 5.948014e-05
## Eggerthellaceae 3.360334e-04 2.490994e-04 0.0003270245 9.913357e-05
## Bacteroidaceae 1.061158e-02 2.184410e-03 0.0174753710 9.715090e-03
## Muribaculaceae 1.632592e-01 1.069403e-01 0.1816621019 2.508079e-01
## Odoribacteraceae 0.000000e+00 0.000000e+00 0.0000000000 0.000000e+00
## MB162 MB163 MB164
## Bifidobacteriaceae 0.0000000000 4.620325e-05 0.000000e+00
## Atopobiaceae 0.0000000000 0.000000e+00 8.324870e-05
## Eggerthellaceae 0.0002792936 4.620325e-05 9.989844e-05
## Bacteroidaceae 0.0014179521 1.238247e-02 2.182781e-02
## Muribaculaceae 0.3368495682 3.573821e-01 2.886399e-01
## Odoribacteraceae 0.0000000000 0.000000e+00 0.000000e+00
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 6 taxonomic ranks]:
## Kingdom Phylum Class
## Bifidobacteriaceae "Bacteria" "Actinobacteria" "Actinobacteria"
## Atopobiaceae "Bacteria" "Actinobacteria" "Coriobacteriia"
## Eggerthellaceae "Bacteria" "Actinobacteria" "Coriobacteriia"
## Bacteroidaceae "Bacteria" "Bacteroidetes" "Bacteroidia"
## Muribaculaceae "Bacteria" "Bacteroidetes" "Bacteroidia"
## Odoribacteraceae "Bacteria" "Bacteroidetes" "Bacteroidia"
## Order Family
## Bifidobacteriaceae "Bifidobacteriales" "Bifidobacteriaceae"
## Atopobiaceae "Coriobacteriales" "Atopobiaceae"
## Eggerthellaceae "Eggerthellales" "Eggerthellaceae"
## Bacteroidaceae "Bacteroidales" "Bacteroidaceae"
## Muribaculaceae "Bacteroidales" "Muribaculaceae"
## Odoribacteraceae "Bacteroidales" "Odoribacteraceae"
## unique
## Bifidobacteriaceae "Bifidobacteriaceae"
## Atopobiaceae "Atopobiaceae"
## Eggerthellaceae "Eggerthellaceae"
## Bacteroidaceae "Bacteroidaceae"
## Muribaculaceae "Muribaculaceae"
## Odoribacteraceae "Odoribacteraceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
The top 10 families are:
“Bacteroidaceae” “Clostridiales_Incertae_Sedis_XIII” “Erysipelotrichaceae” “Lachnospiraceae”
“Lactobacillaceae” “Muribaculaceae”
“Peptostreptococcaceae” “Ruminococcaceae” “Streptococcaceae” “Unknown”
phy2 <- phy %>% aggregate_top_taxa(level = "Family", top = 10) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 11 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 11 taxa by 2 taxonomic ranks ]
# we now have 11 taxa, 10 top families and 1 other
head(otu_table(phy2))
## OTU Table: [6 taxa and 64 samples]
## taxa are rows
## MB101 MB102 MB103
## Bacteroidaceae 0.0034498949 0.0036279595 0.004543639
## Clostridiales_Incertae_Sedis_XIII 0.0007553024 0.0005106017 0.001398043
## Erysipelotrichaceae 0.3839998367 0.4359732337 0.250923707
## Lachnospiraceae 0.0258435912 0.0120931982 0.010635111
## Lactobacillaceae 0.0289056280 0.0299642579 0.201318155
## Muribaculaceae 0.4336048339 0.4801268442 0.508887557
## MB104 MB105 MB106
## Bacteroidaceae 0.0003521747 0.000239765 0.0009279487
## Clostridiales_Incertae_Sedis_XIII 0.0003815226 0.001598434 0.0005413034
## Erysipelotrichaceae 0.5647707930 0.367759596 0.4660622112
## Lachnospiraceae 0.0076891472 0.028052509 0.0179210084
## Lactobacillaceae 0.0273228855 0.069951448 0.0302163280
## Muribaculaceae 0.3836649645 0.486043677 0.4489918225
## MB107 MB108 MB109
## Bacteroidaceae 0.0012268057 0.0059077536 0.001341791
## Clostridiales_Incertae_Sedis_XIII 0.0006353101 0.0004982443 0.001158819
## Erysipelotrichaceae 0.4342234977 0.5051959761 0.344657233
## Lachnospiraceae 0.0083247530 0.0060263832 0.019425470
## Lactobacillaceae 0.0697307600 0.0464316219 0.083556965
## Muribaculaceae 0.4715753500 0.4088450223 0.484477921
## MB110 MB111 MB112
## Bacteroidaceae 0.001625675 0.0003072092 0.0092050011
## Clostridiales_Incertae_Sedis_XIII 0.001914101 0.0006826871 0.0009726934
## Erysipelotrichaceae 0.353584352 0.4083833971 0.4264430263
## Lachnospiraceae 0.038518014 0.0309257236 0.0205689070
## Lactobacillaceae 0.155383082 0.0554683233 0.0212806339
## Muribaculaceae 0.410115895 0.4454533042 0.4583995635
## MB113 MB114 MB115
## Bacteroidaceae 2.148228e-05 0.0008667842 0.0002106087
## Clostridiales_Incertae_Sedis_XIII 1.224490e-03 0.0003885584 0.0011733911
## Erysipelotrichaceae 4.520086e-01 0.3697581971 0.3179288143
## Lachnospiraceae 1.542427e-02 0.0113279732 0.0100791287
## Lactobacillaceae 9.830290e-02 0.0864393102 0.2294130036
## Muribaculaceae 3.873899e-01 0.4894939773 0.3985618437
## MB116 MB117 MB118
## Bacteroidaceae 0.0010579548 0.0002991976 0.008608074
## Clostridiales_Incertae_Sedis_XIII 0.0005501365 0.0009519924 0.000344323
## Erysipelotrichaceae 0.3800385096 0.4448524412 0.755487647
## Lachnospiraceae 0.0115317069 0.0428396573 0.043406215
## Lactobacillaceae 0.0938829056 0.0605195158 0.028729448
## Muribaculaceae 0.4406381583 0.3960832313 0.023413962
## MB119 MB120 MB121
## Bacteroidaceae 0.015167835 0.0045489658 0.0112253766
## Clostridiales_Incertae_Sedis_XIII 0.001450836 0.0004291477 0.0003500386
## Erysipelotrichaceae 0.568771845 0.7764569565 0.7345620896
## Lachnospiraceae 0.185025609 0.1133379109 0.0676419467
## Lactobacillaceae 0.021916423 0.0088404429 0.0244785632
## Muribaculaceae 0.047481920 0.0236031242 0.0165725183
## MB122 MB123 MB124
## Bacteroidaceae 0.014974707 0.009700358 0.022513569
## Clostridiales_Incertae_Sedis_XIII 0.001293401 0.001397509 0.001758275
## Erysipelotrichaceae 0.037393654 0.044966912 0.120021405
## Lachnospiraceae 0.341630260 0.552098319 0.492622888
## Lactobacillaceae 0.076856749 0.021538082 0.029432001
## Muribaculaceae 0.244366521 0.096387028 0.158091889
## MB125 MB126 MB127
## Bacteroidaceae 0.010623125 0.0034843784 2.067799e-03
## Clostridiales_Incertae_Sedis_XIII 0.003123002 0.0003484378 3.759634e-05
## Erysipelotrichaceae 0.181699700 0.6611027228 7.868413e-01
## Lachnospiraceae 0.327349629 0.1266488576 5.153205e-02
## Lactobacillaceae 0.041951507 0.0078315552 2.957579e-03
## Muribaculaceae 0.177175036 0.1831953409 1.447584e-01
## MB128 MB129 MB130
## Bacteroidaceae 3.975005e-03 0.0063293038 8.524803e-03
## Clostridiales_Incertae_Sedis_XIII 3.093389e-05 0.0002249753 2.029715e-05
## Erysipelotrichaceae 7.340613e-01 0.6913489516 5.351953e-01
## Lachnospiraceae 6.069230e-02 0.0865404805 8.664853e-02
## Lactobacillaceae 5.784638e-03 0.0049644539 6.109442e-03
## Muribaculaceae 1.830823e-01 0.1954285029 3.474669e-01
## MB131 MB132 MB133
## Bacteroidaceae 7.481833e-03 9.858664e-03 1.283594e-02
## Clostridiales_Incertae_Sedis_XIII 3.072621e-05 9.606494e-05 8.022463e-05
## Erysipelotrichaceae 7.039529e-01 6.979598e-01 6.401123e-01
## Lachnospiraceae 6.464795e-02 1.362921e-02 6.002808e-02
## Lactobacillaceae 1.981841e-03 6.136148e-03 1.343763e-03
## Muribaculaceae 1.951729e-01 2.483399e-01 2.554553e-01
## MB134 MB135 MB136
## Bacteroidaceae 0.02707421 0.007213115 0.002462062
## Clostridiales_Incertae_Sedis_XIII 0.16640803 0.180586190 0.075697211
## Erysipelotrichaceae 0.20586931 0.036562345 0.047405882
## Lachnospiraceae 0.24846201 0.374485842 0.409508035
## Lactobacillaceae 0.01671008 0.044490810 0.057030306
## Muribaculaceae 0.07529236 0.054664680 0.089171404
## MB137 MB138 MB139
## Bacteroidaceae 0.008657516 0.007481690 0.0002611250
## Clostridiales_Incertae_Sedis_XIII 0.106538703 0.001181319 0.0005004896
## Erysipelotrichaceae 0.066269864 0.228388418 0.6490697421
## Lachnospiraceae 0.519564846 0.451710288 0.0330105538
## Lactobacillaceae 0.008059463 0.034678287 0.0436513981
## Muribaculaceae 0.045138691 0.002782663 0.0156892612
## MB140 MB141 MB142
## Bacteroidaceae 0.001617591 0.003067171 0.0024105708
## Clostridiales_Incertae_Sedis_XIII 0.001507923 0.001516546 0.0000892804
## Erysipelotrichaceae 0.227641608 0.374143748 0.6210939825
## Lachnospiraceae 0.497614739 0.225880108 0.1141003512
## Lactobacillaceae 0.010116796 0.025304161 0.0538956015
## Muribaculaceae 0.006360695 0.075230890 0.1343372418
## MB143 MB144 MB145
## Bacteroidaceae 1.529653e-03 0.0260807822 0.0154271464
## Clostridiales_Incertae_Sedis_XIII 8.740877e-05 0.0003823361 0.0003093162
## Erysipelotrichaceae 6.027272e-01 0.5045197586 0.6393566223
## Lachnospiraceae 1.338228e-01 0.1232760740 0.1163995592
## Lactobacillaceae 1.494034e-01 0.1205451020 0.0502252209
## Muribaculaceae 6.988331e-02 0.1435945053 0.1237071549
## MB146 MB147 MB148
## Bacteroidaceae 0.0085899266 0.017709622 0.0076064438
## Clostridiales_Incertae_Sedis_XIII 0.0001784258 0.000692555 0.0008039331
## Erysipelotrichaceae 0.4083146411 0.406925550 0.4580717974
## Lachnospiraceae 0.1367761011 0.172000989 0.0917411335
## Lactobacillaceae 0.2115365008 0.143482562 0.1331436876
## Muribaculaceae 0.2185205954 0.206950284 0.2632571658
## MB149 MB150 MB151
## Bacteroidaceae 0.0231314235 0.004166850 0.004151365
## Clostridiales_Incertae_Sedis_XIII 0.0006720995 0.001511217 0.001893205
## Erysipelotrichaceae 0.3589851298 0.748771219 0.697794302
## Lachnospiraceae 0.1335517657 0.081180216 0.123628567
## Lactobacillaceae 0.0498193733 0.059597694 0.009922219
## Muribaculaceae 0.4064241508 0.012603254 0.017631897
## MB152 MB153 MB154
## Bacteroidaceae 5.153975e-04 0.0016025182 0.000729714
## Clostridiales_Incertae_Sedis_XIII 7.730963e-05 0.0006867935 0.001945904
## Erysipelotrichaceae 8.452261e-01 0.7071684075 0.311052734
## Lachnospiraceae 4.911738e-02 0.1619401917 0.387332166
## Lactobacillaceae 4.638578e-02 0.0084132208 0.026804826
## Muribaculaceae 2.010050e-03 0.0044355416 0.008756567
## MB155 MB156 MB157
## Bacteroidaceae 0.0007483014 0.0008527572 0.0288496684
## Clostridiales_Incertae_Sedis_XIII 0.0018258553 0.0018760659 0.0001566498
## Erysipelotrichaceae 0.3293723248 0.1752700398 0.6349276800
## Lachnospiraceae 0.3881588793 0.5337123366 0.1152420239
## Lactobacillaceae 0.0103564908 0.0176805003 0.0057438254
## Muribaculaceae 0.0236163908 0.0289937464 0.1956294710
## MB158 MB159 MB160
## Bacteroidaceae 0.0106115808 2.184410e-03 0.01747537
## Clostridiales_Incertae_Sedis_XIII 0.0002122316 7.664597e-05 0.00000000
## Erysipelotrichaceae 0.6149764777 7.774967e-01 0.66471815
## Lachnospiraceae 0.1680343815 7.038016e-02 0.09884315
## Lactobacillaceae 0.0129638145 2.186326e-02 0.01770020
## Muribaculaceae 0.1632591702 1.069403e-01 0.18166210
## MB161 MB162 MB163
## Bacteroidaceae 0.0097150901 1.417952e-03 0.01238247
## Clostridiales_Incertae_Sedis_XIII 0.0002577473 2.148412e-05 0.00000000
## Erysipelotrichaceae 0.4634692785 3.483006e-01 0.27158269
## Lachnospiraceae 0.2126811666 2.828170e-01 0.29447640
## Lactobacillaceae 0.0110831334 9.581919e-03 0.01339894
## Muribaculaceae 0.2508079386 3.368496e-01 0.35738212
## MB164
## Bacteroidaceae 2.182781e-02
## Clostridiales_Incertae_Sedis_XIII 9.989844e-05
## Erysipelotrichaceae 5.546861e-01
## Lachnospiraceae 1.070745e-01
## Lactobacillaceae 6.160404e-03
## Muribaculaceae 2.886399e-01
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family
## Bacteroidaceae "Bacteroidaceae"
## Clostridiales_Incertae_Sedis_XIII "Clostridiales_Incertae_Sedis_XIII"
## Erysipelotrichaceae "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae"
## unique
## Bacteroidaceae "Bacteroidaceae"
## Clostridiales_Incertae_Sedis_XIII "Clostridiales_Incertae_Sedis_XIII"
## Erysipelotrichaceae "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)+ scale_fill_viridis_d()
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# vitamin
phy2 %>% plot_composition(group_by = "vitamin")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "vitamin")+
scale_y_continuous(labels = percent)
# fiber
phy2 %>% plot_composition(group_by = "fiber")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "fiber")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+ scale_y_continuous(labels = percent)
The top 5 families are:
“Erysipelotrichaceae” “Lachnospiraceae” “Lactobacillaceae”
“Muribaculaceae” “Streptococcaceae”
phy2 <- phy %>% aggregate_top_taxa(level = "Family", top = 5) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 6 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 6 taxa by 2 taxonomic ranks ]
# we now have 6 taxa, 5 top and 1 other
head(otu_table(phy2))
## OTU Table: [6 taxa and 64 samples]
## taxa are rows
## MB101 MB102 MB103 MB104 MB105
## Erysipelotrichaceae 0.38399984 0.43597323 0.25092371 0.564770793 0.36775960
## Lachnospiraceae 0.02584359 0.01209320 0.01063511 0.007689147 0.02805251
## Lactobacillaceae 0.02890563 0.02996426 0.20131815 0.027322885 0.06995145
## Muribaculaceae 0.43360483 0.48012684 0.50888756 0.383664964 0.48604368
## Other 0.12764611 0.04184247 0.02823547 0.016552210 0.04819277
## Streptococcaceae 0.00000000 0.00000000 0.00000000 0.000000000 0.00000000
## MB106 MB107 MB108 MB109 MB110
## Erysipelotrichaceae 0.46606221 4.342235e-01 0.505195976 0.34465723 0.35358435
## Lachnospiraceae 0.01792101 8.324753e-03 0.006026383 0.01942547 0.03851801
## Lactobacillaceae 0.03021633 6.973076e-02 0.046431622 0.08355697 0.15538308
## Muribaculaceae 0.44899182 4.715753e-01 0.408845022 0.48447792 0.41011589
## Other 0.03680863 1.612373e-02 0.033500996 0.06788241 0.04239866
## Streptococcaceae 0.00000000 2.190724e-05 0.000000000 0.00000000 0.00000000
## MB111 MB112 MB113 MB114 MB115
## Erysipelotrichaceae 0.40838340 0.42644303 0.45200859 0.36975820 0.3179288143
## Lachnospiraceae 0.03092572 0.02056891 0.01542427 0.01132797 0.0100791287
## Lactobacillaceae 0.05546832 0.02128063 0.09830290 0.08643931 0.2294130036
## Muribaculaceae 0.44545330 0.45839956 0.38738990 0.48949398 0.3985618437
## Other 0.05976925 0.07330787 0.04687433 0.04298054 0.0438968619
## Streptococcaceae 0.00000000 0.00000000 0.00000000 0.00000000 0.0001203478
## MB116 MB117 MB118 MB119 MB120
## Erysipelotrichaceae 0.38003851 0.44485244 0.75548765 0.56877184 0.776456956
## Lachnospiraceae 0.01153171 0.04283966 0.04340622 0.18502561 0.113337911
## Lactobacillaceae 0.09388291 0.06051952 0.02872945 0.02191642 0.008840443
## Muribaculaceae 0.44063816 0.39608323 0.02341396 0.04748192 0.023603124
## Other 0.07390872 0.05570515 0.08831884 0.12558528 0.057934941
## Streptococcaceae 0.00000000 0.00000000 0.06064388 0.05121892 0.019826624
## MB121 MB122 MB123 MB124 MB125
## Erysipelotrichaceae 0.73456209 0.03739365 0.04496691 0.12002141 0.18169970
## Lachnospiraceae 0.06764195 0.34163026 0.55209832 0.49262289 0.32734963
## Lactobacillaceae 0.02447856 0.07685675 0.02153808 0.02943200 0.04195151
## Muribaculaceae 0.01657252 0.24436652 0.09638703 0.15809189 0.17717504
## Other 0.07932599 0.14902851 0.12511817 0.12307928 0.12354301
## Streptococcaceae 0.07741889 0.15072430 0.15989149 0.07675254 0.14828112
## MB126 MB127 MB128 MB129
## Erysipelotrichaceae 0.6611027228 0.7868412808 0.7340613110 0.6913489516
## Lachnospiraceae 0.1266488576 0.0515320509 0.0606923006 0.0865404805
## Lactobacillaceae 0.0078315552 0.0029575788 0.0057846382 0.0049644539
## Muribaculaceae 0.1831953409 0.1447584435 0.1830822532 0.1954285029
## Other 0.0210224162 0.0137101322 0.0161165589 0.0215676276
## Streptococcaceae 0.0001991073 0.0002005138 0.0002629381 0.0001499835
## MB130 MB131 MB132 MB133
## Erysipelotrichaceae 0.5351952586 0.7039529274 0.6979598208 0.6401123145
## Lachnospiraceae 0.0866485345 0.0646479544 0.0136292133 0.0600280786
## Lactobacillaceae 0.0061094422 0.0019818408 0.0061361480 0.0013437625
## Muribaculaceae 0.3474669156 0.1951729118 0.2483398778 0.2554552748
## Other 0.0238288544 0.0340600083 0.0336587533 0.0429201765
## Streptococcaceae 0.0007509946 0.0001843573 0.0002761867 0.0001403931
## MB134 MB135 MB136 MB137 MB138
## Erysipelotrichaceae 0.20586931 0.03656234 0.04740588 0.066269864 0.228388418
## Lachnospiraceae 0.24846201 0.37448584 0.40950804 0.519564846 0.451710288
## Lactobacillaceae 0.01671008 0.04449081 0.05703031 0.008059463 0.034678287
## Muribaculaceae 0.07529236 0.05466468 0.08917140 0.045138691 0.002782663
## Other 0.34689353 0.34616990 0.22655446 0.244460899 0.107946342
## Streptococcaceae 0.10677271 0.14362643 0.17032992 0.116506237 0.174494002
## MB139 MB140 MB141 MB142 MB143
## Erysipelotrichaceae 0.64906974 0.227641608 0.37414375 0.6210939825 0.602727154
## Lachnospiraceae 0.03301055 0.497614739 0.22588011 0.1141003512 0.133822822
## Lactobacillaceae 0.04365140 0.010116796 0.02530416 0.0538956015 0.149403435
## Muribaculaceae 0.01568926 0.006360695 0.07523089 0.1343372418 0.069883309
## Other 0.03912523 0.115753688 0.08826637 0.0762752217 0.043595123
## Streptococcaceae 0.21945381 0.142512475 0.21117473 0.0002976013 0.000568157
## MB144 MB145 MB146 MB147
## Erysipelotrichaceae 0.5045197586 0.6393566223 0.4083146411 0.4069255503
## Lachnospiraceae 0.1232760740 0.1163995592 0.1367761011 0.1720009894
## Lactobacillaceae 0.1205451020 0.0502252209 0.2115365008 0.1434825625
## Muribaculaceae 0.1435945053 0.1237071549 0.2185205954 0.2069502844
## Other 0.1079007019 0.0697314749 0.0239090538 0.0702696018
## Streptococcaceae 0.0001638583 0.0005799679 0.0009431077 0.0003710116
## MB148 MB149 MB150 MB151 MB152
## Erysipelotrichaceae 0.4580717974 0.3589851298 0.74877122 0.697794302 0.84522613
## Lachnospiraceae 0.0917411335 0.1335517657 0.08118022 0.123628567 0.04911738
## Lactobacillaceae 0.1331436876 0.0498193733 0.05959769 0.009922219 0.04638578
## Muribaculaceae 0.2632571658 0.4064241508 0.01260325 0.017631897 0.00201005
## Other 0.0536161529 0.0507715142 0.05528412 0.066900846 0.02863033
## Streptococcaceae 0.0001700628 0.0004480663 0.04256349 0.084122169 0.02863033
## MB153 MB154 MB155 MB156 MB157
## Erysipelotrichaceae 0.707168407 0.311052734 0.32937232 0.17527004 0.6349276800
## Lachnospiraceae 0.161940192 0.387332166 0.38815888 0.53371234 0.1152420239
## Lactobacillaceae 0.008413221 0.026804826 0.01035649 0.01768050 0.0057438254
## Muribaculaceae 0.004435542 0.008756567 0.02361639 0.02899375 0.1956294710
## Other 0.085448562 0.170947655 0.14148882 0.13393974 0.0480914835
## Streptococcaceae 0.032594076 0.095106052 0.10700709 0.11040364 0.0003655162
## MB158 MB159 MB160 MB161
## Erysipelotrichaceae 0.6149764777 0.7774967425 0.6647181458 0.463469279
## Lachnospiraceae 0.1680343815 0.0703801640 0.0988431509 0.212681167
## Lactobacillaceae 0.0129638145 0.0218632636 0.0177002003 0.011083133
## Muribaculaceae 0.1632591702 0.1069402928 0.1816621019 0.250807939
## Other 0.0405185526 0.0230704376 0.0363610350 0.059499970
## Streptococcaceae 0.0002476036 0.0002490994 0.0007153661 0.002458513
## MB162 MB163 MB164
## Erysipelotrichaceae 0.348300606 0.2715826923 0.5546860692
## Lachnospiraceae 0.282816998 0.2944764017 0.1070744743
## Lactobacillaceae 0.009581919 0.0133989419 0.0061604036
## Muribaculaceae 0.336849568 0.3573821240 0.2886398828
## Other 0.019486100 0.0625360963 0.0427898303
## Streptococcaceae 0.002964809 0.0006237438 0.0006493398
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family unique
## Erysipelotrichaceae "Erysipelotrichaceae" "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae" "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae" "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae" "Muribaculaceae"
## Other "Other" "Other"
## Streptococcaceae "Streptococcaceae" "Streptococcaceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# vitamin
phy2 %>% plot_composition(group_by = "vitamin")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "vitamin")+
scale_y_continuous(labels = percent)
# fiber
phy2 %>% plot_composition(group_by = "fiber")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "fiber")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+ scale_y_continuous(labels = percent)
phy_high<-subset_samples(phy, group %in% c("AH","BH"))
phy_high
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 2688 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 2688 taxa by 6 taxonomic ranks ]
## phy_tree() Phylogenetic Tree: [ 2688 tips and 2686 internal nodes ]
table(sample_data(phy_high)$group)
##
## AH BH
## 8 8
This phyloseq has 2688 sequences and 16 samples.
8 samples with Retinyl Acetate High Fiber Diet.
8 samples with Beta Carotene High Fiber Diet.
The top 5 families for high fiber diet with vitamins are:
“Erysipelotrichaceae” “Lachnospiraceae” “Lactobacillaceae”
“Muribaculaceae” “Unknown”
phy2 <- phy_high %>% aggregate_top_taxa(level = "Family", top = 5) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 6 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 6 taxa by 2 taxonomic ranks ]
head(otu_table(phy2))
## OTU Table: [6 taxa and 16 samples]
## taxa are rows
## MB126 MB127 MB128 MB129
## Erysipelotrichaceae 0.661102723 0.786841281 0.734061311 0.691348952
## Lachnospiraceae 0.126648858 0.051532051 0.060692301 0.086540481
## Lactobacillaceae 0.007831555 0.002957579 0.005784638 0.004964454
## Muribaculaceae 0.183195341 0.144758444 0.183082253 0.195428503
## Other 0.020325540 0.012005765 0.015327745 0.019137895
## Unknown 0.000895983 0.001904881 0.001051752 0.002579716
## MB130 MB131 MB132 MB133 MB142
## Erysipelotrichaceae 0.5351952586 0.703952927 0.697959821 0.640112314 0.62109398
## Lachnospiraceae 0.0866485345 0.064647954 0.013629213 0.060028079 0.11410035
## Lactobacillaceae 0.0061094422 0.001981841 0.006136148 0.001343763 0.05389560
## Muribaculaceae 0.3474669156 0.195172912 0.248339878 0.255455275 0.13433724
## Other 0.0241333117 0.027761134 0.029035628 0.038247092 0.02389739
## Unknown 0.0004465373 0.006483231 0.004899312 0.004813478 0.05267544
## MB143 MB144 MB145 MB146 MB147
## Erysipelotrichaceae 0.60272715 0.50451976 0.63935662 0.408314641 0.40692555
## Lachnospiraceae 0.13382282 0.12327607 0.11639956 0.136776101 0.17200099
## Lactobacillaceae 0.14940344 0.12054510 0.05022522 0.211536501 0.14348256
## Muribaculaceae 0.06988331 0.14359451 0.12370715 0.218520595 0.20695028
## Other 0.01885844 0.05931671 0.04552748 0.020697390 0.03482562
## Unknown 0.02530484 0.04874785 0.02478396 0.004154772 0.03581499
## MB148 MB149
## Erysipelotrichaceae 0.45807180 0.35898513
## Lachnospiraceae 0.09174113 0.13355177
## Lactobacillaceae 0.13314369 0.04981937
## Muribaculaceae 0.26325717 0.40642415
## Other 0.02288117 0.04777507
## Unknown 0.03090504 0.00344451
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family unique
## Erysipelotrichaceae "Erysipelotrichaceae" "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae" "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae" "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae" "Muribaculaceae"
## Other "Other" "Other"
## Unknown "Unknown" "Unknown"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+ scale_y_continuous(labels = percent)
phy_low<-subset_samples(phy, group %in% c("AL","BL"))
phy_low
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 2688 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 2688 taxa by 6 taxonomic ranks ]
## phy_tree() Phylogenetic Tree: [ 2688 tips and 2686 internal nodes ]
table(sample_data(phy_low)$group)
##
## AL BL
## 8 8
This phyloseq has 2688 sequences and 16 samples.
8 samples with Retinyl Acetate low Fiber Diet.
8 samples with Beta Carotene low Fiber Diet.
The top 5 families are:
“Erysipelotrichaceae” “Lachnospiraceae” “Muribaculaceae”
“Ruminococcaceae” “Streptococcaceae”
phy2 <- phy_low %>% aggregate_top_taxa(level = "Family", top = 5) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 6 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 6 taxa by 2 taxonomic ranks ]
head(otu_table(phy2))
## OTU Table: [6 taxa and 16 samples]
## taxa are rows
## MB118 MB119 MB120 MB121 MB122
## Erysipelotrichaceae 0.75548765 0.56877184 0.77645696 0.734562090 0.03739365
## Lachnospiraceae 0.04340622 0.18502561 0.11333791 0.067641947 0.34163026
## Muribaculaceae 0.02341396 0.04748192 0.02360312 0.016572518 0.24436652
## Other 0.11005423 0.10461410 0.04609046 0.094655272 0.13258795
## Ruminococcaceae 0.00699406 0.04288760 0.02068492 0.009149285 0.09329731
## Streptococcaceae 0.06064388 0.05121892 0.01982662 0.077418888 0.15072430
## MB123 MB124 MB125 MB134 MB135
## Erysipelotrichaceae 0.04496691 0.12002141 0.18169970 0.20586931 0.03656234
## Lachnospiraceae 0.55209832 0.49262289 0.32734963 0.24846201 0.37448584
## Muribaculaceae 0.09638703 0.15809189 0.17717504 0.07529236 0.05466468
## Other 0.06284681 0.08049843 0.09799341 0.26589259 0.30255340
## Ruminococcaceae 0.08380945 0.07201284 0.06750111 0.09771102 0.08810730
## Streptococcaceae 0.15989149 0.07675254 0.14828112 0.10677271 0.14362643
## MB136 MB137 MB138 MB139 MB140
## Erysipelotrichaceae 0.04740588 0.06626986 0.228388418 0.64906974 0.227641608
## Lachnospiraceae 0.40950804 0.51956485 0.451710288 0.03301055 0.497614739
## Muribaculaceae 0.08917140 0.04513869 0.002782663 0.01568926 0.006360695
## Other 0.17028515 0.16557498 0.070275379 0.06911109 0.044881285
## Ruminococcaceae 0.11329961 0.08694538 0.072349251 0.01366554 0.080989198
## Streptococcaceae 0.17032992 0.11650624 0.174494002 0.21945381 0.142512475
## MB141
## Erysipelotrichaceae 0.37414375
## Lachnospiraceae 0.22588011
## Muribaculaceae 0.07523089
## Other 0.08318849
## Ruminococcaceae 0.03038203
## Streptococcaceae 0.21117473
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family unique
## Erysipelotrichaceae "Erysipelotrichaceae" "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae" "Lachnospiraceae"
## Muribaculaceae "Muribaculaceae" "Muribaculaceae"
## Other "Other" "Other"
## Ruminococcaceae "Ruminococcaceae" "Ruminococcaceae"
## Streptococcaceae "Streptococcaceae" "Streptococcaceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+ scale_y_continuous(labels = percent)
phy<-readRDS("D:/R/Masha/phy_cleaned_prevalence.rds")
phy
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 1571 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 1571 taxa by 6 taxonomic ranks ]
## phy_tree() Phylogenetic Tree: [ 1571 tips and 1569 internal nodes ]
The 2nd phyloseq object was cleaned by:
Removing NA phylum sequences.
Removing sequences that occur in not more than 3 samples (5% of our samples).
Removing the phyla Cyanobacteria/Chloroplast, Deferribacteres, and Tenericutes which are comprised of low-prevalence features.
This phyloseq have 1571 sequences.
## There are 25 different families
get_taxa_unique(phy, "Family")
## [1] "Erysipelotrichaceae" "Muribaculaceae"
## [3] "Lactobacillaceae" "Streptococcaceae"
## [5] "Lachnospiraceae" "Peptostreptococcaceae"
## [7] "Clostridiales_Incertae_Sedis_XIII" "Ruminococcaceae"
## [9] "Bacteroidaceae" NA
## [11] "Sutterellaceae" "Atopobiaceae"
## [13] "Eggerthellaceae" "Clostridiaceae_1"
## [15] "Enterococcaceae" "Akkermansiaceae"
## [17] "Rikenellaceae" "Staphylococcaceae"
## [19] "Prevotellaceae" "Bifidobacteriaceae"
## [21] "Porphyromonadaceae" "Moraxellaceae"
## [23] "Enterobacteriaceae" "Eubacteriaceae"
## [25] "Caulobacteraceae"
sample_data(phy)$group<-factor(sample_data(phy)$group)
sample_data(phy)$gender<-factor(sample_data(phy)$gender)
sample_data(phy)$vitamin<-factor(sample_data(phy)$vitamin)
sample_data(phy)$fiber<-factor(sample_data(phy)$fiber)
phy2 <- phy %>% aggregate_taxa(level = "Family") %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 25 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 25 taxa by 6 taxonomic ranks ]
We have 25 taxa because we have 25 different families.
head(otu_table(phy2))
## OTU Table: [6 taxa and 64 samples]
## taxa are rows
## MB101 MB102 MB103 MB104
## Bifidobacteriaceae 2.043903e-05 5.376344e-05 9.988763e-05 0.0000000000
## Atopobiaceae 4.496587e-04 1.424731e-03 2.746910e-04 0.0010278398
## Eggerthellaceae 1.430732e-04 8.602151e-04 5.493819e-04 0.0004698696
## Bacteroidaceae 3.454196e-03 3.629032e-03 4.544887e-03 0.0003524022
## Muribaculaceae 4.338797e-01 4.801613e-01 5.090024e-01 0.3837660049
## Porphyromonadaceae 2.043903e-05 0.000000e+00 0.000000e+00 0.0000000000
## MB105 MB106 MB107 MB108
## Bifidobacteriaceae 0.0001799784 0.0001353887 2.192165e-05 0.0001661879
## Atopobiaceae 0.0013398392 0.0053768640 3.726681e-04 0.0024928183
## Eggerthellaceae 0.0003799544 0.0009477206 5.918846e-04 0.0004035992
## Bacteroidaceae 0.0002399712 0.0009283794 1.227613e-03 0.0059115406
## Muribaculaceae 0.4860816702 0.4490841924 4.715347e-01 0.4088222027
## Porphyromonadaceae 0.0000000000 0.0000000000 0.000000e+00 0.0000000000
## MB109 MB110 MB111 MB112
## Bifidobacteriaceae 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## Atopobiaceae 0.0027787957 0.0020232277 0.0022899720 0.0022917164
## Eggerthellaceae 0.0008855503 0.0005517894 0.0009911819 0.0004058248
## Bacteroidaceae 0.0013435935 0.0016290924 0.0003076082 0.0092623538
## Muribaculaceae 0.4845181385 0.4101634348 0.4457242464 0.4610885653
## Porphyromonadaceae 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## MB113 MB114 MB115 MB116
## Bifidobacteriaceae 6.454389e-05 2.991504e-05 0.0000000000 0.0000000000
## Atopobiaceae 2.237522e-03 1.884648e-03 0.0022877096 0.0031347962
## Eggerthellaceae 7.314974e-04 5.085557e-04 0.0004515216 0.0006142506
## Bacteroidaceae 2.151463e-05 8.675362e-04 0.0002107101 0.0010590528
## Muribaculaceae 3.876721e-01 4.894400e-01 0.3985129888 0.4410531221
## Porphyromonadaceae 0.000000e+00 0.000000e+00 0.0000000000 0.0000000000
## MB117 MB118 MB119 MB120
## Bifidobacteriaceae 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## Atopobiaceae 0.0023423031 0.0006461061 0.0001539781 0.0000429332
## Eggerthellaceae 0.0013618041 0.0021536871 0.0010778469 0.0008157307
## Bacteroidaceae 0.0002995969 0.0086147484 0.0151778447 0.0045509188
## Muribaculaceae 0.3960943458 0.0233890420 0.0475132531 0.0236132578
## Porphyromonadaceae 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## MB121 MB122 MB123 MB124
## Bifidobacteriaceae 0.0000000000 0.000000000 0.000000000 0.000000000
## Atopobiaceae 0.0008574879 0.000000000 0.000000000 0.000000000
## Eggerthellaceae 0.0030434783 0.004775879 0.002650982 0.001529871
## Bacteroidaceae 0.0112318841 0.014989355 0.009775495 0.022527346
## Muribaculaceae 0.0162198068 0.244519247 0.094565488 0.158188633
## Porphyromonadaceae 0.0000000000 0.000000000 0.000000000 0.000000000
## MB125 MB126 MB127 MB128
## Bifidobacteriaceae 0.000000e+00 0.000000e+00 0.0000000000 1.547604e-05
## Atopobiaceae 0.000000e+00 6.818027e-05 0.0003135032 2.166646e-04
## Eggerthellaceae 7.011372e-03 2.215859e-04 0.0000877809 1.392844e-04
## Bacteroidaceae 1.070287e-02 3.579464e-03 0.0020691212 3.977343e-03
## Muribaculaceae 1.763744e-01 1.879560e-01 0.1448008628 1.830816e-01
## Porphyromonadaceae 2.477517e-05 0.000000e+00 0.0000000000 0.000000e+00
## MB129 MB130 MB131 MB132
## Bifidobacteriaceae 1.500803e-05 2.031117e-05 3.076119e-05 0.0000000000
## Atopobiaceae 3.001606e-04 3.412276e-03 5.306305e-03 0.0073172490
## Eggerthellaceae 2.101124e-04 2.031117e-04 1.384253e-04 0.0001682126
## Bacteroidaceae 6.333388e-03 8.530690e-03 7.490349e-03 0.0098644687
## Muribaculaceae 1.955096e-01 3.474225e-01 1.953181e-01 0.2483539194
## Porphyromonadaceae 0.000000e+00 0.000000e+00 0.000000e+00 0.0000000000
## MB133 MB134 MB135 MB136 MB137
## Bifidobacteriaceae 0.0000000000 0.00000000 0.000000000 0.000000000 0.000000000
## Atopobiaceae 0.0072281899 0.00000000 0.000000000 0.000000000 0.000000000
## Eggerthellaceae 0.0005019576 0.01106843 0.005065554 0.009454759 0.007767656
## Bacteroidaceae 0.0128501155 0.02779912 0.007726034 0.002694361 0.008681498
## Muribaculaceae 0.2554562795 0.06826007 0.039864635 0.046343017 0.043892966
## Porphyromonadaceae 0.0000000000 0.00000000 0.000000000 0.000000000 0.000000000
## MB138 MB139 MB140 MB141
## Bifidobacteriaceae 0.000000000 0.0000000000 0.0000000000 0.000000e+00
## Atopobiaceae 0.000000000 0.0000000000 0.0000000000 6.822329e-05
## Eggerthellaceae 0.003034861 0.0070752150 0.0020347558 5.372584e-03
## Bacteroidaceae 0.005198849 0.0002612387 0.0005224373 3.070048e-03
## Muribaculaceae 0.002797350 0.0156960923 0.0063792345 7.496035e-02
## Porphyromonadaceae 0.000000000 0.0000000000 0.0004399472 0.000000e+00
## MB142 MB143 MB144 MB145
## Bifidobacteriaceae 0.0000000000 2.186892e-05 0.000000000 0.0000000000
## Atopobiaceae 0.0065252369 6.560675e-03 0.003912128 0.0067527040
## Eggerthellaceae 0.0002085692 2.186892e-05 0.000000000 0.0001160923
## Bacteroidaceae 0.0024134438 1.530824e-03 0.026099089 0.0154402802
## Muribaculaceae 0.1342291878 6.973998e-02 0.143380844 0.1236963799
## Porphyromonadaceae 0.0000000000 0.000000e+00 0.000000000 0.0000000000
## MB146 MB147 MB148 MB149
## Bifidobacteriaceae 0.000000e+00 0.000000e+00 3.093964e-05 2.804262e-05
## Atopobiaceae 3.573160e-03 5.494913e-03 7.750379e-03 7.851935e-03
## Eggerthellaceae 5.104515e-05 4.950373e-05 1.237585e-04 0.000000e+00
## Bacteroidaceae 8.601108e-03 1.772233e-02 7.611151e-03 2.316321e-02
## Muribaculaceae 2.186519e-01 2.069751e-01 2.633891e-01 4.067583e-01
## Porphyromonadaceae 0.000000e+00 0.000000e+00 3.093964e-05 0.000000e+00
## MB150 MB151 MB152 MB153
## Bifidobacteriaceae 0.0000000000 0.000000e+00 0.0000000000 0.000000e+00
## Atopobiaceae 0.0002495083 4.565272e-05 0.0003351898 2.863524e-05
## Eggerthellaceae 0.0017612352 2.077199e-03 0.0014696782 1.345856e-03
## Bacteroidaceae 0.0041682567 3.834828e-03 0.0003351898 1.059504e-03
## Muribaculaceae 0.0125781548 1.759912e-02 0.0017533003 4.438463e-03
## Porphyromonadaceae 0.0000000000 0.000000e+00 0.0000000000 0.000000e+00
## MB154 MB155 MB156 MB157
## Bifidobacteriaceae 0.000000e+00 0.0000000000 0.0000000000 2.614926e-05
## Atopobiaceae 4.869023e-05 0.0001497768 0.0000000000 0.000000e+00
## Eggerthellaceae 1.606778e-03 0.0014977683 0.0015360109 1.568956e-04
## Bacteroidaceae 7.303535e-04 0.0007488842 0.0008533394 2.871189e-02
## Muribaculaceae 8.666861e-03 0.0236347842 0.0288997611 1.955180e-01
## Porphyromonadaceae 1.022495e-03 0.0000000000 0.0000000000 0.000000e+00
## MB158 MB159 MB160 MB161
## Bifidobacteriaceae 1.770632e-05 3.835238e-05 0.0000000000 3.971012e-05
## Atopobiaceae 5.311897e-05 7.670476e-05 0.0001022850 5.956517e-05
## Eggerthellaceae 3.364201e-04 2.492905e-04 0.0003273122 9.927529e-05
## Bacteroidaceae 1.062379e-02 2.186086e-03 0.0174907432 9.728978e-03
## Muribaculaceae 1.633054e-01 1.068881e-01 0.1813104760 2.510076e-01
## Porphyromonadaceae 1.062379e-04 0.000000e+00 0.0000000000 0.000000e+00
## MB162 MB163 MB164
## Bifidobacteriaceae 0.000000e+00 4.625882e-05 0.000000e+00
## Atopobiaceae 0.000000e+00 0.000000e+00 8.331667e-05
## Eggerthellaceae 2.797143e-04 4.625882e-05 9.998000e-05
## Bacteroidaceae 1.420088e-03 1.239736e-02 2.182897e-02
## Muribaculaceae 3.368190e-01 3.577426e-01 2.886923e-01
## Porphyromonadaceae 8.606593e-05 0.000000e+00 0.000000e+00
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 6 taxonomic ranks]:
## Kingdom Phylum Class
## Bifidobacteriaceae "Bacteria" "Actinobacteria" "Actinobacteria"
## Atopobiaceae "Bacteria" "Actinobacteria" "Coriobacteriia"
## Eggerthellaceae "Bacteria" "Actinobacteria" "Coriobacteriia"
## Bacteroidaceae "Bacteria" "Bacteroidetes" "Bacteroidia"
## Muribaculaceae "Bacteria" "Bacteroidetes" "Bacteroidia"
## Porphyromonadaceae "Bacteria" "Bacteroidetes" "Bacteroidia"
## Order Family
## Bifidobacteriaceae "Bifidobacteriales" "Bifidobacteriaceae"
## Atopobiaceae "Coriobacteriales" "Atopobiaceae"
## Eggerthellaceae "Eggerthellales" "Eggerthellaceae"
## Bacteroidaceae "Bacteroidales" "Bacteroidaceae"
## Muribaculaceae "Bacteroidales" "Muribaculaceae"
## Porphyromonadaceae "Bacteroidales" "Porphyromonadaceae"
## unique
## Bifidobacteriaceae "Bifidobacteriaceae"
## Atopobiaceae "Atopobiaceae"
## Eggerthellaceae "Eggerthellaceae"
## Bacteroidaceae "Bacteroidaceae"
## Muribaculaceae "Muribaculaceae"
## Porphyromonadaceae "Porphyromonadaceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
The top 10 families are:
“Bacteroidaceae” “Clostridiales_Incertae_Sedis_XIII” “Erysipelotrichaceae” “Lachnospiraceae”
“Lactobacillaceae” “Muribaculaceae”
“Peptostreptococcaceae” “Ruminococcaceae” “Streptococcaceae” “Unknown”
The same as the first phyloseq object
phy2 <- phy %>% aggregate_top_taxa(level = "Family", top = 10) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 11 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 11 taxa by 2 taxonomic ranks ]
# we now have 11 taxa, 10 top families and 1 other
head(otu_table(phy2))
## OTU Table: [6 taxa and 64 samples]
## taxa are rows
## MB101 MB102 MB103
## Bacteroidaceae 0.0034541961 0.0036290323 0.004544887
## Clostridiales_Incertae_Sedis_XIII 0.0007562441 0.0005107527 0.001398427
## Erysipelotrichaceae 0.3844377223 0.4360752688 0.250942689
## Lachnospiraceae 0.0256305441 0.0120967742 0.010538145
## Lactobacillaceae 0.0289416670 0.0299731183 0.201323511
## Muribaculaceae 0.4338797367 0.4801612903 0.509002372
## MB104 MB105 MB106
## Bacteroidaceae 0.0003524022 0.0002399712 0.0009283794
## Clostridiales_Incertae_Sedis_XIII 0.0003817691 0.0015998080 0.0005415546
## Erysipelotrichaceae 0.5650182074 0.3680558333 0.4661625051
## Lachnospiraceae 0.0076647480 0.0279966404 0.0177359147
## Lactobacillaceae 0.0273111712 0.0700115986 0.0302303541
## Muribaculaceae 0.3837660049 0.4860816702 0.4490841924
## MB107 MB108 MB109
## Bacteroidaceae 0.0012276125 0.0059115406 0.001343594
## Clostridiales_Incertae_Sedis_XIII 0.0006357279 0.0004985637 0.001160376
## Erysipelotrichaceae 0.4343994563 0.5054248475 0.345120313
## Lachnospiraceae 0.0082863845 0.0059590228 0.019329425
## Lactobacillaceae 0.0697546967 0.0464613851 0.083669232
## Muribaculaceae 0.4715347349 0.4088222027 0.484518139
## MB110 MB111 MB112
## Bacteroidaceae 0.001629092 0.0003076082 0.0092623538
## Clostridiales_Incertae_Sedis_XIII 0.001918125 0.0006835737 0.0009787539
## Erysipelotrichaceae 0.354196227 0.4087770866 0.4290761518
## Lachnospiraceae 0.038309948 0.0306582815 0.0205777035
## Lactobacillaceae 0.155709706 0.0555403650 0.0213416090
## Muribaculaceae 0.410163435 0.4457242464 0.4610885653
## MB113 MB114 MB115
## Bacteroidaceae 2.151463e-05 0.0008675362 0.0002107101
## Clostridiales_Incertae_Sedis_XIII 1.226334e-03 0.0003888955 0.0011739562
## Erysipelotrichaceae 4.526678e-01 0.3699294005 0.3180518347
## Lachnospiraceae 1.540448e-02 0.0113378006 0.0099033744
## Lactobacillaceae 9.838640e-02 0.0865142994 0.2295234942
## Muribaculaceae 3.876721e-01 0.4894399904 0.3985129888
## MB116 MB117 MB118
## Bacteroidaceae 0.0010590528 0.0002995969 0.0086147484
## Clostridiales_Incertae_Sedis_XIII 0.0005507074 0.0009532629 0.0003445899
## Erysipelotrichaceae 0.3804329408 0.4453644188 0.7559441764
## Lachnospiraceae 0.0114589511 0.0425155246 0.0433752584
## Lactobacillaceae 0.0939803440 0.0606002833 0.0287517229
## Muribaculaceae 0.4410531221 0.3960943458 0.0233890420
## MB119 MB120 MB121
## Bacteroidaceae 0.015177845 0.004550919 0.0112318841
## Clostridiales_Incertae_Sedis_XIII 0.001451794 0.000429332 0.0003502415
## Erysipelotrichaceae 0.568949209 0.776747381 0.7349758454
## Lachnospiraceae 0.184905743 0.113171905 0.0674758454
## Lactobacillaceae 0.021930886 0.008844238 0.0244927536
## Muribaculaceae 0.047513253 0.023613258 0.0162198068
## MB122 MB123 MB124
## Bacteroidaceae 0.014989355 0.009775495 0.022527346
## Clostridiales_Incertae_Sedis_XIII 0.001294666 0.001408334 0.001759351
## Erysipelotrichaceae 0.037401462 0.045315218 0.120094852
## Lachnospiraceae 0.341187640 0.554552233 0.492503633
## Lactobacillaceae 0.076903159 0.021083589 0.029450011
## Muribaculaceae 0.244519247 0.094565488 0.158188633
## MB125 MB126 MB127
## Bacteroidaceae 0.010702871 0.0035794641 2.069121e-03
## Clostridiales_Incertae_Sedis_XIII 0.003146446 0.0003579464 3.762039e-05
## Erysipelotrichaceae 0.182493868 0.6790925206 7.871564e-01
## Lachnospiraceae 0.328246166 0.1031056112 5.126404e-02
## Lactobacillaceae 0.041919580 0.0080452717 2.934390e-03
## Muribaculaceae 0.176374402 0.1879559555 1.448009e-01
## MB128 MB129 MB130
## Bacteroidaceae 3.977343e-03 0.0063333884 8.530690e-03
## Clostridiales_Incertae_Sedis_XIII 3.095209e-05 0.0002251204 2.031117e-05
## Erysipelotrichaceae 7.343692e-01 0.6917200702 5.353617e-01
## Lachnospiraceae 6.041847e-02 0.0861911122 8.652557e-02
## Lactobacillaceae 5.788040e-03 0.0049676577 6.113661e-03
## Muribaculaceae 1.830816e-01 0.1955095976 3.474225e-01
## MB131 MB132 MB133
## Bacteroidaceae 7.490349e-03 0.0098644687 1.285012e-02
## Clostridiales_Incertae_Sedis_XIII 3.076119e-05 0.0000961215 8.031322e-05
## Erysipelotrichaceae 7.046003e-01 0.6982385736 6.406184e-01
## Lachnospiraceae 6.396789e-02 0.0135050704 5.969280e-02
## Lactobacillaceae 1.968716e-03 0.0060316240 1.345246e-03
## Muribaculaceae 1.953181e-01 0.2483539194 2.554563e-01
## MB134 MB135 MB136
## Bacteroidaceae 0.02779912 0.007726034 0.002694361
## Clostridiales_Incertae_Sedis_XIII 0.17086357 0.193427550 0.082839367
## Erysipelotrichaceae 0.20822308 0.039162268 0.050702983
## Lachnospiraceae 0.25508607 0.391537545 0.432959389
## Lactobacillaceae 0.01328781 0.036033543 0.052172635
## Muribaculaceae 0.06826007 0.039864635 0.046343017
## MB137 MB138 MB139
## Bacteroidaceae 0.008681498 0.005198849 0.0002612387
## Clostridiales_Incertae_Sedis_XIII 0.106833824 0.001187554 0.0005007075
## Erysipelotrichaceae 0.066453437 0.229593856 0.6493088059
## Lachnospiraceae 0.520861296 0.453645792 0.0329813867
## Lactobacillaceae 0.008081789 0.034861320 0.0436486339
## Muribaculaceae 0.043892966 0.002797350 0.0156960923
## MB140 MB141 MB142
## Bacteroidaceae 0.0005224373 0.003070048 2.413444e-03
## Clostridiales_Incertae_Sedis_XIII 0.0015123185 0.001517968 8.938681e-05
## Erysipelotrichaceae 0.2282776067 0.374426498 6.216554e-01
## Lachnospiraceae 0.4990376155 0.225597380 1.136106e-01
## Lactobacillaceae 0.0101462824 0.025327898 5.395984e-02
## Muribaculaceae 0.0063792345 0.074960345 1.342292e-01
## MB143 MB144 MB145
## Bacteroidaceae 1.530824e-03 0.0260990890 0.0154402802
## Clostridiales_Incertae_Sedis_XIII 8.747567e-05 0.0003830055 0.0003095796
## Erysipelotrichaceae 6.031448e-01 0.5052116105 0.6398235397
## Lachnospiraceae 1.334441e-01 0.1228626925 0.1161503783
## Lactobacillaceae 1.494959e-01 0.1207014472 0.0501712362
## Muribaculaceae 6.973998e-02 0.1433808443 0.1236963799
## MB146 MB147 MB148
## Bacteroidaceae 0.008601108 0.0177223336 0.0076111506
## Clostridiales_Incertae_Sedis_XIII 0.000178658 0.0006930522 0.0008044306
## Erysipelotrichaceae 0.408565376 0.4070443801 0.4582160205
## Lachnospiraceae 0.136724433 0.1719016856 0.0916741437
## Lactobacillaceae 0.211326919 0.1434865474 0.1330094985
## Muribaculaceae 0.218651898 0.2069750749 0.2633891278
## MB149 MB150 MB151
## Bacteroidaceae 0.023163208 0.004168257 0.003834828
## Clostridiales_Incertae_Sedis_XIII 0.000673023 0.001511727 0.001894588
## Erysipelotrichaceae 0.359001683 0.748994628 0.698258349
## Lachnospiraceae 0.133342681 0.080972789 0.123444954
## Lactobacillaceae 0.049859787 0.059603135 0.009929467
## Muribaculaceae 0.406758273 0.012578155 0.017599123
## MB152 MB153 MB154
## Bacteroidaceae 3.351898e-04 0.0010595040 0.0007303535
## Clostridiales_Incertae_Sedis_XIII 7.735149e-05 0.0006872459 0.0019476093
## Erysipelotrichaceae 8.456322e-01 0.7076341561 0.3110818970
## Lachnospiraceae 4.911819e-02 0.1619323063 0.3874281819
## Lactobacillaceae 4.641089e-02 0.0084187618 0.0268283182
## Muribaculaceae 1.753300e-03 0.0044384629 0.0086668614
## MB155 MB156 MB157
## Bacteroidaceae 0.0007488842 0.0008533394 0.0287118875
## Clostridiales_Incertae_Sedis_XIII 0.0018272774 0.0018773467 0.0001568956
## Erysipelotrichaceae 0.3296288530 0.1753328024 0.6356885100
## Lachnospiraceae 0.3883413714 0.5337353510 0.1149521469
## Lactobacillaceae 0.0103645568 0.0176925703 0.0057266879
## Muribaculaceae 0.0236347842 0.0288997611 0.1955180168
## MB158 MB159 MB160
## Bacteroidaceae 0.0106237938 2.186086e-03 0.01749074
## Clostridiales_Incertae_Sedis_XIII 0.0002124759 7.670476e-05 0.00000000
## Erysipelotrichaceae 0.6155426103 7.779205e-01 0.66522104
## Lachnospiraceae 0.1675903465 7.020403e-02 0.09872553
## Lactobacillaceae 0.0129787347 2.184168e-02 0.01771577
## Muribaculaceae 0.1633054164 1.068881e-01 0.18131048
## MB161 MB162 MB163
## Bacteroidaceae 0.0097289785 1.420088e-03 0.01239736
## Clostridiales_Incertae_Sedis_XIII 0.0002581158 2.151648e-05 0.00000000
## Erysipelotrichaceae 0.4640722724 3.488037e-01 0.27186307
## Lachnospiraceae 0.2123697012 2.828342e-01 0.29427547
## Lactobacillaceae 0.0110989775 9.574834e-03 0.01311437
## Muribaculaceae 0.2510076442 3.368190e-01 0.35774257
## MB164
## Bacteroidaceae 0.02182897
## Clostridiales_Incertae_Sedis_XIII 0.00009998
## Erysipelotrichaceae 0.55502233
## Lachnospiraceae 0.10686196
## Lactobacillaceae 0.00609878
## Muribaculaceae 0.28869226
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family
## Bacteroidaceae "Bacteroidaceae"
## Clostridiales_Incertae_Sedis_XIII "Clostridiales_Incertae_Sedis_XIII"
## Erysipelotrichaceae "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae"
## unique
## Bacteroidaceae "Bacteroidaceae"
## Clostridiales_Incertae_Sedis_XIII "Clostridiales_Incertae_Sedis_XIII"
## Erysipelotrichaceae "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)+ scale_fill_viridis_d()
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# vitamin
phy2 %>% plot_composition(group_by = "vitamin")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "vitamin")+
scale_y_continuous(labels = percent)
# fiber
phy2 %>% plot_composition(group_by = "fiber")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "fiber")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+ scale_y_continuous(labels = percent)
The top 5 families are:
“Erysipelotrichaceae” “Lachnospiraceae” “Lactobacillaceae”
“Muribaculaceae” “Streptococcaceae”
They are the same of the first cleaned phyloseq object
phy2 <- phy %>% aggregate_top_taxa(level = "Family", top = 5) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 6 taxa and 64 samples ]
## sample_data() Sample Data: [ 64 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 6 taxa by 2 taxonomic ranks ]
head(otu_table(phy2))
## OTU Table: [6 taxa and 64 samples]
## taxa are rows
## MB101 MB102 MB103 MB104 MB105
## Erysipelotrichaceae 0.38443772 0.43607527 0.25094269 0.565018207 0.36805583
## Lachnospiraceae 0.02563054 0.01209677 0.01053814 0.007664748 0.02799664
## Lactobacillaceae 0.02894167 0.02997312 0.20132351 0.027311171 0.07001160
## Muribaculaceae 0.43387974 0.48016129 0.50900237 0.383766005 0.48608167
## Other 0.12711033 0.04169355 0.02819328 0.016239868 0.04785426
## Streptococcaceae 0.00000000 0.00000000 0.00000000 0.000000000 0.00000000
## MB106 MB107 MB108 MB109 MB110
## Erysipelotrichaceae 0.46616251 4.343995e-01 0.505424847 0.34512031 0.35419623
## Lachnospiraceae 0.01773591 8.286384e-03 0.005959023 0.01932942 0.03830995
## Lactobacillaceae 0.03023035 6.975470e-02 0.046461385 0.08366923 0.15570971
## Muribaculaceae 0.44908419 4.715347e-01 0.408822203 0.48451814 0.41016343
## Other 0.03678703 1.600281e-02 0.033332542 0.06736289 0.04162068
## Streptococcaceae 0.00000000 2.192165e-05 0.000000000 0.00000000 0.00000000
## MB111 MB112 MB113 MB114 MB115
## Erysipelotrichaceae 0.40877709 0.42907615 0.45266781 0.36992940 0.3180518347
## Lachnospiraceae 0.03065828 0.02057770 0.01540448 0.01133780 0.0099033744
## Lactobacillaceae 0.05554037 0.02134161 0.09838640 0.08651430 0.2295234942
## Muribaculaceae 0.44572425 0.46108857 0.38767212 0.48943999 0.3985129888
## Other 0.05930002 0.06791597 0.04586919 0.04277851 0.0438879022
## Streptococcaceae 0.00000000 0.00000000 0.00000000 0.00000000 0.0001204058
## MB116 MB117 MB118 MB119 MB120
## Erysipelotrichaceae 0.38043294 0.44536442 0.75594418 0.56894921 0.776747381
## Lachnospiraceae 0.01145895 0.04251552 0.04337526 0.18490574 0.113171905
## Lactobacillaceae 0.09398034 0.06060028 0.02875172 0.02193089 0.008844238
## Muribaculaceae 0.44105312 0.39609435 0.02338904 0.04751325 0.023613258
## Other 0.07307464 0.05542543 0.08784890 0.12544819 0.057788082
## Streptococcaceae 0.00000000 0.00000000 0.06069090 0.05125272 0.019835137
## MB121 MB122 MB123 MB124 MB125
## Erysipelotrichaceae 0.73497585 0.03740146 0.04531522 0.12009485 0.18249387
## Lachnospiraceae 0.06747585 0.34118764 0.55455223 0.49250363 0.32824617
## Lactobacillaceae 0.02449275 0.07690316 0.02108359 0.02945001 0.04191958
## Muribaculaceae 0.01621981 0.24451925 0.09456549 0.15818863 0.17637440
## Other 0.07937198 0.14911675 0.12335349 0.12296336 0.12157174
## Streptococcaceae 0.07746377 0.15087174 0.16112998 0.07679951 0.14939425
## MB126 MB127 MB128 MB129
## Erysipelotrichaceae 0.6790925206 0.7871564005 0.7343691965 0.6917200702
## Lachnospiraceae 0.1031056112 0.0512640449 0.0604184722 0.0861911122
## Lactobacillaceae 0.0080452717 0.0029343900 0.0057880401 0.0049676577
## Muribaculaceae 0.1879559555 0.1448008628 0.1830815897 0.1955095976
## Other 0.0215961001 0.0136436597 0.0160796088 0.0214614819
## Streptococcaceae 0.0002045408 0.0002006421 0.0002630927 0.0001500803
## MB130 MB131 MB132 MB133
## Erysipelotrichaceae 0.5353617419 0.7046003353 0.6982385736 0.6406184118
## Lachnospiraceae 0.0865255718 0.0639678853 0.0135050704 0.0596928019
## Lactobacillaceae 0.0061136613 0.0019687159 0.0060316240 0.0013452465
## Muribaculaceae 0.3474225129 0.1953181476 0.2483539194 0.2554562795
## Other 0.0238249990 0.0339603488 0.0335944634 0.0427467122
## Streptococcaceae 0.0007515132 0.0001845671 0.0002763493 0.0001405481
## MB134 MB135 MB136 MB137 MB138
## Erysipelotrichaceae 0.20822308 0.03916227 0.05070298 0.066453437 0.22959386
## Lachnospiraceae 0.25508607 0.39153754 0.43295939 0.520861296 0.45364579
## Lactobacillaceae 0.01328781 0.03603354 0.05217264 0.008081789 0.03486132
## Muribaculaceae 0.06826007 0.03986463 0.04634302 0.043892966 0.00279735
## Other 0.34551145 0.33956240 0.23142115 0.243881543 0.10368670
## Streptococcaceae 0.10963153 0.15383960 0.18640082 0.116828969 0.17541498
## MB139 MB140 MB141 MB142 MB143
## Erysipelotrichaceae 0.64930881 0.228277607 0.37442650 0.621655444 0.6031447504
## Lachnospiraceae 0.03298139 0.499037615 0.22559738 0.113610631 0.1334441358
## Lactobacillaceae 0.04364863 0.010146282 0.02532790 0.053959836 0.1494959214
## Muribaculaceae 0.01569609 0.006379234 0.07496035 0.134229188 0.0697399786
## Other 0.03881572 0.113231412 0.08831506 0.076246946 0.0436066219
## Streptococcaceae 0.21954936 0.142927849 0.21137282 0.000297956 0.0005685919
## MB144 MB145 MB146 MB147
## Erysipelotrichaceae 0.5052116105 0.6398235397 0.4085653761 0.4070443801
## Lachnospiraceae 0.1228626925 0.1161503783 0.1367244328 0.1719016856
## Lactobacillaceae 0.1207014472 0.0501712362 0.2113269187 0.1434865474
## Muribaculaceae 0.1433808443 0.1236963799 0.2186518976 0.2069750749
## Other 0.1076792603 0.0695780044 0.0237870396 0.0702457860
## Streptococcaceae 0.0001641452 0.0005804617 0.0009443353 0.0003465261
## MB148 MB149 MB150 MB151 MB152
## Erysipelotrichaceae 0.458216021 0.359001683 0.74899463 0.698258349 0.84563222
## Lachnospiraceae 0.091674144 0.133342681 0.08097279 0.123444954 0.04911819
## Lactobacillaceae 0.133009498 0.049859787 0.05960313 0.009929467 0.04641089
## Muribaculaceae 0.263389128 0.406758273 0.01257815 0.017599123 0.00175330
## Other 0.053541041 0.050588895 0.05527343 0.066584492 0.02843956
## Streptococcaceae 0.000170168 0.000448682 0.04257786 0.084183615 0.02864583
## MB153 MB154 MB155 MB156 MB157
## Erysipelotrichaceae 0.707634156 0.311081897 0.32962885 0.17533280 0.6356885100
## Lachnospiraceae 0.161932306 0.387428182 0.38834137 0.53373535 0.1149521469
## Lactobacillaceae 0.008418762 0.026828318 0.01036456 0.01769257 0.0057266879
## Muribaculaceae 0.004438463 0.008666861 0.02363478 0.02889976 0.1955180168
## Other 0.084960770 0.170805336 0.14094000 0.13386051 0.0478008472
## Streptococcaceae 0.032615543 0.095189405 0.10709044 0.11047901 0.0003137911
## MB158 MB159 MB160 MB161
## Erysipelotrichaceae 0.6155426103 0.7779205339 0.6652210380 0.464072272
## Lachnospiraceae 0.1675903465 0.0702040347 0.0987255283 0.212369701
## Lactobacillaceae 0.0129787347 0.0218416814 0.0177157703 0.011098977
## Muribaculaceae 0.1633054164 0.1068880878 0.1813104760 0.251007644
## Other 0.0403350036 0.0229155481 0.0363111920 0.058989378
## Streptococcaceae 0.0002478885 0.0002301143 0.0007159953 0.002462027
## MB162 MB163 MB164
## Erysipelotrichaceae 0.348803684 0.271863074 0.55502233
## Lachnospiraceae 0.282834151 0.294275471 0.10686196
## Lactobacillaceae 0.009574834 0.013114375 0.00609878
## Muribaculaceae 0.336819003 0.357742570 0.28869226
## Other 0.018999053 0.062380016 0.04267480
## Streptococcaceae 0.002969274 0.000624494 0.00064987
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family unique
## Erysipelotrichaceae "Erysipelotrichaceae" "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae" "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae" "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae" "Muribaculaceae"
## Other "Other" "Other"
## Streptococcaceae "Streptococcaceae" "Streptococcaceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# vitamin
phy2 %>% plot_composition(group_by = "vitamin")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "vitamin")+
scale_y_continuous(labels = percent)
# fiber
phy2 %>% plot_composition(group_by = "fiber")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "fiber")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+ scale_y_continuous(labels = percent)
phy_high<-subset_samples(phy, group %in% c("AH","BH"))
phy_high
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 1571 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 1571 taxa by 6 taxonomic ranks ]
## phy_tree() Phylogenetic Tree: [ 1571 tips and 1569 internal nodes ]
table(sample_data(phy_high)$group)
##
## AH BH
## 8 8
This phyloseq has 1571 sequences and 16 samples.
8 samples with Retinyl Acetate High Fiber Diet.
8 samples with Beta Carotene High Fiber Diet.
The top 5 families for high fiber diet with vitamins are:
“Erysipelotrichaceae” “Lachnospiraceae” “Lactobacillaceae”
“Muribaculaceae” “Unknown”
They are the same as the first phyloseq object.
phy2 <- phy_high %>% aggregate_top_taxa(level = "Family", top = 5) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 6 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 6 taxa by 2 taxonomic ranks ]
head(otu_table(phy2))
## OTU Table: [6 taxa and 16 samples]
## taxa are rows
## MB126 MB127 MB128 MB129
## Erysipelotrichaceae 0.6790925206 0.787156400 0.734369196 0.691720070
## Lachnospiraceae 0.1031056112 0.051264045 0.060418472 0.086191112
## Lactobacillaceae 0.0080452717 0.002934390 0.005788040 0.004967658
## Muribaculaceae 0.1879559555 0.144800863 0.183081590 0.195509598
## Other 0.0208802073 0.011963283 0.015290331 0.019030181
## Unknown 0.0009204336 0.001881019 0.001052371 0.002581381
## MB130 MB131 MB132 MB133 MB142
## Erysipelotrichaceae 0.5353617419 0.704600335 0.698238574 0.640618412 0.62165544
## Lachnospiraceae 0.0865255718 0.063967885 0.013505070 0.059692802 0.11361063
## Lactobacillaceae 0.0061136613 0.001968716 0.006031624 0.001345246 0.05395984
## Muribaculaceae 0.3474225129 0.195318148 0.248353919 0.255456279 0.13422919
## Other 0.0241499777 0.027700448 0.029016677 0.038128702 0.02380669
## Unknown 0.0004265345 0.006444468 0.004854136 0.004758558 0.05273822
## MB143 MB144 MB145 MB146 MB147
## Erysipelotrichaceae 0.60314475 0.50521161 0.63982354 0.408565376 0.40704438
## Lachnospiraceae 0.13344414 0.12286269 0.11615038 0.136724433 0.17190169
## Lactobacillaceae 0.14949592 0.12070145 0.05017124 0.211326919 0.14348655
## Muribaculaceae 0.06973998 0.14338084 0.12369638 0.218651898 0.20697507
## Other 0.01887288 0.05928378 0.04546950 0.020622240 0.03477637
## Unknown 0.02530234 0.04855963 0.02468897 0.004109135 0.03581595
## MB148 MB149
## Erysipelotrichaceae 0.45821602 0.359001683
## Lachnospiraceae 0.09167414 0.133342681
## Lactobacillaceae 0.13300950 0.049859787
## Muribaculaceae 0.26338913 0.406758273
## Other 0.02283345 0.047672462
## Unknown 0.03087776 0.003365115
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family unique
## Erysipelotrichaceae "Erysipelotrichaceae" "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae" "Lachnospiraceae"
## Lactobacillaceae "Lactobacillaceae" "Lactobacillaceae"
## Muribaculaceae "Muribaculaceae" "Muribaculaceae"
## Other "Other" "Other"
## Unknown "Unknown" "Unknown"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+ scale_y_continuous(labels = percent)
phy_low<-subset_samples(phy, group %in% c("AL","BL"))
phy_low
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 1571 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 1571 taxa by 6 taxonomic ranks ]
## phy_tree() Phylogenetic Tree: [ 1571 tips and 1569 internal nodes ]
table(sample_data(phy_low)$group)
##
## AL BL
## 8 8
This phyloseq has 1571 sequences and 16 samples.
8 samples with Retinyl Acetate low Fiber Diet.
8 samples with Beta Carotene low Fiber Diet.
They are:
“Erysipelotrichaceae” “Lachnospiraceae” “Muribaculaceae”
“Ruminococcaceae” “Streptococcaceae”
They are the same as the 1st phyloseq object
phy2 <- phy_low %>% aggregate_top_taxa(level = "Family", top = 5) %>%
microbiome::transform(transform = "compositional")
phy2
## phyloseq-class experiment-level object
## otu_table() OTU Table: [ 6 taxa and 16 samples ]
## sample_data() Sample Data: [ 16 samples by 4 sample variables ]
## tax_table() Taxonomy Table: [ 6 taxa by 2 taxonomic ranks ]
head(otu_table(phy2))
## OTU Table: [6 taxa and 16 samples]
## taxa are rows
## MB118 MB119 MB120 MB121 MB122
## Erysipelotrichaceae 0.755944176 0.56894921 0.77674738 0.734975845 0.03740146
## Lachnospiraceae 0.043375258 0.18490574 0.11317190 0.067475845 0.34118764
## Muribaculaceae 0.023389042 0.04751325 0.02361326 0.016219807 0.24451925
## Other 0.110118022 0.10463914 0.04602439 0.094710145 0.13268888
## Ruminococcaceae 0.006482598 0.04273993 0.02060793 0.009154589 0.09333103
## Streptococcaceae 0.060690903 0.05125272 0.01983514 0.077463768 0.15087174
## MB123 MB124 MB125 MB134 MB135
## Erysipelotrichaceae 0.04531522 0.12009485 0.18249387 0.20822308 0.03916227
## Lachnospiraceae 0.55455223 0.49250363 0.32824617 0.25508607 0.39153754
## Muribaculaceae 0.09456549 0.15818863 0.17637440 0.06826007 0.03986463
## Other 0.05997846 0.08054769 0.09580556 0.25855741 0.28122340
## Ruminococcaceae 0.08445862 0.07186568 0.06768575 0.10024186 0.09437255
## Streptococcaceae 0.16112998 0.07679951 0.14939425 0.10963153 0.15383960
## MB136 MB137 MB138 MB139 MB140
## Erysipelotrichaceae 0.05070298 0.06645344 0.22959386 0.64930881 0.228277607
## Lachnospiraceae 0.43295939 0.52086130 0.45364579 0.03298139 0.499037615
## Muribaculaceae 0.04634302 0.04389297 0.00279735 0.01569609 0.006379234
## Other 0.16954882 0.16491990 0.06645027 0.06887994 0.042152442
## Ruminococcaceae 0.11404497 0.08704344 0.07209775 0.01358441 0.081225253
## Streptococcaceae 0.18640082 0.11682897 0.17541498 0.21954936 0.142927849
## MB141
## Erysipelotrichaceae 0.37442650
## Lachnospiraceae 0.22559738
## Muribaculaceae 0.07496035
## Other 0.08323242
## Ruminococcaceae 0.03041053
## Streptococcaceae 0.21137282
head(tax_table(phy2))
## Taxonomy Table: [6 taxa by 2 taxonomic ranks]:
## Family unique
## Erysipelotrichaceae "Erysipelotrichaceae" "Erysipelotrichaceae"
## Lachnospiraceae "Lachnospiraceae" "Lachnospiraceae"
## Muribaculaceae "Muribaculaceae" "Muribaculaceae"
## Other "Other" "Other"
## Ruminococcaceae "Ruminococcaceae" "Ruminococcaceae"
## Streptococcaceae "Streptococcaceae" "Streptococcaceae"
phy2 %>% plot_composition()+
scale_y_continuous(labels = percent)
# gender
phy2 %>% plot_composition(group_by = "gender")+ scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "gender")+ scale_y_continuous(labels = percent)
# group
phy2 %>% plot_composition(group_by = "group")+
scale_y_continuous(labels = percent)
phy2 %>% plot_composition(average_by = "group")+
scale_y_continuous(labels = percent)