[Bioc-devel] The ShortRead::chromosome function

Martin Morgan mtmorgan at fhcrc.org
Fri Dec 10 22:58:16 CET 2010

On 12/10/2010 11:25 AM, Steve Lianoglou wrote:
> Howdy,
> I'm developing a package that defines a `chromosome` function. Since
> the `setGeneric("chromosome")` is already defined in ShortRead, my
> package lists ShortRead in the Imports of the DESCRIPTION, and also
> has an importFrom(ShortRead, chromosome) in my NAMESPACE.
> I also have an exportMethods(..., chromosome, ...) in my NAMESPACE so
> that people can use this function when loading my library, but this
> function isn't actually being exported into "the works."
> I looked back at the ShortRead package, and realize that the
> `chromosome` function is not listed in the `exportMethods` clause of
> its NAMESPACE. Is this why that's happening? Shouldn't `chromosome` be
> listed in the ShortRead NAMESPACE file, anyway?

Hi Steve --

I think what is going on is that exportMethod adds your method to the
'chromosome' generic. While the 'chromosome' generic is visible inside
your package, it is not, unfortunately, available to the user. E.g., if
the user were to then library(ShortRead), my guess is they'd see your
chromosome method.

You'll want  to either re-export the generic export(chromosome) or make
the chromosome generic visible to the user by having your package
Depend: on ShortRead.

A consequence of exporting the chromosome generic is that R CMD check
will warn that you need to document it; it's not really clear what your
documentation would be -- see ShortRead::chromosome ?


> Thanks,
> -steve

Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793

More information about the Bioc-devel mailing list