[Bioc-devel] Importing classes into NAMESPACE

Hervé Pagès hpages at fredhutch.org
Thu Feb 26 20:40:43 CET 2015

Hi Karolis,

On 02/25/2015 09:02 AM, Karolis Uziela wrote:
> Thank you for your help everyone! Importing constructors separately (as
> Thomas suggested), has solved the problem.
> @Gabe: I am not using any methods from Biobase, GenomicRanges
> and S4Vectors. I am only using their constructors. Does it mean that I can
> skip importing the classes and only import the constructors? Or did you
> have something else in your mind?

If you really don't do anything with the objects returned by the
GRanges(), Rle(), or IRanges() constructors, that is, you either return
them directly to the user or pass them as input to other functions (not
methods), and if you don't define yourself methods for these classes,
I think you can skip importing the classes. However, as Gabe pointed
out, the cherry-picking game is generally not worth it and will often
turn out to be counter-productive.


> I thought it is better to avoid importing whole packages, especially if
> they are large. Or do you have some arguments, why I should do that?
> Regards,
> Karolis
> On Wed, Feb 25, 2015 at 3:31 PM, Gabe Becker <becker.gabe at gene.com> wrote:
>> Karolis,
>> Do you really not need any of the methods for GRanges and ExpressionSet
>> objects? import(GenomicRanges) might be better, even though the package
>> isn't exactly small.
>> ~G
>> On Wed, Feb 25, 2015 at 6:27 AM, Thomas Sandmann <sandmann.thomas at gene.com
>>> wrote:
>>> Hi Karolis,
>>> These classes have constructor functions of the same name as the class.
>>> For
>>> example, the constructor function for GRanges is called GRanges().
>>> If you use the constructors you need to import them separately, e.g.
>>> importFrom GenomicRanges GRanges
>>> Best,
>>> Thomas
>>>          [[alternative HTML version deleted]]
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>> --
>> Gabriel Becker, Ph.D
>> Computational Biologist
>> Genentech Research

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the Bioc-devel mailing list