Building specific Ortoghonal contrasts in LIMMA
1
0
Entering edit mode
@garcia-orellanamiriam-5283
Last seen 9.6 years ago
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 [[alternative HTML version deleted]]
limma gcrma limma gcrma • 1.3k views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 9 hours ago
WEHI, Melbourne, Australia
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 Gordon > 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:4}}
ADD COMMENT
0
Entering edit mode
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?? Thanks, Miriam ******************************** Miriam Garcia, MS PhD candidate Department of Animal Sciences University of Florida ________________________________________ From: Gordon K Smyth [smyth@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 Gordon > 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}}
ADD REPLY
0
Entering edit mode
Dear Miriam, The warning is most likely occuring because all the normalized expression values are equal for at least one gene. This can sometimes occur with gcrma normalization if you don't have a lot of arrays. I have no idea about why topTable gives an error. Have you trouble shooted your data? Do you have enough replicates? Have you filtered non-expressed genes? Quality assessment plots? MDS plot? MA plots? plotSA? I can't help you more with these data specific issues. If you want more help from the list after doing some data checking, I suggest you give some more information, including the targets frame, how many arrays you have, some information about what the data looks like etc. And output from sessionInfo(). Best wishes Gordon --------------------------------------------- Professor Gordon K Smyth, Bioinformatics Division, Walter and Eliza Hall Institute of Medical Research, 1G Royal Parade, Parkville, Vic 3052, Australia. http://www.statsci.org/smyth On Sun, 13 May 2012, Garcia Orellana,Miriam wrote: > 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?? Thanks, Miriam ******************************** Miriam Garcia, MS PhD candidate Department of Animal Sciences University of Florida ________________________________________ From: Gordon K Smyth [smyth@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 Gordon > 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:9}}
ADD REPLY

Login before adding your answer.

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