Thank you so much Dr. Friederike. I am glad that the heatmap pop up after trying the code you provided above. Thank you once again.
Hello,
Please can anyone help figure out where I am wrong here. I was trying to plot heatmap from RNA-seq data that I analysed using DESeq2. I want to filter out TopVarGenes from the list of DEGs obtained but whenever I type the following code:
library("genefilter")
topVarGenes <- head(order(rowVars(assay(rld)), decreasing = TRUE), 20)
mat <- assay(rld)[ topVarGenes, ]
mat <- mat - rowMeans(mat)
anno <- as.data.frame(coldata(rld)[, c("condition")])
pheatmap(mat, annotation_col = anno)
It returns with the following errors
Error in check.length("fill") : 'gpar' element 'fill' must not be length 0
Where have I missed it then?.
Thank you.
1 answer
my first guess would be that the error is due to lack of row.names for the anno object.
annotation_col expects a data.frame, where the content defines the groups of interest (e.g. the condition), and the row.names correspond to the individual sample names (i.e. the colnames of your matrix).
Try whether row.names(anno) <- colnames(rld) helps.
Log in to answer this question.
Please add the results of
head(mat),str(mat),head(anno),str(anno)`.Thank you Dr. Friederike for offering to help. The following are the results as requested.
Please use
ADD COMMENT/ADD REPLYwhen responding to existing posts to keep threads logically organized.SUBMIT ANSWERis for new answers to original question.Please use the formatting bar (especially the

codeoption) to present your post better. I've done it for you this time.Thank you!
Sure, will correct that in the future. Was my mistake though being I am new to using this platform. Thank you for the brief tutoring/touring around with me.