Question: GSEA /enrichment plot with heat map
gravatar for IrK
4.2 years ago by
IrK50 wrote:

Hi guys, 

 I am wondering if its possible to build GSEA enrichment plots and heat maps of the same scale, exactly as it's done on the paper  (Fig 1. Gene set enrichment analysis: a knowledge-based approach for interpreting genome-wide expression profiles./Subramanian A

I produced  enrichment plots with javaGSEA Desktop Application, but I would like to have a  heat map scaled to gene set.  (Fig2 at


Thank you

rna-seq • 3.4k views
ADD COMMENTlink modified 4.2 years ago • written 4.2 years ago by IrK50

Thank you,

may be I am asking a nonsense question.... ;)

but I would like to show visually a correlation of gene sets (I have three of them) to a heat map. So I would have a heat map and then three gene sets beside. I thought may be there is a R function which will help me to make it correctly and at the right scale.However, more I search for this, more I think that it is just an image editing work without any functions ;). Probably guys from mentioned above publications, just took a heat map, than transposed enrichment plot (may be made it bigger or smaller) and presented together. ;)

and I am breaking my head how I can do it in R ;))))))

ADD REPLYlink modified 3 months ago by RamRS26k • written 4.2 years ago by IrK50

Correct me if I am wrong... You want to make a heatmap and present next to it three bars, where you indicate if a gene is in a certain gene set or not?

Like I said before, you can use heatmap.2 in R. You'll have to label all the genes for each gene set (present or not), so 3 separate labels (vectors) and use them for RowSideColors.

ADD REPLYlink written 4.2 years ago by Benn7.9k

yeah, you understood me correctly.

So you are suggesting the following (just a dummy small example):

heat_map_matrix=replicate(10,rnorm(10))    # basically its my Gen.Expr values

# According to heatmap.2 documentation:
# Create a character vector of length nrow(x) containing the color names for a vertical side bar
# Let's say I color present genes from my gene set in "Green" color, and absent genes in "Red" color


heatmap.2(heat_map_matrix, RowSideCol=labeled_gene_set, Rowv=F, Colv=T)

SO I will get a heat map and beside a colored line whether a green color indicates a presence of the gene (from gene list) and red - absence.

Its not exactly what I was looking for, but its a good solution as well.It was a perfect solution in case the RowSideCol would be just a vector of values.

However I am wondering how would you plot three gene sets beside each other, I managed only one (labeled_gene_set).

ADD REPLYlink modified 3 months ago by RamRS26k • written 4.2 years ago by IrK50

I think there's an older post about putting more bars next to the heatmap: How Do I Draw A Heatmap In R With Both A Color Key And Multiple Color Side Bars?

It's not easy, but the end results may look very nice! Good luck!

ADD REPLYlink written 4.2 years ago by Benn7.9k
gravatar for Benn
4.2 years ago by
Benn7.9k wrote:

You can use heatmap.2 in R from library(gplots), it has a RowSideColors option for sidebars.

ADD COMMENTlink written 4.2 years ago by Benn7.9k
Please log in to add an answer.


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