Thanks so much Hervé! That appears to have solved the problem. And I will definitely keep in mind for the future Michael’s suggestion of duck typing for matrix-like objects.
All of the best, Elizabeth > On Oct 10, 2018, at 9:33 PM, Hervé Pagès <hpa...@fredhutch.org> wrote: > > Hi Elizabeth, > > I agree that the setClassUnion() warning is rather esoteric, especially > the "consider setClassUnion()" part. > > library(DelayedArray) > setClassUnion("matrixOrHDF5", c("matrix", "DelayedArray")) > # Warning message: > # subclass "DelayedArray1" of class "DelayedArray" is not local and > # cannot be updated for new inheritance information; consider > > Furthermore, showClass("DelayedArray") reports the correct inheritance > information: > > showClass("DelayedArray1") > # Class "DelayedArray1" [package "DelayedArray"] > # > # Slots: > # > # Name: index delayed_ops seed > # Class: list list ANY > # > # Extends: > # Class "DelayedArray", directly > # Class "DelayedUnaryIsoOp", by class "DelayedArray", distance 2 > # Class "matrixOrHDF5", by class "DelayedArray", distance 2 > # Class "DelayedUnaryOp", by class "DelayedArray", distance 3 > # Class "DelayedOp", by class "DelayedArray", distance 4 > # Class "Array", by class "DelayedArray", distance 5 > > As well as extends(): > > extends("DelayedArray1") > # [1] "DelayedArray1" "DelayedArray" "DelayedUnaryIsoOp" > # [4] "matrixOrHDF5" "DelayedUnaryOp" "DelayedOp" > # [7] "Array" > > extends("DelayedArray", "matrixOrHDF5") > # [1] TRUE > > extends("DelayedArray1", "DelayedArray") > # [1] TRUE > > extends("DelayedArray1", "matrixOrHDF5") > # [1] TRUE > > So it might just be a spurious warning :-/ > > Anyway, I've exported the DelayedArray1 class in DelayedArray 0.7.48: > > https://github.com/Bioconductor/DelayedArray/commit/26061a9b28b87b8a3ee26b8b81ff3334b55115c1 > > No more warning with this version: > > library(DelayedArray) > setClassUnion("matrixOrHDF5", c("matrix", "DelayedArray")) > > Cheers, > H. > > > On 10/10/2018 11:51 AM, Elizabeth Purdom wrote: >> Hello, >> I am using `setClassUnion` in my package `clusterExperiment` in the >> following code to allow for either matrix or DelayedArray: >> setClassUnion("matrixOrHDF5",members=c("matrix", "DelayedArray")) >> This causes the following warning in checking my package: >> Warning: subclass "DelayedArray1" of class "DelayedArray" is not local and >> cannot be updated for new inheritance information; consider setClassUnion() >> I’ve gotten this warning in other settings, and I believe it is due to the >> fact that setClassUnion works on the subclasses of the members, so if you >> give the argument `members=c(“X”,”Y”)` and you haven’t imported into your >> package all of the subclasses of “X” and “Y” it is warning you those >> non-imported classes haven’t been dealt with (though if so, I’d say the >> warning is awfully cryptic, especially since it says to use `setClassUnion` >> as a solution). In my other cases, I have just gone ahead and imported all >> of the subclasses from the package that defines the member classes and have >> gotten rid of the message (in the past it hasn’t been so many). But >> “DelayedArray1” is not an exported class of the DelayedArray package so that >> is not an option here. >> I have been just ignoring this warning, since I understand (I think) the >> warning, I can’t do anything about it, and am not concerned about it since >> this new class is only used internally by my function for the slot >> definition. And I don’t think the user sees this generally. But given that >> we’re coming up on a release I thought I would ask if there’s anything I can >> do to get rid of this warning! Or can I go with my first instinct and safely >> ignore it? >> Thanks, >> Elizabeth Purdom >> _______________________________________________ >> Bioc-devel@r-project.org mailing list >> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwIFaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=4le20lkIbxVE8gFC4uH_tCGjq9qX1garrTomLOEFN6A&s=VePKILIDYgQk9KdF7u7hJQJLglF5ga8I6M5u99inEyo&e= > > -- > Hervé Pagès > > Program in Computational Biology > Division of Public Health Sciences > Fred Hutchinson Cancer Research Center > 1100 Fairview Ave. N, M1-B514 > P.O. Box 19024 > Seattle, WA 98109-1024 > > E-mail: hpa...@fredhutch.org > Phone: (206) 667-5791 > Fax: (206) 667-1319 _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel