[Bioc-devel] best practice: dependencies of dependencies / no visible global function definition
Martin Morgan
mtmorgan at fredhutch.org
Wed Jun 24 20:27:47 CEST 2015
On 06/24/2015 10:42 AM, Michael Lawrence wrote:
> In order for R to find those symbols reliably, you need to import
> those functions into your NAMESPACE, and therefore you should ensure
yes
> that the Biobase package is listed on the Depends line of your
> DESCRIPTION. Your package directly depends on Biobase, so there's no
Hmm,
Imports: Biobase
and in the NAMESPACE
import(Biobase)
or selectively importFrom(Biobase, ...) would ensure that the symbols are always
available in your package and would eliminate the note (which should really be
stronger than that) about undefined symbols. Failing to import the symbols from
Biobase is actually closer to an error in your current package -- a package
Import'ing (not Depend'ing on) your package could invoke your function, but your
function would not see the Biobase symbols it uses. Also, without
import(Biobase) or importFrom(Biobase, ...) the user could define pData =
function(...) {}, or attach a package that defines a pData function, and this
would break your code.
Personally and more or less as a separate issue, I would Depends: Biobase (so
arriving at the same solution as Michael) to communicate to your users / fellow
developers that yes, they can expect to work with Biobase functionality when
using your package. I'd do this even if I received a NOTE: about too many
non-base packages is Depends:.
Martin
>
> On Wed, Jun 24, 2015 at 10:36 AM, Ludwig Geistlinger
> <Ludwig.Geistlinger at bio.ifi.lmu.de> wrote:
>> I'm surely not the first asking this question.
>> But as I did not find a clear answer to that (e.g. in the 'Writing R
>> extensions' manual or in the diverse posts on this), I risk asking it
>> again.
>>
>> As an example:
>>
>> I'm dealing a lot with ExpressionSets (from Biobase) and
>> GeneSet[Collection]s (from GSEABase) in my package and they are in- &
>> outputs of my exported functions, so I want them to be available when my
>> package is loaded.
>>
>> Thus, I would tend to put both, 'Biobase' and 'GSEABase', in the 'Depends'
>> field of my DESCRIPTION file and a corresponding 'import' directive in my
>> NAMESPACE file.
>>
>> However, I do know that 'GSEABase' depends on 'Biobase' - so in order to
>> be not redundant and keeping the 'Depends' field as small as possible, I
>> could also remove 'Biobase' from my 'Depends'.
>>
>> Now, everything still works fine (building, installing, and I still got
>> the ExpressionSets when loading my package), however R CMD CHECK now
>> *notes* on many occasions:
>>
>> no visible global function definition for ‘pData’
>> no visible global function definition for ‘exprs’
>> no visible global function definition for ‘fData’
>> ...
>>
>> Ok, these are NOTES, but I assume they are there for a reason.
>> So, I wonder what a developer's best practice is on that - ignoring the
>> notes, adding all Biobase/ExpressionSet functionality via imports, or
>> indeed depending on both packages.
>>
>> Best,
>> Ludwig
>>
>> --
>> Dipl.-Bioinf. Ludwig Geistlinger
>>
>> Lehr- und Forschungseinheit für Bioinformatik
>> Institut für Informatik
>> Ludwig-Maximilians-Universität München
>> Amalienstrasse 17, 2. Stock, Büro A201
>> 80333 München
>>
>> Tel.: 089-2180-4067
>> eMail: Ludwig.Geistlinger at bio.ifi.lmu.de
>>
>> _______________________________________________
>> Bioc-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M1 B861
Phone: (206) 667-2793
More information about the Bioc-devel
mailing list