Raw MS data can be represented visually using the following steps:
- Load the libraries:
library(mzR)
library(MSnbase)
- Load the files into objects:
mzxml_file <- file.path(getwd(), "datasets", "ch6", "threonine_i2_e35_pH_tree.mzXML") ms1 <- openMSfile(mzxml_file)
mzdata_file <- file.path(getwd(), "datasets", "ch6", "HAM004_641fE_14-11-07--Exp1.extracted.mzdata") ms2 <- openMSfile(mzdata_file)
mzml_file <- file.path(getwd(), "datasets", "ch6", "MM8.mzML") ms3 <- openMSfile(mzml_file)
- View the metadata where available:
runInfo(ms3)
## $scanCount ## [1] 198 ## ## $lowMz ## [1] 95.51765 ## ## $highMz ## [1] 1005.043 ## ## $dStartTime ## [1] 0.486 ## ## $dEndTime ## [1] 66.7818 ## ## $msLevels ## [1] 1 ## ## $startTimeStamp ## [1] "2008-09-01T09:48:37.296+01:00"
sampleInfo(ms1)
## [1] ""
- Plot the spectra:
msn_exp <- MSnbase::readMSData(mzxml_file) MSnbase::plot(msn_exp, full = TRUE)
MSnbase::plot(msn_exp[5], full = TRUE)