| read.mzXML & write.mzXML {caMassClass} | R Documentation |
Read and write protein mass spectra data to/from mzXML files.
mzXML = new.mzXML()
mzXML = read.mzXML(filename)
write.mzXML(mzXML, filename, precision=c('32', '64'))
mzXML |
class storing partially parsed mzXML data |
filename |
character string with name of the file (connection) |
precision |
precision to be used in saving scan data. Save double
(floating point) array using 32 or 64 bits? |
The main task of read.mzXML and write.mzXML functions is to
extract and save scan data of mzXML files. In addition attempt is made to keep
all other sections of mzXML file as unparsed XML code, so the data can be
extracted latter or saved into new mzXML files. Those unparsed sections are
stored as XML text
Function read.mzXML returns object of type
mzXML, containing:
scan |
List of Mass Spectra scans. Each element of the list contain the
following elements:
NULL. See mzXML schema and documentation for
more details
|
header |
Stores header of <mzXML> section containing information about namespace and schema file location. |
msInstrument |
General information about the MS instrument. Stored as XML. |
parentFile |
Path to all the ancestor files. Stored as XML. |
dataProcessing |
Description of any data manipulation. Stored as XML. |
separation |
Information about the separation technique. Stored as XML. |
spotting |
Acquisition independent properties of a MALDI experiment. Stored as XML. |
indexOffset |
Offset of the index element. Either 0 or a vector. |
Function new.mzXML returns the same object as read.mzXML but
with all fields equal to NULL.
Function write.mzXML does not return anything.
Jarek Tuszynski (SAIC) jaroslaw.w.tuszynski@saic.com
Definition of mzXML format:
http://tools.proteomecenter.org/mzXMLschema.php
Documentation of mzXML format:
http://sashimi.sourceforge.net/schema_revision/mzXML_2.1/Doc/mzXML_2.1_tutorial.pdf
More Documentation of mzXML format:
http://sashimi.sourceforge.net/software_glossolalia.html
ReadmzXML software http://tools.proteomecenter.org/readmzXML.php
For reading XML files see xmlTreeParse from XML.
Other R function related to mzXML format: xcmsRaw from
xcms BioConductor package.
directory = system.file("Test", package = "caMassClass")
FileName = file.path(directory,"test1.xml")
xml = read.mzXML(FileName)
xml
# test reading/writing
write.mzXML(xml, "temp.xml")
xml2 = read.mzXML("temp.xml")
file.remove("temp.xml")
stopifnot(all(xml$scan[[1]]$peaks == xml2$scan[[1]]$peaks))
stopifnot(xml$msInstrument == xml2$msInstrument)
# extracting scan data from the output
FileName = file.path(directory,"test2.xml")
xml = read.mzXML(FileName)
plot(xml$scan[[1]]$mass, xml$scan[[1]]$peaks, type="l")
# extracting data from unparsed sections
tree = xmlTreeParse(xml$msInstrument, asText=TRUE, asTree=TRUE)
x = xmlRoot(tree)
xmlName(x)
xmlAttrs(x[["msManufacturer"]]) ["value"]
xmlAttrs(x[["software"]])