cdfpath <- file.path(find.package("faahKO"), "cdf")
my.input.files <- dir(c(paste(cdfpath, "WT", sep='/'),
paste(cdfpath, "KO", sep='/')), full.names=TRUE)
# create xcmsSet object
xs <- new("xcmsSet")
xs@filepaths <- my.input.files
op<-par(mfrow=c(3,1))
x<-combine_spectra(xs=xs, mzbin=0.25,
linear=TRUE, continuum=FALSE)
plot(x$mz, x$intensity,
type='h',
main='original',
xlab='m/Z', ylab='ion intensity')
xy <- peakdetection(x=x$mz, y=x$intensity,
scales=1:10, SNR.Th=1.0, SNR.area=20, mintr=0.5)
id.peakcenter<-xy[,4]
plot(x$mz[id.peakcenter], x$intensity[id.peakcenter], type='h',
main='filtered')
plot(x$mz, x$intensity, type='l',
xlim=c(400,450),
main='zoom',
log='y',
xlab='m/Z', ylab='ion intensity (log scale)')
points(x$mz[id.peakcenter], x$intensity[id.peakcenter],col='red', type='h')
Run the code above in your browser using DataLab