# NOT RUN {
data(marty)
##Class label 0/1
marty.type.num <- ifelse(marty.type.cl=="Her2+",0,1)
#Annotation of the grade of tumor
grade=factor(sample(c(1:3),23,rep=TRUE),labels=c("I","II","III"))
typeXfactor=paste(marty.type.num,grade,sep=":")
##dataset fro example
normData<-marty[1:100,]
rt<-runTtest(normData, labels=marty.type.num, plot=FALSE)
normData.DE<-normData[which(rt["AdjpValue"]<0.05),]
marty.lm=lm(t(normData.DE)~as.factor(typeXfactor))
X=model.matrix(marty.lm)
#We want to test Basal vs Her2+ within each grade
LC<-matrix(c(0,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1),ncol=6,byrow=TRUE)
#We also want to test grade II vs grade III
LC2=c(0,1,-1,0,1,-1)
LC=rbind(LC,LC2)
row.names(LC)=c("B:I-H:I","B:II-H:II","B:III-H:III","II-III")
marty.LC=test.LC(LC,X,t(normData.DE))
marty.LC$pvalue
#List of the probesets differentially expressed for each of the four tests :
ll=list()
for(i in 1:nrow(marty.LC$pvalue)){
ll[[i]]=as.matrix(marty.LC$pvalue[i,which(marty.LC$pvalue[i,]<0.05)])
rownames(ll[[i]])=names(which(marty.LC$pvalue[i,]<0.05))
}
names(ll)=rownames(marty.LC$pvalue)
print(ll)
# }
Run the code above in your browser using DataLab