Alpha Diversity of Macatawa Watershed Bacterial Communities
Introduction
In this assignment you will explore alpha diversity using the Macatawa watershed data. You will be doing many of the same things you did with the Lake Erie data in Tutorial 7.
You will do the diversity computations using HPC (the corresponding code in Tutorial 7 includes everything before the section titled Diversity box plots), and you will produce diversity box plots using your local computer (the rest of Tutorial 7). As before, we will customize our plots using color schemes that have already been chosen to work well with the Macatawa watershed data. You have been provided with code on our Moodle site that you can modify to do the plotting. As in the past, you will need to add an introduction, explanatory text for each code block and corresponding output, and discussion of your interpretation of the plots.
You will create two pairs of plots. In one of the plots in the first pair you should plot the Chao1 estimate of species richness on the y axis. In the other pot you should plot the inverse Simpson diversity index. In both plots in the first pair, there should be a box plot for each WaterTempSeason4 value (this is the x variable), and points should be colored by Site and the shape should be determined by SiteType. The example Quarto file is already set up to produce the first pair of plots.
In the second pair of plots you will use the same alpha diversity measures as in the first pair. This time, however, use Site as the x variable (one box per site), color the points by WaterTempSeason, and determine the point shapes by SiteType.
Alpha diversity computations
We will start by doing the diversity computations (without the plots) on HPC. Create a Quarto file and save it in the code directory in your watershedMacatawa project directory on HPC. Give the file an appropriate descriptive name.
You will need to modify your code from Tutorial 7 in the usual way–change variable names so that they use mac or macatawa instead of erie. Also remove the plotting code at the end (everything from the Diversity box plots section in Tutorial 7), since we will be creating the plots using a separate Quarto file.
The only code that you need to include from the Rarefy the data and compute alpha diversity (single simulation) section of Tutorial 7 is the block where the diversity.index and richness.method are set. The rest of the code in this section is intended to provide an example of a single simulation. The diversity computations that we actually use are in the next section where multiple simulations are run.
Make sure you have an introduction and that you have explanatory text for each code block. You do not need to include any interpretation in this Quarto document. You will include that when you do the plotting instead.
You should use the following file names and locations for the clean data that your code produces (edit your code accordingly before you run it):
| Data set or figure | folder | file name |
|---|---|---|
| Metadata with ordination and diversity columns | clean_data | macatawa_meta_ordination_diversity_invSimp_chao1.rds |
Finally, don’t forget to update your code to use the chao1 estimate of species richness.
Run your code on HPC by submitting an appropriate Slurm job (you will need to write a new Slurm script and submit it). It takes a long time to run the code (10 hours or so!), so don’t wait until the due date to work on this!
Once your code has run successfully, copy the code and the clean data files you produced to your local computer so that you can use them for plotting later.
Diversity plots
Plot pair 1
Modify the diversity plotting code from our Moodle page by adding an introduction and explanatory text where indicated. Save the file the code directory in your watershedMacatawa directory on your local computer. Make sure you have copied the clean data files you created earlier from HPC to the clean_data directory on your local computer. Ensure that the file names match the file names read in by the code.
For the plot interpretation, describe any patterns you see in your plots. Do the patterns make sense biologically/physically? Why? Given what you know about the differences between the two diversity measures, compare what you see in the two plots.
Plot pair 2
Save a copy of the plotting code you created for the first pair of plots. Give it a name that clearly differentiates it from your other Quarto file. Modify the introduction and explanatory text as required to reflect the changes for the second pair. Change the names of the output files (the .pdf files) to reflect your choices.
Modify the plotting code so that it uses the correct factors to separate the boxes and to determine the colors and shapes of the points.
For the plot interpretation, describe any patterns you see in your plots. Do the patterns make sense biologically/physically? Why? You are displaying exactly the same information in pair 2 as pair 1. Is one pair more informative than the other? Do the two pairs emphasize different patterns in the data? Explain.
What you need to turn in
For this assignment, you need to turn in 6 files:
- The following Quarto (.qmd) files:
- the one you used to perform the diversity calculations
- the one you used to produce the first pair of plots
- the one that you used to produce the second pair of plots
- The rendered reports (.html) that were generated for each of the Quarto files you turned in that are listed above