diff --git a/DESCRIPTION b/DESCRIPTION index 350618b3..c7a12322 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: AlpsNMR Type: Package Title: Automated spectraL Processing System for NMR -Version: 4.7.0 -Date: 2023-02-16 +Version: 4.7.1 +Date: 2024-06-02 Encoding: UTF-8 Authors@R: c( person(given = "Ivan", @@ -39,7 +39,12 @@ Authors@R: c( person(given = "Nestlé Institute of Health Sciences", role = "cph"), person(given = "Institute for Bioengineering of Catalonia", - role = "cph") + role = "cph"), + person(given = "Miller", + family = "Jack", + email = "jack.miller@physics.org", + role=c("ctb"), + comment = c(ORCID = "0000-0002-6258-1299", "Autophase wrapper, ASICS export")) ) Description: Reads Bruker NMR data directories both zipped and unzipped. It provides automated and efficient signal processing for untargeted @@ -54,7 +59,7 @@ License: MIT + file LICENSE URL: https://sipss.github.io/AlpsNMR/, https://github.com/sipss/AlpsNMR BugReports: https://github.com/sipss/AlpsNMR/issues LazyData: FALSE -Depends: R (>= 4.2), future (>= 1.10.0) +Depends: R (>= 4.2) Imports: utils, generics, @@ -85,8 +90,9 @@ Imports: ggplot2 (>= 3.1.0), baseline (>= 1.2-1), vctrs (>= 0.3.0), - BiocParallel + BiocParallel (>= 1.34.0) Suggests: + ASICS, BiocStyle, ChemoSpec, cowplot, @@ -96,6 +102,7 @@ Suggests: ggrepel (>= 0.8.0), gridExtra, knitr, + NMRphasing, plotly (>= 4.7.1), progressr, SummarizedExperiment, @@ -105,6 +112,6 @@ Suggests: zip (>= 2.0.4) biocViews: Software, Preprocessing, Visualization, Classification, Cheminformatics, Metabolomics, DataImport -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Roxygen: list(markdown = TRUE) VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index efd17220..408a9f39 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -49,6 +49,7 @@ export(new_nmr_dataset_1D) export(new_nmr_dataset_peak_table) export(nmr_align) export(nmr_align_find_ref) +export(nmr_autophase) export(nmr_baseline_estimation) export(nmr_baseline_removal) export(nmr_baseline_threshold) @@ -130,6 +131,7 @@ export(rename) export(save_files_to_rDolphin) export(save_profiling_output) export(tidy) +export(to_ASICS) export(to_ChemoSpec) export(validate_nmr_dataset) export(validate_nmr_dataset_1D) @@ -137,7 +139,6 @@ export(validate_nmr_dataset_family) export(validate_nmr_dataset_peak_table) importFrom(dplyr,filter) importFrom(dplyr,rename) -importFrom(future,plan) importFrom(generics,tidy) importFrom(glue,glue) importFrom(glue,glue_collapse) diff --git a/NEWS.md b/NEWS.md index ef1298b1..e1cfa714 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# AlpsNMR 4.7.1 (2024-06-02) + +- Added `nmr_autophase()` for automated phase correction using the NMRphasing package (#68). +- Added `to_ASICS` function to export dataset for ASICS quantification (#68). + # AlpsNMR 4.1.6 (2023-02-16) - Download improvements: diff --git a/R/import_jdx.R b/R/import_jdx.R index 8d8b5bd9..fb754a5b 100644 --- a/R/import_jdx.R +++ b/R/import_jdx.R @@ -250,7 +250,6 @@ process_block <- function(lines, metadata_only = FALSE) { #' @keywords internal #' @noRd read_jdx <- function(file_names, metadata_only = FALSE) { - warn_future_to_biocparallel() output <- BiocParallel::bplapply( X = file_names, FUN = function(file_name) { diff --git a/R/nmr_autophase.R b/R/nmr_autophase.R new file mode 100644 index 00000000..52abf728 --- /dev/null +++ b/R/nmr_autophase.R @@ -0,0 +1,111 @@ +#' @title Rephase 1D NMR data +#' @description +#' Use phasing algorithms to rephase data in the spectral domain. +#' +#' This function may improve autophasing processing from instrument vendors. It +#' wraps the [NMRphasing::NMRphasing()] function, to automatically rephase spectra, +#' allowing you to choose from a number of algorithms +#' of which `NLS`, `MPC_DANM` and `SPC_DANM` are the most recent. +#' +#' Rephasing should happen before any spectra interpolation. +#' +#' Please use the `all_components = TRUE` when calling [nmr_read_samples()] in order +#' to load the complex spectra and fix NMR phasing correctly. +#' +#' @param dataset An [nmr_dataset] object +#' @param method The autophasing method. See [NMRphasing::NMRphasing()] for details. +#' @param withBC `NMRphasing::NMRphasing` may perform a baseline correction using modified polynomial fitting. By default +#' AlpsNMR offers other baseline estimation methods and better visualization of its effect, so AlpsNMR by default +#' disables the baseline correction offered by NMRphasing. +#' @param ... Other parameters passed on to [NMRphasing::NMRphasing()]. +#' @return A (hopefully better phased) [nmr_dataset] object, with updated real and imaginary parts. +#' @examples +#' if (requireNamespace("NMRphasing", quietly=TRUE)) { +#' # Helpers to create a dataset: +#' lorentzian <- function(x, x0, gamma, A) { +#' A * (1 / (pi * gamma)) * ((gamma^2) / ((x - x0)^2 + gamma^2)) +#' } +#' x <- seq(from=1, to=2, length.out = 300) +#' y <- lorentzian(x, 1.3, 0.01, 1) + lorentzian(x, 1.6, 0.01, 1) +#' dataset <- new_nmr_dataset( +#' metadata = list(external = data.frame(NMRExperiment = "10")), +#' data_fields = list(data_1r = list(y)), +#' axis = list(list(x)) +#' ) +#' # Autophase, interpolate and plot: +#' dataset <- nmr_autophase(dataset, method = "NLS") +#' dataset <- nmr_interpolate_1D(dataset, axis = c(min = 1, max = 2, by = 0.01)) +#' plot(dataset) +#' } +#' @export +nmr_autophase <- function(dataset, + method = c("NLS", "MPC_DANM", "MPC_EMP", "SPC_DANM", "SPC_EMP", "SPC_AAM", "SPC_DSM"), + withBC = FALSE, ...) { + require_pkgs("NMRphasing") + if (!"data_1i" %in% names(c(dataset))) { + cli::cli_warn(c( + "!" = "nmr_autophase() performs better with access to the whole complex NMR spectra", + "i" = "Please read the dataset using {.code all_components=TRUE}.", + "i" = "See {.fun AlpsNMR::nmr_autophase} for a full example" + )) + } + + if (inherits(dataset, "nmr_dataset_1D")) { + cli::cli_abort(c( + "x" = "nmr_autophase() expects non-interpolated spectra", + "i" = "Please use nmr_autophase() before calling nmr_interpolate_1D()", + "i" = "See {.fun AlpsNMR::nmr_autophase} for a full example" + )) + } + + method <- match.arg(method) + + real_list_of_spectra <- dataset$data_1r + imag_list_of_spectra <- dataset$data_1i + absorptionOnly <- FALSE + if (is.null(imag_list_of_spectra)) { + imag_list_of_spectra <- vector(mode="list", length=dataset$num_samples) + } else { + any_imag_missing <- purrr::map_lgl(imag_list_of_spectra, is.null) + any_imag_missing <- any_imag_missing[any_imag_missing] + if (length(any_imag_missing) > 0) { + if (length(any_imag_missing < 7)) { + miss_sample_names <- paste0(names(any_imag_missing), collapse = ", ") + msg <- "Samples without imaginary component: {miss_sample_names}" + } else { + miss_sample_names <- paste0(names(utils::head(any_imag_missing, n=5)), collapse = ", ") + msg <- "Samples without imaginary component: {miss_sample_names} and {length(any_imag_missing)-5} more" + } + cli::cli_warn(c( + "!" = "{length(any_imag_missing)}/{dataset$num_samples} samples have a missing imaginary spectrum", + "i" = msg, + "i" = "Estimating autophase using only the absorption" + )) + } + } + + real_imag_lists <- BiocParallel::bpmapply( + FUN = function(real, imag, ...) { + if (!is.null(imag)) { + absorptionOnly <- FALSE + to_phase <- complex( + real = real, + imaginary = imag + ) + } else { + absorptionOnly <- TRUE + to_phase <- real + } + phased <- NMRphasing::NMRphasing(to_phase, absorptionOnly = TRUE, ...) + list(real = Re(phased), imag = Im(phased)) + }, + real_list_of_spectra, imag_list_of_spectra, + MoreArgs = list(method = method, withBC = withBC, ...), + SIMPLIFY = FALSE + ) + dataset[["data_1r"]] <- purrr::map(real_imag_lists, "real") + if ("data_1i" %in% c(dataset)) { + dataset[["data_1i"]] <- purrr::map(real_imag_lists, "imag") + } + dataset +} diff --git a/R/nmr_data_analysis.R b/R/nmr_data_analysis.R index 8bbb6bfb..2706fa21 100644 --- a/R/nmr_data_analysis.R +++ b/R/nmr_data_analysis.R @@ -270,8 +270,7 @@ split_build_perform <- function(train_test_subset, do_cv <- function(dataset, y_column, identity_column, train_evaluate_model, train_test_subsets, train_evaluate_model_args_iter = NULL, ..., .enable_parallel = TRUE) { if (.enable_parallel) { - warn_future_to_biocparallel() - fun <- mymapply + fun <- BiocParallel::bpmapply } else { fun <- mapply } diff --git a/R/nmr_dataset.R b/R/nmr_dataset.R index 3f314ff7..88132642 100644 --- a/R/nmr_dataset.R +++ b/R/nmr_dataset.R @@ -231,7 +231,6 @@ nmr_read_samples_bruker <- if (length(sample_names) == 0) { stop("No samples to load") } - warn_future_to_biocparallel() list_of_samples <- BiocParallel::bplapply( X = sample_names, FUN = function(sampl, pulse_sequence, metadata_only, ...) { diff --git a/R/nmr_detect_peaks_align.R b/R/nmr_detect_peaks_align.R index 56911440..82f1abc5 100644 --- a/R/nmr_detect_peaks_align.R +++ b/R/nmr_detect_peaks_align.R @@ -93,7 +93,8 @@ NULL #' @param baselineThresh All peaks with intensities below the thresholds are excluded. Either: #' - A numeric vector of length the number of samples. Each number is a threshold for that sample #' - A single number. All samples use this number as baseline threshold. -#' - `NULL`. If that's the case, a default function is used ([nmr_baseline_threshold()]) +#' - `NULL`. If that's the case, a default function is used ([nmr_baseline_threshold()]), which assumes +#' that there is no signal in the region 9.5-10 ppm. #' @inheritParams speaq::detectSpecPeaks #' @param range_without_peaks A numeric vector of length two with a region without peaks, only used when `baselineThresh = NULL` #' @param fit_lorentzians If `TRUE`, fit a lorentzian to each detected peak, to infer its inflection points. For now disabled for backwards compatibility. @@ -175,8 +176,7 @@ nmr_detect_peaks <- function(nmr_dataset, ) } - warn_future_to_biocparallel() - peakList <- mymapply( + peakList <- BiocParallel::bpmapply( FUN = callDetectSpecPeaks, X = data_matrix_to_list, baselineThresh = baselineThresh, @@ -493,7 +493,6 @@ nmr_detect_peaks_tune_snr <- function(ds, ds1 <- filter(ds, NMRExperiment == !!NMRExperiment) names(SNR_thresholds) <- SNR_thresholds - warn_future_to_biocparallel() peaks_detected_list <- BiocParallel::bplapply( X = SNR_thresholds, FUN = function(SNR.Th, nmr_dataset, ...) { diff --git a/R/utils.R b/R/utils.R index 98c056ba..d4c366a5 100644 --- a/R/utils.R +++ b/R/utils.R @@ -228,26 +228,6 @@ progress_bar_end <- function(pb) { } } -#' @importFrom future plan -warn_future_to_biocparallel <- function() { - # REMOVE THIS WARNING >ONE YEAR AFTER IT'S BEEN RELEASED to BIOCONDUCTOR - current_plan <- future::plan() - if (inherits(current_plan, "sequential")) { - return() - } - rlang::warn( - message = c( - "AlpsNMR now uses BiocParallel instead of future for parallellization", - "i" = "If you used plan(multisession) or any other plan(), consider removing all plan() calls and use:\n library(BiocParallel)\n register(SnowParam(workers = 3), default = TRUE)", - "i" = "You just need to place that code once, typically at the beginning of your script" - ), - class = "AlpsNMR-future-to-biocparallel-warning", - .frequency = "once", - .frequency_id = "future-to-biocparallel" - ) - return() -} - #' Convert to ChemoSpec Spectra class #' @param nmr_dataset An [nmr_dataset_1D] object @@ -288,6 +268,36 @@ to_ChemoSpec <- function(nmr_dataset, desc = "A nmr_dataset", group = NULL) { return(Spectra) } +#' @title Export data for the ASICS spectral quantification library +#' @description +#' Exports the spectra matrix, sample names and chemical shift axis into +#' an ASICS Spectra object. +#' +#' @param dataset An [nmr_dataset_1D] object +#' @inheritDotParams ASICS::createSpectra -spectra +#' @return An [ASICS::Spectra-class] object +#' @examples +#' if (requireNamespace("ASICS", quietly=TRUE)) { +#' nsamp <- 3 +#' npoints <- 300 +#' metadata <- list(external = data.frame( +#' NMRExperiment = paste0("Sample", seq_len(nsamp)) +#' )) +#' dataset <- new_nmr_dataset_1D( +#' ppm_axis = seq(from = 0.2, to = 10, length.out = npoints), +#' data_1r = matrix(runif(nsamp * npoints), nrow = nsamp, ncol = npoints), +#' metadata = metadata +#' ) +#' forAsics <- to_ASICS(dataset) +#' #ASICS::ASICS(forAsics) +#' } +#' @export +to_ASICS <- function(dataset, ...) { + require_pkgs("ASICS") + spectra_matrix <- t(nmr_data(dataset)) + ASICS::createSpectra(spectra_matrix, ...) +} + abort_if_not <- function(condition, ...) { if (!condition) { diff --git a/R/workaround-biocparallel-bug.R b/R/workaround-biocparallel-bug.R deleted file mode 100644 index 49aa0930..00000000 --- a/R/workaround-biocparallel-bug.R +++ /dev/null @@ -1,99 +0,0 @@ -# This whole file is a workaround for: -# - https://github.com/Bioconductor/BiocParallel/pull/227 -# (merged released on Bioconductor 3.16, BiocParallel 1.31.14) -# And a workaround for: -# - https://github.com/Bioconductor/BiocParallel/pull/228 -# (as of 2022-11-04 it is under review) -# -# Please once that's merged and released, ensure you have -# BiocParallel (>= 1.xx.xx?) -# in the DESCRIPTION file, replace all usages of mymapply() with -# BiocParallel::bpmapply() and delete this file. -# -# Most of these functions are copies from the BiocParallel package - -.getDotsForMapply <- function (...) -{ - ddd <- list(...) - if (!length(ddd)) - return(list(list())) - len <- vapply(ddd, length, integer(1L)) - if (!all(len == len[1L])) { - max.len <- max(len) - if (max.len && any(len == 0L)) - stop("zero-length and non-zero length inputs cannot be mixed") - if (any(max.len%%len)) - warning("longer argument not a multiple of length of vector") - ddd <- lapply(ddd, rep_len, length.out = max.len) - } - ddd -} - -.simplify <- function (results, SIMPLIFY = FALSE) -{ - if (SIMPLIFY && length(results)) - results <- simplify2array(results) - results -} - -# see test_utilities.R:test_transposeArgsWithIterations() for all -# USE.NAMES corner cases -.transposeArgsWithIterations <- function(nestedList, USE.NAMES) { - num_arguments <- length(nestedList) - if (num_arguments == 0L) { - return(list()) - } - - # nestedList[[1L]] has the values for the first argument in all iterations - num_iterations <- length(nestedList[[1L]]) - - # count the iterations, and name them if needed - iterations <- seq_len(num_iterations) - if (USE.NAMES) { - first_arg <- nestedList[[1L]] - if (is.character(first_arg) && is.null(names(first_arg))) { - names(iterations) <- first_arg - } else { - names(iterations) <- names(first_arg) - } - } - - # argnames: - argnames <- names(nestedList) - - # on iteration `i` we get the i-th element from each list. - # note that .getDotsForMapply() has taken care already of ensuring that - # nestedList elements are recycled properly - lapply(iterations, function(i) { - x <- lapply(nestedList, function(argi) { - unname(argi[i]) - }) - names(x) <- argnames - x - }) -} - -.wrapMapply <- function(dots, .FUN, .MoreArgs) { - .mapply(.FUN, dots, .MoreArgs)[[1L]] -} - -mymapply <- function(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE, - BPREDO = list(), BPPARAM = BiocParallel::bpparam(), BPOPTIONS = BiocParallel::bpoptions()) { - ## re-package for lapply - ddd <- .getDotsForMapply(...) - if (!length(ddd)) - return(list()) - - ddd <- .transposeArgsWithIterations(ddd, USE.NAMES) - if (!length(ddd)) - return(ddd) - - FUN <- match.fun(FUN) - - res <- BiocParallel::bplapply(X=ddd, .wrapMapply, .FUN=FUN, - .MoreArgs=MoreArgs, BPREDO=BPREDO, - BPPARAM=BPPARAM, BPOPTIONS = BPOPTIONS) - .simplify(res, SIMPLIFY) -} - - diff --git a/man/AlpsNMR-package.Rd b/man/AlpsNMR-package.Rd index a3c6b7e1..ca9744ef 100644 --- a/man/AlpsNMR-package.Rd +++ b/man/AlpsNMR-package.Rd @@ -60,6 +60,7 @@ Other contributors: \item Laura López Sánchez [contributor] \item Nestlé Institute of Health Sciences [copyright holder] \item Institute for Bioengineering of Catalonia [copyright holder] + \item Miller Jack \email{jack.miller@physics.org} (\href{https://orcid.org/0000-0002-6258-1299}{ORCID}) (Autophase wrapper, ASICS export) [contributor] } } diff --git a/man/Pipelines.Rd b/man/Pipelines.Rd index 472bb44b..ab4e615a 100644 --- a/man/Pipelines.Rd +++ b/man/Pipelines.Rd @@ -106,7 +106,8 @@ for peaks.} \itemize{ \item A numeric vector of length the number of samples. Each number is a threshold for that sample \item A single number. All samples use this number as baseline threshold. -\item \code{NULL}. If that's the case, a default function is used (\code{\link[=nmr_baseline_threshold]{nmr_baseline_threshold()}}) +\item \code{NULL}. If that's the case, a default function is used (\code{\link[=nmr_baseline_threshold]{nmr_baseline_threshold()}}), which assumes +that there is no signal in the region 9.5-10 ppm. }} \item{SNR.Th}{The parameter of peakDetectionCWT function of MassSpecWavelet package, look it up in the original function. If you set -1, the function will itself re-compute this value.} @@ -221,30 +222,30 @@ Other import/export functions: Other metadata functions: \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_groups}()} Other outlier detection functions: +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_filter}()}, \code{\link{nmr_pca_outliers_plot}()}, -\code{\link{nmr_pca_outliers_robust}()}, -\code{\link{nmr_pca_outliers}()} +\code{\link{nmr_pca_outliers_robust}()} Other peak detection functions: \code{\link{nmr_baseline_threshold}()}, -\code{\link{nmr_detect_peaks_plot_overview}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()}, \code{\link{nmr_integrate_regions}()} Other alignment functions: -\code{\link{nmr_align_find_ref}()}, -\code{\link{nmr_align}()} +\code{\link{nmr_align}()}, +\code{\link{nmr_align_find_ref}()} Other peak integration functions: \code{\link{get_integration_with_metadata}()}, diff --git a/man/filter.nmr_dataset_family.Rd b/man/filter.nmr_dataset_family.Rd index a61aad09..a61e3923 100644 --- a/man/filter.nmr_dataset_family.Rd +++ b/man/filter.nmr_dataset_family.Rd @@ -30,9 +30,9 @@ sample_10 <- filter(dataset_1D, NMRExperiment == "10") } \seealso{ Other subsetting functions: +\code{\link{[.nmr_dataset}()}, \code{\link{[.nmr_dataset_1D}()}, \code{\link{[.nmr_dataset_peak_table}()}, -\code{\link{[.nmr_dataset}()}, \code{\link{nmr_pca_outliers_filter}()} } \concept{subsetting functions} diff --git a/man/format.nmr_dataset.Rd b/man/format.nmr_dataset.Rd index 02c926ac..2c2ca5af 100644 --- a/man/format.nmr_dataset.Rd +++ b/man/format.nmr_dataset.Rd @@ -29,14 +29,14 @@ Other class helper functions: \code{\link{format.nmr_dataset_peak_table}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/format.nmr_dataset_1D.Rd b/man/format.nmr_dataset_1D.Rd index bc65b1d4..00196111 100644 --- a/man/format.nmr_dataset_1D.Rd +++ b/man/format.nmr_dataset_1D.Rd @@ -25,19 +25,19 @@ format(dataset_1D) } \seealso{ Other class helper functions: -\code{\link{format.nmr_dataset_peak_table}()}, \code{\link{format.nmr_dataset}()}, +\code{\link{format.nmr_dataset_peak_table}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} Other nmr_dataset_1D functions: \code{\link{[.nmr_dataset_1D}()}, @@ -47,8 +47,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} } diff --git a/man/format.nmr_dataset_peak_table.Rd b/man/format.nmr_dataset_peak_table.Rd index 571bc8a4..c1358267 100644 --- a/man/format.nmr_dataset_peak_table.Rd +++ b/man/format.nmr_dataset_peak_table.Rd @@ -31,18 +31,18 @@ format(new) } \seealso{ Other class helper functions: -\code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset}()}, +\code{\link{format.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/get_integration_with_metadata.Rd b/man/get_integration_with_metadata.Rd index 75193c00..a33f6bbc 100644 --- a/man/get_integration_with_metadata.Rd +++ b/man/get_integration_with_metadata.Rd @@ -45,8 +45,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} } diff --git a/man/is.nmr_dataset_1D.Rd b/man/is.nmr_dataset_1D.Rd index 25ff06f1..e365a527 100644 --- a/man/is.nmr_dataset_1D.Rd +++ b/man/is.nmr_dataset_1D.Rd @@ -23,19 +23,19 @@ result <- is(dataset_1D) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} Other nmr_dataset_1D functions: \code{\link{[.nmr_dataset_1D}()}, @@ -45,8 +45,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} } diff --git a/man/is.nmr_dataset_peak_table.Rd b/man/is.nmr_dataset_peak_table.Rd index f70d5faa..a7f85eee 100644 --- a/man/is.nmr_dataset_peak_table.Rd +++ b/man/is.nmr_dataset_peak_table.Rd @@ -30,18 +30,18 @@ is(new) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/new_nmr_dataset.Rd b/man/new_nmr_dataset.Rd index 39fefa02..8d186d28 100644 --- a/man/new_nmr_dataset.Rd +++ b/man/new_nmr_dataset.Rd @@ -43,18 +43,18 @@ my_2D_data <- new_nmr_dataset(metadata_2D, data_fields_2D, axis_2D) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/new_nmr_dataset_1D.Rd b/man/new_nmr_dataset_1D.Rd index d9d9918c..f3aa2194 100644 --- a/man/new_nmr_dataset_1D.Rd +++ b/man/new_nmr_dataset_1D.Rd @@ -38,18 +38,18 @@ dummy_nmr_dataset_1D <- new_nmr_dataset_1D( } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset_peak_table}()}, \code{\link{new_nmr_dataset}()}, +\code{\link{new_nmr_dataset_peak_table}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/new_nmr_dataset_peak_table.Rd b/man/new_nmr_dataset_peak_table.Rd index 97e3b028..849c70d0 100644 --- a/man/new_nmr_dataset_peak_table.Rd +++ b/man/new_nmr_dataset_peak_table.Rd @@ -31,18 +31,18 @@ new <- new_nmr_dataset_peak_table(peak_table, metadata) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset}()}, +\code{\link{new_nmr_dataset_1D}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/nmr_autophase.Rd b/man/nmr_autophase.Rd new file mode 100644 index 00000000..45762200 --- /dev/null +++ b/man/nmr_autophase.Rd @@ -0,0 +1,59 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/nmr_autophase.R +\name{nmr_autophase} +\alias{nmr_autophase} +\title{Rephase 1D NMR data} +\usage{ +nmr_autophase( + dataset, + method = c("NLS", "MPC_DANM", "MPC_EMP", "SPC_DANM", "SPC_EMP", "SPC_AAM", "SPC_DSM"), + withBC = FALSE, + ... +) +} +\arguments{ +\item{dataset}{An \link{nmr_dataset} object} + +\item{method}{The autophasing method. See \code{\link[NMRphasing:NMRphasing]{NMRphasing::NMRphasing()}} for details.} + +\item{withBC}{\code{NMRphasing::NMRphasing} may perform a baseline correction using modified polynomial fitting. By default +AlpsNMR offers other baseline estimation methods and better visualization of its effect, so AlpsNMR by default +disables the baseline correction offered by NMRphasing.} + +\item{...}{Other parameters passed on to \code{\link[NMRphasing:NMRphasing]{NMRphasing::NMRphasing()}}.} +} +\value{ +A (hopefully better phased) \link{nmr_dataset} object, with updated real and imaginary parts. +} +\description{ +Use phasing algorithms to rephase data in the spectral domain. + +This function may improve autophasing processing from instrument vendors. It +wraps the \code{\link[NMRphasing:NMRphasing]{NMRphasing::NMRphasing()}} function, to automatically rephase spectra, +allowing you to choose from a number of algorithms +of which \code{NLS}, \code{MPC_DANM} and \code{SPC_DANM} are the most recent. + +Rephasing should happen before any spectra interpolation. + +Please use the \code{all_components = TRUE} when calling \code{\link[=nmr_read_samples]{nmr_read_samples()}} in order +to load the complex spectra and fix NMR phasing correctly. +} +\examples{ +if (requireNamespace("NMRphasing", quietly=TRUE)) { + # Helpers to create a dataset: + lorentzian <- function(x, x0, gamma, A) { + A * (1 / (pi * gamma)) * ((gamma^2) / ((x - x0)^2 + gamma^2)) + } + x <- seq(from=1, to=2, length.out = 300) + y <- lorentzian(x, 1.3, 0.01, 1) + lorentzian(x, 1.6, 0.01, 1) + dataset <- new_nmr_dataset( + metadata = list(external = data.frame(NMRExperiment = "10")), + data_fields = list(data_1r = list(y)), + axis = list(list(x)) + ) + # Autophase, interpolate and plot: + dataset <- nmr_autophase(dataset, method = "NLS") + dataset <- nmr_interpolate_1D(dataset, axis = c(min = 1, max = 2, by = 0.01)) + plot(dataset) +} +} diff --git a/man/nmr_baseline_threshold.Rd b/man/nmr_baseline_threshold.Rd index 407e8904..1f68a93d 100644 --- a/man/nmr_baseline_threshold.Rd +++ b/man/nmr_baseline_threshold.Rd @@ -52,10 +52,10 @@ bl_threshold <- nmr_baseline_threshold(dataset_1D, range_without_peaks = c(9.5,1 \seealso{ Other peak detection functions: \code{\link{Pipelines}}, -\code{\link{nmr_detect_peaks_plot_overview}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()}, diff --git a/man/nmr_detect_peaks.Rd b/man/nmr_detect_peaks.Rd index 46df4349..5bebe8db 100644 --- a/man/nmr_detect_peaks.Rd +++ b/man/nmr_detect_peaks.Rd @@ -27,7 +27,8 @@ for peaks.} \itemize{ \item A numeric vector of length the number of samples. Each number is a threshold for that sample \item A single number. All samples use this number as baseline threshold. -\item \code{NULL}. If that's the case, a default function is used (\code{\link[=nmr_baseline_threshold]{nmr_baseline_threshold()}}) +\item \code{NULL}. If that's the case, a default function is used (\code{\link[=nmr_baseline_threshold]{nmr_baseline_threshold()}}), which assumes +that there is no signal in the region 9.5-10 ppm. }} \item{SNR.Th}{The parameter of peakDetectionCWT function of MassSpecWavelet package, look it up in the original function. If you set -1, the function will itself re-compute this value.} @@ -62,8 +63,8 @@ Peak_detection Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, -\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, diff --git a/man/nmr_detect_peaks_plot.Rd b/man/nmr_detect_peaks_plot.Rd index b3780cf1..65a4133e 100644 --- a/man/nmr_detect_peaks_plot.Rd +++ b/man/nmr_detect_peaks_plot.Rd @@ -38,9 +38,9 @@ Peak_detection nmr_detect_peaks Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()}, @@ -49,9 +49,9 @@ Other peak detection functions: Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()}, diff --git a/man/nmr_detect_peaks_plot_overview.Rd b/man/nmr_detect_peaks_plot_overview.Rd index 7212e5cd..d3ff5b95 100644 --- a/man/nmr_detect_peaks_plot_overview.Rd +++ b/man/nmr_detect_peaks_plot_overview.Rd @@ -36,9 +36,9 @@ Peak_detection Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()}, diff --git a/man/nmr_detect_peaks_tune_snr.Rd b/man/nmr_detect_peaks_tune_snr.Rd index 19b36883..5c3b05f1 100644 --- a/man/nmr_detect_peaks_tune_snr.Rd +++ b/man/nmr_detect_peaks_tune_snr.Rd @@ -28,7 +28,8 @@ for peaks.} \itemize{ \item A numeric vector of length the number of samples. Each number is a threshold for that sample \item A single number. All samples use this number as baseline threshold. -\item \code{NULL}. If that's the case, a default function is used (\code{\link[=nmr_baseline_threshold]{nmr_baseline_threshold()}}) +\item \code{NULL}. If that's the case, a default function is used (\code{\link[=nmr_baseline_threshold]{nmr_baseline_threshold()}}), which assumes +that there is no signal in the region 9.5-10 ppm. }} \item{\code{range_without_peaks}}{A numeric vector of length two with a region without peaks, only used when \code{baselineThresh = NULL}} \item{\code{fit_lorentzians}}{If \code{TRUE}, fit a lorentzian to each detected peak, to infer its inflection points. For now disabled for backwards compatibility.} @@ -58,9 +59,9 @@ nmr_detect_peaks Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, -\code{\link{nmr_detect_peaks_plot_overview}()}, -\code{\link{nmr_detect_peaks_plot}()}, \code{\link{nmr_detect_peaks}()}, +\code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()}, diff --git a/man/nmr_identify_regions_blood.Rd b/man/nmr_identify_regions_blood.Rd index 06606ed9..f723dc92 100644 --- a/man/nmr_identify_regions_blood.Rd +++ b/man/nmr_identify_regions_blood.Rd @@ -36,10 +36,10 @@ identification <- nmr_identify_regions_blood(ppm_to_assign) Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, -\code{\link{nmr_detect_peaks_plot_overview}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()}, \code{\link{nmr_integrate_regions}()} diff --git a/man/nmr_identify_regions_cell.Rd b/man/nmr_identify_regions_cell.Rd index 69c7b04f..1f199be9 100644 --- a/man/nmr_identify_regions_cell.Rd +++ b/man/nmr_identify_regions_cell.Rd @@ -36,10 +36,10 @@ identification <- nmr_identify_regions_cell(ppm_to_assign, num_proposed_compound Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, -\code{\link{nmr_detect_peaks_plot_overview}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_urine}()}, \code{\link{nmr_integrate_regions}()} diff --git a/man/nmr_identify_regions_urine.Rd b/man/nmr_identify_regions_urine.Rd index 7151daaa..5f952f7a 100644 --- a/man/nmr_identify_regions_urine.Rd +++ b/man/nmr_identify_regions_urine.Rd @@ -37,10 +37,10 @@ identification <- nmr_identify_regions_urine(ppm_to_assign, num_proposed_compoun Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, -\code{\link{nmr_detect_peaks_plot_overview}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_integrate_regions}()} diff --git a/man/nmr_integrate_peak_positions.Rd b/man/nmr_integrate_peak_positions.Rd index 2d02efb4..be544bf2 100644 --- a/man/nmr_integrate_peak_positions.Rd +++ b/man/nmr_integrate_peak_positions.Rd @@ -50,8 +50,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} } diff --git a/man/nmr_integrate_regions.Rd b/man/nmr_integrate_regions.Rd index 20b29dd2..5048d00d 100644 --- a/man/nmr_integrate_regions.Rd +++ b/man/nmr_integrate_regions.Rd @@ -87,10 +87,10 @@ peak_table_integration <- nmr_integrate_regions( Other peak detection functions: \code{\link{Pipelines}}, \code{\link{nmr_baseline_threshold}()}, -\code{\link{nmr_detect_peaks_plot_overview}()}, +\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_detect_peaks_plot}()}, +\code{\link{nmr_detect_peaks_plot_overview}()}, \code{\link{nmr_detect_peaks_tune_snr}()}, -\code{\link{nmr_detect_peaks}()}, \code{\link{nmr_identify_regions_blood}()}, \code{\link{nmr_identify_regions_cell}()}, \code{\link{nmr_identify_regions_urine}()} @@ -111,8 +111,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_peak_positions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} } diff --git a/man/nmr_meta_add.Rd b/man/nmr_meta_add.Rd index a2879884..713b8266 100644 --- a/man/nmr_meta_add.Rd +++ b/man/nmr_meta_add.Rd @@ -78,14 +78,14 @@ nmr_meta_get(nmr_dataset, groups = "external") Other metadata functions: \code{\link{Pipelines}}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_groups}()} Other nmr_dataset functions: \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, -\code{\link{nmr_meta_get}()} +\code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()} Other nmr_dataset_1D functions: \code{\link{[.nmr_dataset_1D}()}, @@ -95,15 +95,15 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_peak_positions}()}, \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} Other nmr_dataset_peak_table functions: \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, -\code{\link{nmr_meta_get}()} +\code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()} } \concept{metadata functions} \concept{nmr_dataset functions} diff --git a/man/nmr_meta_export.Rd b/man/nmr_meta_export.Rd index 902ad018..fe6e2675 100644 --- a/man/nmr_meta_export.Rd +++ b/man/nmr_meta_export.Rd @@ -34,14 +34,14 @@ dataset <- nmr_read_samples_dir(dir_to_demo_dataset) Other metadata functions: \code{\link{Pipelines}}, \code{\link{nmr_meta_add}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_groups}()} Other nmr_dataset functions: \code{\link{nmr_meta_add}()}, -\code{\link{nmr_meta_get_column}()}, -\code{\link{nmr_meta_get}()} +\code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()} Other nmr_dataset_1D functions: \code{\link{[.nmr_dataset_1D}()}, @@ -51,15 +51,15 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_peak_positions}()}, \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} Other nmr_dataset_peak_table functions: \code{\link{nmr_meta_add}()}, -\code{\link{nmr_meta_get_column}()}, -\code{\link{nmr_meta_get}()} +\code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()} Other import/export functions: \code{\link{Pipelines}}, diff --git a/man/nmr_meta_groups.Rd b/man/nmr_meta_groups.Rd index 3c6d0483..5285d5dd 100644 --- a/man/nmr_meta_groups.Rd +++ b/man/nmr_meta_groups.Rd @@ -25,7 +25,7 @@ Other metadata functions: \code{\link{Pipelines}}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, -\code{\link{nmr_meta_get}()} +\code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()} } \concept{metadata functions} diff --git a/man/nmr_pca_build_model.Rd b/man/nmr_pca_build_model.Rd index 4cdc9a0e..1e5cbf7b 100644 --- a/man/nmr_pca_build_model.Rd +++ b/man/nmr_pca_build_model.Rd @@ -73,10 +73,10 @@ model <- nmr_pca_build_model(dataset_1D) } \seealso{ Other PCA related functions: +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_filter}()}, \code{\link{nmr_pca_outliers_plot}()}, \code{\link{nmr_pca_outliers_robust}()}, -\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_plots}} } \concept{PCA related functions} diff --git a/man/nmr_pca_outliers_filter.Rd b/man/nmr_pca_outliers_filter.Rd index 470ca8ea..061476a6 100644 --- a/man/nmr_pca_outliers_filter.Rd +++ b/man/nmr_pca_outliers_filter.Rd @@ -29,21 +29,21 @@ dataset_whitout_outliers <- nmr_pca_outliers_filter(dataset_1D, outliers_info) \seealso{ Other PCA related functions: \code{\link{nmr_pca_build_model}()}, +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_plot}()}, \code{\link{nmr_pca_outliers_robust}()}, -\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_plots}} Other outlier detection functions: \code{\link{Pipelines}}, +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_plot}()}, -\code{\link{nmr_pca_outliers_robust}()}, -\code{\link{nmr_pca_outliers}()} +\code{\link{nmr_pca_outliers_robust}()} Other subsetting functions: +\code{\link{[.nmr_dataset}()}, \code{\link{[.nmr_dataset_1D}()}, \code{\link{[.nmr_dataset_peak_table}()}, -\code{\link{[.nmr_dataset}()}, \code{\link{filter.nmr_dataset_family}()} } \concept{PCA related functions} diff --git a/man/nmr_pca_outliers_plot.Rd b/man/nmr_pca_outliers_plot.Rd index 195c8819..91628cd5 100644 --- a/man/nmr_pca_outliers_plot.Rd +++ b/man/nmr_pca_outliers_plot.Rd @@ -31,16 +31,16 @@ Plot for outlier detection diagnostic \seealso{ Other PCA related functions: \code{\link{nmr_pca_build_model}()}, +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_filter}()}, \code{\link{nmr_pca_outliers_robust}()}, -\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_plots}} Other outlier detection functions: \code{\link{Pipelines}}, +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_filter}()}, -\code{\link{nmr_pca_outliers_robust}()}, -\code{\link{nmr_pca_outliers}()} +\code{\link{nmr_pca_outliers_robust}()} } \concept{PCA related functions} \concept{outlier detection functions} diff --git a/man/nmr_pca_outliers_robust.Rd b/man/nmr_pca_outliers_robust.Rd index 2627023e..9c71b92f 100644 --- a/man/nmr_pca_outliers_robust.Rd +++ b/man/nmr_pca_outliers_robust.Rd @@ -47,16 +47,16 @@ outliers_info <- nmr_pca_outliers_robust(dataset_1D) \seealso{ Other PCA related functions: \code{\link{nmr_pca_build_model}()}, +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_filter}()}, \code{\link{nmr_pca_outliers_plot}()}, -\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_plots}} Other outlier detection functions: \code{\link{Pipelines}}, +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_filter}()}, -\code{\link{nmr_pca_outliers_plot}()}, -\code{\link{nmr_pca_outliers}()} +\code{\link{nmr_pca_outliers_plot}()} } \concept{PCA related functions} \concept{outlier detection functions} diff --git a/man/nmr_pca_plots.Rd b/man/nmr_pca_plots.Rd index 2fc91bfd..39f468d8 100644 --- a/man/nmr_pca_plots.Rd +++ b/man/nmr_pca_plots.Rd @@ -39,9 +39,9 @@ nmr_pca_loadingplot(model, 1) \seealso{ Other PCA related functions: \code{\link{nmr_pca_build_model}()}, +\code{\link{nmr_pca_outliers}()}, \code{\link{nmr_pca_outliers_filter}()}, \code{\link{nmr_pca_outliers_plot}()}, -\code{\link{nmr_pca_outliers_robust}()}, -\code{\link{nmr_pca_outliers}()} +\code{\link{nmr_pca_outliers_robust}()} } \concept{PCA related functions} diff --git a/man/nmr_ppm_resolution.Rd b/man/nmr_ppm_resolution.Rd index fbc3f89a..6aca448c 100644 --- a/man/nmr_ppm_resolution.Rd +++ b/man/nmr_ppm_resolution.Rd @@ -45,8 +45,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{print.nmr_dataset_1D}()} } \concept{nmr_dataset_1D functions} diff --git a/man/print.nmr_dataset.Rd b/man/print.nmr_dataset.Rd index 419696e7..4615ce65 100644 --- a/man/print.nmr_dataset.Rd +++ b/man/print.nmr_dataset.Rd @@ -25,18 +25,18 @@ print(dataset) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/print.nmr_dataset_1D.Rd b/man/print.nmr_dataset_1D.Rd index 45fc36bd..31e344db 100644 --- a/man/print.nmr_dataset_1D.Rd +++ b/man/print.nmr_dataset_1D.Rd @@ -25,19 +25,19 @@ print(dataset_1D) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, -\code{\link{print.nmr_dataset_peak_table}()}, \code{\link{print.nmr_dataset}()}, +\code{\link{print.nmr_dataset_peak_table}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} Other nmr_dataset_1D functions: \code{\link{[.nmr_dataset_1D}()}, @@ -48,8 +48,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()} } \concept{class helper functions} diff --git a/man/print.nmr_dataset_peak_table.Rd b/man/print.nmr_dataset_peak_table.Rd index 253f1837..514353da 100644 --- a/man/print.nmr_dataset_peak_table.Rd +++ b/man/print.nmr_dataset_peak_table.Rd @@ -31,18 +31,18 @@ new } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, -\code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset}()}, +\code{\link{print.nmr_dataset_1D}()}, +\code{\link{validate_nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/sub-.nmr_dataset_1D.Rd b/man/sub-.nmr_dataset_1D.Rd index 77a4f90b..0cd33a19 100644 --- a/man/sub-.nmr_dataset_1D.Rd +++ b/man/sub-.nmr_dataset_1D.Rd @@ -25,8 +25,8 @@ dataset_1D[0] } \seealso{ Other subsetting functions: -\code{\link{[.nmr_dataset_peak_table}()}, \code{\link{[.nmr_dataset}()}, +\code{\link{[.nmr_dataset_peak_table}()}, \code{\link{filter.nmr_dataset_family}()}, \code{\link{nmr_pca_outliers_filter}()} @@ -38,8 +38,8 @@ Other nmr_dataset_1D functions: \code{\link{nmr_integrate_regions}()}, \code{\link{nmr_meta_add}()}, \code{\link{nmr_meta_export}()}, -\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_meta_get}()}, +\code{\link{nmr_meta_get_column}()}, \code{\link{nmr_ppm_resolution}()}, \code{\link{print.nmr_dataset_1D}()} } diff --git a/man/sub-.nmr_dataset_peak_table.Rd b/man/sub-.nmr_dataset_peak_table.Rd index 12d8e895..b49a6770 100644 --- a/man/sub-.nmr_dataset_peak_table.Rd +++ b/man/sub-.nmr_dataset_peak_table.Rd @@ -31,8 +31,8 @@ new[0] } \seealso{ Other subsetting functions: -\code{\link{[.nmr_dataset_1D}()}, \code{\link{[.nmr_dataset}()}, +\code{\link{[.nmr_dataset_1D}()}, \code{\link{filter.nmr_dataset_family}()}, \code{\link{nmr_pca_outliers_filter}()} } diff --git a/man/to_ASICS.Rd b/man/to_ASICS.Rd new file mode 100644 index 00000000..1fc25f02 --- /dev/null +++ b/man/to_ASICS.Rd @@ -0,0 +1,44 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{to_ASICS} +\alias{to_ASICS} +\title{Export data for the ASICS spectral quantification library} +\usage{ +to_ASICS(dataset, ...) +} +\arguments{ +\item{dataset}{An \link{nmr_dataset_1D} object} + +\item{...}{ + Arguments passed on to \code{\link[ASICS:createSpectra]{ASICS::createSpectra}} + \describe{ + \item{\code{norm.method}}{Character specifying the normalisation method to use on +spectra ONLY if the \code{\link[ASICS]{importSpectra}} function was not used.} + \item{\code{norm.params}}{List containing normalisation parameteres (see +\code{\link[ASICS]{normaliseSpectra}} for details) ONLY if the +\code{\link[ASICS]{importSpectra}} function was not used.} + }} +} +\value{ +An \link[ASICS:Spectra-class]{ASICS::Spectra} object +} +\description{ +Exports the spectra matrix, sample names and chemical shift axis into +an ASICS Spectra object. +} +\examples{ +if (requireNamespace("ASICS", quietly=TRUE)) { + nsamp <- 3 + npoints <- 300 + metadata <- list(external = data.frame( + NMRExperiment = paste0("Sample", seq_len(nsamp)) + )) + dataset <- new_nmr_dataset_1D( + ppm_axis = seq(from = 0.2, to = 10, length.out = npoints), + data_1r = matrix(runif(nsamp * npoints), nrow = nsamp, ncol = npoints), + metadata = metadata + ) + forAsics <- to_ASICS(dataset) + #ASICS::ASICS(forAsics) +} +} diff --git a/man/validate_nmr_dataset.Rd b/man/validate_nmr_dataset.Rd index 4a5ccece..77b760c4 100644 --- a/man/validate_nmr_dataset.Rd +++ b/man/validate_nmr_dataset.Rd @@ -39,32 +39,32 @@ dataset_1D_validated <- validate_nmr_dataset_1D(dataset_1D) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, \code{\link{validate_nmr_dataset_peak_table}()} Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, \code{\link{validate_nmr_dataset_family}()}, \code{\link{validate_nmr_dataset_peak_table}()} } diff --git a/man/validate_nmr_dataset_family.Rd b/man/validate_nmr_dataset_family.Rd index cbca37a2..b1684f77 100644 --- a/man/validate_nmr_dataset_family.Rd +++ b/man/validate_nmr_dataset_family.Rd @@ -25,18 +25,18 @@ validate_nmr_dataset_family(dataset_1D) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, -\code{\link{validate_nmr_dataset_peak_table}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset}()}, +\code{\link{validate_nmr_dataset_peak_table}()} } \concept{class helper functions} diff --git a/man/validate_nmr_dataset_peak_table.Rd b/man/validate_nmr_dataset_peak_table.Rd index a8150558..20bbfced 100644 --- a/man/validate_nmr_dataset_peak_table.Rd +++ b/man/validate_nmr_dataset_peak_table.Rd @@ -25,18 +25,18 @@ pt_validated <- validate_nmr_dataset_peak_table(pt) } \seealso{ Other class helper functions: +\code{\link{format.nmr_dataset}()}, \code{\link{format.nmr_dataset_1D}()}, \code{\link{format.nmr_dataset_peak_table}()}, -\code{\link{format.nmr_dataset}()}, \code{\link{is.nmr_dataset_1D}()}, \code{\link{is.nmr_dataset_peak_table}()}, +\code{\link{new_nmr_dataset}()}, \code{\link{new_nmr_dataset_1D}()}, \code{\link{new_nmr_dataset_peak_table}()}, -\code{\link{new_nmr_dataset}()}, +\code{\link{print.nmr_dataset}()}, \code{\link{print.nmr_dataset_1D}()}, \code{\link{print.nmr_dataset_peak_table}()}, -\code{\link{print.nmr_dataset}()}, -\code{\link{validate_nmr_dataset_family}()}, -\code{\link{validate_nmr_dataset}()} +\code{\link{validate_nmr_dataset}()}, +\code{\link{validate_nmr_dataset_family}()} } \concept{class helper functions} diff --git a/tests/testthat/test-autophase.R b/tests/testthat/test-autophase.R new file mode 100644 index 00000000..0f07d62b --- /dev/null +++ b/tests/testthat/test-autophase.R @@ -0,0 +1,20 @@ +test_that("nmr_dataset_autophase works", { + skip_if_not_installed("NMRphasing") + lorentzian <- function(x, x0, gamma, A) { + A * (1 / (pi * gamma)) * ((gamma^2) / ((x - x0)^2 + gamma^2)) + } + + x <- seq(from=1, to=2, length.out = 300) + y <- lorentzian(x, 1.3, 0.01, 1) + lorentzian(x, 1.6, 0.01, 1) + dataset <- new_nmr_dataset( + metadata = list(external = data.frame(NMRExperiment = "10")), + data_fields = list( + data_1r = list(y) + ), + axis = list(list(x)) + ) + expect_warning( + nmr_autophase(dataset, method="NLS"), + "all_components=TRUE" + ) +}) diff --git a/tests/testthat/test-for_asics.R b/tests/testthat/test-for_asics.R new file mode 100644 index 00000000..23e7d5ce --- /dev/null +++ b/tests/testthat/test-for_asics.R @@ -0,0 +1,16 @@ +test_that("to_ASICS works", { + skip_if_not_installed("ASICS") + # Create a random spectra matrix + nsamp <- 3 + npoints <- 300 + metadata <- list(external = data.frame( + NMRExperiment = paste0("Sample", seq_len(nsamp)) + )) + dummy_nmr_dataset_1D <- new_nmr_dataset_1D( + ppm_axis = seq(from = 0.2, to = 10, length.out = npoints), + data_1r = matrix(runif(nsamp * npoints), nrow = nsamp, ncol = npoints), + metadata = metadata + ) + spec_obj <- to_ASICS(dummy_nmr_dataset_1D) + expect_true(class(spec_obj)[1] == "Spectra") +}) \ No newline at end of file diff --git a/vignettes/Vig01-introduction-to-alpsnmr.Rmd b/vignettes/Vig01-introduction-to-alpsnmr.Rmd index 422f7d16..a3958e82 100644 --- a/vignettes/Vig01-introduction-to-alpsnmr.Rmd +++ b/vignettes/Vig01-introduction-to-alpsnmr.Rmd @@ -49,7 +49,7 @@ that can control the parallellization registering backends. Please check ```{r} #register(SerialParam(), default = TRUE) # disable parallellization -register(SnowParam(workers = 3, exportglobals = FALSE), default = TRUE) # enable parallellization with 3 workers +register(SnowParam(workers = 2, exportglobals = FALSE), default = TRUE) # enable parallellization with 2 workers ``` @@ -143,6 +143,17 @@ If you want to learn more about sample metadata (including acquisition and FID processing parameters), as well as more complex ways of adding annotations, check out the `vignette("Vig02-handling-metadata-and-annotations", package = "AlpsNMR")`. +# Phasing + +It might be the case that automatically reconstructed metabolite NMR spectra have +a first-order phase error. AlpsNMR provides a convenient wrapper function +the `NMRphasing` package, offering a variety of algorithms to estimate +and correct for phase errors, which arise on physical grounds. + +```{r} +#dataset <- nmr_autophase(dataset, method="MPC_DANM") +``` + # Interpolation diff --git a/vignettes/Vig01b-introduction-to-alpsnmr-old-api.Rmd b/vignettes/Vig01b-introduction-to-alpsnmr-old-api.Rmd index f3a2fe2a..03108a7e 100644 --- a/vignettes/Vig01b-introduction-to-alpsnmr-old-api.Rmd +++ b/vignettes/Vig01b-introduction-to-alpsnmr-old-api.Rmd @@ -67,7 +67,7 @@ the `BiocParallel` introduction for further details ```{r} library(BiocParallel) #register(SerialParam(), default = TRUE) # disable parallellization -register(SnowParam(workers = 3, exportglobals = FALSE), default = TRUE) # enable parallellization with 4 workers +register(SnowParam(workers = 2, exportglobals = FALSE), default = TRUE) # enable parallellization with 2 workers ``` @@ -443,7 +443,7 @@ dplyr::bind_rows( After applying any feature selection or machine learning, Alps allows the identification of features of interest through `nmr_identify_regions_blood`. -The function gives 3 posibilities sorted by the most probable metabolite +The function gives 3 possibilities sorted by the most probable metabolite (see `nmr_identify_regions_blood` for details). ```{r}