Aggregate Community Data to Phylum and Calculate Relative Abundances
Introduction
In this assignment you will aggregate the Macatawa shared data and calculate abundances and relative abundances of the different phyla. This will follow the first part of Tutorial 5 (up to but not including the Joining the sample data with the metadata section). The computations take a lot of memory and time when we use the full Macatawa watershed data sets, so we will run the computations on the cluster.
Use RStudio on your local computer to create an appropriately titled Quarto (.qmd) document for this assignment. Save it in the watershedMacatawa project that you created on HPC in assignment RA1. Alternatively, if you have started working on a Quarto file that you have saved locally, make a copy of the file on HPC and edit that version on your local computer using RStudio.
You will need to create a new slurm script to submit this job to slurm on HPC. You should start by making a copy of the slurm script you used for RA1. Give the copy an appropriate name and change it so that it executes in your new Quarto file. Also, change the job name to something appropriate for this assignment.
Things you need to do differenty with the watershed data
There are a few things you will need to do differently now that you are working with the watershed data instead of the Erie data.
- You should change the names of the objects you create. Instead of using erie in the names use mac or macatawa
- When you filter out uncommon phyla, filter out phyla that make up less than 0.2% of the sample instead of 2%
- Do not print out the shared data at first. You can use dim to print out the dimensions of the shared data. After you lengthen the data you can start to print it out
- Create a .csv file with the results (aggregated to phylum level with abundances and relative abundances) that you will turn in. Use the write_csv command to save your .csv file in the outputs subdirectory. You can learn more about using this command by typing
?write_csvinto the console in RStudio - Use the following names for the clean data files and the csv that you produce:
| Data set or figure | folder | file name |
|---|---|---|
| Aggregated (phylum level) data with abundances and relative abundances | clean_data | macatawa_phylum.rds |
| Aggregated (phylum level) data with abundances and relative abundances | outputs | macatawa_phylum.csv |
Create local copies of files
When you have finalized your code and rendered your final .html report, don’t forget to make local copies of your code (.qmd) and report (.html) and the clean data and output files (see the table above). These files should be saved in the appropriate directories within your local watershedMacatawa project directory.
What you need to turn in
You need to turn in thee files (upload to Moodle):
- Your Quarto file showing your explanation, code, and appropriate output. Don’t forget to include a brief introduction for the report and a brief explanation for each piece of the code.
- Your rendered Quarto file (html)
- The .csv file you produced