[BioC] Building specific Ortoghonal contrasts in LIMMA

Garcia Orellana,Miriam mgarciao at ufl.edu
Sun May 13 12:36:32 CEST 2012

Dear Dr. Smith:
Thanks for taking some of your time to help me.
I was able to built the design with the  contrast you suggested me but I am getting some warning messages as well as weird results.
The codes I used were:
> library (limma)
> library (gcrma)
>  setwd ("c:/Users/miriam/Documents/CEL_files")
> Data <-ReadAffy()
> eset <- gcrma (Data)
> targets <- readTargets ("FA.txt")
> library (affy)
> Data <-ReadAffy(filenames=targets$FileName)
> Damdiet <-factor(targets$Damdiet, levels = c("Ctl", "SFA", "EFA"))
> Calfdiet <-factor(targets$Calfdiet, levels = c("LLA", "HLA"))
> contrasts (Damdiet) <- cbind (CrlvsSFAEFA=c(-2,1,1),EFAvsSFA=c(0,-1,1))
> contrasts (Calfdiet) <- c(-1,1)
> design <-model.matrix (~Damdiet*Calfdiet)
> fit <- lmFit (eset, design)
> fit <-ebayes(fit)
Warning message:
Zero sample variances detected, have been offset 
*** I am not sure about this warning, but I read in other blog that we should not care about these message, is that true??
> topTable (fit, coef=2, n=40, adjust= "BH")
Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
  attempt to set an attribute on NULL
***	AFTER getting that error I tried the next code:
> fit <-lmFit (eset,design)
> efit <-eBayes (fit)
Warning message:
Zero sample variances detected, have been offset 
> write.table(topTable(efit, coef=4, sort.by="B", number=24128), file="limma_complete_coeff4_woFDR.xls", row.names=F, sep="\t")
> write.table(topTable(efit, coef=4, adjust="fdr", sort.by="B", number=24128), file="limma_complete_coeff4_withFDR.xls", row.names=F, sep="\t")
**** When I exported the output from limma for the effect of calf diet (HLA vs LLA) I found that no matter if I adjusted for FDR  or BH (I tried both) I am still getting the same P values for all the genes which also accounted for the same number of genes with Pvalue <0.05. If it is suppose that FDR is more strict about picking up significant genes. So why the use of FDR did not affect my output???

Is there anything wrong with my approach??


Miriam Garcia, MS
PhD candidate
Department of Animal Sciences
University of Florida

From: Gordon K Smyth [smyth at wehi.EDU.AU]
Sent: Sunday, May 13, 2012 1:44 AM
To: Garcia Orellana,Miriam
Cc: Bioconductor mailing list
Subject: Building specific Ortoghonal contrasts in LIMMA

Dear Miriam,

I am assuming that you already know how to create factors in R to
represent Damdiet and MR.  You need something like:

   Damdiet <- factor(Damdiet, levels=c("Ctl","SFA","EFA"))
   MR <- factor(MR, levels=c("LLA","HLA"))

   contrasts(Damdiet) <- cbind(CtlvsSFAEFA=c(-2,1,1), EFAvsSFA=c(0,-1,1))
   contrasts(MR) <- c(-1,1)

   design <- model.matrix(~Damdiet*MR)

Then the five contrasts you have specified will be coefficients 2-6 of the
fitted model (in the same order that you listed them).

Best wishes

> Date: Sat, 12 May 2012 06:46:06 +0000
> From: "Garcia Orellana,Miriam" <mgarciao at ufl.edu>
> To: "bioconductor at r-project.org" <bioconductor at r-project.org>
> Subject: [BioC] Building specific Ortoghonal contrasts in LIMMA
> Dear All:

> I just started getting familiar with the use of R and different packages
> to analyze liver samples. After some reading and searching I was able to
> understand how to pre-process the data including normalization with
> GCRMA but now I got a problem when using LIMMA and trying to built my
> design.

> I have 18 arrays, a group of 6 are from liver of calves that were born
> from dams fed 3 different diets (Damdiet: Ctl, SFA, EFA). After the
> calves were born, a group of 3 from each dam diet were fed 2 different
> milk replacers (MR: LLA, HLA). So I have a factorial (3x2). I am
> interested in evaluating specific orthogonal contrast and I couldn't
> find any online help about how I can set the model matrix in limma for
> those contrast of interest.

> As if I were to use my orthogonal contrast in SAS they would be:

> contrast 'Ctl vs (SFA+EFA)' Damdiet -2 1 1;
> contrast 'EFA vs SFA' damdiet 0 -1 1;
> contrast 'MR' MR -1 1;
> contrast 'MR by ctl vs (SFA+EFA)' MR*damdiet 2 -1 -1 -2 1 1;
> contrast 'MR by EFAvs SFA' calfdiet*damdiet 0 1 -1 0 -1 1;
> I will deeply appreciate any help.
> Miriam
> ********************************
> Miriam Garcia, MS
> PhD candidate
> Department of Animal Sciences
> University of Florida

The information in this email is confidential and intend...{{dropped:6}}

More information about the Bioconductor mailing list