No 3. Subset Fish Only Samples

This script subsets the fish gut only microbiome from the rarefied data for subsequent analyses.

In this script we subset the fish samples from the phyloseq object (with corrected NA taxa) created in Script 2.

Subset Fish Samples

First, we load the data.

ps.slv.tree.mbio.rar.bocas <- readRDS(
  "rdata/p2/ps_16S_bocas_rar_all_ASVID_no_NA.rds")

Then pull out only the fish gut samples.

ps.slv.tree.mbio.rar.bocas.fish_all <- subset_samples(ps.slv.tree.mbio.rar.bocas,
                                                  Fraction == "Fish")
sample_data(ps.slv.tree.mbio.rar.bocas.fish_all)
phyloseq-class experiment-level object
otu_table()   OTU Table:         [ 9389 taxa and 89 samples ]
sample_data() Sample Data:       [ 89 samples by 11 sample variables ]
tax_table()   Taxonomy Table:    [ 9389 taxa by 11 taxonomic ranks ]
phy_tree()    Phylogenetic Tree: [ 9389 tips and 9388 internal nodes ]
           Region          Locality          Position 
                1                 1                 2 
        Reef_type              Zone              Reef 
                2                 3                 9 
         Fraction Fraction_delailed           Species 
                1                 1                 1 
         SeqDepth            Sample 
               89                89 

Remove Empty ASVs

Check and remove empty ASVs, in other words ASVs not present in any fish gut sample.

any(taxa_sums(ps.slv.tree.mbio.rar.bocas.fish_all) == 0)
[1] TRUE
ps.slv.tree.mbio.rar.bocas.fish <- prune_taxa(
  taxa_sums(ps.slv.tree.mbio.rar.bocas.fish_all) > 0,
  ps.slv.tree.mbio.rar.bocas.fish_all)
saveRDS(ps.slv.tree.mbio.rar.bocas.fish,"rdata/p3/ps_16S_bocas_fish_final.rds")
phyloseq-class experiment-level object
otu_table()   OTU Table:         [ 3113 taxa and 89 samples ]
sample_data() Sample Data:       [ 89 samples by 11 sample variables ]
tax_table()   Taxonomy Table:    [ 3113 taxa by 11 taxonomic ranks ]
phy_tree()    Phylogenetic Tree: [ 3113 tips and 3112 internal nodes ]

That’s the end of Script 3. The remainder of the Scripts will deal with the fish only data. In the next Script we conduct alpha diversity estimates of the fish gut microbiome.


Previous

Next

Source Code

The source code for this page can be accessed on GitHub by clicking this link.

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/bocasbiome/web/, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".