I am trying to do some clustering. I need to get heatmap plot for edgeR gene expressions. I usually get the following error, although I ensured data1 is matrix. Any hint? Thanks
Error in heatmap.2(data1, col = col.pan, Rowv = TRUE, scale = "none", : `x' must be a numeric matrix
et <- exactTest(dge, pair=c("ctrl", "tr"))
etp <- topTags(et, n=2000000)
data1 <- as.matrix(etp$table$logFC)
heatmap.2(data1, col=col.pan, Rowv=TRUE, scale="none",trace="none", dendrogram="both", cexRow=1, cexCol=1.4, density.info="none",margin=c(10,9), lhei=c(2,10), lwid=c(2,6))
Hi Sharon, how are you?
In your code above, data1 will just consist of a single vector of log base 2 fold changes, and you will not be able to generate a heatmap with that.
What exactly are you aiming to do?
Hi Kevin, I think you are right. I am trying to plot my genes expressions using heatmap. But still if I call with etp$table for all the matrix, it gives the same error.
I believe that the 'table' object of etp is just P values, fold changes, and other stats.
I believe that you have to do something like this:
The first line extracts gene names (assuming gene names are rownames of etp$table) that have absolute log2 FC > 2 and adjusted P value <0.05. The second line subsets your expression matrix (assuming it's called *ExprMatrix*) and concurrently performs the
heatmap.2
function.Sorry for this noise. But is not ExprMatrix just my etp?
Hey Sharon,
Your original expression matrix will be whatever you passed as the 'counts' argument to
DGEList()
. For example,DGEList(counts=counts, group=1:2)
Much as I am aware, etp just contains information on the differential expression analysis.
[source: page 23/24 of https://bioconductor.org/packages/release/bioc/vignettes/edgeR/inst/doc/edgeRUsersGuide.pdf]
Finally works, thanks Kevin !
Great - good luck with the rest of the project