Cohort-Guided Interval Alignment for 1D NMR Spectra
Source:R/preproc_alignSegment.R
align_spectra.RdAligns 1D NMR spectra using signal-adaptive ppm intervals derived from the
cohort median spectrum. Intervals are constructed around median peak systems
and aligned locally via cross-correlation.
The function accepts either a metabom8-style dat list or plain matrix/vector with ppm.
Arguments
- x
A numeric matrix/vector of spectra or a named list with elements
X,ppm, and optionallymeta.- ppm
Numeric vector of chemical shift values (ppm). Ignored if
xis adatlist.- half_win_ppm
Numeric scalar controlling alignment interval width.
- lag.max
Integer. Maximum allowed lag for cross-correlation alignment.
Details
Alignment intervals are derived from peaks in the cohort median spectrum.
The half_win_ppm parameter controls interval granularity:
Smaller values (e.g. 0.005–0.007 ppm) generate more, narrower intervals (RSPA-like behaviour).
Larger values (e.g. 0.008–0.015 ppm) merge nearby multiplets into broader regions (icoshift-like behaviour).
Typical 600–800 MHz \(^1\)H NMR data:
0.006–0.008 ppm: stable multiplet-level alignment
<0.005 ppm: may split J-coupled systems
>0.015 ppm: may merge unrelated resonances
Alignment parameters and interval definitions are recorded in
attr(X, "m8_prep").
See also
Other preprocessing:
align_segment(),
binning(),
calibrate(),
correct_baseline(),
correct_lw(),
pqn(),
print_preprocessing()