R/defdMethods.R
defdMethods.Rd
defdMethods enumerates methods defined for a class in a package -- NEEDS WORK
defdMethods(cl, pkg = paste0("package:", cl), verbose = TRUE)
cl | character(1) name of class |
---|---|
pkg | character(1) name of package where class is defined, defaults to 'package:classname' which works for major classes like SummarizedExperiment; |
verbose | logical(1) if TRUE (default) will issue a message enumerating superclasses. |
a data.frame instance with columns 'method', 'cl', 'pkg', 'nmeth4cl', counting the number of method-signature combinations for this method, and 'sigs', a list of lists of named signature elements (each element is a list of character vectors of method parameter types, named with parameter names)
Users should consider how methods inherited from superclasses defined in other packages are also relevant to reports of this type. See the example.
# start with simple tabulation of package-specific methods suppressPackageStartupMessages({ require("SingleCellExperiment") }) scem = defdMethods("SingleCellExperiment")#>#> method cl pkg nmeth4cl #> 1 [ SingleCellExperiment package:SingleCellExperiment 1 #> 2 [<- SingleCellExperiment package:SingleCellExperiment 1 #> 3 altExp SingleCellExperiment package:SingleCellExperiment 3 #> 4 altExp<- SingleCellExperiment package:SingleCellExperiment 3 #> 5 altExpNames SingleCellExperiment package:SingleCellExperiment 1 #> 6 altExpNames<- SingleCellExperiment package:SingleCellExperiment 1 #> sigs #> 1 x="SingleCellExperiment", i="ANY", j="ANY", drop="ANY" #> 2 x="SingleCellExperiment", i="ANY", j="ANY", value="SingleCellExperiment" #> 3 x="SingleCellExperiment", e="character", x="SingleCellExperiment", e="missing", x="SingleCellExperiment", e="numeric" #> 4 x="SingleCellExperiment", e="character", x="SingleCellExperiment", e="missing", x="SingleCellExperiment", e="numeric" #> 5 x="SingleCellExperiment" #> 6 x="SingleCellExperiment", value="character"scem$method#> [1] "[" "[<-" "altExp" #> [4] "altExp<-" "altExpNames" "altExpNames<-" #> [7] "altExps" "altExps<-" "cbind" #> [10] "coerce" "colData" "colLabels" #> [13] "colLabels<-" "colPair" "colPair<-" #> [16] "colPairNames" "colPairNames<-" "colPairs" #> [19] "colPairs<-" "counts" "counts<-" #> [22] "cpm" "cpm<-" "int_colData" #> [25] "int_colData<-" "int_elementMetadata" "int_elementMetadata<-" #> [28] "int_metadata" "int_metadata<-" "logcounts" #> [31] "logcounts<-" "mainExpName" "mainExpName<-" #> [34] "normcounts" "normcounts<-" "objectVersion" #> [37] "parallel_slot_names" "rbind" "reducedDim" #> [40] "reducedDim<-" "reducedDimNames" "reducedDimNames<-" #> [43] "reducedDims" "reducedDims<-" "rowData" #> [46] "rowPair" "rowPair<-" "rowPairNames" #> [49] "rowPairNames<-" "rowPairs" "rowPairs<-" #> [52] "rowSubset" "rowSubset<-" "show" #> [55] "sizeFactors" "sizeFactors<-" "tpm" #> [58] "tpm<-" "updateObject" "weights" #> [61] "weights<-"scem["isSpike", "sigs"]#> [[1]] #> NULL #># now let's collect some related classes, with the objective of # enumerating relevant coercion methods and their signatures require("SummarizedExperiment") se = defdMethods("SummarizedExperiment", verbose=FALSE) rse = defdMethods("RangedSummarizedExperiment", "package:SummarizedExperiment", verbose=FALSE) cmb = try(rbind(scem,se,rse)) require("dplyr")#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> $SingleCellExperiment #> [1] "from=\"RangedSummarizedExperiment\", to=\"SingleCellExperiment\"" #> [2] "from=\"SummarizedExperiment\", to=\"SingleCellExperiment\"" #> #> $SummarizedExperiment #> [1] "from=\"ExpressionSet\", to=\"SummarizedExperiment\"" #> [2] "from=\"RangedSummarizedExperiment\", to=\"SummarizedExperiment\"" #> [3] "from=\"SummarizedExperiment\", to=\"ExpressionSet\"" #> [4] "from=\"SummarizedExperiment\", to=\"RangedSummarizedExperiment\"" #> [5] "from=\"SummarizedExperiment\", to=\"SingleCellExperiment\"" #> #> $RangedSummarizedExperiment #> [1] "from=\"ExpressionSet\", to=\"RangedSummarizedExperiment\"" #> [2] "from=\"RangedSummarizedExperiment\", to=\"ExpressionSet\"" #> [3] "from=\"RangedSummarizedExperiment\", to=\"SingleCellExperiment\"" #> [4] "from=\"RangedSummarizedExperiment\", to=\"SummarizedExperiment\"" #> [5] "from=\"SummarizedExperiment\", to=\"RangedSummarizedExperiment\"" #>