Steffen Neumann (sneumannipb-halle.de),
Luis Filipe de Figueiredo (Luis.deFigueiredo
ebi.ac.uk)
Jie Hao (j.hao“imperial.ac.uk)
The nmRIO package aims at providing a common interface to several NMR data formats.
Cool R packages for NMR processing are e.g. cite(Lewis09rNMRopensource) and cite(Hao12BATMANRpackage)
A short example sequence to read data from a mass spectrometer. First open the file.
library(nmRIO)
## Loading required package: XML
## Loading required package: caTools
nmrMLfile <- system.file("examples/HMDB00005.nmrML", package = "nmRIO")
fid <- readNMRMLFID(nmrMLfile)
plot(Re(fid), type="l")
Luis: I also need to access the following parameters: spectral width (ideally in ppm but can work out the one in Hz) transmitter frequency. Later, for bruker files I also need the following data group delay, dsp firmware version
tree <- xmlTreeParse(nmrMLfile)
root <- xmlRoot(tree)
## Get required parameters from nmrML
irradiationFrequency <- as.double(xmlAttrs(xmlElementsByTagName(root, "irradiationFrequency", recursive = TRUE)[[1]])["value"])
sweepWidth <- as.double(xmlAttrs(xmlElementsByTagName(root, "sweepWidth", recursive = TRUE)[[1]])["value"])
numberOfDataPoints <- as.integer(xmlAttrs(xmlElementsByTagName(root, "DirectDimensionParameterSet", recursive = TRUE)[[1]])["numberOfDataPoints"])
irradiationFrequency
## [1] 599.4
sweepWidth
## [1] 7200
numberOfDataPoints
## [1] 57804
spectrum <- Re(fft(fid, inverse=TRUE))
The rudimentary processing results in:
plot(spectrum, type="l")
## Mockup to write the spectrum back into the nmrML
## as "processed data"
#b64string <- nmRIO:::binaryArrayEncode(spectrum, byteFormat="complex64", compression="gzip")
A lot.
## R version 3.1.1 (2014-07-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=de_DE.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=de_DE.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] nmRIO_0.3 caTools_1.17 XML_3.98-1.1 knitr_1.6
##
## loaded via a namespace (and not attached):
## [1] bitops_1.0-6 evaluate_0.5.5 formatR_0.10 stringr_0.6.2
## [5] tools_3.1.1