[BioC] namespace and other developer tools

James W. MacDonald jmacdon at med.umich.edu
Thu Dec 14 16:03:15 CET 2006

Hi Naomi,

Naomi Altman wrote:
> I have also been foiled by the sophistication of Bioconductor code.
> Is there a manual that explains namespace and other code-hiding tools 
> (.e.g generic functions) that would provide some guidance.
> The beauty of R is that I can hack - when I can find the code.

I don't know of any manual that covers the topic, but there are only a 
few things you really need to know to find things.


General description:

R manual info:
See section 1.6

To find/see/use methods in a namespace

For example:

 > t.test
function (x, ...)
<environment: namespace:stats>

Not very useful.

 > methods("t.test")
[1] t.test.default* t.test.formula*

    Non-visible functions are asterisked

Getting closer.

 > stats:::t.test.default

Will show the function.

S4 methods


Finding things:


In particular the includeDefs argument.

For example:

 > library(GOstats)
 > hyperGTest
standardGeneric for "hyperGTest" defined from package "Category"
   defined with value class: "HyperGResultBase"

function (p)
.valueClassTest(standardGeneric("hyperGTest"), "HyperGResultBase",
<environment: 0x039c1314>
Methods may be defined for arguments: p

Not very helpful.

 > showMethods("hyperGTest", includeDefs=T)

Will show the function(s)

As many BioC packages use both S4 methods and a namespace, you often 
need to use a combination of the two in order to find things.



> Thanks,
> Naomi

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

Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.

More information about the Bioconductor mailing list