Calculation times
3
0
Entering edit mode
Claire Wilson ▴ 280
@claire-wilson-273
Last seen 6.9 years ago
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}}
Cancer Cancer • 541 views
0
Entering edit mode
Claire Wilson ▴ 280
@claire-wilson-273
Last seen 6.9 years ago
THanks for that, I shall give it ago, I was just curious as to why it took a matter of seconds in the older version of R/BioConductor and nearly an hour in the current release. Claire > -----Original Message----- > From: Stephen Henderson [mailto:s.henderson@ucl.ac.uk] > Sent: 06 June 2003 15:10 > To: Claire Wilson > Subject: RE: [BioC] Calculation times > > > esApply is slow. You best remove all the conditions from the > calc.func, > which have to be repeated 22,000 times. > > or go back to pData and add factor 'groups' for controlA, > controlB, treatA, > treatB. > > >test<-function(x){by(x, groups, mean)} > > >test.matrix<- esApply(SE.exprs,1,test) (20 sec?) > > this will give you four columns of means by factor > doing calculations on a matrix is quick > > >testout[1,]/testout[2,] ## would be 1 mean div > another (2 > secs?) > > etc.. etc.. > > hope it helps > > Stephen > WIBR, UCL > > > > > > -----Original Message----- > From: Claire Wilson [mailto:ClaireWilson@picr.man.ac.uk] > Sent: Friday, June 06, 2003 1:57 PM > To: BioC mailing list > Subject: [BioC] Calculation times > > 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}} > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor > > > ********************************************************************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager (wibr.mail@ucl.ac.uk). All files are > scanned for viruses. > ********************************************************************** > > -------------------------------------------------------- This email is confidential and intended solely for the use of th... {{dropped}}
0
Entering edit mode
A.J. Rossini ▴ 810
@aj-rossini-209
Last seen 6.9 years ago
might be a known problem with R 1.7.0 and recent R 1.7.0-patched (until a few days ago). Install a very recent version of R-patched (today or later) might help., or wait until 1.7.1 (to be released soon). "Claire Wilson" <clairewilson@picr.man.ac.uk> writes: > 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}} > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor > -- A.J. Rossini / rossini@u.washington.edu / rossini@scharp.org Biomedical/Health Informatics and Biostatistics, University of Washington. Biostatistics, HVTN/SCHARP, Fred Hutchinson Cancer Research Center. FHCRC: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachments ... {{dropped}}
0
Entering edit mode
Jeff Gentry ★ 3.9k
@jeff-gentry-12
Last seen 6.9 years ago
> 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. I'm not sure of all the how's and why's of what it affected, so do not know if it would help out here - however there were some problems fixed in R-1.7.0 (patched) which solved some problems which led to massive speed problems. You should make sure you are using an up to date R-1.7.0 (patched), see: http://www.bioconductor.org/downloadingR.html for more information on how to obtain it. This is probably a good idea anyways, and very well might solve your problem.