msc.peaks.read.mzXML & msc.peaks.write.mzXML {caMassClass}R Documentation

Read / write calculated peaks heights and positions to/from mzXML Files

Description

Functions to read and write mzXML files containing peaks stored in the format used by peak finding functions.

Usage

msc.peaks.write.mzXML(scans, filename, mzXML=NULL, ...)
msc.peaks.read.mzXML(filename, wipe=TRUE)

Arguments

scans Peak information to be stored in mzXML file. A data-frame in the similar to format as returned by msc.peaks.find, containing four components:
  • Spectrum. - sample number of each peak (the same for all peaks from the same sample)
  • Peak. - peak number within each sample
  • Intensity - peak height (intensity)
  • Substance.Mass - x-axis position, or corresponding mass of the peak measured in M/Z
filename character string with name of the file.
mzXML class storing partially parsed mzXML data
wipe Should all scans that were returned be also deleted (wiped) from mzXML record? Set to TRUE by default to minimize memory use.
... additional parameters to be passed to write.mzXML function (precision)

Details

Functions read.mzXML and write.mzXML use very general data type to communicate with mzXML files. Functions msc.rawMS.read.mzXML and msc.rawMS.write.mzXML allow passing information using data format specialized for storing peak data.

Value

Function msc.peaks.read.mzXML returns data in the same format as msc.peaks.write.mzXML input parameter scans. In addition, object of type mzXML is attached as "mzXML" attribute. See read.mzXML for details.
Functions msc.peaks.write.mzXML do not return anything.

Author(s)

Jarek Tuszynski (SAIC) jaroslaw.w.tuszynski@saic.com

See Also

Examples

  # load "Data_IMAC.Rdata" file containing raw MS spectra 'X'  
  directory  = system.file("Test", package = "caMassClass")
  X = msc.rawMS.read.csv(directory, "IMAC_.*csv", mzXML.record=TRUE) 

  # Find Peaks and save them
  Peaks = msc.peaks.find(X) # create peak data
  msc.peaks.write.mzXML(Peaks, "peaks.mzXML", mzXML=attr(X,"mzXML"), 
                        precision='64')
  Output = msc.peaks.read.mzXML("peaks.mzXML")
  stopifnot(Output$Substance.Mass == Peaks$Substance.Mass,
            Output$Intensity      == Peaks$Intensity, 
            Output$Spectrum.      == Peaks$Spectrum., 
            Output$Peak.          == Peaks$Peak.)
  mzXML = attr(Output,"mzXML")
  strsplit(mzXML$parentFile, '\n')      # show mzXML$parentFile record
  # Suggestion: inspect 'peaks.mzXML' using any text editor          
  file.remove("peaks.mzXML")

[Package caMassClass version 1.6 Index]