Hi friendly Bioc gang! I'm struggling with what seems like a silly problem. I'm trying to write a simple wrapper S4 generic that accesses the data slot of various S4 objects (seurat and SingleCellExperiment objects). So the generic is:
And the methods are:
setMethod("getGE","seurat", function(x) Seurat::GetAssayData(x)) setMethod("getGE","SingleCellExperiment", function(x) SingleCellExperiment::logcounts(x))
Problem is that when I install the package, I get the warning
> in method for ‘getGE’ with signature ‘"seurat"’: no definition for class “seurat”
This isn't surprising, since Seurat isn't imported, but I don't want the user to have to import it if their data is in a SingleCellExperiment object. The function still seems to work fine if I attach Seurat and load a seurat object, so I'm tempted to just suppress the error. Before I do something so rash, does anyone have a suggestion for a less dumb way to do this?
Thanks so much!