Provides a high-performance Rust backend for the metabodecon package, enabling efficient deconvolution, alignment, and post-processing of 1D NMR spectra. The package wraps optimized Rust functions to improve performance and scalability for large datasets. The recommended way to use mdrb is by installing metabodecon and setting the backend argument to "rust" when calling its functions. The Rust part of the package is based on the metabodecon-rust crate.
- Install R version 4.2 or higher from CRAN.
- If you're on Windows install RTools from CRAN.
- Install the Rust toolchain from rustup.rs.
- Install the mdrb package by running the following commands in R:
install.packages("pak")
pak::pkg_install("spang-lab/mdrb")
mdrb is supposed to be used in combination with metabodecon. For example, to deconvolute a spectrum using the Rust backend, you can use the following code:
# Load spectra using metabodecon
spectra <- metabodecon::read_spectra("misc/example_datasets/bruker/blood", "bruker", 10, 10)
# Deconvopute a single spectrum using mdrb
rust_deconvolution <- mdrb::deconvolute_rust(
spectra[[1]],
sfr = c(-2.2, 11.8),
nfit = 10,
smopts = c(2, 5),
delta = 6.4,
ignore_regions = c(4.7, 4.9),
parallel = TRUE,
optimize_settings = FALSE
)
# Deconvolute multiple spectra using mdrb
rust_deconvolutions <- multi_deconvolute_rust(
spectra,
sfr = c(-2.2, 11.8),
nfit = 10,
smopts = c(2, 5),
delta = 6.4,
ignore_regions = c(4.7, 4.9),
parallel = TRUE,
optimize_settings = FALSE
)
Since mdrb is mostly intended as dependency of metabodecon and not for direct usage, documentation for mdrb is scarce. However, users interested in deconvolution and alignment of NMR spectra are encouraged to check out the metabodecon package, which provides a high-level interface to the Rust backend. metabodecon's documentation is available at spang-lab.github.io/metabodecon and includes pages about
See CONTRBUTING.md.