[BioC] Calculation times
Claire Wilson
ClaireWilson at picr.man.ac.uk
Fri Jun 6 16:40:32 MEST 2003
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 at 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 at 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 at 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 at ucl.ac.uk). All files are
> scanned for viruses.
> **********************************************************************
>
>
--------------------------------------------------------
This email is confidential and intended solely for the use of th... {{dropped}}
More information about the Bioconductor
mailing list