Skip to content

5. Curation

Kelsy Cain edited this page Oct 7, 2024 · 1 revision

Now that the gating parameters are set and all the samples have been analyzed using gating.R, you can now begin curating the cytometry data by generating the particle size distribution (PSD). To do this, open PSD.R.

Load Data

  1. Load the required packages.
library(tidyverse)
library(FCSplankton)
  1. Set working directory setwd("PATH/TO/PROJECT/").

  2. Load PSD data.

project <- basename(getwd())
PSD_all <- read_csv(paste0("Influx_", project,"_PSD.csv"))
PSD_all[1:3,]

Calculate per population cell abundance, biomass, carbon quota, and cell diameter.

Note for conversion from carbon per cell to equivalent spherical diameter: Based on Menden-Deuer, S. & Lessard, E. J. Carbon to volume relationships for dinoflagellates, diatoms, and other protist plankton. Limnol. Oceanogr. 45, 569–579 (2000). d <- 0.261; e <- 0.860 # < 3000 µm3

  1. Calculate the per population cell abundance, biomass, carbon quota, and cell diameter from PSD data for every sample replicate.
influx_replicates <- PSD_all %>%
  group_by(time,station,cast,lat,lon,depth,pop,replicate) %>%
  dplyr::summarise(
    lat = unique(lat, na.rm = TRUE),
    lon = unique(lon, na.rm = TRUE),
    cell_abundance = sum(abundance_per_bin, na.rm = TRUE), # calculate cell abundance per population
    carbon_biomass = sum(biomass_per_bin, na.rm = TRUE)) %>% # calculate carbon biomass per population
  mutate(carbon_quota = carbon_biomass / cell_abundance, # calculate carbon per cell
         diameter = round(2*(3/(4*base::pi)*(carbon_quota/d)^(1/e))^(1/3),5)) %>% # convert carbon per cell to equivalent spherical diameter
  arrange(time)
  1. Average per population cell abundance, biomass, carbon quota, and cell diameter data among sample replicates.
influx <- influx_replicates %>%
  group_by(time,station,cast,lat,lon,depth,pop) %>%
  dplyr::summarise(
    lat = mean(lat, na.rm = TRUE),
    lon = mean(lon, na.rm = TRUE),
    cell_abundance = mean(cell_abundance, na.rm = TRUE), # calculate cell abundance per population
    carbon_biomass = mean(carbon_biomass, na.rm = TRUE), # calculate carbon biomass per population
    carbon_quota = mean(carbon_quota), # calculate carbon per cell
    diameter = mean(diameter, na.rm = TRUE)) %>% # convert carbon per cell to equivalent spherical diameter
  arrange(time)

Format and save data following Simons CMAP data submission requirements

  1. Ensure the time format has not been changed and is the correct format for CMAP data submission (yyyy-mm-ddThh:mm:ss).
influx$time[1:3]
influx$time <- str_replace_all(as.character(influx$time), " ","T")
  1. Assign function arguments for cmap_convert().
project <- basename(getwd())
cruise <- "" # Cruise ID (ex. KM1906); leave blank if samples were not collected during a cruise
cruise_keywords <- "" # Cruise keywords, alternate cruise names commonly referred to (ex. "Gradients 2, Gradients 2017, NPSG, Thomas G. Thompson"), any relevant geographical, personal, dataset specific keywords for querying data
  1. Save data.
cmap_convert(data = influx , cruise, cruise_keywords, project, version = "v1.0")