Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples function and generics #35

Open
nsheff opened this issue Apr 18, 2019 · 5 comments
Open

samples function and generics #35

nsheff opened this issue Apr 18, 2019 · 5 comments
Labels
question Further information is requested

Comments

@nsheff
Copy link
Contributor

nsheff commented Apr 18, 2019

the bioconductor Biobase package creates a generic samples function:

https://github.com/Bioconductor/Biobase/blob/2845fa44788b8379f931fa0a19c6812fb1dd453b/R/AllGenerics.R#L60

This makes it so if you load Biobase after BiocProject, it fails:

library(BiocProject)
library(Biobase)
bp = BiocProject::BiocProject("/home/ns5bc/code/dura_macs/metadata/config.yaml", subproject="atac")
samples(bp)

Returns:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘samples’ for signature ‘"SimpleList"’

and:


Attaching package: ‘Biobase’

The following object is masked from ‘package:BiocProject’:

    samples

The following object is masked from ‘package:pepr’:

    samples

it works if you load BiocProject after Biobase, but then samples can't work on a MIAME object:

> samples(m)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘samples’ for signature ‘"MIAME"’
> Biobase::samples(m)
list()
> class(m)
[1] "MIAME"
attr(,"package")
[1] "Biobase"

Is there any way to make these place nicely?

@nsheff nsheff added the question Further information is requested label Apr 18, 2019
@nsheff
Copy link
Contributor Author

nsheff commented Apr 18, 2019

information here: http://adv-r.had.co.nz/S4.html
maybe we need to link into the existing generic and have biocproject import biobase

@stolarczyk
Copy link
Member

using

setGeneric("samples", getGeneric("samples", package="Biobase"))

in BiocProject package is not possible, as the devtools::check and even just attaching BiocProject package throws warnings that say:

Warning: multiple methods tables found for ‘samples’
     Warning: replacing previous import ‘Biobase::samples’ by ‘pepr::samples’ when loading ‘BiocProject’

and

Warning: replacing previous import ‘Biobase::samples’ by ‘pepr::samples’ when loading ‘BiocProject’

but redefining the generic in pepr both solves the issue in BiocProject and does not trigger any warnings when attaching/checking pepr

Yet, all the functionality is there:

> samples(bp)
      sample_name               file_path
1:    laminB1Lads    data/laminB1Lads.bed
2: vistaEnhancers data/vistaEnhancers.bed
> m=Biobase::MIAME()
> samples(m)
list()

Do we go this route?

@stolarczyk
Copy link
Member

Even if the former worked we'd run into the same issue when using pepr::samples with Biobase loaded

BiocProject just maps this method to the Annotated class

@nsheff
Copy link
Contributor Author

nsheff commented Apr 18, 2019

this causes pepr to depend on biobase though, correct? we don't want to do that...

isn't there a way to keep pepr independent, but allow biocproject to attach the pepr function to the biobase generic for annotated objects?

@stolarczyk
Copy link
Member

this causes pepr to depend on biobase though, correct?

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants