[BioC] labeling a hclust tree with custom labels

Sean Davis sdavis2 at mail.nih.gov
Fri Mar 28 15:42:14 CET 2008


On Fri, Mar 28, 2008 at 10:26 AM, IAIN GALLAGHER
<iaingallagher at btopenworld.com> wrote:
> Hi All.
>
>  I am clustering affymetrix expression data using hclust. I would like to label the tree with the sample name and group from which the sample comes from. I can generate a vector of labels from my phenoData slot
>
>  eg
>
>  graph_labels <- paste(pData(rma_data)$group, pData(rma_data)$label, sep=' : ')
>
>  but I can't get them to sit on the right branches using
>
>  plot (clust, labels = graph_labels).
>
>  I suspect this has to do with the labeling in the dist object.
>
>  I was wondering if there was a way to change the labels in the dist object to reflect my preferred labeling or a way to quickly re-order my preferred labeling vector to match that of the dist object.
>

Hi, Iain.

What you are showing looks to be the correct way to go about things.
The labels will be reordered as necessary, I believe.  However, since
we cannot see how you created the "clust" object, it is impossible to
tell where the problem might be.  Only after you post all the relevant
code can anyone really help you.  Also, it is a really good idea to
post the output of sessionInfo() for every question to the list.  Even
if it isn't important, no one will ever fault you for doing so.

Sean



More information about the Bioconductor mailing list