msImport {msProcess} | R Documentation |
Imports data from (multiple) mass spectrum file(s) and compiles them
into an object of msList
, i.e., a list of two-column matrices.
msImport(path, label="unclassified", type="ASCII", pattern="", ...)
path |
A single character string or a vector of character strings. Each character string can either be a path to the directory containing the mass spectra files (i.e., directory path) or a path to a mass spectra file (i.e., file path). In the case of a vector of character strings, the paths should be either all directory paths or all file paths. |
... |
Additional arguments. See importData for details. |
label |
A single character string or a vector of character strings
defining the classification label(s) for the spectra to be imported.
The length of label must be equal to the number of elements
in the path argument.
The labels will be used in mass spectra classification but not in processing.
Default: "unclassified" . |
pattern |
A character string denoting the pattern to use in filtering the list
of files in the path directory.
Default: "" (all files in path ). |
type |
A single character string or a vector of character strings
specifying the input data file type(s).
The length of type must be equal to the number of
elements in the path variable,
otherwise the first entry is replicated accordingly. This
argument may be any of the supported types in the
importData function or type "CiphergenXML" ,
which represents a Ciphergen XML mass spectrometry data file.
Default: "ASCII" . |
Each data file has two columns defined by m/z
and intensity
values.
This function also checks if the following conditions hold:
and issues warning messages if not.
An object of msList
, which is a list of two-column matrices, one matrix for each imported file.
The first column is named "mz"
and contains m/z values.
The second column is named "intensity"
and contains the intensity values.
The list has an attribute named "type"
, which is a factor and
contains the classification labels for the imported spectra.
importData
, msImportCiphergenXML
.
## create faux MS data files n.file <- 10 files <- file.path(getwd(), paste("ms", seq(n.file), ".csv", sep="")) for (i in seq(n.file)) { ms <- data.frame("m/z"=(1:5), intensity=(6:10)+i) if (is.R()) write.table(ms, file=files[i]) else write.table(ms, file=files[i], dimnames="colnames") } ## load the mass spectra files into a list of ## two-column matrices msImport(path=files) ## do the same except use the path and pattern ## arguments msImport(path=getwd(), pattern=".csv" ) ## remove the files unlink(files)