Mass Spectrometryデータの読み書き

基本的なところから調べねば ...





mzRを使用した例:

## Open a MS file and read the spectrum and header information
library(msdata)
fl <- system.file("threonine", "threonine_i2_e35_pH_tree.mzXML", package = "msdata")
ms_fl <- openMSfile(fl, backend = "pwiz")
## Get the spectra
pks <- spectra(ms_fl) # See how pks looks like
## Get the header
hdr <- header(ms_fl) # See how hdr looks like
## Modify the spectrum data adding 100 to each intensity.
pks <- lapply(pks, function(z) {
   z[, 2] <- z[, 2] + 100
   z
})
## Write the data to a mzML file.
out_file <- tempfile()
writeMSData(object = pks, file = out_file, header = hdr)
# object: list containing for each spectrum one matrix with columns mz (first column)
# and intensity (second column).