Title: | Analysis of Soil Organic Matter using Nuclear Magnetic Resonance |
---|---|
Description: | Integrates the 13C nuclear magnetic resonance (NMR) spectra using different integration ranges ("Smernik", "Bonanomi","Molecular Mixing Model"). Output depends on the "NMRmeth" chosen. For the Molecular Mixing Model, a measurement of the fitting quality is given by its R-factor. For more details see Colocho Hurtarte, L. C. (2023). <doi:10.5281/zenodo.10137768> |
Authors: | Luis Colocho [aut, cre] |
Maintainer: | Luis Colocho <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.0 |
Built: | 2025-01-19 04:30:21 UTC |
Source: | https://github.com/luiscol8/somnmr |
The function can be used to check which combinations of standards produce a good fit.
fit_LCF( all.samples, all.standards, ecosys = NULL, amoSTD, ex.smaller = NULL, file.output = NULL, best.fits = NULL, NMRmeth, FixNC )
fit_LCF( all.samples, all.standards, ecosys = NULL, amoSTD, ex.smaller = NULL, file.output = NULL, best.fits = NULL, NMRmeth, FixNC )
all.samples |
List of all samples |
all.standards |
List of all standards |
ecosys |
Standards to be used for the MMM, can be Terrestrial("Terr_Nelson" or "Terr_Baldock") or Aquatic ("Aqua_Nelson" or "Aqua_Baldock") |
amoSTD |
Use at most X standards |
ex.smaller |
Exclude portions smaller than a given value (decimal form), default to NULL |
file.output |
Possibility to have a file output, default to NULL |
best.fits |
Possibility to output more than the best fit (e.g. the first 10 best fits), default to 1 |
NMRmeth |
Regions to be integrated, methods available include: "4region", "Bonanomi", "Smernik" and Molecular mixing model ("MMM"). |
FixNC |
TRUE or FALSE, for fixing or not the NC ratio on the sample fitting. |
A dataframe containing the result of the fitting exercise for all files.
Contains 3 CP MAS 13C NMR spectra.
GarciaF200
GarciaF200
A nested list with 3 sub-lists:
A list containing the vegetation NMR spectrum of one of the following sites.
"EB_Vegetation", "Fendt_Vegetation", "Graswang_Vegetation"
A data frame with 2 columns:
Numeric vector.
Numeric vector.
The spectra were taken in a NMR spectrometer with field strength of 200 MHz and MAS rate of 6.8 kHz
Garcia-Franco et al. (2021) DOI: 10.1007/s00374-020-01518-0
data(GarciaF200)
data(GarciaF200)
Contains 17 CP MAS 13C NMR spectra.
Hall300
Hall300
A nested list with 17 sub-lists:
A list containing the soil NMR spectrum of one of the following sites.
"Calhoun", "CPER", "DCFS", "elve", "GRSM", "HARV", "icac", "JERC", "KONZ", "LENO", "MOAB", "NIWO", "ONAQ", "samt", "SCBI", "UNDE", "WOOD"
A data frame with 2 columns:
Numeric vector.
Numeric vector.
The spectra were taken in a NMR spectrometer with field strength of 300 MHz and MAS rate of 12 kHz
https://portal.edirepository.org/nis/mapbrowse?packageid=edi.575.1
data(Hall300)
data(Hall300)
This function allows you to integrate the 13C-NMR spectra using diferent integration regions. The loaded Raw spectra can be integrated using the spinning side bands regions(default), the Bonanomi("Bonanomi") regions or the Molecular Mixing Model regions("MMM"). The function returns the corrected, normalized and flattened spectrum
int_nmr(raw.spec, NMRmeth = NULL, NMR_field = NULL, NMR_rotation = NULL)
int_nmr(raw.spec, NMRmeth = NULL, NMR_field = NULL, NMR_rotation = NULL)
raw.spec |
Raw spectrum |
NMRmeth |
Regions to be integrated. Default is spinning side bands, other methods available include: Bonanomi ("Bonanomi") and Molecular mixing model ("MMM" or "MMM"). |
NMR_field |
Magnetic field of the NMR |
NMR_rotation |
Rotation frequency of the sample probe in the NMR |
A nested list containing in the first level a string (name) and a list (data) which contains two data frames one the raw spectrum and another the output of table of the integration with the spinning side bands.
data(GarciaF200) Integralregions <- int_nmr(GarciaF200, NMRmeth = "4region", NMR_field = 200, NMR_rotation = 6800)
data(GarciaF200) Integralregions <- int_nmr(GarciaF200, NMRmeth = "4region", NMR_field = 200, NMR_rotation = 6800)
This function copies the spectra read using the read_spec function and creates a .csv file with a colum with their names and two empty columns where the user must add the C and N values. Thereafter the file is read with the function nc_data
mk_nc_data(raw.spec)
mk_nc_data(raw.spec)
raw.spec |
The uploaded spectra read using the read_spec function |
A data frame with three columns, one containing the names extracted from the raw.spec, and two columns to be filled manually with the carbon and nitrogen values.
## any .txt file as output from BRUKER
## any .txt file as output from BRUKER
The function wraps the Linear combination fit of the integrated regions of the molecular mixing model.
MMM_fit(sample, standards, ex.smaller = NULL, NMRmeth, FixNC)
MMM_fit(sample, standards, ex.smaller = NULL, NMRmeth, FixNC)
sample |
Sample Integrals |
standards |
List of all standards |
ex.smaller |
Exclude portions smaller than a given value (decimal form), default to NULL |
NMRmeth |
Regions to be integrated, methods available include: "4region", "Bonanomi", "Smernik" and Molecular mixing model ("MMM"). |
FixNC |
TRUE or FALSE, for fixing or not the NC ratio on the sample fitting. |
A dataframe containing the result of the fitting exercise.
Quadratic programming solution function for linear combination fitting (LCF)
MMM_solve_QP(LCF.stds, LCF.samp, NMRmeth = NULL, FixNC)
MMM_solve_QP(LCF.stds, LCF.samp, NMRmeth = NULL, FixNC)
LCF.stds |
Standards for LCF |
LCF.samp |
NMR Sample(s) for LCF |
NMRmeth |
Regions to be integrated, methods available include: "4region", "Bonanomi", "Smernik" and Molecular mixing model ("MMM"). |
FixNC |
TRUE or FALSE, for fixing or not the NC ratio on the sample fitting. |
A dataframe containing the result of the quadratic programming exercise, constrained or not by the Nc ratio (FixNC)
This function allows you import a .csv file and create a dataframe with the C and N data of the samples been processed. The created dataframe will be merged with the spectral data during the fitting.
nc_data(NCdata)
nc_data(NCdata)
NCdata |
Raw spectrum |
A dataframe with the molar ratio between the nitrogen and carbon.
Contains 17 measurements of N and C, presented as molar N:C ratios.
ncHall300
ncHall300
A nested list with 17 sub-lists:
A list containing the soil NMR spectrum of one of the following sites.
"Calhoun", "CPER", "DCFS", "elve", "GRSM", "HARV", "icac", "JERC", "KONZ", "LENO", "MOAB", "NIWO", "ONAQ", "samt", "SCBI", "UNDE", "WOOD"
Numeric vector.
https://portal.edirepository.org/nis/mapbrowse?packageid=edi.575.1
data(ncHall300)
data(ncHall300)
The function creates a data frame with all standards of the selected ecosystem (Terrestrial or Aquatic).
NMR_table(NMRmeth = NULL)
NMR_table(NMRmeth = NULL)
NMRmeth |
Regions to be integrated, methods available include: "4region", "Bonanomi", "Smernik" and Molecular mixing model ("MMM"). |
A data frame containing the starting (from) and ending (to) ppm integral ranges of the different C functional groups.
see_NMR_table <- NMR_table(NMRmeth="4region")
see_NMR_table <- NMR_table(NMRmeth="4region")
This function allows you to plot the 13C-NMR spectra using marking different integration regions. The loaded Raw spectra are intensity normalized and plotted with the chosen integration regions, either spinning side bands (default), the Bonanomi("Bonanomi") regions or the Molecular Mixing Model regions("MMM"). The function returns the plots as images either tiff or png, normalized and flattened spectrum
plot_NMR( raw.spec, NMRmeth = NULL, use.tiff = NULL, set.plot.ymax = NULL, file.output = NULL )
plot_NMR( raw.spec, NMRmeth = NULL, use.tiff = NULL, set.plot.ymax = NULL, file.output = NULL )
raw.spec |
loaded NMR spectra |
NMRmeth |
Regions to be integrated, methods available include: "4region", "Bonanomi", "Smernik" and Molecular mixing model ("MMM"). |
use.tiff |
Logical, default to FALSE (use png) |
set.plot.ymax |
Set maximum of plot y axis, defaults to NULL |
file.output |
Logical, default to FALSE |
A plot of the NMR spectrum and a csv file of the data plotted.
library(ggplot2) data("GarciaF200") plot_NMR(GarciaF200, NMRmeth = "MMM", file.output = FALSE, use.tiff = FALSE)
library(ggplot2) data("GarciaF200") plot_NMR(GarciaF200, NMRmeth = "MMM", file.output = FALSE, use.tiff = FALSE)
This function reads the raw file, Bruker, tab separated or coma separated extracts the spectra and returns a list with name, and the raw spectral data.
read_raw_spec(file = NULL, filetype = NULL)
read_raw_spec(file = NULL, filetype = NULL)
file |
The raw file |
filetype |
The raw file type "Bruker", .csv ("tab"), csv ("coma") |
A list with the name of the file and the raw spectral data.
## any .txt file as output from BRUKER
## any .txt file as output from BRUKER
This function loads, integrates and calculates the functional group distribution from the raw spectra. Produces also the molecular mixing model fitting if NC data is provided. Output is a list with the raw data, integrals and corrected spectra.
region_calc( batch_nmr = NULL, file = NULL, NMRmeth = NULL, FixNC, NMR_field = NULL, NMR_rotation = NULL, ecosys = NULL, cndata = NULL, mod_std = NULL )
region_calc( batch_nmr = NULL, file = NULL, NMRmeth = NULL, FixNC, NMR_field = NULL, NMR_rotation = NULL, ecosys = NULL, cndata = NULL, mod_std = NULL )
batch_nmr |
Vector with file names, default |
file |
The raw file |
NMRmeth |
Regions to be integrated, methods available include: "4region", "Bonanomi", "Smernik" and Molecular mixing model ("MMM"). |
FixNC |
TRUE or FALSE, for fixing or not the NC ratio on the sample fitting. |
NMR_field |
Magnetic field of the NMR |
NMR_rotation |
Rotation frequency of the sample probe in the NMR |
ecosys |
Standards to be used for the MMM, can be Terrestrial("Terr_Nelson" or "Terr_Baldock") or Aquatic ("Aqua_Nelson" or "Aqua_Baldock") |
cndata |
The N:C data file created with mk_nc_data |
mod_std |
File containing a modified NMR table |
A data frame that contains the SSBs corrected C functional groups, or if the "MMM" method is selected, the result of the fitting of the "MMM".
data("GarciaF200") IntegralSSBc <- region_calc(GarciaF200, NMRmeth = "4region", NMR_field = 200, NMR_rotation = 6800)
data("GarciaF200") IntegralSSBc <- region_calc(GarciaF200, NMRmeth = "4region", NMR_field = 200, NMR_rotation = 6800)
Contains 15 CP MAS 13C NMR spectra.
Smernik200
Smernik200
A nested list with 15 sub-lists:
A list containing the soil NMR spectrum of one of the following sites.
"Control", "Burnt", "Burnt 1 year", "Control", "Control", "Control", "Control", "Burnt", "Burnt", "Burnt", "Burnt", "Burnt 1 year", "Burnt 1 year", "Burnt 1 year", "Burnt 1 year"
A data frame with 2 columns:
Numeric vector.
Numeric vector.
The spectra were taken in a NMR spectrometer with field strength of 200 MHz and MAS rate of 5 kHz
Smernik et al., (2008) DOI: 10.1071/SR07128
data(Smernik200)
data(Smernik200)
Contains 15 CP MAS 13C NMR spectra.
Smernik400
Smernik400
A nested list with 15 sub-lists:
A list containing the soil NMR spectrum of one of the following sites.
"Control", "Burnt", "Burnt 1 year", "Control", "Control", "Control", "Control", "Burnt", "Burnt", "Burnt", "Burnt", "Burnt 1 year", "Burnt 1 year", "Burnt 1 year", "Burnt 1 year"
A data frame with 2 columns:
Numeric vector.
Numeric vector.
The spectra were taken in a NMR spectrometer with field strength of 400 MHz and MAS rate of 7 kHz
Smernik et al., (2008) DOI: 10.1071/SR07128
data(Smernik400)
data(Smernik400)
Spinnning side bands ofset calculation function This function calculates the spinning side band ofset for a given 13C NMR table. The function returns the 13C NMR integration table to be used in the int_nmr function.
ssb_offset(NMRmeth = NULL, NMR_field = NULL, NMR_rotation = NULL)
ssb_offset(NMRmeth = NULL, NMR_field = NULL, NMR_rotation = NULL)
NMRmeth |
Regions to be integrated, methods available include: "4region", "Bonanomi", "Smernik" and Molecular mixing model ("MMM"). |
NMR_field |
Magnetic field of the NMR |
NMR_rotation |
Rotation frequency of the sample probe in the NMR |
A dataframe containing the integral regions of the NMR spectrometer (according to the NMR spectrometer field and rotation speed) using the selected method and the predicted regions of the SSBs.
see_offset <- ssb_offset (NMRmeth='4region', NMR_field = 200, NMR_rotation = 6800)
see_offset <- ssb_offset (NMRmeth='4region', NMR_field = 200, NMR_rotation = 6800)
The function creates a data frame with all standards of the selected ecosystem (Terrestrial or Aquatic).
std_nmr(ecosys = NULL)
std_nmr(ecosys = NULL)
ecosys |
Standards from the ecosystem to be fitted. "Terr_Nelson" or "Terr_Baldock" for terrestrial, "Aqua_Nelson" or "Aqua_Baldock" for aquatic. |
A data frame with all standards of the selected ecosystem ("Terr_Nelson" or "Terr_Baldock" for terrestrial, "Aqua_Nelson" or "Aqua_Baldock" for aquatic).
std_table <- std_nmr(ecosys="Terr_Nelson")
std_table <- std_nmr(ecosys="Terr_Nelson")