Trouble calculating fold-changes - please help
1
0
Entering edit mode
@srinivas-iyyer-939
Last seen 9.7 years ago
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) Could any one help me please. Thanks sri
Cancer Cancer • 822 views
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 4 months ago
United States
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
ADD COMMENT

Login before adding your answer.

Traffic: 700 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6