Create Stacked Barplot of Relative Abundances

Introduction

In this assignment you will create a stacked bar plot showing how the relative abundances of the different phyla of bacteria change over time at two sites in the Macatawa watershed. You did something similar with the Lake Erie data in the second part of Tutorial 5 (starting with the Joining the sample data with the metadata section). Since there are more phyla and more samples in the Macatawa watershed data, we need to work a bit harder to get readable plots. You will be provided with a Quarto file on our Moodle page that you will need to modify to create your plots. You will also need to add a brief introduction and explanatory text for the code blocks. You should conclude your document with your interpretation of the plot.

Since the computations for this assignment are not very demanding, we do not need to use the cluster. Instead you will will do the analysis using your local computer. The code will read in some of the clean data files you produced in RA1 and RA2. It is important that you have followed the instructions in those assignments so that you have the appropriate clean data files with the correct names in the correct directories on your local computer.

We will usually do more demanding computations on the cluster, while we do less demanding computations locally–especially when we want to do a lot of interacting with the code. When we are producing plots it is common to make small changes to the code as we play with different plotting options. This is not efficient on the cluster.

For this assignment you will be assigned two sites to compare. See the link on our course Moodle page for the sites you have been assigned. Each person has been assigned a lake site and a stream site (everyone has a unique pair).

What you need to do

  • Download the Quarto document that includes the plotting code, and save it in the code directory within your local watershedMacatawa project directory
  • Make sure that the macatawa_phylum.rds file you created in the last assignment is in the clean_data directory. If you followed the instructions for that assignment it should already be there.
  • Modify the code to plot the data from the two sites you were assigned. Change axis titles, output file names, etc. accordingly.
  • Run the code to confirm that it is working
  • Add a brief introduction at the beginning of the document. This should be a short paragraph about what your code is doing
  • Add a brief explanation of the code and the output before each code block. You may want to refer to tutorial 5 to help you do this, but use your own words instead of just copying the text in the tutorial
  • Add your plot interpretation (a paragraph). Your interpretation should address the following with respect to the cyanobacteria phylum:
    • Describe patterns in each site, including seasonal variation
    • Compare the seasonal patterns between sites. Remember that one of your sites is a lake site and one of your sites is a stream site.
    • Do the patterns within sites and between sites behave as you would expect (e.g., given that cyanobacteria are photosynthetic autotrophs, given differences between lake and stream environments, etc.)

Make a copy of your code on HPC

Although we do not need to use HPC to do the analysis for this assignment, it is still sensible to create a backup of your code in your project on HPC. Once you have finalized your code, make a copy of your Quarto (.qmd) file in your code directory on HPC. You do not need to make a copy of the rendered report (.html file) or any output, since those can be easily generated by running the code in the Quarto document.

What you need to turn in

You need to turn in three files (upload to Moodle):

  • Your Quarto (.qmd) file, including the new text that you added
  • Your rendered Quarto report (html)
  • The pdf of your plot