Downstream analyses after taxonomy assignment
This repository contains code for some common steps to prepare a phyloseq object—such as the one created in Step 4a/b of the trklab-metabarcoding obitools pipeline—for downstream analyses. Steps and their parameters listed should not be viewed as prescriptive; most are optional or customizable using different parameters based on the unique needs and goals of each project. These general steps, however, have become relatively standard steps in studies of herbivore diets in our lab, and should be considered before running major analyses (e.g., quantifying dietary richness or composition).
- Read in phyloseq object (e.g., from step 4a/b of trklab-metabarcoding).
- Filter to only samples of interest (e.g., a certain sample species, sequencing date, or collection type) if only a subset of samples will undergo major analysis. This is common in large projects.
- Remove (“prune”) any low-read samples. The code provided filters out samples <1,000 reads but this parameter can be changed to fit individual project needs.
- Rarefy to even sequence read depth across samples.
- Save copies of phyloseq OTU table 1) before rarefying and 2) after rarefying. These .csv files should be viewed as the versions of record for any downstream analyses and carefully edited and formatted versions are commonly used as supplemental datasets in manuscripts. A few recent examples with supplementary datasets to reference for formatting: Hoff et al. (2025) PNAS; Littleford-Colquhoun et al. (2024) Royal Society Open Science.
- Merge phyloseq object with external data tables. This may occur if you want to add additional data on the taxa appearing in the taxonomy table, for example.
- Data summaries throughout. These summaries are often printed alongside a message describing that output for ease of reference and code annotation.
- A filtered pruned, and rarefied phyloseq object ready for downstream analyses.
- Raw versions of OTU tables pre- and post-rarefaction to edit for inclusion in supplements to papers.
- Data summaries that include metrics to report in papers.
Hoff et al. (2025): H.K. Hoff, B.L. Littleford-Colquhoun, R.Y. Kartzinel, H.M. Anderson, C. Geremia, L.M. McGarvey, C. Segal, & T.R. Kartzinel, The apportionment of dietary diversity in wildlife, Proc. Natl. Acad. Sci. U.S.A. 122 (29) e2502691122, https://doi.org/10.1073/pnas.2502691122 (2025).
Littleford-Colquhoun et al. (2024): Littleford-Colquhoun Bethan L., Geremia Chris, McGarvey Lauren M., Merkle Jerod A., Hoff Hannah K., Anderson Heidi, Segal Carlisle R., Kartzinel Rebecca Y., Maywar Ian J., Nantias Natalie, Moore Camela and Kartzinel Tyler R. Body size modulates the extent of seasonal diet switching by large mammalian herbivores in Yellowstone National Park, R. Soc. Open Sci. 11:240136 http://doi.org/10.1098/rsos.240136 (2024).