Learn R Programming

MALDIquantForeign (version 0.3)

import: Import files

Description

This function provides a general interface to import different file formats into MassSpectrum-class objects.

Usage

import(path, type = "auto", pattern, verbose = FALSE,
    ...)

Arguments

path
character, path to directory or file which should be read in.
type
character, file format. If type is set to auto MALDIquant tries to detect the correct file type automatically. It often depends on the file extension (if path is a directory the most represen
pattern
character, a regular expression to find files in a directory (see details).
verbose
logical, verbose output?
...
arguments to be passed to specific import functions.

Value

Details

Specific import functions: ll{ txt importTxt tab importTab csv importCsv fid importBrukerFlex ciphergen importCiphergenXml mzXML importMzXml mzML importMzMl }

path: In addition to the above mentioned file types the following (compressed) archives are supported, too: zip, tar, tar.gz, tar.bz2, tar.xz. The archives are uncompressed in a temporary directory. Afterwards the import function is called (with type="auto").

pattern: Sometimes unusual file extensions are used (e.g. "*.xml" for mzXML files). In this case a specific pattern could be defined to import files with an unusual file extension (e.g. pattern="^.*\.xml$" to read all *.xml files in a directory; see regexp for details).

References

http://strimmerlab.org/software/maldiquant/

See Also

MassSpectrum-class

Examples

Run this code
library("MALDIquant")
library("MALDIquantForeign")

## get example directory
exampleDirectory <- system.file(file.path("tests", "data"),
                                package="MALDIquantForeign")

## import mzXML files
s <- import(exampleDirectory, type="mzXML")

## import tab delimited file with different file extension (default: *.tab)
s <- import(exampleDirectory, type="tab", pattern="^.*\\.txt")

## import single mzML file
s <- import(file.path(exampleDirectory, "tiny1.mzML1.1.mzML"))

## import gzipped csv file
s <- import(file.path(exampleDirectory, "compressed", "csv1.csv.gz"))

Run the code above in your browser using DataLab