Pluggable alignment stages used by align() and the
align_fun argument of fit_mdm() /
benchmark().
clupa(): CluPA — hierarchical-clustering peak alignment (recursive FFT segment shifts, Beirnaert et al. 2018, Vu et al. 2011). Operates on the Lorentz reconstructionsit$supalready attached to each spectrum by deconvolution.snap_to_ref(): Reference snapping — snap each peak to the nearest reference column withinmaxCombine.
All these functions require every input spectrum to share the same
$cs grid; an explicit stop() is raised otherwise. Call
harmonize_grid() upstream to enforce that invariant.
snap_to_ref() applies the snapping step on its own: for
each peak in each spectrum, finds the nearest reference column on
the shared cs grid and records that column as pcisn (and its
ppm value as x0sn). Peaks farther than maxCombine columns from
every reference column get pcisn = NA / x0sn = NA. Original
x0, x0al, A, lambda, pcide and pcial are preserved —
snapping only adds the snapped fields. Collisions on the same
pcisn column are not merged here; si_mat() sums
their areas when rasterising the feature matrix. sit$supal is
cleared because the post-snap superposition would need recomputing.
Usage
clupa(
x,
y = NULL,
ref = NULL,
maxShift = 50,
verbose = TRUE,
nworkers = 1,
full = TRUE,
use_speaq = FALSE,
gap_tol = NULL
)
snap_to_ref(x, ref = NULL, maxCombine = 20, ...)Arguments
- x
A
decons2oralignsobject.- y
Optional factor of class labels. Unused by the default pipeline; accepted for signature compatibility.
- ref
Optional reference spectrum (
alignordecon2). WhenNULL, chosen internally.- maxShift
Maximum CluPA shift in datapoints.
- verbose
Print progress messages?
- nworkers
Number of parallel workers.
- full
If
TRUEalso recompute the aligned superposition.- use_speaq
Use
speaq::hClustAlign(CluPA only).- gap_tol
Optional gap tolerance in ppm; only consulted by experimental snap backends.
- maxCombine
Maximum reference-snapping distance in datapoints.
- ...
Ignored.
Examples
decons <- deconvolute(sim[1:5], sfr=c(3.55, 3.35), verbose=FALSE)
aligned <- clupa(decons, maxShift=50, verbose=FALSE) # CluPA stage
snapped <- snap_to_ref(aligned, maxCombine=20) # reference snapping