[BioC] heatmap.2 question - plotting gene expression ordered by a vector

Sean Davis sdavis2 at mail.nih.gov
Thu Sep 4 23:52:15 CEST 2008


On Thu, Sep 4, 2008 at 5:29 PM, Iain Gallagher
<iaingallagher at btopenworld.com> wrote:
> Hi List.
>
> I have question I hope someone can help me with. I have a matrix of gene expression results and I would like to generate a heatmap with each gene plotted in the order of a vector (specifically a biological parameter that all the genes co vary with). I've been wrestling with this for a couple of days now and I'm not sure my approach is right.
>
> z_mat is my matrix - samples in columns and genes in rows.
>
> max_resp is my biological parameter - a vector of values (1 for each subject).
>
> What I'd like is a gradient of expression for each gene (ideally)... the expression values do generally increase as max_resp increases. But I can't seem to get this and my heatmaps seem messier than they should be.
>
> Is there a way to order the rows (gene expression values) of the heatmap to reflect the order of the max_resp vector?
>
> For example I've tried:
>
> max_order<-order(change_data[,2])
>
> to set a vector reflecting the order of the max_resp parameter from lowest to highest
>
>  heatmap.2(z_mat, col=heatcols, Colv=max_order, labCol=change_data[,2][max_order])
>
> but the labeling (labCol) is not in order (i.e. max_order) and the colour gradient does not reflect my data (i.e. generally good correlation of gene expression and max_resp).
>
> My understanding of the heatmap.2 help is that setting Colv (or Rowv) to a vector reorders the dendrogram to the vector order... my understanding is likely flawed.

You need to at least turn off row dendrograms; you cannot arbitrarily
reorder a dendrogram.  However, I remember that there were some bugs
with heatmap.2 in the past that precluded the row ordering from
working correctly (i.e., vector order if dendrogram was not used).  I
haven't checked recently to see if that is still the case.

Hope that helps.

Sean



More information about the Bioconductor mailing list