writeMetadata {MALDIrppa}R Documentation

Write metadata in different formats

Description

This function is simply a wrapper to write the metadata associated with a collection of mass spectra into a file in either the R or csv format.

Usage

writeMetadata(x, filename = "Metadata", format = c("R", "csv"), ...)

Arguments

x

Metadata in any sensible data format, preferably matrix or data.frame.

filename

A character string specifying a name for the destination file (filename extension not required).

format

One of R (default .RData file) or text (comma-separated .csv file).

...

Other arguments.

Details

It uses either save or write.table to store the metadata. Check these functions for adequate data formats.

Value

No return value, file in selected format created on destination folder.

Examples

# Load example data

data(spectra) # list of MassSpectra class objects
data(type)    # metadata

# Some pre-processing

sc.spectra <- screenSpectra(spectra, meta = type)

spectra <- sc.spectra$fspectra # filtered spectra
type <- sc.spectra$fmeta # filtered metadata

spectra <- transformIntensity(spectra, method = "sqrt")
spectra <- wavSmoothing(spectra)
spectra <- removeBaseline(spectra)
peaks <- detectPeaks(spectra)
peaks <- alignPeaks(peaks, minFreq = 0.8)

# Intensity matrix

int <- intensityMatrix(peaks)

# Save resulting data in R format (to a temporary location as an example)

writeIntensity(int, filename = file.path(tempdir(),"MyintMatrix"))
writeMetadata(type, filename = file.path(tempdir(),"MyMetadata"))

# Save resulting data in csv format (to a temporary location as an example)

writeIntensity(int, filename = file.path(tempdir(),"MyintMatrix"),
               format = "csv")
writeMetadata(type, filename = file.path(tempdir(),"MyMetadata"),
               format = "csv")


[Package MALDIrppa version 1.1.0-2 Index]