Question: Why some rows are deleted from the heat map created
0
gravatar for UDAY.AGRI123
3 months ago by
UDAY.AGRI12310
UDAY.AGRI12310 wrote:

Image link https://ibb.co/zhHbMyL

I am using heatmap3 to create heatmap. I have 77 rows and 10 columns in reality but getting heatmap with only 38 rows with 10 columns. my code is as below

x <- Heatmap_data

x

y <- as.matrix(Heatmap_data)

y

class(x)

class(y)

library(heatmap3)

nrow(y)

ncol(y)

heatmap3(y, Rowv = NULL, Colv = NULL,
         distfun = function(y) as.dist(1 - cor(t(y), use = "pa")), balanceColor = F, showColDendro = T, showRowDendro = F,
         col = colorRampPalette(c("white", "firebrick3"))(1024),
         method = "complete", ColAxisColors = 0,
         RowAxisColors = 0, hclustfun = hclust, reorderfun = function(d, w)
           reorder(d, w), symm = FALSE, scale = c("none"),
         ColSideWidth = 0.4, file = "heatmap3.pdf", topN = NA, filterFun = sd,
         returnDistMatrix = FALSE, margins = c(5, 5), cexRow = 0.2 + 1/log10(nrow(y)), cexCol = 0.2 +
           1/log10(ncol(y)), lasRow = 2, lasCol = 2, labRow = NULL,
         labCol = NULL, main = NULL, xlab = NULL, ylab = NULL,
         keep.dendro = FALSE, verbose = getOption("verbose"), useRaster = if
         (ncol(y) * nrow(y) >= 50000) TRUE else FALSE)

my data (truncated) looks like below (10 columns & 77 rows). Values are protein identities.

ORFs Aspergillus_nidulans Batrachochytrium_dendrobatidis Bifiguratus_adelaidae Botrytis_cinerea

STRG.198.1 55 0 0 39.394

STRG.428.1 86.301 88.889 87.302 90.411

STRG.1138.5 69.231 56.338 0 64.368

R • 256 views
ADD COMMENTlink modified 3 months ago by Kevin Blighe63k • written 3 months ago by UDAY.AGRI12310
1

Many programs that do this kind of analysis have an option to remove "flat" data points, which are rows where there is not much difference between samples. I don't use R, but my guess is that filterFun = sd could be doing that. Even if that's not the case, looking into what rows are removed and what they have in common could help you figure this out.

ADD REPLYlink written 3 months ago by Mensur Dlakic6.0k

How to add figures: How to add images to a Biostars post

ADD REPLYlink written 3 months ago by Asaf8.3k

are you trying to log transform values of 0?

ADD REPLYlink written 3 months ago by N15120

I am not doing that, you can see how my data looks like in updated post. All numeric data is protein identity values and first column is gene names.

ADD REPLYlink written 3 months ago by UDAY.AGRI12310

Do you see any errors or warnings?

ADD REPLYlink written 3 months ago by RamRS28k

I am not seeing any errors or warnings, simply the nice and beautiful output figure is popping up.

ADD REPLYlink written 3 months ago by UDAY.AGRI12310

Please provide minimal dataset for reproducibility.

ADD REPLYlink written 3 months ago by nlehmann100

What do you mean by that ? are you saying to give my data to see how it looks or anything else you meant?

ADD REPLYlink written 3 months ago by UDAY.AGRI12310
1

No, you don't have to share your data. I mean that

ADD REPLYlink written 3 months ago by nlehmann100
3
gravatar for Kevin Blighe
3 months ago by
Kevin Blighe63k
Kevin Blighe63k wrote:

Hey Uday, there is no error here, per se. This was a relatively recent introduction in R whereby certain plotting functions now intelligently only show as many labels as can be reasonably read by the viewer.

We can replicate this 'issue' by simply modifying the size of the row [gene] names:

require(heatmap3)

mat <- matrix(rexp(2000, rate = 0.1), ncol = 20)
rownames(mat) <- paste0('gene', 1:nrow(mat))
colnames(mat) <- paste0('sample', 1:ncol(mat))

dev.new(width = 10, height = 8)
heatmap3(mat, cexRow = 3)

a

dev.new(width = 10, height = 8)
heatmap3(mat, cexRow = 1)

b

Kevin

ADD COMMENTlink written 3 months ago by Kevin Blighe63k
1

Hi Kevin,

It is so simple, ate my time like anything, hehehe!!! Thanks, and much appreciated for your time in replying.

Uday

ADD REPLYlink modified 3 months ago by RamRS28k • written 3 months ago by UDAY.AGRI12310

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.
Upvote|Bookmark|Accept

ADD REPLYlink written 3 months ago by genomax87k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 674 users visited in the last hour