I seem to have hit an S4 method caching issue on R 3.5.1 / Bioconductor 3.8 that appears to be specific to Linux. I can reproduce this issue on the Bioc 3.8 release AMI as well as a VM running Red Hat Linux. Running the same version of R/Bioconductor on macOS with the same versions of my toolchain doesn't reproduce this issue described below:
My basejump package (see develop branch for latest code) defines an S4 generic plotHeatmap()
, along with corresponding method support for SummarizedExperiment. My bcbioRNASeq package depends on basejump, and therefore inherits the SummarizedExperiment method. When I attach basejump and call plotHeatmap()
on a SummarizedExperiment, the SE method is current and works as expected. However, when I attach bcbioRNASeq, a cached version of the inherited S4 method for SummarizedExperiment (exported from basejump), is incorrectly loaded, and my function doesn't work as expected.
R on Linux doesn't seem to be updating the method cache as expected, whereas this works fine on macOS. I've tried digging around in the documentation for the methods package, specifically Methods_Details, which suggests resetGeneric()
as a potential solution, but I can't seem to figure out how to clear the method cache.
As a follow-up, I've found some additional information in How Methods Work regarding how S4 generics cache methods, but there's very little information in the R documentation on how to troubleshoot S4 caching issues.
I'm working on trying to generate a reprex for this issue, but it does seem to be isolated to RStudio on Linux, and potentially only affects packages loaded inside an R Project.
I think the cache is created when a package imports a method, so the problem is that one or more of your packages was installed before the method was updated. The solution is to re-install the package(s) with stale cached methods; the challenge is to find out what those are...
Indeed, I think that's what I'm seeing in my library. I'm working on reinstalling the dependencies from scratch to see if that fixes the issue. Thanks Martin!