Issues with Pheatmap
1
0
Entering edit mode
axe880 • 0
@172ed42b
Last seen 2.6 years ago
United Kingdom

Hi everyone,

Generating a pheatmap for my analysis. Everything is going to plan except for the colouring of the map itself - only some samples are being coloured whilst the rest are blank.

Here is my script:

sampledist <- dist(t(assay(vsd)), method = "euclidean")
sampledist_matrix <- as.matrix(sampledist)
colors <- colorRampPalette(rev(brewer.pal(9, "YlGnBu")))(255)

Specify colours for experimental design annotations:

variety_clr <- brewer.pal(3, "Set3")[c(1,3)]
names(variety_clr) <- unique(coldata$Variety)
time_clr <- brewer.pal(4, "Set1")
names(time_clr) <- unique(coldata$Time)
annotation_colours <- list(Tissue = c(Leaf = "forestgreen", Root = "red"),
                           Variety = variety_clr, Time = time_clr)
# plot
phm_ed <- pheatmap(sampledist_matrix,
                   clustering_distance_rows=sampledist,
                   clustering_distance_cols=sampledist,
                   clustering_method = "average",
                   treeheight_row = 80,
                   treeheight_col = 80,
                   annotation_col = coldata[2:4,],
                   annotation_row = coldata[2:4,],
                   annotation_colors = annotation_colours,
                   show_rownames = TRUE,
                   show_colnames = FALSE,
                   cellwidth = 15,
                   cellheight = 15,
                   cutree_rows = 2,
                   cutree_cols = 2,
                   col=colors,
                   fontsize = 12,
                   border_color = "black")

enter image description here

If anyone could shed any light as to why this might be I would appreciate the help.

Thanks in advance

pheatmap • 2.5k views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

These two lines select only three rows:

annotation_col = coldata[2:4,],
                   annotation_row = coldata[2:4,],

Where I would imagine you meant to choose those three columns instead?

ADD COMMENT
0
Entering edit mode

Does the ":" between the 2 and the 4 not select for columns 2, 3, and 4? That was my impression but I am new to this. What would the alternative be if not this? Thanks!

ADD REPLY
1
Entering edit mode

It does select for 2, 3, and 4. But [2:4,] is rows 2-4. If you want columns, it's [,2:4]. Note which side of the comma the range is on.

ADD REPLY
0
Entering edit mode

Ah great I see - I've managed to solve this issue now. Thanks again.

ADD REPLY

Login before adding your answer.

Traffic: 460 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6