Preproc: Standard 1D NMR Preprocessing

Description Usage Arguments Details Value The Pipeline Author(s) Examples

View source: R/preprocessing.R

Description

Preproc() is a function aimed at streamlining the preprocessing stage of analysing NMR spectra. It harnesses the power of the package metabom8 to quickly and easily process spectra.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Preproc(
  X,
  ppm,
  meta,
  baseline = T,
  flip = F,
  cali = F,
  calibrant = "tsp",
  lineWid = 1,
  lowCut = 0.25,
  watCut = c(4.5, 5),
  ureCut = c(5.6, 6),
  uppCut = 9.5,
  noi_sh = c(9.5, 11)
)

Arguments

X

A matrix containing the non-preprocessed NMR spectral data. The rows should containing all values of a single experiment, and the columns, the values of the chemical shift variables.

ppm

An array of the chemical shift variables, column matched to X.

meta

The matrix of metadata pertaining to the X matrix. This is crucial for the TSP calibration and line width calculation.

baseline

Default is set to TRUE. This argument calls on metabom8::bcor(), a baseline correcting function to smooth the spectral baselines and remove the influence of broad peaks.

flip

Default is set to FALSE. NOT CRUCIAL FOR STANDARDLY ACQUIRED SPECTRA This function checks the orientation of spectra. This is a particularly important function for spectra derived from a small number of scans; the NMR orientates spectra based on what side of the y-axis has the most signal and water has a very large impact on this and without a large amount of metabolite signal on the correct side of the spectra (as seen in spectra derived from small scans) the spectra will be orientated the wrong way.

cali

Default is set to FALSE. This calls on the metabom8 function metabom8::calibrate() which ensures peaks are aligned based on the TSP signal. Calibration is standardly performed by the NMR but this can be performed again for certainty.

calibrant

This is the signal you wish to use as the calibrant. This signal must be compatible with metabom8::calibrate(). For urine spectra, tsp is the main calibrant.

lineWid

This argument provides import for metabom8::lw(), a function that calculates the line width of peaks. Spectra with peaks that have small line widths have sharper and more precise results which is more desirable. A maximum cutoff of 1 ensures spectra contain robust results. Consider omitting spectra with line widths over 1.

lowCut

A single floating point number defining the ppm value that the lower limit of the spectra are trimmed to.

watCut

The lower and upper ppm values concatenated, from which the water region will be trimmed and omitted. Water regions provide no important information and should be removed prior to data analysis. Default is set to c(4.5,5)

ureCut

The lower and upper ppm values concatenated, from which the urea region will be trimmed and omitted. Urea regions also provide no important information and should be removed prior to data analysis. Default is set to c(5.6,6)

uppCut

A single floating point number defining the ppm value that the upper limit of the spectra are trimmed to.

noi_sh

The shift of the noise region used to calculate estimation of noise

Details

Preproc() is powered by the metabom8 package and is simply a tool to harness and streamline functions in metabom8 when preprocessing NMR spectra, not replace them.

Value

This function returns a list with:

  1. The processed X matrix in the first element,

  2. The processed ppm array in the second element, and

  3. The line width results in a data frame in the third element.

The Pipeline

This function streamlines the preprocessing of NMR urine spectra by combining a range of functions. It:

  1. Orientates the spectra correctly,

  2. Calibrates the spectra by a specific peak,

  3. Calculates the line widths of the peaks and returns a warning with the spectra that exceed the specified threshold,

  4. Removes the lower, upper, water and urea regions of the spectra,

  5. Corrects the baseline of the spectra using asymmetric least squares

  6. Verifies that the resulting X, ppm and meta objects match appropriately.

Author(s)

kylebario1@gmail.com

Examples

1
path = system.file('extdata', package = 'unorm')

kylebario/unorm documentation built on Dec. 21, 2021, 8:45 a.m.