Thanks for reminding me of your link.

I'm still trying to figure out if there's a simple solution to figuring out
if the cluster assigned to say "1" or "2" is associated with the left or
right of the heatmap, after the dendrogram has been reordered.

A clunky solution to this is:

hcc <-hclust(cor.dist(t(active.matrix))) #where cor.dist is a distance
function
ddc <- as.dendrogram(hcc)

ColV <- colMeans(active.matrix)

ddc <- reorder(ddc,ColV)
reordered.labels <- labels(ddc)

 category<-data.frame(as.numeric(cutree(hcc,k=2)))

And then use the reordered.labels vector to figure out the cluster that's
"1" or "2" in the category data.frame

Thanks,
Andrew

On 5/28/07, Thomas Girke <thomas.girke@ucr.edu> wrote:
>
> Andrew,
>
> If I understand you correctly, then the hclust components 'labels' and
> 'order' contain
> the information you are looking for. Below is a short example that
> illustrates how to
> access this data. More details on this topic including dendrogram coloring
> utilities
> can be found on this page:
>
> http://faculty.ucr.edu/~tgirke/Documents/R_BioCond/R_BioCondManual.html#R_clustering
>
> # Generate a sample hclust object and plot it with heatmap
> y <- matrix(rnorm(50), 10, 5, dimnames=list(paste("g", 1:10, sep=""),
> paste("t", 1:5, sep="")))
> hr <- hclust(as.dist(1-cor(t(y), method="pearson")), method="complete")
> hc <- hclust(as.dist(1-cor(y, method="spearman")), method="complete")
> heatmap(y, Rowv=as.dendrogram(hr), Colv=as.dendrogram(hc), scale="row")
>
> # Print the dendrogram labels (hr) in the order they appear in the tree.
> hr$labels[hr$order]
>
> # Cut the row tree by height level
> mycl <- cutree(hr, h=max(hr$height)/1.5)
>
> # Print the obtained cluster numbers in tree order
> mycl[hr$order]
>
> # Plot the heatmap with color bar where the row colors correspond to the
> obtained clusters
> mycol <- sample(rainbow(256)); mycol <- mycol[as.vector(mycl)]
> heatmap(y, Rowv=as.dendrogram(hr), Colv=as.dendrogram(hc), scale="row",
> RowSideColors=mycol)
>
>
>
> Thomas
>
>
> On Sun 05/27/07 22:22, Andrew Yee wrote:
> > I've been using heatmap(), hclust(), and cutree(), and I'm trying to
> figure
> > out the column labels of the left (as opposed to the right) cluster.
> >
> > Using cutree(x, k=2), I get two clusters labeled 1 and 2.  How do you
> figure
> > out if cluster 2 is the one associated with the left cluster on the
> heatmap
> > (instead of manually going to the heatmap)?
> >
> > Thanks,
> > Andrew
> >
> > Andrew Yee, MD
> > MGH Cancer Center
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > Bioconductor mailing list
> > Bioconductor@stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/bioconductor
> > Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
> >
>
> --
> Dr. Thomas Girke
> Assistant Professor of Bioinformatics
> Director, Bioinformatics Facility
> Center for Plant Cell Biology
> Department of Botany and Plant Sciences
> 1008 Noel T. Keen Hall
> University of California
> Riverside, CA 92521
>
> E-mail: thomas.girke@ucr.edu
> Website: http://faculty.ucr.edu/~tgirke
> Ph: 951-827-2469
> Fax: 951-827-4437
>

	[[alternative HTML version deleted]]

