Hi Saurin,

 

Yes, I found your old script then I google KEGG2heatmap and I tried it.
However I got en error point out to SlotAssignment and I didn't manage
to fix it. I'm working with AB dataset (not affy) and made an annotation
library using AnnotationDbi and it works fine with probe IDs.

 

>  ls("package:AB1700sp2.db")

 [1] "AB1700sp2"              "AB1700sp2_dbconn"
"AB1700sp2_dbfile"      

 [4] "AB1700sp2_dbInfo"       "AB1700sp2_dbschema"     "AB1700sp2ACCNUM"


 [7] "AB1700sp2ALIAS2PROBE"   "AB1700sp2CHR"
"AB1700sp2CHRLENGTHS"   

[10] "AB1700sp2CHRLOC"        "AB1700sp2CHRLOCEND"
"AB1700sp2ENSEMBL"      

[13] "AB1700sp2ENSEMBL2PROBE" "AB1700sp2ENTREZID"      "AB1700sp2ENZYME"


[16] "AB1700sp2ENZYME2PROBE"  "AB1700sp2GENENAME"      "AB1700sp2GO"


[19] "AB1700sp2GO2ALLPROBES"  "AB1700sp2GO2PROBE"      "AB1700sp2MAP"


[22] "AB1700sp2MAPCOUNTS"     "AB1700sp2OMIM"
"AB1700sp2ORGANISM"     

[25] "AB1700sp2PATH"          "AB1700sp2PATH2PROBE"    "AB1700sp2PFAM"


[28] "AB1700sp2PMID"          "AB1700sp2PMID2PROBE"
"AB1700sp2PROSITE"      

[31] "AB1700sp2REFSEQ"        "AB1700sp2SYMBOL"
"AB1700sp2UNIGENE"      

[34] "AB1700sp2UNIPROT"      

 

> esetSub2 = CRCsubset_map_Q_unique

 

> esetSub2

ExpressionSet (storageMode: lockedEnvironment)

assayData: 14354 features, 50 samples 

  element names: exprs, se.exprs 

phenoData

  sampleNames: A1_PT, A17_PT, ..., A54_NT  (50 total)

  varLabels and varMetadata description:

    samplename: read from file

    assayname: read from file

    group: read from file

featureData

  featureNames: 160832, 105812, ..., 221132  (14354 total)

  fvarLabels and fvarMetadata description: none

experimentData: use 'experimentData(object)'

Annotation: AB1700sp2

 

> esetSub2X = exprs(esetSub2)

> chiptype ='AB1700sp2.db'

> envGeneNames <- AB1700sp2SYMBOL;

> envPath2Probes <- AB1700sp2PATH2PROBE;

> 

> source("R:\\gsea\\Pathway2Heatmap.R")

> # Generate Pathway Heatmap

>   All_DE_Pathway <- aafPathway(featureNames(esetSub2), chiptype);

>   unique(sapply(All_DE_Pathway, length));

 [1]  0  2  1  3  4 11  8  5  6  7 12  9 13 18 25 16 20 10 27 19 14 17
28 26 21 32 15 24

>   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

 

Error in checkSlotAssignment(object, name, value) : 

  assignment of an object of class "matrix" is not valid for slot
"Lkeys" in an object of class "AnnDbBimap"; is(value, "character") is
not TRUE

> #

 

> traceback()

12: stop(gettextf("assignment of an object of class \"%s\" is not valid
for slot \"%s\" in an object of class \"%s\"; is(value, \"%s\") is not
TRUE", 

        class(value), name, class(obj), slotClass), domain = NA)

11: checkSlotAssignment(object, name, value)

10: `slot<-`(object, name, TRUE, value)

9: `@<-`(`*tmp*`, Lkeys, value = c("155638", "105812", "193511"))

8: `Lkeys<-`(x, value)

7: `Lkeys<-`(x, value)

6: switch(as.character(direction(x)), `1` = `Lkeys<-`(x, value), 

       `-1` = `Rkeys<-`(x, value), stop("keys<- is undefined for an
undirected bimap"))

5: `keys<-`(`*tmp*`, value = c("155638", "105812", "193511"))

4: `keys<-`(`*tmp*`, value = c("155638", "105812", "193511"))

3: mget(unique(pathDEGenes), env = envGeneNames, ifnotfound = NA)

2: mget(unique(pathDEGenes), env = envGeneNames, ifnotfound = NA)

1: Pathway2Heatmap(pathID, pathFile, pathSub)

 

Any ideas what is wrong? Thanks in advance...

Lina

________________________________

From: Saurin D. Jani [mailto:saurin_jani@yahoo.com] 
Sent: Tuesday, September 01, 2009 7:55 PM
To: bioconductor@stat.math.ethz.ch; Lina Cekaite
Subject: Re: [BioC] labRow function in KEGG2heatmap



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,k
eysize=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]]

