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

Read and Write Mass Spectra Peaks in CSV Format

Description

Functions to read and write CSV (comma separated values) text files containing peaks in the format used by Ciphergen's peak file.

Usage

  X = msc.peaks.read.csv(fname, mzXML.record=FALSE)
  msc.peaks.write.csv(X, fname)

Arguments

X Peak information. A data-frame in the same format as returned by msc.peaks.find, containing five components:
  • Spectrum.Tag - sample name of each peak
  • Spectrum. - sample number of each peak
  • 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
fname either a character string naming a file or a connection.
mzXML.record should mzXML record be created to store mata-data (input file names)?

Value

Function msc.peaks.read.csv returns peak information data frame. See argument X above. If mzXML.record was set to true than mzXML record with input file names will be attached to X as "mzXML" attribute.
Function msc.peaks.write.csv does not return anything.

Author(s)

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

See Also

msc.peaks.find and msc.peaks.align

Examples

  # load "Data_IMAC.Rdata" file containing raw MS spectra 'X'  
  if (!file.exists("Data_IMAC.Rdata")) example("msc.project.read")
  load("Data_IMAC.Rdata")

  # Find Peaks and save them
  Peaks = msc.peaks.find(X) # create peak data
  msc.peaks.write.csv(Peaks, "peaks.csv")
  Pks = msc.peaks.read.csv("peaks.csv", mzXML.record=TRUE)
  stopifnot(Pks==Peaks)
  mzXML = attr(Pks,"mzXML")
  strsplit(mzXML$parentFile, '\n')      # show mzXML$parentFile record
  # Suggestion: inspect 'peaks.csv' using any text editor          
  file.remove("peaks.csv")

[Package caMassClass version 1.6 Index]