msimat: Read mass spectrometry imaging data

Description Usage Arguments Details Value Examples

View source: R/msimat.R

Description

Import mass spectrometry imaging data in either CSV or triplet format. CSV file is for example exported from MSiReader using the Intensity export function or from other software. For CSV file, column headers should be ion masses, and table values should be all numeric or there will be an error.

Usage

1
2
3
4
5
6
msimat(csv = NULL, sep = ",", rows = NULL, cols = NULL,
  vals = NULL, peaks = NULL, spots = NULL, remove.zeroes = TRUE,
  header = TRUE, check.names = FALSE, row.names = 1,
  reformat.large.csv = NULL, crlf = FALSE,
  script.path = system.file("msimunging.pl", package = "mass2adduct"),
  ...)

Arguments

csv

filename; CSV-formatted table of intensities arranged by peak masses (columns, with column headers) and pixel spots (rows, with row names)

sep

character; column separator in CSV file (default: ",")

rows

filename; File of row numbers, 0-based (see note on triplet representation above), one per line

cols

filename; File of column numbers, 0-based, one per line

vals

filename; File of intensity values, one per line

peaks

filename; File of peak mass values, one per line. Order in list should correspond to the column numbers given to argument cols

spots

filename; File of pixel spot names, one per line. Order in list should correspond to the row numbers given to argument rows

remove.zeroes

logical; remove columns where all values are zero? (default: TRUE)

header

logical; (default: TRUE)

check.names

logical; (default: FALSE)

row.names

numeric; column in import table specifying row names (default: 1)

reformat.large.csv

filename prefix; If this is not null, then the CSV file specified to option csv will be converted to triplet format and imported as a sparse matrix. The character string passed to this option will be used as a filename prefix for the output files. This option can be used if the CSV file is too large to be imported as-is, and the majority of data in the matrix are zeroes. If not (a "dense" matrix), then the data may need to be reduced before import, e.g. by sampling a subset of the pixels, or using a more stringent filtering cutoff for the peaks.

crlf

logical; Whether input CSV file uses CRLF line endings (Windows/ DOS format).

script.path

Path to msimunging.pl script, if reformat.large.csv is not NULL. By default looks in the installation path for the package

...

Parameters to be passed to read.csv()

Details

Alternatively the data can be in triplet form, with separate lists of row, column, and intensity values. Two additional lists hold the peak mass values and the pixel spot names. This is useful for importing very large but sparse data matrices. If a filename is specified to option csv, then options row, cols, vals, peaks, and spots are ignored.

It is also possible to convert a CSV file into triplet form before import, by calling the Perl script msimunging.pl, included in the package source, either outside of R, or during the import (see description of parameter reformat.large.csv below). The conversion may take a long time, and hence it may be more practical to convert large CSV files first before interactive data analysis.

Value

Object of class msimat

Examples

1
2
3
d <- msimat(csv=system.file("extdata","msi.csv",package="mass2adduct"),sep=";")
print(d) # Summary of contents
plot(d) # Mass spectrum of total intensity per peak

kbseah/mass2adduct documentation built on June 9, 2021, 9:20 p.m.