LIMMA Adjustment for Covariates
1
0
Entering edit mode
@trinhpauline-9521
Last seen 8.9 years ago

I apologize for my naiveté but I'm fairly new to R and very new to limma. My overall research question is to determine whether or not there is a difference in gene expression between post-intervention and pre-intervention of a group of patients. I wanted to adjust for potential confounding covariates such as contamination of the sample from white blood cells which I had arrived at by creating two variables that represent leukocytes and smooth muscle cells. I derived these variables by taking the expression level at probe sets coding for the genes to those leukocytes and muscle cells and averaged those expressions into these two variables. 

I ran the following workflow: 

e<-justRMA(filenames=celList, destructive=TRUE) 
d<-read.table("expressionDataHFNIH1-14-15.txt", header=T, row.names=1)
names(d)<-gsub(".CEL", "", gsub("X", "", names(d)))
d<-round(d, 5)
design <- cbind(ID = c(1,1,2,2,7,7,8,8,9,9,10,10,11,11,14,14,16,16,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,33,33,34,34,35,35,36,36,37,37,39,39,40,40,41,41), Congestion=c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2), cd45=c(5.8431,9.34022,5.84936,8.48469,5.74679,9.746,7.02528,8.01279,4.51826,7.92241,7.11258,3.98122,4.93983,8.25378,10.11714,9.12532,8.99222,8.54245,7.43757,7.89494,7.0255,7.84656,5.75105,6.3731,6.57053,7.33729,9.04808,9.76327,3.95987,5.83226,7.86699,6.61648,5.62214,8.24516,6.14157,5.0675,4.36437,5.97211,5.75741,6.45735,5.44796,5.41904,4.62525,4.23153,3.99304,5.48816,4.92795,4.86038,6.67107,3.56441,3.96629,7.23041,4.7075,7.74862,4.7599,8.1618),          SMC=c(6.10775,7.63237,6.44302,6.76774,6.37873,6.39852,5.65846,6.52086,6.46114,6.68354,6.32257,5.53346,5.39986,5.88007,6.43321,5.02119,6.38468,6.69504,11.59846,5.77372,6.32704,5.95683,5.25758,6.0633,8.6829,7.57135,7.10109,5.19097,3.95233,4.69579,5.3558,5.7178,5.82353,5.80212,6.49176,5.10923,5.04173,3.65802,5.43176,4.67313,6.26439,5.12875,12.18113,5.30599,5.87447,5.10515,6.43704,7.01435,6.14525,6.58549,7.33405,6.06033,5.9862,6.22096,5.86709,6.10098))               

ID<-factor(design[,1])
Congestion<-factor(design[,2], levels=c("1","2"))
cd45<-factor(design[,3])
SMC<-factor(design[,4])

#create a design matrix
design<-model.matrix(~ID+Congestion+SMC+cd45)

fit <- lmFit(e, design)
fit <- eBayes(fit)

And received the following error: 

Warning message:
Partial NA coefficients for 54675 probe(s) 
> fit <- eBayes(fit)
Error in ebayes(fit = fit, proportion = proportion, stdev.coef.lim = stdev.coef.lim,  : 
  No residual degrees of freedom in linear model fits


How do I get this to work? I'm uncertain as to what I'm doing improperly in my naiveté and any assistance would be greatly appreciated. Thank you in advance! 

limma covariates • 3.2k views
ADD COMMENT
0
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 9 hours ago
The city by the bay

The cell proportions are real-valued covariates, so you shouldn't covert them to factors. Doing so means that you're considering each unique value of the cell proportion as a separate level of the factor. This effectively means that each sample gets its own coefficient such that there are no residual d.f. for variance estimation. Anyway, if you just do:

cd45 <- design[,3]
SMC <- design[,4]

... and construct design from that, you should be able to solve that problem. Note that your design assumes that the contamination has a linear effect on expression. This might be a bit too restrictive, so you might consider using splines to account for non-linear trends:

cd45 <- splines::ns(design[,3], df=3) # for example

Another thing to be careful of is whether the treatment is correlated with the proportion of contaminating cells. If so, any attempt to model the latter may absorb genuine DE from the former. This is because you can't distinguish between non-interesting DE due to changes in the proportions and interesting DE due to the treatment effect. This may be an issue for cd45 which seems to increase considerably upon treatment in some pairs.

ADD COMMENT
0
Entering edit mode

Thank you so much!! 

ADD REPLY

Login before adding your answer.

Traffic: 847 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