[BioC] Trouble calculating fold-changes - please help

Sean Davis sdavis2 at mail.nih.gov
Sat May 13 02:28:00 CEST 2006


Srinivas Iyyer wrote:
> Hello:
> 
> I am analyzing farmer_breast data.  I classified
> normals as normal and any other transformed tissue
> into cancer. 
> in my class file CL0 = normal and CL1 = Cancer
> 
> 
> I wrote a function to compute fold changes. 
> I would like some help from group members to comment
> on this function to calculate fold changes. 
> 
> 1. is there a better way to calculate. 
> 2. how do i get log-fold changes. 
> 
> 
> 
> 
> fc <- function(x,CL0,CL1){
> 	x0 <- x[,CL0]
> 	x1 <- x[,CL1]
> 	res <- (apply(x0,1,mean) - apply(x1,1,mean))
> }
> 
> 
> foldcs
> <-fc(mydata_mat,CL0=(farm.cl==0),CL1=(fram.cl==1))
> 
> 
> logfoldcs <- log(foldcs,2) OR loggoldcs <-
> log2(foldcs)
> 
> While doing this I get error:
> Warning message:
> NaNs produced in: log(x, base) 

Hi, Sri.

Your fc() function does a subtraction.  It seems like foldcs might have 
some negative values, for which log is undefined.  A fold-change on 
non-logged raw expression (or ratio in two-color terms) is a ratio, not 
a difference.

Sean



More information about the Bioconductor mailing list