Skip to content

[Bioc-devel] BiocGenerics attach when GenomicFeatures imported

3 messages · Marcin Cieślik, Hervé Pagès

#
Hi Marcin,
On 10/19/2015 05:11 AM, Marcin Cie?lik wrote:
Not sure exactly what you mean by "use the genes() function". Do you
mean when you add an internal call to genes() in one of the functions
of your package? Are you saying that before you add that call, when you
install and load your package BiocGenerics doesn't get attached (only
loaded via a namespace), but after you add the call to genes() and
re-install and re-load your package, BiocGenerics now gets attached?
I would be surprised if that was the case.

However, if by "use the genes() function" you mean use the genes()
function in an example or in the vignette then running the example or
the code in the vignette will necessarily attach GenomicFeatures and
consequently BiocGenerics (which GenomicFeatures depends on via the
Depends field).

Please clarify in which context you "use the genes() function". Also
please show your DESCRIPTION file.
There could be several reasons for that:

- your package could depend (via the Depends field) on a package that
   depends itself (via the Depends field again) directly or indirectly
   on BiocGenerics

- one of the functions in your package could use an explicit call
   to library() or require() to attach a package that depends directly
   or indirectly (via the Depends field) on BiocGenerics

- not sure what happens exactly if your package contains a dataset
   that is a serialized instance of a class defined in a package
   that depends directly or indirectly (via the Depends field) on
   BiocGenerics, but that could be another reason or at least something
   to investigate

Hard to know exactly what's going on in your case without more
information.

Thanks,
H.

  
    
#
Dear Herve,

Thank you for your response and apologies for not being sufficiently clear.
your package BiocGenerics doesn't get attached (only
loaded via a namespace), but after you add the call to genes() and
re-install and re-load your package, BiocGenerics now gets attached?
I would be surprised if that was the case.

Almost, BiocGenerics is loaded via namespace when I load my package. When I
call a function (att from my package) that calls genes() the BiocGeneris
are attached.

1. By use the genes function I mean calling the genes function by a
function from the package I am developing. In the example package this is:

att <- function() {
    # this works fine no impicit "attach"
    txdb <- makeTxDbFromGFF(system.file("extdata", "test.gtf",
package="attch"))
    # this cause an implicit attach
    gen <- genes(txdb)
}

2. file contents:

DESCRIPTION
Package: attch
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors at R: person("First", "Last", email = "first.last at example.com", role =
c("aut", "cre"))
Description: What the package does (one paragraph).
Depends:
 R (>= 3.2.0)
Imports:
 IRanges,
 GenomeInfoDb,
 GenomicRanges,
 GenomicFeatures,
 Biostrings,
 rtracklayer
License: What license is it under?
LazyData: true

NAMESPACE
# Generated by roxygen2 (4.1.1): do not edit by hand
export(att)
import(GenomicFeatures)

3. None of the reasons you listed as causing an implicit attach seems to
apply here.

Thanks,
Marcin
On Mon, Oct 19, 2015 at 5:56 PM, Herv? Pag?s <hpages at fredhutch.org> wrote:

            

  
  
#
Hi Marcin,

Thanks for providing the details. I was able to reproduce this. The
culprit was the "range" method for CompressedIRangesList objects
defined in the IRanges package. It was attaching the XVector package
to the search path instead of loading its namespace. This is fixed in
IRanges 2.4.1 (release) and IRanges 2.5.2 (devel). If everything goes
well, both versions should become available via biocLite() on Wednesday.

Cheers,
H.
On 10/19/2015 08:26 PM, Marcin Cie?lik wrote: