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 exchange on the
Bioconductor community slack about this (join at
https://bioc-community.herokuapp.com/; discussion starting with
https://community-bioc.slack.com/archives/C35G93GJH/p1580144746014800).
The plyranges package http://bioconductor.org/packages/plyranges and
recently accepted fluentGenomics workflow
https://github.com/Bioconductor/Contributions/issues/1350 provide
illustrations.
In your domain it's really surprising that your package does not use
(Import or Depend on) SummarizedExperiment or GenomicRanges packages. From
a superficial look at your package, it seems like something like
`reduce_dimensions()` could be defined to take & return a
SummarizedExperiment and hence benefit from some of the points in the
github issue comment mentioned above.
Certainly there is a useful transition, both 'on the way in' to a
SummarizedExperiment, and after leaving the more specialized bioinformatic
computations to, e.g., display a pairs plot of the reduced dimensions,
where one might re-shape the data to a tidy format and use 'plain old'
tibbles; the fluentGenomics workflow might provide some guidance.
At the end of the day it would not be surprising for Bioconductor packages
to make use of tidy concepts and data structures, particularly in the
vignette, and it would be a mistake for Bioconductor to exclude
well-motivated 'tidy' representations.
Martin Morgan
?On 2/6/20, 5:46 PM, "Bioc-devel on behalf of stefano" <
bioc-devel-bounces at r-project.org on behalf of mangiolastefano at gmail.com>
wrote:
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
classes.
For example, several methos do not apparently handle S4 objects based
on
S3 tbl_df
```library(tidyverse)setOldClass("tbl_df")
setClass("test2", contains = "tbl_df")
my <- new("test2", tibble(a = 1))
my %>% mutate(b = 3)
a b
1 1 3
```
```my <- new("test2", tibble(a = rnorm(100), b = 1))
my %>% nest(data = -b)
Error: `x` must be a vector, not a `test2` object
Run `rlang::last_error()` to see where the error occurred.
```
Could you please advise whether a tidyverse based package can be
hosted on
Bioconductor, and if S4 classes are really mandatory? I need to
understand
if I am forced to submit to CRAN instead (although Bioconductor would
be a
good fit, sice I try to interface transcriptional analysis tools to
tidy
universe)
Thanks a lot.
Stefano
[[alternative HTML version deleted]]