Hello everyone,
I am analyzing microarray data with limma package and I have a couple of doubts as it is the first time I use it. I have 3 conditions which I want to compare. My data looks like this:
Condition AGE SEX
0 64 Male
0 65 Female
1 67 Male
1 60 Male
2 58 Male
2 65 Female
I want to correct the results by sex and age as there are slightly differences in sex and age between groups. I have came with two different codes to correct by age/sex and I obtain different results. Do you think the code I am using is correct to adjust by age and sex. Which strategy is better?
Introducing sex and age in the model:
design <- model.matrix(~0+Condition+as.numeric(AGE)+SEX,targets) fit <- lmFit(y,design) cont.matrix <- makeContrasts(P1="1-0", P2=”1-2”, P3=”2-0”, levels=design) fit2 <- contrasts.fit(fit, cont.matrix) fit3 <- eBayes(fit2) topTable(fit3, coef=1, n=Inf, adjust="BH")
Using the function RemoveBatchEffect
y_correct<-removeBatchEffect(y,batch=(targets$SEX),covariates=(targets$AGE) design <- model.matrix(~0+Condition) fit <- lmFit(y_correct,design) cont.matrix <- makeContrasts(P1="1-0", P2=”1-2”, P3=”2-0”, levels=design) fit2 <- contrasts.fit(fit, cont.matrix) fit3 <- eBayes(fit2) topTable(fit3, coef=1, n=Inf, adjust="BH")
Can anyone confirm me which method would be more correct and confirm me that it make sense? Thankyou
Following up on ellen2270: If Sex and Age are not considered batch, but rather covariates: How do I then obtain values for scatterplot representation of the expression values after the covariate adjustment? Scatterplots of logCPM do not always show the logFC that are in the topTable if covariates are included in the model. If Sex or Age are not a batch, so I would not like to include them in the removeBatchEffect function.
removeBatchEffect()
can adjust for an arbitrary number of covariates as well as batch factors. Please see the documentation?removeBatchEffect
.