[Bioc-devel] Please help us minimize the dependencies between packages

Henrik Bengtsson hb at stat.berkeley.edu
Mon Aug 27 21:08:27 CEST 2007


Hi,

at the recent BioC2007 developers meeting, we discussed how we could
make the package dependencies more light-weight (resulting in easier
maintenance, smaller downloads, and more reused code).  We agreed that
one way to achieve this is to move packages from Depends to Suggests
in your DESCRIPTION file, whenever possible.  A package under Suggests
does not have to be installed in order to install and load your
package.  Note that such packages will still be needed by R CMD check
so package testing/validation will remain the same.

Here are some guidelines that we would appreciate developers to consider:

1) Move all annotation data packages and all experiment data packages
to DESCRIPTION/Suggests.  The 'Suggests' field uses the same syntax as
'Depends' and lists packages that are not necessarily needed.

1a) It is often the case that experiment data packages are loaded by
Rd examples.  If so, examples need to be updated as:

  if (require("<package>")) {
     <your old example code here>
  }

This will give the user the option to download and install the needed
package(s), if they want to run the example.

1b) Functions that are using annotation data packages (and/or
experiment data packages) need to be updated as:

myFunction <- function(...) {
  require("<package>") || stop("Package '<package>' was not found and
needs to be installed.'')

  <your old code here>
}

The load of annotation data package may also be conditional, e.g.
using if-else or switch statements.  Again, this will give the user
the option to install only those package needed.


2) If you have a function that is rarely called but contains code that
depends on another package, you might consider to apply (1b) to these
functions as well.  This will allow other developers to use parts of
your package without having to enforcing extra dependencies on their
users. There are many examples of Bioconductor packages where this
could be applied.

The above indeed is already suggested in Section "The DESCRIPTION
file" in "Writing R Extensions".

Best,

Henrik Bengtsson
UC Berkeley



More information about the Bioc-devel mailing list