Question: How To Combine Multiple Separate Heatmaps Together
1
gravatar for chentong.biology
7.1 years ago by
chentong.biology50 wrote:

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 • 5.4k views
ADD COMMENTlink modified 7.1 years ago by Arun2.3k • written 7.1 years ago by chentong.biology50

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 REPLYlink written 7.1 years ago by Michael Dondrup46k

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 REPLYlink written 7.1 years ago by chentong.biology50
3
gravatar for Arun
7.1 years ago by
Arun2.3k
Germany
Arun2.3k wrote:

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 COMMENTlink modified 7.1 years ago • written 7.1 years ago by Arun2.3k

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 REPLYlink modified 7.1 years ago • written 7.1 years ago by Sukhdeep Singh9.8k

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 REPLYlink written 7.1 years ago by Arun2.3k

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

ADD REPLYlink written 7.1 years ago by Sukhdeep Singh9.8k

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 REPLYlink written 7.1 years ago by Arun2.3k

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

ADD REPLYlink written 7.1 years ago by Arun2.3k

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

Cheers

ADD REPLYlink written 7.1 years ago by Sukhdeep Singh9.8k

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

ADD REPLYlink written 7.1 years ago by chentong.biology50

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

ADD REPLYlink modified 7.1 years ago • written 7.1 years ago by Sukhdeep Singh9.8k

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

ADD REPLYlink written 7.1 years ago by chentong.biology50

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

ADD REPLYlink modified 7.1 years ago • written 7.1 years ago by Arun2.3k

Thanks, I solved it by using kmeans.

ADD REPLYlink written 7.0 years ago by chentong.biology50
2
gravatar for Sukhdeep Singh
7.1 years ago by
Sukhdeep Singh9.8k
Netherlands
Sukhdeep Singh9.8k wrote:

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 COMMENTlink written 7.1 years ago by Sukhdeep Singh9.8k

Great suggestions! I will try and tell.

ADD REPLYlink written 7.1 years ago by chentong.biology50
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: 1462 users visited in the last hour