## need access to CDF (raw data)
require(gcspikelite)
gcmsPath <- paste(find.package("gcspikelite"), "data", sep="/")
## full paths to file names
cdfFiles <- dir(gcmsPath, "CDF", full=TRUE)
## create a 'peaksDataset' object and add XCMS peaks to it
pd <- peaksDataset(cdfFiles[1:3], mz=seq(50,550), rtrange=c(7.5,8.5))
pd <- addXCMSPeaks(cdfFiles[1:3], pd, peakPicking=c('mF'), snthresh=5,
fwhm=10, step=1, steps=2, mzdiff=0.5, sleep=0)
## align the chromatograms
mp <- correlationAlignment(object=pd, thr=0.8, D=20,
penality=0.2, normalize=TRUE,
minFilter=2)
## view the alignment results
mp@Alignment
## plot the mass spectra
par(mfrow=c(3,1))
plotSpectra(object=pd, sample=cdfFiles[1], spectraID=2)
plotSpectra(object=pd, sample=cdfFiles[2], spectraID=3)
plotSpectra(object=pd, sample=cdfFiles[3], spectraID=4)
Run the code above in your browser using DataLab