Learn R Programming

readMzXmlData (version 2.8.3)

readMzXmlDir: Reads recursively mass spectrometry data in mzXML format.

Description

Reads recursively all mass spectrometry data in mzXML format in a specified directory.

Usage

readMzXmlDir(
  mzXmlDir,
  removeCalibrationScans = TRUE,
  removeMetaData = FALSE,
  rewriteNames = TRUE,
  fileExtension = "mzXML",
  verbose = FALSE
)

Value

A list of spectra.

  • [[1]]spectrum$mass: A vector of calculated mass.

  • [[1]]spectrum$intensity: A vector of intensity values.

  • [[1]]metaData: A list of metaData depending on read spectrum.

Arguments

mzXmlDir

character, path to directory which should be read recursively.

removeCalibrationScans

logical, if TRUE all scans in directories called “[Cc]alibration” will be ignored.

removeMetaData

logical, to save memory metadata could be deleted.

rewriteNames

logical, if TRUE all list elements get an unique name from metadata otherwise file path is used.

fileExtension

character, file extension of mzXML formatted files. The directory is only searched for fileExtension files. In most cases it would be “"mzXML"” but sometimes you have to use “xml”.

verbose

logical, verbose output?

Author

Sebastian Gibb mail@sebastiangibb.de

Details

See readMzXmlFile.

See Also

readMzXmlFile, importMzXml

Examples

Run this code

## load library
library("readMzXmlData")

## get examples directory
exampleDirectory <- system.file("Examples", package="readMzXmlData")

## read example spectra
spec <- readMzXmlDir(exampleDirectory)

## plot spectra
plot(spec[[1]]$spectrum$mass, spec[[1]]$spectrum$intensity, type="n")

l <- length(spec)
legendStr <- character(l)
for (i in seq(along=spec)) {
  lines(spec[[i]]$spectrum$mass, spec[[i]]$spectrum$intensity, type="l",
        col=rainbow(l)[i])
  legendStr[i] <- basename(spec[[i]]$metaData$file)
}

## draw legend
legend(x="topright", legend=legendStr, col=rainbow(l), lwd=1)

Run the code above in your browser using DataLab