[BioC] How to load annotation package dynamically?

James W. MacDonald jmacdon at med.umich.edu
Mon Nov 12 15:13:19 CET 2007

Hi Chanchal,

Chanchal Kumar wrote:
> Dear Bioconductor Developers and Users,
>   I have created few annotation packages which are for organism specific
> proteomics database from IPI(http://www.ebi.ac.uk/IPI/IPIhelp.html) .
> Now I am keen on writing a generic utility function for GO enrichment
> using "GOStats". The input to the function would be 1) the test list of
> IPI ids, 2) The universe set and 3) the Annotation package to be used.
> I can see from the Affymetrix microarray analysis modules that given a
> CEL file for any platform the function (say mas5(), or gcrma()) loads
> the appropriate package dynamically and the user doesn't have to worry
> about specifying the platform the data belongs to. Also the probes etc
> are matched automatically. I want to do something similar so that the
> user doesn't have to worry about mapping the IPIs to the Entrez ids etc.
> I should mention that the packages I created have mappings to ENTREZ and
> GO etc.
> I am aware that this is an abstract request but hope I have explained my
> problem in quite some detail. I will be thankful if you could suggest an
> elegant way to replicate that functionality. I am kind of lost in all
> the code. Any insights will be very helpful.

Assuming the package is already installed (the affy package will also 
install missing packages from BioC), all you really need is something like:

require(thepackagename, quietly = TRUE, character.only = TRUE) ||
stop(paste("The package", thepackagename, "needs to be installed first."))

There is quite a bit of other code in the affy package for automatic 
loading of packages, but the use case there is much more complicated.



> Thanks in advance!
> Best Regards,
> Chanchal 
> ===============================
> Chanchal Kumar, Ph.D. Candidate
> Dept. of Proteomics and Signal Transduction
> Max Planck Institute of Biochemistry
> Am Klopferspitz 18
> 82152 D-Martinsried (near Munich)
> Germany
> e-mail: chanchal at biochem.mpg.de
> Phone: (Office) +49 (0) 89 8578 2296
> Fax:(Office) +49 (0) 89 8578 2219
> http://www.biochem.mpg.de/mann/
> ===============================
> _______________________________________________
> 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

James W. MacDonald, M.S.
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109

More information about the Bioconductor mailing list