This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Microarray contrast matrix design

Hi I am trying to create an appropriate design matrix to determine gene that are differentially expressed between cancer and normal sample. Below table is the information file for my dataset.

Sample     Subtype     Cancer
A          Normal      Normal
B          Normal      Normal
C          Normal      Normal
D          stage 1     Cancer
E          stage 1     Cancer
F          stage 2     Cancer
G          stage 2     Cancer
H          stage 2     Cancer
I          NA          Biopsy

At the moment I create a design matrix using these command:

f=factor(information$cancer)
design=model.matrix(~f)
fit=lmFit(exp_sample,design)
fit=eBayes(fit)

However I am not sure how to construct my contrast matrix for 2 levels (compare cancer and normal) only? Also do i need to discard those biopsy data or not? It would be great if you guys can give me some advice! Many thanks

microarray r

1 answer

You have a data frame where first three columns are Normal and then next two columns are"stage1_cancer" and next three columns are "stage3_cancer" carrying their respective expression values. (here we discard biopsy) you should then do it like following :

groups<-as.factor(c(rep("Normal",3),rep("stage1_Cancer",2), rep("stage2_Cancer",3)))
design<-model.matrix(~0+groups)
colnames(design)=levels(groups)
fit<-lmFit(dataframe, design)
cont.matrix.stage2<-makeContrasts(stage2_Cancer-Normal,
levels=design)
cont.matrix.stage1<-makeContrasts(stage1_Cancer-Normal,
levels=design)
fit.stage2<-contrasts.fit(fit, cont.matrix.stage2)
fit.stage1<-contrasts.fit(fit, cont.matrix.stage1)
ebfit.stage2<-eBayes(fit.stage2)
ebfit.stage1<-eBayes(fit.stage1)
topTable.stage2(ebfit.stage2, number=Inf, p=0.05, adjust.method="none", coef=1)
topTable.stage1(ebfit.stage1, number=Inf, p=0.05, adjust.method="none", coef=1)

Log in to answer this question.