Have you checked the posts on the right of the screen? Just save the data.frame produced by topTable without sorting, subset the expressionSet accordingly, and make a heatmap of that.
fit<-lmFit(selExpr,design)
contrast.matrix<-makeContrasts(BT20_1_day-BT20_0, levels=design)
fits<-contrasts.fit(fit,contrast.matrix)
ebfit<-eBayes(fits)
# use top 200 probes
tt = topTable(ebfit,number=200,coef=1,adjust="fdr",p.value=0.05)
library(gplots)
idx = rownames(tt)
# assume that selExpr is an ExpressionSet
heatmap.2(exprs(selExpr)[idx,],trace='none',scale='row')
# OR, if selExpr is a matrix
heatmap.2(selExpr[idx,],trace='none',scale='row')
Hi, Sean Davis. Thanks for your useful explanation.
However, I have this same errors again.
> heatmap.2(exprs(selExpr)[index_top,],trace='none',scale='row')
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "exprs", for signature "matrix"
> heatmap.2(selExpr[idx,],trace='none',scale='row')
Error in heatmap.2(selExpr[idx, ], trace = "none", scale = "row") :
`x' must have at least 2 rows and 2 columns
Do you have a question that we can answer? When you dump code on us and ask "how to do" there is no specific thing we can give you. You are asking the internet to do your job.
Search "making heatmaps in R" on the google or on biostars and you'll see many tutorials. You have then to read them and try it. When you get a specific question, search that, and we may be able to help.
Have you checked the posts on the right of the screen? Just save the data.frame produced by
topTable
without sorting, subset theexpressionSet
accordingly, and make a heatmap of that.I tried that, and it was not working
Define "not working".
It keeps showing me an error even I have already set it to be a numeric matrix
Error in heatmap.plus(top) : 'x' must be a numeric matrix
It would be rather more useful if you also showed the entirety of the relevant code...
> top<-as.numeric(rownames(topTable(ebfit,n=10000,coef=1,adjust="fdr",p.value=0.05)))
>heatmap.plus(top)
I'm not sure how you could hope for that to ever work. You're trying to make a heatmap of probe names, which doesn't make any sense.
or something like that.
as.numeric of the rownames? Stopped reading there.