[BioC] labeling a hclust tree with custom labels

Mikhail, Amy a.mikhail at abdn.ac.uk
Sat Mar 29 13:39:36 CET 2008


Hi Iain,

I'm guessing that the labels currently coming up on hclust are the names
of your .cel files?  If your expressionset is called my.expressionset,
and your desired sample names for images are "Control 1" etc, you could
just do:

sampleNames(my.expressionset) <- c("Control 1", "Control 2", "Control
3", "Treatment 1", "Treatment 2", "Treatment 3")

Nb1. You would have to follow the same order for the new sample names as
the order of columns in your expressionset.  If you have a lot of files
and already have a vector of your preferred sample names (in the right
order) you could just put that in instead of the list above and it would
be even faster ;-)

Nb2. Anything else you do after this code will now show your preferred
sample labels instead of the .cel file names.

Hope that helps,

Best wishes,
Amy

------------------------------------------------------------------------
--------------------------------------- 

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


The University of Aberdeen is a charity registered in Scotland, No SC013683.



More information about the Bioconductor mailing list