Hi Lina,
I wrote this long time ago but it still works great. It will generate all heatmaps automatically. If only one Gene is involved in KEGG pathway..it will generate DOT plot with that gene's intensity.

# Input: expression matrix, chip environments
# output: heatmaps of all the pathways for all the genes in expression matrix

#About Pathway to HEATMAP

# Variable explanation:

# esetSub2 = expression matirx
# esetSub2X = exprs(esetSub2)
# chiptype = annotation found from GeneChip, here 'hgu95a'
# envPath2Probes = Environment
# e.g.
# envGeneNames <- hgu95aGENENAME;
# envPath2Probes <- hgu95aPATH2PROBE;


# Generate Pathway Heatmap
  All_DE_Pathway <- aafPathway(featureNames(esetSub2), chiptype);
  unique(sapply(All_DE_Pathway, length));
  pathlist <- do.call("c", All_DE_Pathway);
  pathL <- length(pathlist);
  pathmatrix <- sapply(pathlist, attributes);
  pathnamesX <- unique(t(pathmatrix));
  kegg <- as.list(envPath2Probes);
  pathRow <-  as.numeric(nrow(pathnamesX));
  if(pathL >=1)
  {
    for(i in 1:pathRow)
    {
      pathID <- pathnamesX[,"id"][i];
      pathID <- as.character(unlist(pathID));

      pathName <- as.character(unlist(pathnamesX[,"name"][i]));
      pathName <- trimWhiteSpace(pathName);
      pathName <- sub("/", "_", pathName);
      pathName <- sub(" ", "_", pathName);
      pathName <- sub("  ", "_", pathName);
      pathName <- sub("   ", "_", pathName);
      pathName <- sub(" ", "_", pathName);
      pathName <- sub("-", "_", pathName);
      pathFile <- paste("Pathway",pathName,".jpeg",sep = "_");
      pathSub <- paste(pathName,"Legend: Red = High, Blue = Low, White =
Medium",sep = "  ");
      pathSub <- paste("Date of Analysis:",date(),pathSub,sep = "  ");

      Pathway2Heatmap(pathID,pathFile,pathSub); # check out the function below
    }

  } # if ends here
#

###########################################################
Pathway2Heatmap <- function(pathway,file,Hsub)
{

  kegg <- as.list(envPath2Probes);
  pathProbes <- as.matrix(kegg[[pathway]]); # genes extracted from pathway
  esetSub2Genes <- as.matrix(featureNames(esetSub2));

  temp <- as.matrix(rbind(unique(esetSub2Genes),unique(pathProbes)));
  temp1 <- as.matrix(temp[ as.matrix(duplicated(temp,))]);

  exp2 <- esetSub2[temp1];
  exp2X <-  exprs(exp2);

  pathDEGenes <- as.matrix(featureNames(exp2));
  pathDEGeneNames <- mget(unique(pathDEGenes),env = envGeneNames,ifnotfound="No
Annotation For this Probe");

  row.names(exp2X) <- pathDEGeneNames;
  colnames(exp2X) <- samples;

  if (nrow(exp2X) > 1)
  {
    jpeg(filename= file,width=2000,height=2000);
    row.dist <- as.dist(1 - cor(t(exp2X)));
    Hsub <- c("Generated by EXAMPLE");
    gmpalette <- bluered(64);

heatmap.2(exp2X,col=gmpalette,Colv= FALSE,Rowv =
as.dendrogram(hclust(row.dist,method="centroid")),scale="row",key=TRUE,keysize=0.60,symkey=FALSE,density.info="none",trace="none",margins=c(5,85),cexRow=1,cexCol=1,
sub=Hsub,cex.sub=1);

dev.off(which = dev.cur());

    print("Pathway Heat map done");
  }#if

####
 if(nrow(exp2X) == 1)
  {

  dotchart(exp2X);
  p_t <- paste(Hsub,"Gene:",pathDEGeneNames,sep = " ");
  title(sub = p_t,cex.sub = 1);
  dev.off();
 }
#####

}#pathway2heatmap
###########################################################

Saurin

--- On Tue, 9/1/09, Lina Cekaite <Lina.Cekaite@rr-research.no> wrote:

From: Lina Cekaite <Lina.Cekaite@rr-research.no>
Subject: [BioC] labRow function in KEGG2heatmap
To: bioconductor@stat.math.ethz.ch
Date: Tuesday, September 1, 2009, 1:10 PM

Hi,



I wonder if anyone has used labRow function with success in
KEGG2heatmap? I want to have GeneSymbols instead of ProbeIds on a
heatmap. I manage to get the heatmap with GeneSymbols by using mget
function however they were missmapped and didn't match the probeIds. 



geneSymbl <- mget(featureNames(CRCsubset_map_Q_unique),
envir=AB1700sp2SYMBOL)



KEGG2heatmap("05210", CRCsubset_map_Q_unique, data = "AB1700sp2", 

cexRow=0.6, cexCol=1, col=map_colour, xlab="Samples", ylab="Genes",
labRow=geneSymbl, 

ColSideColors=colr,main=paste("KEGG pathway:Colorectal cancer") )



Is there anyway that I can heatmap&geneSymbols without getting back to
kegg pathway, making kegg-eset and using labRow in heatmap2? Thanks for
any help.



Lina


    [[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



      
	[[alternative HTML version deleted]]

