[Bioc-devel] BiocGenerics attach when GenomicFeatures imported

Hervé Pagès hpages at fredhutch.org
Tue Oct 20 08:32:03 CEST 2015


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:
> Dear Herve,
>
> Thank you for your response and apologies for not being sufficiently clear.
>
>  > 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.
>
> 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
> <mailto: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
> <mailto:hpages at fredhutch.org>> wrote:
>
>     Hi Marcin,
>
>     On 10/19/2015 05:11 AM, Marcin Cieślik wrote:
>
>         Dear Bioc Developers,
>
>         I am developing a package that depends on GenomicFeatures which
>         I am adding
>         to my package using Imports: and import(GenomicFeatures).
>         However, when I
>         use the "genes" function the "BiocGenerics" package gets
>         attached (I am not
>         adding BiocGenerics to my Depends:).
>
>
>     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.
>
>
>         Am I missing something? Why would a package be non-explicitly
>         attached?
>
>
>     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.
>
>
>         Yours,
>         Marcin
>
>         A tiny hopefully reproducible example:
>
>         download package:
>         https://drive.google.com/open?id=0B_OomVx_ca5wcEVmR3JVMWp5YTA
>         R CMD INSTALL /mctp/users/mcieslik/attch_0.0.0.9000.tar.gz
>         from R:
>         library(attch)
>         att()
>         Attaching package: ‘BiocGenerics’
>
>         The following objects are masked from ‘package:parallel’:
>         ....
>
>                  [[alternative HTML version deleted]]
>
>         _______________________________________________
>         Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org>
>         mailing list
>         https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
>
>     --
>     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 <mailto:hpages at fredhutch.org>
>     Phone: (206) 667-5791 <tel:%28206%29%20667-5791>
>     Fax: (206) 667-1319 <tel:%28206%29%20667-1319>
>
>

-- 
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