How To Combine Multiple Separate Heatmaps Together
2
1
Entering edit mode
12.3 years ago

Hi, everyone

Do you known how thay get this type of pictures? Thank you!

I known seqMiner can give this type of picture, but I have to work on server(only command line available) for it will cost lots of memory. Can this be finished by R or other programming languages?

The input data format may like this, several groups of data, each group has same columns:

#                      grp1                       grp2                              grp3
Gene    1       2       3       4       1       2       3       4       1       2       3       4
a       0.1     0.2     0.3     0.4     0.1     0.2     0.3     0.4     0.1     0.2     0.2     0.4
b       0.1     0.2     0.3     0.4     0.1     0.2     0.3     0.4     0.1     0.2     0.2     0.4
c       0.1     0.2     0.3     0.4     0.1     0.2     0.3     0.4     0.1     0.2     0.2     0.4
d       0.1     0.2     0.3     0.4     0.1     0.2     0.3     0.4     0.1     0.2     0.2     0.4
e       0.1     0.2     0.3     0.4     0.1     0.2     0.3     0.4     0.1     0.2     0.2     0.4
f       0.1     0.2     0.3     0.4     0.1     0.2     0.3     0.4     0.1     0.2     0.2     0.4

enter image description here

And also when using heatmap.2 to draw heatmap for lots of data, it will take a large amount of time. Is there any fast tools to solve it?

Thank you!

heatmap • 11k views
ADD COMMENT
0
Entering edit mode

bit small picture, also this doesn't look like a heatmap. and most important: which data were used to generate this? It's hard to help out of context with contradictory information.

ADD REPLY
0
Entering edit mode

Sorry for my ambigous information. The a larger picture and sample data are attached. It is not a classical heatmap but more like color each point according to its value.

ADD REPLY
3
Entering edit mode
12.3 years ago
Arun 2.4k

This should get you started. You'll require packages ggplot2 and reshape2. I don't see any clustering here. Hope I'm right.

require(ggplot2)
require(reshape2)
x <- as.data.frame( matrix(rnorm(1200,100,35), ncol=12) )
names(x) <- paste( "g", sort(rep(1:3,4)), rep(1:4,3), sep="")
head(x)
x$id <- paste( "gene", 1:dim(x)[1], sep="")

x.m <- melt( x, c("id"), names(x)[1:12] )
x.m$grp <- c( rep("g1",400), rep("g2",400), rep("g3",400) )
x.m$grp <- factor(x.m$grp, levels=c("g1","g2","g3"), ordered=T )
x.m <- subset( x.m, select=c(grp, id, variable, value) )

p <- ggplot( data=x.m, aes(variable, id)) + geom_tile(aes(fill = value), colour = "white") + scale_fill_gradient(low = "white", high = "steelblue")
p <- p + facet_grid( .~grp, scale="free")
p

This is how it looks. You can build on this as you want. In case you don't follow, let me know. I'll try to comment the code later.

ADD COMMENT
0
Entering edit mode

Good work, but R cries when the list (before melting) > 10K-15K and with facets, launch the code and go out for a walk. Then, best is to remove the labels on y axis. Also, concerning clustering one never knows, it might be centroid :)

ADD REPLY
0
Entering edit mode

It is slow with ggplot2 on large data. True. However, I run on the cluster and continue with the other tasks. Doesn't seem to bother me so much, yet! :)

ADD REPLY
0
Entering edit mode

Are you running it on parallel nodes, which lib are you using for that or a custom code

ADD REPLY
0
Entering edit mode

Nope. For loading a data and for creating the plot using ggplot2, I don't think there's any amount of parallelism possible. For the in-betweens I use package doMC with plyr

ADD REPLY
0
Entering edit mode

I merely stated it to explain that there are no constraints on memory. Usually, the loading is faster than ggplot2 creation.

ADD REPLY
0
Entering edit mode

Yeah yeah, I got it, one can also use 'ff' for loading.

Cheers

ADD REPLY
0
Entering edit mode

Do you mean "p + opts(axis.ticks=themeblank(), axis.text=themeblank()) "?

ADD REPLY
0
Entering edit mode

yeah, just the axis.text should be axis.text.y, because x axis is fine, just y axis is cluttered up

ADD REPLY
0
Entering edit mode

Great great answer, Thanks Arun! I wonder if I can cluster data first, then do the heatmap?

ADD REPLY
0
Entering edit mode

In that case, I think you require something like this?

ADD REPLY
0
Entering edit mode

Thanks, I solved it by using kmeans.

ADD REPLY
2
Entering edit mode
12.3 years ago

Obtain coverage for your factor within certain range like +/-2.5 kb with a binsize like 50 and then load this matrix in javatree view. It should work. Save multiple plots and line them together manually or you can try comibing geomtile for heatmap generation with facetsgrid for multiple maps of the ggplot2 lib in R.

Cheers

ADD COMMENT
0
Entering edit mode

Great suggestions! I will try and tell.

ADD REPLY

Login before adding your answer.

Traffic: 2473 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