[BioC] Annotation.db: how automatically call a mapping?
P.D. Moerland
P.D.Moerland at amc.uva.nl
Mon Jun 29 22:06:43 CEST 2009
Dear Guido,
A few weeks back I was struggling with the same problem and came up with this solution:
makeMapping <- function(annotPkg,str="SYMBOL",ids){
do.call(library,list(annotPkg))
annotPkg = sub(".db","",annotPkg)
f = function(x) mget(ids,x,ifnotfound=NA)
annot = do.call(f,list(get(paste(annotPkg,str,sep=""))))
return(annot)
}
Just as an example:
> makeMapping("moe430a.db",str="SYMBOL",ids=c("1415670_at","1415671_at"))
$`1415670_at`
[1] "Copg"
$`1415671_at`
[1] "Atp6v0d1"
best,
Perry
---
Perry Moerland, PhD
Room J1B-206, Bioinformatics Laboratory
Department of Clinical Epidemiology, Biostatistics and Bioinformatics
Academic Medical Centre, University of Amsterdam
Postbus 22660, 1100 DD Amsterdam, The Netherlands
tel: +31 20 5664660
p.d.moerland at amc.uva.nl, http://www.amc.uva.nl/
----- Original Message -----
From: "Hooiveld, Guido" <Guido.Hooiveld at wur.nl>
Date: Monday, June 29, 2009 9:43 pm
Subject: [BioC] Annotation.db: how automatically call a mapping?
To: bioconductor at stat.math.ethz.ch
> Hi,
>
> I am facing a problem i cannot solve myselves, despite everything i
> read/know. But i assume the solution is easy for the more knowledgable
> folks in BioC/R...
>
> This does work:
> > library(moe430a.db)
> > xxyy <- moe430aSYMBOL
> > xxyy
> SYMBOL map for chip moe430a (object of class "AnnDbBimap")
>
> However, for this to work you need to know the array type of the data
> that is analyzed.
>
>
> Now i would like to automatically extract the (e.g.) SYMBOL mapping from
> an annotation.db, thus by retrieving the array type from the eset.
>
> > library(affy)
> > eset <- rma(data)
> > probeids <- featureNames(eset)
> > annotation(eset)
> [1] "moe430a"
>
> But how can i use this info to properly call the SYMBOL mapping?
>
> I tried this:
> > arraytype <- annotation(eset)
> > arraytype <- paste(arraytype, "db", sep = ".")
> > arraytype
> [1] "moe430a.db"
> > arraytype <- paste("package", arraytype, sep = ":")
> > gh <- ls(arraytype)
> > gh
> [1] "moe430a" "moe430a_dbconn" "moe430a_dbfile"
> "moe430a_dbInfo" "moe430a_dbschema" "moe430aACCNUM"
> "moe430aALIAS2PROBE" "moe430aCHR" "moe430aCHRLENGTHS"
> "moe430aCHRLOC"
> [11] "moe430aCHRLOCEND" "moe430aENSEMBL"
> "moe430aENSEMBL2PROBE" "moe430aENTREZID" "moe430aENZYME"
> "moe430aENZYME2PROBE" "moe430aGENENAME" "moe430aGO"
> "moe430aGO2ALLPROBES" "moe430aGO2PROBE"
> [21] "moe430aMAP" "moe430aMAPCOUNTS" "moe430aMGI"
> "moe430aMGI2PROBE" "moe430aORGANISM" "moe430aPATH"
> "moe430aPATH2PROBE" "moe430aPFAM" "moe430aPMID"
> "moe430aPMID2PROBE"
> [31] "moe430aPROSITE" "moe430aREFSEQ" "moe430aSYMBOL"
> "moe430aUNIGENE" "moe430aUNIPROT"
>
> > gh[33]
> [1] "moe430aSYMBOL"
> >
> > symbols <- mget(probeids, gh[33])
> Error in mget(probeids, gh[33]) : second argument must be an environment
>
> This also doesn't work:
> > symbols <- mget(probeids, envir=gh[33])
> Error in mget(probeids, envir = gh[33]) :
> second argument must be an environment
>
> My approach thus is the wrong approach to automatically extract mappings
> from a annotation.db.
> Since i don't know about any other possibility, i would appreciate if
> someone could point me to a working solution.
>
> Thanks,
> Guido
>
>
> ------------------------------------------------
> Guido Hooiveld, PhD
> Nutrition, Metabolism & Genomics Group
> Division of Human Nutrition
> Wageningen University
> Biotechnion, Bomenweg 2
> NL-6703 HD Wageningen
> the Netherlands
> tel: (+)31 317 485788
> fax: (+)31 317 483342
> internet:
> email: guido.hooiveld at wur.nl
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
More information about the Bioconductor
mailing list