[BioC] pmcorrect.mas
Matthias Kohl
Matthias.Kohl at stamats.de
Sat Oct 25 19:49:56 CEST 2008
Dear affy developer,
the function pmcorrect.mas has
pm.corrected <- apply(cbind(pps.pm - pps.im, delta), 1, max)
It would be clearly more efficient to replace this with one of the
following proposals:
## slightly faster
pm.corrected <- pmax(pps.pm - pps.im, delta)
## clearly faster
pm.corrected <- pps.pm - pps.im
pm.corrected[pm.corrected < delta] <- delta
## fastest
pm.corrected <- pmax.int(pps.pm - pps.im, delta)
#######################
## Timing
x <- rnorm(20)
y <- rnorm(20)
delta <- 0.01
t1 <- system.time(for(i in seq_len(1e5)) apply(cbind(x - y, delta), 1,
max) )
t2 <- system.time(for(i in seq_len(1e5)) {z <- x - y; z[z < delta] <-
delta} )
t3 <- system.time(for(i in seq_len(1e5)) pmax(x-y, delta) )
t4 <- system.time(for(i in seq_len(1e5)) pmax.int(x-y, delta) )
t1/t2
t1/t3
t1/t4
This change does really decrease computation time, as function
pmcorrect.mas is called very often. Assume an Affybatch with N arrays
where each array has M different IDs. Then pmcorrect.mas is called N x M
- times.
Best regards,
Matthias
--
Dr. Matthias Kohl
www.stamats.de
More information about the Bioconductor
mailing list