Observation: methods may report more than we need

We are interested in the SingleCellExperiment class.

It is defined in a package.

suppressPackageStartupMessages({
 library(SingleCellExperiment)
 library(DrS4)
 library(dplyr)
})
methods(class="SingleCellExperiment")

There are many methods listed, including '=='.

try(getMethod("==", "SingleCellExperiment"))

We can find the signatures for which '==' is defined:

showMethods("==")

Finding methods defined in a package

DrS4 aims to provide clearer access to the methods actually defined for a class. This requires specifying a package where we look for the class and its methods. More work needs to be done in this domain. Specifically, the function 'defdMethods' currently only retrieves one method/signature for each generic method defined for the class.

Example

library(DrS4)
require("SingleCellExperiment")
scem = defdMethods(cl="SingleCellExperiment",
          pkg="SingleCellExperiment")
head(scem)

Listing available coercion methods

Here we'll list methods of coercing between classes involving SummarizedExperiment, RangedSummarizedExperiment, and SingleCellExperiment.

require("SummarizedExperiment")
se = defdMethods("SummarizedExperiment") # pkg has simple default
rse = defdMethods("RangedSummarizedExperiment", pkg="SummarizedExperiment")
cmb = try(rbind(scem,se,rse))
tmp = (cmb |> filter(method=="coerce"))
sl = (tmp |> select(sigs))[[1]]
names(sl) = tmp$cl
sl


vjcitn/DrS4 documentation built on Oct. 4, 2021, 10:13 p.m.