| msc.baseline.subtract {caMassClass} | R Documentation |
Perform baseline subtraction on batch of mass spectra data
msc.baseline.subtract(X, ...)
X |
Spectrum data either in matrix format [nFeatures x
nSamples] or in 3D array format [nFeatures x nSamples
x nCopies]. Row names (rownames(X) store M/Z mass of
each row/feature. |
... |
Parameters to be passed to bslnoff
function from PROcess library. See details for explanation of
breaks, qntl, and bw. Boolean parameter plot
can be used to plot results.
|
Perform baseline subtraction for every sample in a batch of data, using
bslnoff function from PROcess library. The
bslnoff function splits spectrum into breaks
number of exponentially growing regions. Baseline is calculated by applying
quantile(...,probs=qntl) to each region and smoothing the
results using loess(..., span=bw, degree=1) function.
Data in the same format and size as input variable X but with
the subtracted baseline.
Jarek Tuszynski (SAIC) jaroslaw.w.tuszynski@saic.com
msc.preprocess.run and
msc.project.run pipelines.
msc.project.read
and msc.rawMS.read.csv
msc.mass.cut
bslnoff (from PROcess
library) which is a single-spectrum baseline removal function implemented using
loess function.
rmBaseline (from PROcess
library) can read all CSV files in directory and remove their baselines.
# load "Data_IMAC.Rdata" file containing raw MS spectra 'X'
if (!file.exists("Data_IMAC.Rdata")) example("msc.project.read")
load("Data_IMAC.Rdata")
# run msc.baseline.subtract using 3D input
# this data had baseline removed already so little change is expected
Y = msc.baseline.subtract(X)
avr = mean(abs(X-Y))
cat("Data Size: ", dim(X), " average change :", avr, "\n")
stopifnot(avr<0.3)
# test on data provided in PROcess package (2D input)
# this is "raw" data, so large changes are expected
directory = system.file("Test", package = "PROcess")
X = msc.rawMS.read.csv(directory)
Y = msc.baseline.subtract(X, plot=TRUE)
avr = mean(abs(X-Y))
cat("Data Size: ", dim(X), " average change :", avr, "\n")
stopifnot(avr>7.5)