Repository navigation
Conversation
|
Thanks @kevinrue - this is also a frequent source of confusion in training events for instance, finding a solution would be great. |
|
Hi Kevin, Thanks for the PR. I would prefer the cleaner and more general solution I suggested in the community-bioc Slack. Copying it here for reference:
Of course we have no control on that, so, if for whatever reason this doesn't work, then we'll add Thanks, |
|
Ok I opened this issue in ggplot now: |
|
I'm not sure how widespread S7 is going to be adopted in either BioC or tidyverse, but if it isn't, the mechanism of delayed registration for external generics might be adopted/copied (S7 is MIT licenced). It might make most sense to have the mechanism live in BiocGenerics, on which S4Vectors already depends, and then used here. Possibly, it might be useful to untangle a wider web of very shallow dependencies. |
|
This just got merged by @teunbrand a few minutes ago (thanks Teun!), making this PR unnecessary. Thanks @antagomir and @kevinrue for starting the discussion on the BioC Community Slack and helping with the process. |
Hi there
TL;DR: This PR makes the following code possible:
Without the need for
as.data.frame(df)in theggplot()call.Context:
As per https://community-bioc.slack.com/archives/C6KJHH0M9/p1690235172607369
I've messed around
S4vectorsa bit to test feasibility, and somehow landed on my feet with something that seems to work.I'll be honest, I'm not even sure why R allows me to do it, but it seems that I can
importFroma package that is listed inSuggests(i.e., not inDepends).I added
ggplot2toSuggestsbecause I don't like the idea of having it underImports. It just feels wrong to automatically installggplot2and its own dependencies as a dependency ofS4Vectors.S4Vectorsshould remain a lightweight package.I suppose that if users have
ggplot2installed, the import statement "just works", and if they don't haveggplot2installed.. well... they don't have any reason to callggplot()on aDataFrameobject :DI'm aware that this PR is unlikely to be the final fix (if any is possible at all). I just aim to give a starting point to the discussion.
Also, I've considered other approaches, but run into chicken-and-egg issues:
ggplot2will not accept toSuggests: S4Vectors, as I don't see any Bioconductor package in its existing Imports/Suggests (https://cran.r-project.org/web/packages/ggplot2/index.html) andinstall.packages()cannot see Bioconductor packages without messing withoptions(repos).S4Vectorswill not accept toImports: ggplot2, to justify more cleanlyimportFrom(ggplot2, fortify). Same reason as above: keep S4Vectors dependencies to a minimum?ggplot2::fortifystates "Rather than using this function, I now recommend using the broom package, which implements a much wider range of methods. fortify() may be deprecated in the future." However, it is not clear to me what needs to be done in broom (or biobroom)