Question: getBSgenome{Bsgenome}: avoid attaching BiocGenerics (and others)
0
gravatar for Aditya
4 months ago by
Aditya120
Germany
Aditya120 wrote:

Is there a way to avoid BiocGenerics, S4Vectors, IRanges, and Biostrings from being attached when calling BSgenome::getBSgenome() ?

bsgenome <- BSgenome::getBSgenome('mm10')

Attaching package: ‘BiocGenerics’
    The following objects are masked from ‘package:parallel’:
        clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, 
        clusterExport, clusterMap, parApply, parCapply, 
        parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB
    The following objects are masked from ‘package:stats’:
        IQR, mad, sd, var, xtabs
    The following objects are masked from ‘package:base’:
        anyDuplicated, append, as.data.frame, basename, 
        cbind, colnames, dirname, do.call, duplicated, eval, 
        evalq, Filter, Find, get, grep, grepl, intersect, is.unsorted, 
        lapply, Map, mapply, match, mget, order, paste, pmax, 
        pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, 
        rownames, sapply, setdiff, sort, table, tapply,
        union, unique, unsplit, which, which.max, which.min

Attaching package: ‘S4Vectors’
    The following object is masked from ‘package:base’:
        expand.grid

Attaching package: ‘IRanges’
    The following object is masked from ‘package:grDevices’:
        windows

Attaching package: ‘Biostrings’
    The following object is masked from ‘package:base’:
        strsplit
ADD COMMENTlink modified 3 months ago • written 4 months ago by Aditya120

This works, but relies on using (BioC non-complyingly) non-exported functionality - can this be done better?

bsname <- BSgenome:::.getInstalledPkgnameFromProviderVersion('mm10')
bsgenome <- utils::getFromNamespace(bsname, bsname)
ADD REPLYlink modified 4 months ago • written 4 months ago by Aditya120
Answer: getBSgenome{Bsgenome}: avoid attaching BiocGenerics (and others)
0
gravatar for Aditya
3 months ago by
Aditya120
Germany
Aditya120 wrote:

Solved by Herve Pages in BSgenome 1.53.2 through a new argument load.only Now it can be used without attaching the BSgenome namespace:

BSgenome::getBSgenome(load.only = TRUE)

I must add here that I recently realized that the apparent namespace clashes are actually intentional promotions of primitives and S3 generics to S4 generics, and not something to worry about.

ADD COMMENTlink modified 3 months ago • written 3 months ago by Aditya120
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 212 users visited in the last hour