ReadMspDirectory {OrgMassSpecR}R Documentation

Read in MSP Formatted Mass Spectra

Description

Reads in all .msp files within a directory and makes a single concatenated data frame of m/z values and intensities.

Usage

ReadMspDirectory(directory, skip = 2, comment.char = "", 
                 remove.placeholders = TRUE)

Arguments

directory

character string. The path to the directory containing the .msp files. Can be “./” for the current directory on unix-like systems.

skip

integer. The number of lines at the top of the input file to skip before reading. Passed internally to read.table.

comment.char

a character vector of length one containing a single character or an empty string. Use "" to turn off the interpretation of comments altogether. Passed internally to read.table.

remove.placeholders

TRUE or FALSE specifying if zero intensity peaks in the MSP file should be removed from the resulting data frame.

Details

MSP is a National Institute of Standards and Technology (NIST) text format for centroid spectra. This format is exported by some instrument software.

The spectral files do not need to have the extension .msp. But an attempt will be made to process all files in the directory, regardless of the extension. The presense of other file types may cause errors.

ReadMspDirectory is a wrapper for ReadMspFile.

Value

A data frame with the following column names:

mz

the centroid m/z values.

intensity

the respective intensities.

filename

the corresponding filename (used to identify the spectra within the data frame).

Author(s)

Nathan G. Dodder

See Also

ReadMspFile

Examples

## The package directory msp contains two .msp files 
ReadMspDirectory(paste(system.file(package = "OrgMassSpecR"), 
  "/extdata/msp", sep = ""))

[Package OrgMassSpecR version 0.5-3 Index]