[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.
____________________
NAMESPACE
____________________
General description:
http://en.wikipedia.org/wiki/Namespace_%28computer_science%29
R manual info:
http://cran.r-project.org/doc/manuals/R-exts.html
See section 1.6
To find/see/use methods in a namespace
?methods
?'::'
For example:
> t.test
function (x, ...)
UseMethod("t.test")
<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
____________________
http://www.bioconductor.org/developers/progRef/S4Objects.pdf
Finding things:
?showMethods
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",
"hyperGTest")
<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.
Best,
Jim
> Thanks,
> Naomi
>
--
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
**********************************************************
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