Error in contrast.fit, LIMMA
1
0
Entering edit mode
@david-martino-3283
Last seen 9.6 years ago
Dear list, I get an error: "Error in contrasts.fit(fit,contrast.matrix): Number of rows of contrast matrix must match number of coefficients In addition: Warning row names don't match col names of coefficients" for the following Timecourse design: 3 Timepoints Stimulated (LPS) versus Unstimulated (CON) cells Affy Gene1.0 chips The targets are ChipNumber Name Filename Time Treatment Biolrep 1 LPS.0hr 0Hr_1.CEL 0 T 1 2 CON.0hr 0Hr_2.CEL 0 C 2 3 LPS.6hr 6HrLPS_1.CEL 6 T 3 4 LPS.6hr 6HrLPS_2.CEL 6 T 3 5 CON.6hr 6HrCon_1.CEL 6 C 4 6 CON.6hr 6HrCon_2.CEL 6 C 4 7 LPS.12hr 12HrLPS_1.CEL 12 T 5 8 LPS.12hr 12HrLPS_2.CEL 12 T 5 9 CON.12hr 12HrCon_1.CEL 12 C 6 10 CON.12hr 12HrCon_2.CEL 12 C 6 The design matrix is: Targets<-readTargets() lev<-c("LPS.0hr","CON.0hr","LPS.6hr", +"CON.6hr","LPS.12hr","CON.12hr") f<-factor(Targets$Name,levels=lev) design<-model.matrix(~0+f) colnames(design)<-lev biolrep<-c(1,2,3,3,4,4,5,5,6,6) corfit<-duplicateCorrelation(x,ndups=1,block=biolrep) fit<-lmFit(,x,block=biolrep,cor=corfit$consensus) fit<-eBayes(fit) To extract the contrasts of interest: cont.con<-makeContrasts("CON.6hr-CON.0hr","CON.12hr- CON.6hr",levels=design) cont.lps<-makeContrasts("LPS.6hr-LPS.0hr","LPS.12hr- LPS.6hr",levels=design) cont.dif<-makeContrasts(Dif6H=(LPS.6hr-LPS.0hr)- + (CON.6h-CON.0hr),Dif12H=(LPS.12hr-LPS.6hr)- + (CON.12hr-CON.6hr),levels=design) cont.matrix<-cbind(cont.con,cont.lps,cont.dif) The code: fit2<-contrasts.fit(fit,cont.matrix) returns the afforementioned error message. Any input would be greatly appreciated. With thanks, David sessionInfo(): R version 2.8.0 (2008-10-20)
TimeCourse timecourse TimeCourse timecourse • 4.4k views
ADD COMMENT
0
Entering edit mode
Mark Robinson ★ 1.1k
@mark-robinson-2171
Last seen 9.6 years ago
David, Is this just a typo? The following commands (changed minorly) work for me in a fresh R session: ------- library(limma) lev<-c("LPS.0hr","CON.0hr","LPS.6hr","CON.6hr","LPS.12hr","CON.12hr") f<-factor(rep(lev,each=2)[-c(1,3)],levels=lev) # same as yours design<-model.matrix(~0+f) colnames(design)<-lev cont.con<-makeContrasts("CON.6hr-CON.0hr","CON.12hr- CON.6hr",levels=design) cont.lps<-makeContrasts("LPS.6hr-LPS.0hr","LPS.12hr- LPS.6hr",levels=design) cont.dif<-makeContrasts(Dif6H=(LPS.6hr-LPS.0hr)- (CON.6hr-CON.0hr),Dif12H=(LPS.12hr-LPS.6hr)- # fixed typo (CON.12hr-CON.6hr),levels=design) cont.matrix<-cbind(cont.con,cont.lps,cont.dif) xx <- matrix( rnorm(100), nc=10) # made this up biolrep<-c(1,2,3,3,4,4,5,5,6,6) corfit<-duplicateCorrelation(xx,ndups=1,block=biolrep) fit<-lmFit(xx,design,block=biolrep,cor=corfit$consensus) # changed this fit <- eBayes(fit) fit2<-contrasts.fit(fit,cont.matrix) ------- > fit<-lmFit(,x,block=biolrep,cor=corfit$consensus) Perhaps this should be: fit <- lmFit(x,design,block=biolrep,cor=corfit$consensus) > + (CON.6h-CON.0hr),Dif12H=(LPS.12hr-LPS.6hr)- Should 'CON.6h' be 'CON.6hr'? HTH, Mark > sessionInfo() R version 2.8.1 (2008-12-22) i386-apple-darwin8.11.1 locale: en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] statmod_1.3.6 limma_2.16.2
ADD COMMENT

Login before adding your answer.

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