Hi,
I am drawing some heatmaps using pheatmap following DESeq2 manual section 2.2.1. Below I have codes and my objects output and the error.
> library("pheatmap")
> select <- order(rowMeans(counts(dds, normalized = T)),
decreasing = T)[1:20]
> select
[1] 6672 6341 6665 3898 1780 6696 4512 50 2080 4181 3832
[12] 2304 4024 6671 5684 6666 6668 6283 5170 6253
> nt <- normTransform(dds)
> nt
class: DESeqTransform
dim: 6696 6
metadata(0):
assays(1): ''
rownames(6696): SPAC212.11 SPAC212.10 ...
SPMITTRNAGLU.01 SPMIT.11
rowRanges metadata column names(27): baseMean baseVar
... deviance maxCooks
colnames(6): Rep1.NoB1 Rep2.NoB1 ... Rep2.B1 Rep3.B1
colData names(2): grp sizeFactor
> log2.norm.counts <- assay(nt)[select,]
> head(log2.norm.counts)
Rep1.NoB1 Rep2.NoB1 Rep3.NoB1 Rep1.B1 Rep2.B1 Rep3.B1
SPMIT.06 18.48061 18.59110 18.57181 18.43607 18.53939 18.42969
SPCC1223.02 17.77126 17.80633 17.65893 10.25980 10.23582 11.44853
SPMIT.01 16.16548 16.06370 16.48245 15.84968 16.30330 16.46175
SPBC19C2.07 16.21655 16.16215 16.34401 16.04626 16.18888 16.36363
SPAC6G10.11c 16.19471 16.38594 16.08141 16.27448 16.19867 15.87793
SPMIT.11 16.04221 16.27445 16.34882 15.62673 16.18040 16.05569
> df <- as.data.frame(colData(dds)[,"grp"])
> df
colData(dds)[, "grp"]
1 control
2 control
3 control
4 treatment
5 treatment
6 treatment
> pheatmap(log2.norm.counts, cluster_rows = F, show_rownames = F,
cluster_cols = F, annotation_col = df)
Error in check.length("fill") :
'gpar' element 'fill' must not be length 0
Can someone give a hint on what is the source of this error? Thanks in advance!
Can you try it again after renaming the rows in df to match the column names in log2.norm.counts? I had a similar probelm, and that fixed it for me. I think pheatmap wants to match the annotation by name not by order. It would be helpful to me to know if this is the case.
I had the same error and this worked for me.
I also had the error message mentioned above. My issue was resolved when I updated the row.names of the df passed to annotation_col to match the colnames in the df being plotted. As mentioned above I guess pheatmap uses the row.names to lookup which columns this metadata relates to.
I'm having the same issue and understand how it needs to be resolved, but how exactly did you update the rownames in the df (as in the example above) passed to annotation_col to match colnames?