[R] Chromatogram deconvolution and peak matching

bartjoosen bartjoosen at hotmail.com
Tue Feb 17 14:44:40 CET 2009

```Hi,

I'm trying to match peaks between chromatographic runs.
I'm able to match peaks when they are chromatographed with the same method,
but not when there are different methods are used and spectra comes in to
play.

While searching I found the ALS package which should be usefull for my
application, but I couldn't figure it out.

I made some dummy chroms with R, which mimic my actual datasets, to play
with, but after looking at the manuals of ALS, I'm affraid I can't get the
job done. Can someone put me on the right way?

Here is my code to generate the dummy chroms, which also plots the 2 chroms
and the spectra of the 3 peaks:

#2D chromatogram generation
par(mfrow=c(3,1))
time <- seq(0,20,by=0.05)
f <- function(x,rt) dnorm((x-rt),mean=0,sd=rt/35)
c1 <- f(time,6.1)
c2 <- f(time,5.6)
c3 <- f(time,15)
plot(c1+c2+c3~time,type="l",main="chrom1")

#spectrum generation
spectra <- function(x,a,b,c,d,e) a + b*(x-e) + c*((x-e)^2) + d*((x-e)^3)
x <- 220:300
s1 <- spectra(x,(-194.2),2.386,(-0.009617),(1.275e-05),0)
s2 <- spectra(x,(-1.054e02),1.3,(-5.239e-03),(6.927e-06),-20)
s3 <- spectra(x,(-194.2),2.386,(-0.009617),(1.275e-05),20)

chrom1.tot <-
data.frame(time,outer(c1,s1,"*")+outer(c2,s2,"*")+outer(c2,s2,"*"))
names(chrom.tot)[-1] <- x

#generation of chromatogram 2
c1 <- f(time,2.1)
c2 <- f(time,4)
c3 <- f(time,8)
plot(c1+c2+c3~time,type="l",main="chrom2")

chrom2.tot <-
data.frame(time,outer(c1,s1,"*")+outer(c2,s2,"*")+outer(c2,s2,"*"))
names(chrom.tot)[-1] <- x

plot(s1~x,type="l",main="spectra")
lines(s2~x,col=2)
lines(s3~x,col=3)