[BioC] Calculation times
Claire Wilson
ClaireWilson at picr.man.ac.uk
Fri Jun 6 14:56:32 MEST 2003
Dear all,
I have recently upgraded my linux machine from R1.6.2/Bioconductor 1.1 to R1.7/Bioconductor 1.2 and have found that the new version runs considerabley slower than the old version. So much so that I have a function to calculate fold change for an expression set that takes a few minutes to run in R1.6.2/BioC 1.1, but well over half an hour to run on the latest version.
here is the code..
calc.fc <- function(y, x) {
# split y according to treatment
exprs.values <- split(y, treatment)
# exprs.values has 2 elements control in [[1]] and treatment in [[2]]
# exprs.values[[1]][1:3] is the control group for a
# exprs.values[[1]][4:6] is the control group for b
# exprs.values[[2]][1:3] is the treatment group for a
# exprs.values[[2]][4:6] is the treatment group for b
if (x == "a") {
# Calculate the means expression level for each group in a
m1 <- log2(mean(exprs.values[[1]][1:3]))
m2 <- log2(mean(exprs.values[[2]][1:3]))
}else{
# Calculate the means expression level for each group in b
m1 <- log2(mean(exprs.values[[1]][4:6]))
m2 <- log2(mean(exprs.values[[2]][4:6]))
}
# Calculate the fold change
log.fold.change <- m1 - m2
# If it is less than 0 it is a negative fold change
# Need to make it positive, take the anti-log and then make it negative again
# Else just calculate the anti-log
if (log.fold.change < 0 ) {
x <- -1 * log.fold.change
fold.change <- -1 * (2^x)
}else {
fold.change <- (2^log.fold.change)
}
return (t(fold.change))
}
# Run the function
esApply(eset,1,calc.fc, x="a")
Any ideas?
Thanks
claire
--
Claire Wilson
Bioinformatics group
Paterson Institute for Cancer Research
Christies Hospital NHS Trust
Wilmslow Road,
Withington
Manchester
M20 4BX
tel: +44 (0)161 446 8218
url: http://bioinf.picr.man.ac.uk/
--------------------------------------------------------
This email is confidential and intended solely for the use of th... {{dropped}}
More information about the Bioconductor
mailing list