Description Usage Arguments Details Value See Also Examples
Imports data from (multiple) mass spectrum file(s) and compiles them
into an object of msList
, i.e., a list of two-column matrices.
1 2 |
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 |
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 |
pattern |
A character string denoting the pattern to use in filtering the list
of files in the |
type |
A single character string or a vector of character strings
specifying the input data file type(s).
The length of |
Each data file has two columns defined by m/z
and intensity
values.
This function also checks if the following conditions hold:
the m/z values are distinct;
the m/z values are positive;
the m/z values are the same across spectra;
the lengths of each spectra are the same.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.