knitr::opts_chunk$set(echo = TRUE)
knitr::opts_knit$set(root.dir = 'C:\\Users\\Mark\\Desktop\\temp plfa practice - can delete whenever/') 

This is a package for running QC on and processing named PLFA data. The three major components are calculating lipid concentrations, biomarker concentrations and mol %, and d13C isotope data, with output in a format that can easily be further analyzed using tidyverse and statistical packages in R.

Getting started

Installation

If the devtools package isn't already installed, download and install from CRAN.

install.packages("devtools")

Install plfaR package.

devtools::install_github(repo = 'mlfelice/plfaR')

The package is now ready for processing PLFA data.

Basic Workflow

Summary

This vignette shows an example workflow for basic importing and processing of PLFA data from raw named peak lists to lipid and biomarker concentrations and mol %.

Processing

Import packages

library(plfaR)  # PLFA processing
library(tidyverse)  # Basic data wrangling
library(readxl)  # Import Excel files

Import sample metadata. At minimum, you should have the following columns: Batch DataFileName SampleType SampleWt You can also include any additional data you will want for analysis.

# Import metadata Excel file
md <- read_xlsx('plfaR_example-metadata.xlsx')

# Preview metadata
head(md)

Import your PLFA data. This should be your named peak list, and should be an Excel file with the following formatting: Either single tab OR peak list data on a worksheet named 'named_peaks' File should have the following columns with headers: + Batch + DataFileName + RetTimeSecs + MajorHeightnA + TotalPeakArea1 + DisplayDelta1 + Name

peak_list <- import_batch('plfaR_example-peak-list.xlsx')

# Preview imported data
head(peak_list)

Run QC tests on the data. If there are any issues with the data, an error message will be displayed indicating the issue. This also generates a list containing summary dataframes showing 1) samples with duplicate lipids (and which lipids), 2) samples missing standard peaks (13:0, 16:0*, or 19:0), and 3) the frequency (fraction) with which each lipid is present in a sample.

*NOTE: Although 16:0 isn't technically a standard, it is present in Sphagnum, so should be present in any peat samples. This can likely be ignored if working with mineral soils.

qc_df <- quality_check(peak_list)
# QC summary dataframes can be accessed individually
qc_df[[1]][['duplicate_lipids']]
qc_df[[1]][['missing_lipids']]
qc_df[[1]][['lipid_frequency']]

To process the data, we first calculate lipid concentrations in nmol/g soil * In addition to supplying the peak list, we need to supply a vector containing the sample names for the blanks (should only have 13:0 and 19:0) and standards (ie. the samples on which you want to base kval calculations).

NOTE: process_peak_area() also has several other parameters that can be changed, but which are constant in our lab.

# Create vector of filenames of standards (can also manually supply)
stds <- c('13 Standard 1.raw')

# Blanks represent peak area subtracted for 13:0 and 19:0, so input a named 
# list with a vector for each lipid to subtract
blanks <- list( '13:0' = c('13 Standard 1.raw'),
                '19:0' = c('Control 1 for plot 16 17 and 7.raw',
                           'Control 1 for plots 19 20  21.raw',
                           'Control 2 for plot 16 17 and 7.raw',
                           'Control 2 for plots 19 20  21.raw)'))


# Convert the peak areas to concentration (nmol/g dry soil)
conc_df <- process_peak_area(peak_list, 
                             blanks = blanks, 
                             standard_fnames = stds,
                             soil_wt_df = md)

head(conc_df)

Next, we can calculate the concentrations of groups of indicator lipids as well as their mol %.

indicators_df <- calculate_indicators(conc_df, soil_wt_df = md)

head(indicators_df)

Next, we can calculate the corrected isotope values for individual lipds. This will calculate 2 corrections: 1) normalize measured isotope values to the international reference scale, and 2) correct values for the d13C of methanol added during methylation. The lipid d13C values can be used to calculate the d13C of indicator groups.

Indicator group d13C are calculated from the unweighted average of individual lipid d13C.

# Process lipid d13C to normalize to internationl refernce scale and account 
# for the contribution of methanol to d13C
d13c_lipid_df <- correct_iso_base(df = peak_list, 
                                  d13c_correction = 0, 
                                  methanol_13c = -55.84, 
                                  min_height = 1)

# Calculate d13C of indicator groups
d13c_indicator_df <- indic_iso_base(d13c_lipid_df, md)

head(d13c_lipid_df)
head(d13c_indicator_df)

These dataframes can now be analyzed with your preferred stats pipeline.

Other information

The following are the groups of lipids used for each biomarker group.

indicator_list <- list(f_lipids = c('18:1 w9c', '18:2 w6,9c'),
                       # Lipids representing total bacteria for f to b ratio not shown in Cameron's data, so for now, I will use lipids for Gram +/-, actino, and anaerobe
                       b_lipids = c('15:0 iso', '15:0 anteiso',
                                    '16:1 w7c', '16:0 10me',
                                    '18:1 w9c', '18:1 w9t',
                                    '18:2 w6,9c', '18:0 10me', '19:0 cyclo'),
                       gram_pos_lipids = c('15:0 iso', '15:0 anteiso'),
                       gram_neg_lipids = c('16:1 w7c', '18:1 w9t'),
                       actino_lipids = c('16:0 10me', '18:0 10me'),
                       anaerobe_lipids = c('19:0 cyclo'),
                       protozoa = c('20:4 w6,9,12,15'),
                       # May need to redefine the total_biomass. Right now, it's just all of the
                       # indicator lipids. Not sure if there should be others as well
                       total_biomass = c('8:0', '10:0', '10:0 2OH', '11:0',
                                         '12:0', '12:0 2OH', '12:0 3OH',
                                         '13:0', '14:0', '14:0 2OH',
                                         '14:0 3OH', '14:1', '15:0',
                                         '15:0 anteiso', '15:0 iso',
                                         '16:0 10me', '16:0 2OH', '16:0 iso',
                                         '16:1 w5c', '16:1 w7c', '16:1 w9c',
                                         '17:0', '17:0 iso', '17:0 anteiso',
                                         '17:0 cyclo', '17:1', '17:1 iso',
                                         '18:0', '18:0 10me', '18:1 w9c',
                                         '18:1 w9t', '18:2 w6,9c', '19:0',
                                         '19:0 cyclo', '19:1', '20:0')
)

indicator_list


mlfelice/plfaR documentation built on June 9, 2022, 4:28 p.m.