Learn R Programming

MetProc (version 1.0.1)

write.met: Write Metabolomics Dataset of Standard Structure

Description

Write a metabolomics file based on the metabolites identified to be retained or removed using met_proc. Requires the filepath for the original metabolomics file in order to extract row and column information. Will take in this original file and the results of the met_proc function to write a file that contains only the retained or removed metabolites.

Usage

write.met(res, filename, origfile, headrow = 3, metidcol=1, fvalue=8, sep=",", type="keep")

Arguments

res
The result output from met_proc function.
filename
The name and path for new metabolomics file.
origfile
The name and path for the original metabolomics file.
headrow
The row number that contains the header line in the original metabolomics file. Default is 3.
metidcol
The column number that contains the metabolite ID in the original metabolomics file. Default is 1.
fvalue
The column number where data begins in the original metabolomics file. Default is 8.
sep
File delimiter for both the original metabolomics file and the new file. Default is ",".
type
Either ‘keep’ or ‘remove’ to determine whether the retained metabolites or removed metabolites should be written to the file. Default is "keep".

Value

Writes a file to filename that is of the same structure as the original metabolomics file but only containing either the retained or removed metabolites.

See Also

See MetProc-package for examples of running the full process.

Examples

Run this code
library(MetProc)
#Read in metabolomics data
metdata <- read.met(system.file("extdata/sampledata.csv", package="MetProc"),
headrow=3, metidcol=1, fvalue=8, sep=",", ppkey="PPP", ippkey="BPP")

#Separate likely artifacts from true signal using default settings
results <- met_proc(metdata,plot=FALSE)

#Write the retained metabolites to current directory
write.met(results,'sample_retained.csv',
system.file("extdata/sampledata.csv", package="MetProc"),
headrow=3,metidcol=1,fvalue=8,sep=",",type='keep')

Run the code above in your browser using DataLab