read.mzData | R Documentation |
read.mzData
will import mzData as xcmsRaw-class objects.
read.mzData(filename, fmt = c("xcmsRaw", "xcmsRawLike"), verbose = FALSE)
filename |
A path to a mzData file (as exported by 'xcms::write.mzdata()'). |
fmt |
Output format. Currently 'xcmsRaw' and 'xcmsRawLike' are supported. The latter is an S4 class similar to xcmsRaw but allowing to omit the xcms package. |
verbose |
Print messages to console. |
The main task of read.mzData functions is to import mzData files to R. Currently 'xcmsRaw' is supported as an output format. I created this function for legacy reasons as the mzData import is no longer supported by 'mzR' and consequently 'xcms' since 09/2021. This is a quick and dirty implementation. It will work only for mslevel=1 and a fixed set of base64 encoding parameters (size = 4, endian = "big"). However, feel free to send me an e-mail if you are interested in using the function but cant get it working.
A generic R object of class xcmsRaw.
## Not run:
data(mzXML_data)
write.mzXML(mzXML = mzXML_data, filename = "test.mzXML")
x <- xcms::xcmsRaw("test.mzXML", profstep=0)
xcms::write.mzdata(x, file="test.mzData")
x2 <- read.mzData(filename = "test.mzData")
identical(str(x), str(x2))
identical(x@env$intensity, x2@env$intensity)
identical(x@env$mz, x2@env$mz)
identical(x@scanindex, x2@scanindex)
file.remove(c('test.mzData', 'test.mzXML'))
# check that objects are independent (not identical)
identical(methods::new("xcmsRawLike"), methods::new("xcmsRawLike"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.