Version: 2.8.3
Date: 2023-08-19
Title: Reads Mass Spectrometry Data in mzXML Format
Depends: R (≥ 4.2.0)
Imports: base64enc, digest, XML
Description: Functions for reading mass spectrometry data in mzXML format.
License: GPL (≥ 3)
URL: https://strimmerlab.github.io/software/maldiquant/ https://github.com/sgibb/readMzXmlData/
BugReports: https://github.com/sgibb/readMzXmlData/issues/
LazyLoad: yes
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2023-08-19 14:27:37 UTC; sebastian
Author: Sebastian Gibb [aut, cre]
Maintainer: Sebastian Gibb <mail@sebastiangibb.de>
Repository: CRAN
Date/Publication: 2023-08-19 14:50:02 UTC

The readMzXmlData Package

Description

The package reads mass spectrometry data in mzXML format.

Details

Main functions:

readMzXmlFile: Reads mass spectrometry data in mzXML format.

readMzXmlDir: Reads recursively mass spectrometry data in mzXML format in a specific directory.

mqReadMzXml: Reads mass spectrometry data into MALDIquant.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

References

See website: https://strimmerlab.github.io/software/maldiquant/

See Also

readMzXmlDir, readMzXmlFile


Converts XML attributes.

Description

This function converts a XML time attribute to double.

Usage

.attributeTimeToDouble(attributes, attributeName, required = FALSE)

Arguments

attributes

character, XML attributes

attributeName

character, name XML attributes of attribute to convert

required

logical, throw an error if an required attribute is missing.

Value

double

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

.attributeToString, .attributeToDouble


Converts XML attributes.

Description

This function converts a XML attribute to double.

Usage

.attributeToDouble(attributes, attributeName, required = FALSE)

Arguments

attributes

character, XML attributes

attributeName

character, name XML attributes of attribute to convert

required

logical, throw an error if an required attribute is missing.

Value

double

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

.attributeToString, .attributeTimeToDouble


Converts XML attributes.

Description

This function converts a XML attribute to character.

Usage

.attributeToString(attributes, attributeName, required = FALSE)

Arguments

attributes

character, XML attributes

attributeName

character, name XML attributes of attribute to convert

required

logical, throw an error if an required attribute is missing.

Value

character, attribute string

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

.attributeToDouble, .attributeTimeToDouble


Converts base64 character to double.

Description

This function converts a base64 encoded character vector to a double vector.

Usage

.base64decode(
  x,
  size,
  endian = .Platform$endian,
  compressionType = c("none", "gzip")
)

Arguments

x

character, base64 encoded string.

size

integer, number of bytes per element in the byte stream (see size in readBin).

endian

character, the endian-ness (see endian in readBin).

compressionType

character, type of compression to use for decompression of x (see type in memDecompress.

Value

Vector of type double.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

base64decode from base64enc package


Pattern matching.

Description

This function returns double values found in a character.

Usage

.grepDouble(x)

Arguments

x

character, text

Value

double, matched value

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

.grepNumber .grepSubString


Pattern matching.

Description

This function returns numeric values found in a character.

Usage

.grepNumber(x)

Arguments

x

character, text

Value

numeric, matched value

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

.grepDouble .grepSubString


Pattern matching.

Description

This function returns a substring selected by a regular expression.

Usage

.grepSubString(pattern, x)

Arguments

pattern

character, regexp pattern

x

character, text

Value

character, matched substring

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

.grepNumber


Parse mzXML files.

Description

This function is defines handlers for XML SAX parser. Internal use only.

Usage

.mzXmlHandlers(fileName, verbose = FALSE)

Arguments

fileName

character, path to mzXML file

verbose

logical, verbose output?

Value

function closure

Author(s)

Sebastian Gibb mail@sebastiangibb.de

References

Definition of mzXML format: http://tools.proteomecenter.org/wiki/index.php?title=Formats:mzXML


Parse mzXML files.

Description

This function parses mzXML files.

Usage

.parseMzXml(file, verbose = FALSE, ...)

Arguments

file

character, path to mzXML file

verbose

logical, verbose output?

Value

Returns a list with metadata and spectra.

Author(s)

Sebastian Gibb mail@sebastiangibb.de


Reads mass spectrometry data in mzXML format.

Description

Internal function.

Usage

.readMzXmlFile(mzXmlFile, removeMetaData = FALSE, verbose = FALSE)

Arguments

mzXmlFile

character, path to mzXML file which should be read.

removeMetaData

logical, to save memory metadata could be deleted.

verbose

logical, verbose output?

Value

A list of spectra and metadata.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

readMzXmlFile


Pattern matching.

Description

This function looks for the last match to argument pattern in a file file.

Usage

.revfregexpr(pattern, file)

Arguments

pattern

character, string containing a regular expression.

file

character, file path.

Value

double, position of match.

Author(s)

Sebastian Gibb mail@sebastiangibb.de


Removed functions in package readMzXmlData

Description

These functions are defunct and no longer available.

Details

mqReadMzXml:

use importMzXml instead.


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
)

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?

Details

See readMzXmlFile.

Value

A list of spectra.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

readMzXmlFile, importMzXml

Examples


## 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)


Reads mass spectrometry data in mzXML format.

Description

Reads mass spectrometry data in mzXML format defined in http://tools.proteomecenter.org/wiki/index.php?title=Formats:mzXML

Usage

readMzXmlFile(mzXmlFile, removeMetaData = FALSE, verbose = FALSE)

Arguments

mzXmlFile

character, path to mzXML file which should be read.

removeMetaData

logical, to save memory metadata could be deleted.

verbose

logical, verbose output?

Value

A list of spectra and metadata.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

References

Definition of mzXML format: http://tools.proteomecenter.org/wiki/index.php?title=Formats:mzXML

See Also

readMzXmlDir, importMzXml

Examples


## load library
library("readMzXmlData")

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

## read example spectrum
spec <- readMzXmlFile(file.path(exampleDirectory, "A1-0_A1.mzXML"))

## print metaData
print(spec$metaData)

## plot spectrum
plot(spec$spectrum$mass, spec$spectrum$intensity, type="l")

mirror server hosted at Truenetwork, Russian Federation.