[BioC] heatmap.2 question - plotting gene expression ordered by a vector
Yannick Wurm
yannick.wurm at unil.ch
Mon Jul 27 18:06:48 CEST 2009
Hi all,
here's a quick reply to an old thread:
I also have the feeling heatmap.2 row ordering without using a
dendrogram does not work (even with R 2.9 & latest Bioc).
# My workaround is to change the order of rows in the gene expression
input matrix
toPlot = toPlot[order(rownames(toPlot)),]
# then I run heatmap.2 while telling it not to reorder rows...
heatmap.2(toPlot, Rowv=FALSE, dendrogram="none")
best,
Yannick
--------------------------------------------
yannick . wurm @ unil . ch
Ant Genomics, Ecology & Evolution @ Lausanne
http://www.unil.ch/dee/page28685_fr.html
On September 4th 2008, Sean Davis wrote:
> 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
> Iain Gallagher 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.
>>
>> Could someone give me some advice?
>>
>> Thanks.
>>
>> Iain
>>
>> sessionInfo()
>> R version 2.7.2 (2008-08-25)
>> i486-pc-linux-gnu
>>
>> locale:
>> LC_CTYPE
>> =
>> en_GB
>> .UTF
>> -8
>> ;LC_NUMERIC
>> =
>> C
>> ;LC_TIME
>> =
>> en_GB
>> .UTF
>> -8
>> ;LC_COLLATE
>> =
>> en_GB
>> .UTF
>> -8
>> ;LC_MONETARY
>> =
>> C
>> ;LC_MESSAGES
>> =
>> en_GB
>> .UTF
>> -8
>> ;LC_PAPER
>> =
>> en_GB
>> .UTF
>> -8
>> ;LC_NAME
>> =
>> C
>> ;LC_ADDRESS
>> =C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>>
>> other attached packages:
>> [1] RColorBrewer_1.0-2 gplots_2.6.0 gdata_2.4.2
>> gtools_2.5.0
More information about the Bioconductor
mailing list