The MetaboDecon1D Main Function
MetaboDecon1D.Rd
MetaboDecon1D enables the automatic deconvolution of a 1D NMR spectrum into several Lorentz curves and the integration of them. The NMR file need to be in Bruker format or jcamp-dx format.
Arguments
- filepath
Complete path of the file folder (Notice for Bruker format: filepath need to be the spectrum folder containing one or more different spectra (e.g."C:/Users/Username/Desktop/spectra_from_bruker"))
- filename
Name of the NMR file. (Notice for Bruker format: filename need to be the name of your spectrum which is also the name of the folder) (Default: filename = NA to analyze more spectra at once)
- file_format
Format (bruker or jcampdx) of the NMR file. (Default: file_format = "bruker")
- number_iterations
Number of iterations for the approximation of the parameters for the Lorentz curves (Default: number_iterations=10)
- range_water_signal_ppm
Half width of the water artefact in ppm (Default: range_water_signal=0.1527692 (e.g. for urine NMR spectra))
- signal_free_region
Row vector with two entries consisting of the ppm positions for the left and right border of the signal free region of the spectrum. (Default: signal_free_region=c(11.44494, -1.8828))
- smoothing_param
Row vector with two entries consisting of the number of smoothing repeats for the whole spectrum and the number of data points (uneven) for the mean calculation (Default: smoothing_param=c(2,5))
- delta
Defines the threshold value to distinguish between signal and noise (Default: delta=6.4)
- scale_factor
Row vector with two entries consisting of the factor to scale the x-axis and the factor to scale the y-axis (Default: scale_factor=c(1000,1000000))
Value
List containing
filename
x_values (in datapoints)
x_values_ppm (in ppm)
y_values of the original spectrum
spectrum_superposition y_values of the superposition of all generated Lorentz curves
mse_normed is the mse value between the superposition of the Lorentz curves and the original spectrum which are standardized according to get a total area of 1
peak_triplets_left (ppm x_values)
peak_triplets_middle (ppm x_values)
peak_triplets_right (ppm x_values)
index_peak_triplets_left (index)
index_peak_triplets_middle (index)
index_peak_triplets_right (index)
integrals for each generated Lorentz curve
signal_free_region adjusted borders of signal free region
range_water_signal_ppm adjusted range water signal in ppm
A values of each Lorentz curve
lambda values of each Lorentz curve
x_0 values of each Lorentz curve
Notice: The parameters A, lambda and x_0 to calculate the Lorentz curves are saved in parameters.txt and the approximated spectrum is saved in approximated_spectrum.txt under the file path.
Details
The MetaboDecon1D package returns a list with i.a. the parameters A, lambda and x_0 to calculate the Lorentz curves.The Lorentz curves could be calculated by using the function calculate_lorentz_curves(). This returns a matrix containing the generated and approximated Lorentz curves for each real peak of the spectrum. Each row of the matrix depicts one Lorentz curve. The Lorentz curves could be visualized and saved by using the function plot_lorentz_curves_save_as_png(). The superposition of all Lorentz curves, which reconstructs the original spectrum, could also be visualized and saved with the plot_spectrum_superposition_save_as_png() function. For the analytical calculation of the Lorentz curves peak triplets for each peak are used. To visualize these peak triplets and to illustrate the impact of the threshold delta the function plot_triplets() is available. The integral values for each generated Lorentz curves are saved in a vector.
Notice: It is feasible to load all spectra of a folder at once. Here the filename need to be "NA" which is the default value. One selected spectrum could then be used to adjust the parameters (signal_free_region and range_water_signal_ppm) for the analysis of all spectra. Furthermore it is possible to adjust these parameters for each spectrum separate.
References
Haeckl, M.; Tauber, P.; Schweda, F.; Zacharias, H.U.; Altenbuchinger, M.; Oefner, P.J.; Gronwald, W. An R-Package for the Deconvolution and Integration of 1D NMR Data: MetaboDecon1D. Metabolites 2021, 11, 452. https://www.doi.org/10.3390/metabo11070452
Examples
if (FALSE) {
# Load one spectrum (Bruker format)
result <- MetaboDecon1D(filepath="load_example_path", filename="urine", file_format="bruker")
result$mse_normed
result$integrals
# Load all spectra (Bruker format) of choosen folder
result <- MetaboDecon1D(filepath="load_example_path", file_format="bruker")
result$urine$mse_normed
result$urine2$mse_normed
# Load one spectrum (jcamp-dx format)
result <- MetaboDecon1D(filepath="load_example_path", filename="urine.dx", file_format="jcampdx")
result$mse_normed
result$integrals
# Load all spectra (jcamp-dx format) of choosen folder
result <- MetaboDecon1D(filepath="load_example_path", file_format="jcampdx")
result$urine.dx$mse_normed
result$urine2.dx$mse_normed
}