Package dependencies represent a directed graph (though Bioconductor dependencies are not an acyclic graph). This function simply returns an igraph graph from the package dependency data frame from a call to buildPkgDependencyDataFrame or any tidy data frame with rows of (Package, dependency) pairs. Additional columns are added as igraph edge attributes (see graph_from_data_frame).

buildPkgDependencyIgraph(pkgDepDF)

Arguments

pkgDepDF

a tidy data frame. See description for details.

Value

An igraph directed graph. See the igraph package for details of what can be done.

Examples


library(igraph)
#> 
#> Attaching package: ‘igraph’
#> The following objects are masked from ‘package:dplyr’:
#> 
#>     as_data_frame, groups, union
#> The following objects are masked from ‘package:stats’:
#> 
#>     decompose, spectrum
#> The following object is masked from ‘package:base’:
#> 
#>     union

pkg_dep_df = buildPkgDependencyDataFrame()
#> 'getOption("repos")' replaces Bioconductor standard repositories, see
#> 'help("repositories", package = "BiocManager")' for details.
#> Replacement repositories:
#>     CRAN: https://cloud.r-project.org

# at this point, filter or join to manipulate
# dependency data frame as you see fit.

g = buildPkgDependencyIgraph(pkg_dep_df)
g
#> IGRAPH fbed4f3 DN-- 3499 27215 -- 
#> + attr: name (v/c), edgetype (e/c)
#> + edges from fbed4f3 (vertex names):
#>  [1] a4       ->a4Base       a4       ->a4Preproc    a4       ->a4Classif   
#>  [4] a4       ->a4Core       a4       ->a4Reporting  a4Base   ->a4Preproc   
#>  [7] a4Base   ->a4Core       a4Classif->a4Core       a4Classif->a4Preproc   
#> [10] ABSSeq   ->methods      acde     ->boot         aCGH     ->cluster     
#> [13] aCGH     ->survival     aCGH     ->multtest     ACME     ->Biobase     
#> [16] ACME     ->methods      ACME     ->BiocGenerics ADaCGH2  ->parallel    
#> [19] ADaCGH2  ->ff           ADaCGH2  ->GLAD         ADAM     ->stats       
#> [22] ADAM     ->utils        ADAM     ->methods      ADAMgui  ->stats       
#> + ... omitted several edges

# Look at nodes and edges
head(V(g)) # vertices
#> + 6/3499 vertices, named, from fbed4f3:
#> [1] a4        a4Base    a4Classif ABSSeq    acde      aCGH     
head(E(g)) # edges
#> + 6/27215 edges from fbed4f3 (vertex names):
#> [1] a4    ->a4Base      a4    ->a4Preproc   a4    ->a4Classif  
#> [4] a4    ->a4Core      a4    ->a4Reporting a4Base->a4Preproc  

# subset graph by attributes


head(sort(degree(g, mode='in'), decreasing=TRUE))
#>   methods     stats     utils   ggplot2 S4Vectors  graphics 
#>      1524      1298      1065       719       686       641 
head(sort(degree(g, mode='out'), decreasing=TRUE))
#> singleCellTK   ChromSCape       signeR    metaseqR2    SpliceWiz       scPipe 
#>           84           58           57           55           52           50