How to use Mus.musculus in a package function without polluting namespace?
1
1
Entering edit mode
Shian Su ▴ 40
@shian-su-9869
Last seen 12 months ago
Walter and Eliza Hall Institute of Mediā€¦

I would like to use the following code to get exon annotation within my package

genes <-  AnnotationDbi::keys(Mus.musculus, "GENEID")
exon_data <- AnnotationDbi::select(
    Mus.musculus,
    keys = genes,
    keytype = "GENEID",
    columns = c(
        "GENEID",
        "TXID",
        "EXONCHROM",
        "EXONSTRAND",
        "EXONSTART",
        "EXONEND",
        "SYMBOL"
    )
)

However I want to do this without loading in the Mus.musculus package. Simply getting the Mus.musculus object from the package using getFromNamespace is not enough to make this work. I could library it inside the function and detach it before return, but this has the unwanted side-effect that users with Mus.musculus already loaded will find it detached after running my function.

annotation • 246 views
ADD COMMENT
2
Entering edit mode
@martin-morgan-1513
Last seen 10 weeks ago
United States

This bug has been fixed in the 'devel' branch, version 1.31.1 (available in 48 hours), where Mus.musculus::Mus.musculus now works.

It is better to ask questions about package development on the bioc-devel mailing list.

ADD COMMENT

Login before adding your answer.

Traffic: 457 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6