| Title: | Visualize S4 class inheritance across R/Bioconductor packages |
|---|---|
| Description: | S4 Object-Oriented Programming is fundamental to the Bioconductor ecosystem, enabling modularity and code reuse across hundreds of packages. However, the multi-layered inheritance structures within and between packages can be difficult to navigate. S4Cartographer facilitates the exploration of these relationships by visualizing S4 class hierarchies as directed graphs. By representing classes as nodes and inheritance as edges, it provides a clear overview of complex dependency networks. |
| Authors: | Malte Thodberg [cre, aut] (ORCID: <https://orcid.org/0000-0001-6244-3841>) |
| Maintainer: | Malte Thodberg <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.99.3 |
| Built: | 2026-07-22 10:50:28 UTC |
| Source: | https://github.com/bioc/S4Cartographer |
This function uses getClasses to get S4-classes from packages and isVirtualClass and isClassUnion to describe them.
getS4Classes(packages)getS4Classes(packages)
packages |
character: R packages |
A data.frame (Superclasses is across packages and Subclasses is within a package)
# Single package getS4Classes("S4Vectors") # Multiple packages getS4Classes(c("IRanges", "GenomicRanges"))# Single package getS4Classes("S4Vectors") # Multiple packages getS4Classes(c("IRanges", "GenomicRanges"))
This function uses getClassDef to extract inheritance information between S4 classes.
getS4Inheritance(S4Classes, packages)getS4Inheritance(S4Classes, packages)
S4Classes |
character: S4-classes |
packages |
character: R-package of each S4-class |
data.frame
# Single package one_package <- getS4Classes("GenomicRanges") getS4Inheritance(S4Classes = one_package$S4Class, packages = one_package$Package) # Several packages two_packages <- getS4Classes(c("IRanges", "GenomicRanges")) getS4Inheritance(S4Classes = two_packages$S4Class, packages = two_packages$Package)# Single package one_package <- getS4Classes("GenomicRanges") getS4Inheritance(S4Classes = one_package$S4Class, packages = one_package$Package) # Several packages two_packages <- getS4Classes(c("IRanges", "GenomicRanges")) getS4Inheritance(S4Classes = two_packages$S4Class, packages = two_packages$Package)
This function plots all S4-classes from one or more R-packages as graph, where each node is an S4 class and directed edges represents inheritance. Virtual classes are indicated via node shapes. The graph stops at S4 defined outside the set or R-packages in question.
plotS4ClassGraph(packages, plot = TRUE)plotS4ClassGraph(packages, plot = TRUE)
packages |
character: R-packages |
plot |
logical: Whether to plot (TRUE) or just return the underlying plot data (FALSE) |
ggplot if plot=TRUE or list if plot=FALSE
# Single package plotS4ClassGraph("GenomicRanges") # Several packages: plotS4ClassGraph(c("IRanges", "GenomicRanges"))# Single package plotS4ClassGraph("GenomicRanges") # Several packages: plotS4ClassGraph(c("IRanges", "GenomicRanges"))