ASV data

Below we will use the provided ASV data to combine two data frames and perform some typical calculations.

1 Compile ASV and metadata

library(tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.4.1     ✔ purrr   1.0.1
✔ tibble  3.1.8     ✔ dplyr   1.1.0
✔ tidyr   1.3.0     ✔ stringr 1.5.0
✔ readr   2.1.2     ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
# head(metadata)
asv_long <- asv_table %>%
  pivot_longer(starts_with("Gorda"), names_to = "SAMPLEID") %>% 
  left_join(metadata %>% select(SAMPLEID = SAMPLE, everything()))
Joining with `by = join_by(SAMPLEID)`
# View(asv_long)

2 Get temperature data from data frame

Isolate samples that have a temperature greater than 15 C.

asv_long %>% 
  filter(temp > 15)
# A tibble: 42,039 × 10
   FeatureID         Taxon SAMPL…¹ value VENT  SITE  Sampl…² SAMPL…³ DEPTH  temp
   <chr>             <chr> <chr>   <int> <chr> <chr> <chr>   <chr>   <chr> <dbl>
 1 000562094e0ee78d… Euka… GordaR…     0 Cand… Gord… Sample  Vent    2730     79
 2 000562094e0ee78d… Euka… GordaR…     0 Sir … Gord… Sample  Vent    2732     72
 3 000562094e0ee78d… Euka… GordaR…     0 Cand… Gord… Sample  Vent    2730     79
 4 000562094e0ee78d… Euka… GordaR…     0 Sir … Gord… Sample  Vent    2732     72
 5 000562094e0ee78d… Euka… GordaR…     0 Mt E… Gord… Sample  Vent    2707     40
 6 000562094e0ee78d… Euka… GordaR…     0 Mt E… Gord… Sample  Vent    2707     40
 7 000562094e0ee78d… Euka… GordaR…     0 Sir … Gord… Sample  Vent    2732     72
 8 000562094e0ee78d… Euka… GordaR…     0 Mt E… Gord… Sample  Vent    2707     40
 9 000562094e0ee78d… Euka… GordaR…     0 Cand… Gord… Sample  Vent    2730     79
10 0009645516609bda… Euka… GordaR…     0 Cand… Gord… Sample  Vent    2730     79
# … with 42,029 more rows, and abbreviated variable names ¹​SAMPLEID,
#   ²​Sample_or_Control, ³​SAMPLETYPE
# Make a list of vent sites from Gorda Ridge that had a temperature greater than 15 C.

What are the average temperatures at the vent, plume, versus background samples? And how many of each sample are there?

asv_long %>% 

3 Parse taxon names

asv_long %>% 

4 Calculate relative abundance

Create a table with sequence counts and ASV counts by supergroup.

asv_long %>% 

4.1 Make a bar plot

asv_long %>%