Author: Torben Kimhofer
Date: 2026-05-05

# nmrdata: 1D Proton NMR Data

Torben Kimhofer

#### 5 May 2026

#### Package

nmrdata 1.2.0

# 1 Overview

The nmrdata package provides example one-dimensional proton NMR spectra of murine urine samples collected in a Roux-en-Y gastric bypass study (Li et al. 2011).

Data resources are hosted on Bioconductor’s ExperimentHub (EH) and retrieved on demand; this vignette describes data resources and illustrates retrieval.

Two resources are available:

- a pre-processed dataset for quick example analyses (`EH9905`)
- raw Bruker experiment folders for I/O demonstrations (`EH9906`);

These resources are intended for teaching and for demonstrating the companion package `metabom8`.

    # checking metadata
    meta_path <- system.file("extdata", "metadata.csv", package = "nmrdata")
    if (file.exists(meta_path)) {
      meta <- utils::read.csv(meta_path)
      head(meta[c("Title","RDataPath")])
    }

    ##                             Title                                RDataPath
    ## 1         Bariatric pre-processed   records/17053134/files/bariatric.rdata
    ## 2 Raw Bruker experiments (tar.gz) records/17053118/files/bruker_exp.tar.gz

# 2 Resource Description

- Data were acquired on a Bruker Avance III 600 MHz spectrometer
- Bariatric pre-processed (EH9905)
  - 1D NMR spectra acquired from rat urine specimens (n=67)
  - Baseline corrected, res. water signal excised, dilution normalised (probabilistic quotient normalisation)
  - Provided as named list with elements:
    - `X.pqn`: matrix of PQN-processed spectra
    - `ppm`: chemical shift axis (parts per million)
    - `an`: sample annotation (e.g., class membership)
    - `meta`: acquisition/processing status parameters (TopSpin; `a_*`, `p_*`)
- Raw Bruker experiments (EH9906)
  - Minimal file set of raw Bruker proton NMR experiments (n=21)
  - Retain original files in Bruker directory structure (fid, acqus/procs, 1i/1r)
  - Accessed via `getRawExpDir()`; unpacked into the local EH cache on first use
  - Intended for I/O workflow demos (e.g., with the companion package metabom8)

# 3 Installation

    # Install from Bioconductor
    # if (!require("BiocManager")) install.packages("BiocManager")
    # BiocManager::install("nmrdata")

# 4 Resource discovery via ExperimentHub

    library(ExperimentHub)

    eh <- ExperimentHub()
    query(eh, "nmrdata")

    ## ExperimentHub with 2 records
    ## # snapshotDate(): 2026-04-23
    ## # $dataprovider: Imperial College London
    ## # $species: Rattus norvegicus
    ## # $rdataclass: list, character
    ## # additional mcols(): taxonomyid, genome, description,
    ## #   coordinate_1_based, maintainer, rdatadateadded, preparerclass, tags,
    ## #   rdatapath, sourceurl, sourcetype
    ## # retrieve records with, e.g., 'object[["EH9905"]]'
    ##
    ##            title
    ##   EH9905 | Bariatric pre-processed
    ##   EH9906 | Raw Bruker experiments (tar.gz)

# 5 Importing Bariatric pre-processed data

    hub_id = 'EH9905' # Bariatric pre-processed

    bariatric <- eh[[hub_id]]
    str(bariatric, max.level = 1)

    ## List of 4
    ##  $ X.pqn: num [1:67, 1:56357] 4422 10654 7028 3707 3232 ...
    ##   ..- attr(*, "dimnames")=List of 2
    ##  $ ppm  : num [1:56357] 9.5 9.5 9.5 9.5 9.5 ...
    ##  $ an   :'data.frame':   67 obs. of  4 variables:
    ##  $ meta :'data.frame':   67 obs. of  417 variables:

    # visualise the first NMR spectrum
    plot(bariatric$ppm, bariatric$X.pqn[1, ], type = "l",
         xlab = "Chemical shift (ppm)", ylab = "Intensity")

    # an: sample annotation data (row-matched to `X.pqn`)
    head(bariatric$an)

    ##   ID  Class Timepoint NMR experiment
    ## 1 21 Pre-op       Pre            301
    ## 2 27 Pre-op       Pre            302
    ## 5 20   RYGB        W2            305
    ## 6 34   RYGB        W2            306
    ## 7 36 Pre-op       Pre            307
    ## 9 33 Pre-op       Pre            309

    stopifnot(nrow(bariatric$an)==nrow(bariatric$X.pqn))

    # meta: TopSpin acquisition and processing parameters (row-matched to `X.pqn`)
    head(colnames(bariatric$meta), 10)

    ##  [1] "a_AQSEQ"   "a_AQ_mod"  "a_AUNM"    "a_AUTOPOS" "a_BF1"     "a_BF2"
    ##  [7] "a_BF3"     "a_BF4"     "a_BF5"     "a_BF6"

    stopifnot(nrow(bariatric$meta)==nrow(bariatric$X.pqn))

    # Ex Parameters:
    meta = bariatric$meta

    meta$a_SFO1[1] # carrier frequency

    ## [1] 600.2928

    meta$a_NS[1] # number of scans

    ## [1] 128

    meta$a_OVERFLW[1] # overflow

    ## [1] 0

    meta$p_SI[1] # nb of points in spectrum (zero filled)

    ## [1] 32768

    meta$p_LB[1] # line broadening factor

    ## [1] 0.3

# 6 Importing raw Bruker experiments

    library(nmrdata)

    # download once, unpack once; returns the directory path
    exp_dir <- getRawExpDir(quiet = TRUE)

    # show experiment folder content
    list.files(exp_dir, recursive = TRUE)[1:10]

    ##  [1] "bruker_exp/1/acqu"          "bruker_exp/1/acqus"
    ##  [3] "bruker_exp/1/fid"           "bruker_exp/1/pdata/1/1i"
    ##  [5] "bruker_exp/1/pdata/1/1r"    "bruker_exp/1/pdata/1/proc"
    ##  [7] "bruker_exp/1/pdata/1/procs" "bruker_exp/101/acqu"
    ##  [9] "bruker_exp/101/acqus"       "bruker_exp/101/fid"

If you have `metabom8` installed, you can import/process the raw experiments:

    library(metabom8)

    # import Bruker 1D NMR spectra
    res <- read1d_proc(exp_dir, exp_type = list(pulprog = "noesypr1d"))

    # plot first spectrum
    spec(res$X[1, ], res$ppm)

# 7 Caching and reproducibility

Data are cached under a per-user directory so repeated calls don’t re-download:

    # where the archive and unpacked folder live
    dir <- getRawExpDir(quiet = TRUE)
    print(dir)

    ## [1] "/home/biocbuild/.cache/R/ExperimentHub/bruker_exp"

# 8 Package version

    packageVersion("nmrdata")

    ## [1] '1.2.0'

# 9 Session info

    sessionInfo()

    ## R version 4.6.0 RC (2026-04-17 r89917)
    ## Platform: x86_64-pc-linux-gnu
    ## Running under: Ubuntu 24.04.4 LTS
    ##
    ## Matrix products: default
    ## BLAS:   /home/biocbuild/bbs-3.23-bioc/R/lib/libRblas.so
    ## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0
    ##
    ## locale:
    ##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    ##  [3] LC_TIME=en_GB              LC_COLLATE=C
    ##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    ##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
    ##
    ## time zone: America/New_York
    ## tzcode source: system (glibc)
    ##
    ## attached base packages:
    ## [1] stats     graphics  grDevices utils     datasets  methods   base
    ##
    ## other attached packages:
    ## [1] nmrdata_1.2.0       ExperimentHub_3.2.0 AnnotationHub_4.2.0
    ## [4] BiocFileCache_3.2.0 dbplyr_2.5.2        BiocGenerics_0.58.0
    ## [7] generics_0.1.4      BiocStyle_2.40.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] rappdirs_0.3.4       sass_0.4.10          BiocVersion_3.23.1
    ##  [4] RSQLite_2.4.6        digest_0.6.39        magrittr_2.0.5
    ##  [7] evaluate_1.0.5       bookdown_0.46        fastmap_1.2.0
    ## [10] blob_1.3.0           jsonlite_2.0.0       AnnotationDbi_1.74.0
    ## [13] DBI_1.3.0            tinytex_0.59         BiocManager_1.30.27
    ## [16] httr_1.4.8           purrr_1.2.2          Biostrings_2.80.0
    ## [19] httr2_1.2.2          jquerylib_0.1.4      cli_3.6.6
    ## [22] crayon_1.5.3         rlang_1.2.0          XVector_0.52.0
    ## [25] Biobase_2.72.0       bit64_4.8.0          withr_3.0.2
    ## [28] cachem_1.1.0         yaml_2.3.12          otel_0.2.0
    ## [31] tools_4.6.0          memoise_2.0.1        dplyr_1.2.1
    ## [34] filelock_1.0.3       curl_7.1.0           vctrs_0.7.3
    ## [37] R6_2.6.1             png_0.1-9            magick_2.9.1
    ## [40] stats4_4.6.0         lifecycle_1.0.5      Seqinfo_1.2.0
    ## [43] KEGGREST_1.52.0      S4Vectors_0.50.0     IRanges_2.46.0
    ## [46] bit_4.6.0            pkgconfig_2.0.3      pillar_1.11.1
    ## [49] bslib_0.10.0         Rcpp_1.1.1-1.1       glue_1.8.1
    ## [52] xfun_0.57            tibble_3.3.1         tidyselect_1.2.1
    ## [55] knitr_1.51           htmltools_0.5.9      rmarkdown_2.31
    ## [58] compiler_4.6.0

Li, Jia V, Hutan Ashrafian, Marco Bueter, James Kinross, Charles Sands, Carel W le Roux, Stephen R Bloom, et al. 2011. “Metabolic Surgery Profoundly Influences Gut Microbial-Host Metabolic Cross-Talk.” Gut 60 (9): 1214–23.