peaksAlignment: Data Structure for pairwise alignment of 2 GCMS samples

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/peaksAlignment.R

Description

Store the raw data and optionally, information regarding signal peaks for a number of GCMS runs

Usage

1
2
3
peaksAlignment(d1, d2, t1, t2, gap=0.5, D=50, timedf=NULL, df=30,
               verbose=TRUE, usePeaks=TRUE, compress=TRUE, metric=2,
               type=2, penality=0.2)

Arguments

d1

matrix of MS intensities for 1st sample (if doing a peak alignment, this contains peak apexes/areas; if doing a profile alignment, this contains scan intensities. Rows are m/z bins, columns are peaks/scans.

d2

matrix of MS intensities for 2nd sample

t1

vector of retention times for 1st sample

t2

vector of retention times for 2nd sample

gap

gap penalty for dynamic programming algorithm. Not used if type=2

D

time window (on same scale as retention time differences, t1 and t2. Default scale is seconds.)

timedf

list (length = the number of pairwise alignments) of matrices giving the expected time differences expected at each pair of peaks used with usePeaks=TRUE.

df

integer, how far from the diagonal to go to calculate the similarity of peaks. Smaller value should run faster, but be careful not to choose too low.

verbose

logical, whether to print out info.

usePeaks

logical, TRUE uses peakdata list, FALSE uses rawdata list for computing similarity.

compress

logical, whether to compress the similarity matrix into a sparse format.

metric

numeric, different algorithm to calculate the similarity matrix between two mass spectrum. metric=1 call normDotProduct(); metric=2 call ndpRT(); metric=3 call corPrt()

type

numeric, two different type of alignment function

penality

penalization applied to the matching between two mass spectra if (t1-t2)>D

Details

peaksAlignment is a hold-all data structure of the raw and peak detection data.

Value

peaksAlignment object

Author(s)

Mark Robinson, Riccardo Romoli

References

Mark D Robinson (2008). Methods for the analysis of gas chromatography - mass spectrometry data PhD dissertation University of Melbourne.

See Also

peaksDataset, clusterAlignment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## see clusterAlignment, it calls peaksAlignment

## Not Run:
gcmsPath <- paste(find.package("gcspikelite"), "data", sep="/")
cdfFiles <- dir(gcmsPath,"CDF", full=TRUE)

# read data, peak detection results
pd <- peaksDataset(cdfFiles[1:3], mz=seq(50,550), rtrange=c(7.5,10.5))
pd <- addXCMSPeaks(files=cdfFiles[1:3], object=pd, peakPicking=c('mF'),
                   snthresh=3, fwhm=10,  step=0.1, steps=2, mzdiff=0.5,
                   sleep=0)
## review peak picking
plot(pd, rtrange=c(7.5, 10.5), runs=c(1:3))

## align two chromatogram
pA <- peaksAlignment(pd@peaksdata[[1]], pd@peaksdata[[2]],
                     pd@peaksrt[[1]], pd@peaksrt[[2]], D=50,
                     metric=3, compress=FALSE, type=2, penality=0.2)

plot(pA)
pA@v$match

par(mfrow=c(2,1))
plot(pd@peaksdata[[1]][,15], type='h', main=paste(pd@peaksrt[[1]][[15]]))
plot(pd@peaksdata[[2]][,17], type='h',
     main=paste(pd@peaksrt[[2]][[17]]))
## End (Not Run)

flagme documentation built on Nov. 8, 2020, 5:24 p.m.