Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-08 Thread stefano
e < > lawrence.mich...@gene.com>, "bioc-devel@r-project.org" < > bioc-devel@r-project.org> > *Subject: *Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse > S3 classes/methods > > > > Thanks Guys for the discussion (I am learning a lot), > > &g

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-08 Thread Martin Morgan
Lawrence , "bioc-devel@r-project.org" Subject: Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods Thanks Guys for the discussion (I am learning a lot), To Martin: Thanks for the tips. I will start to implement those S4 style methods https://

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-08 Thread Vincent Carey
gt; an ‘internal’ function that implements the method on base R data types >>> >>> .foo <- function(x) { >>> stopifnot("'x' must be a matrix" = is.matrix(x)) >>> t(x) >>> } >>> >>> and m

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-07 Thread stefano
t;> result <- .foo(x) >> as_tibble(result) >> }) >> >> setMethod("foo", "SummarizedExperiment", function(x) { >> result <- .foo(assay(x)) >> assays(x)[["foo"]] <- result >>

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-07 Thread Vincent Carey
uot;, function(x) { > result <- .foo(assay(x)) > assays(x)[["foo"]] <- result > x > }) > > One would expect the vignette and examples to primarily emphasize the use > of the interoperable (SummmarizedExperiment) version. > > Ma

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-07 Thread Martin Morgan
efano Date: Friday, February 7, 2020 at 12:31 AM To: Michael Lawrence Cc: Martin Morgan , "bioc-devel@r-project.org" Subject: Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods Would this scenario satisfy " make the package _directly_ compatible wit

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread stefano
Would this scenario satisfy " make the package _directly_ compatible with standard Bioconductor data structures" If an input is SummarizedExperiment return SummarizedExperiment, if the input is a tbl_df or ttBulk, return ttBulk (?) Best wishes. *Stefano * Stefano Mangiola | Postdoctoral fell

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread Michael Lawrence via Bioc-devel
I would urge you to make the package _directly_ compatible with standard Bioconductor data structures; no explicit conversion. But you can create wrapper methods (even on an S3 generic) that perform the conversion automatically. You'll probably want two separate APIs though (in different styles), f

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread stefano
Thanks Michael, yes in a sense, ttBulk and SummariseExperiment can be considere as two interfaces. Would be fair enough to create a function that convert from one to the other, although the default would be ttBulk? *> I'm not sure the tidyverse is a great answer to the user interface, because it

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread Michael Lawrence via Bioc-devel
There's a difference between implementing software, where one wants formal data structures, and providing a convenient user interface. Software needs to interface with other software, so a package could provide both types of interfaces, one based on rich (S4) data structures, another on simpler str

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread stefano
Thanks a lot for your comment Martin and Michael, Here I reply to Marti's comment. Michael I will try to implement your solution! I think a key point from https://github.com/Bioconductor/Contributions/issues/1355#issuecomment-580977106 (that I was under-looking) is *>> "So to sum up: if you subm

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread Michael Lawrence via Bioc-devel
Martin's comments are great. I'll just give some technical help. The "tbl_df" S4 class is already defined by dplyr (and more properly), so omit the call to setOldClass(). Then, things work a bit better. > my %>% nest(-b) # had to fix this from your example [some ugly result] Warning messages: 1:

Re: [Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread Martin Morgan
The idea isn't to use S4 at any cost, but to 'play well' with the Bioconductor ecosystem, including writing robust and maintainable code. This comment https://github.com/Bioconductor/Contributions/issues/1355#issuecomment-580977106 provides some motivation; there was also an interesting exchang

[Bioc-devel] Compatibility of Bioconductor with tidyverse S3 classes/methods

2020-02-06 Thread stefano
Hello, I have a package (ttBulk) under review. I have been told to replace the S3 system to S4. My package is based on the class tbl_df and must be fully compatible with tidyverse methods (inheritance). After some tests and research I understood that tidyverse ecosystem is not compatible with S4 c