[BioC] NAMESPACES, export, and unit tests

James W. MacDonald jmacdon at med.umich.edu
Mon May 1 22:16:04 CEST 2006


Hi Paul,

Paul Shannon wrote:
> Hi all,
> 
> In a package ('gaggle') I am about to submit to Bioc, I have
> run into a small problem.
> 
>     1) In inst/unitTests/gaggleTest.R I call two functions from gaggle.R
>        which are otherwise hidden.
> 
>             .gaggleNetworkToGraphNEL
>             .graphNELtoGaggleNetwork
> 
>        It is very helpful to call these methods in gaggleTest, since  
> their
>        proper operation is crucial for the gaggle package.
> 
>     2) Now that I am using NAMESPACES, it seems I can't call
>        these methods in gaggleTest.R unless they are explicitly  
> exported from
>        gaggle.R
> 
>     3) But if I do export them, then they (along with the .Rd files I  
> would then
>        need to create) would be visible to regular users; that seems
>        like a bad idea.
> 
> Is there any other way to make these two functions available to the  
> unitTest
> program?  

There may be a more elegant solution, but one way would be to use the 
triple colon operator:

gaggle:::.gaggleNetworkToGraphNEL

will make this function available.

HTH,

Jim


Anything, perhaps, like the C++ friend construct, or the Java
> convention of allowing multiple classes in the same package access to  
> otherwise-hidden
> methods?
> 
> Thanks -
> 
>    Paul Shannon
> 
> _______________________________________________
> 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.
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