Format the package database

reformat_db(db, version = NULL)

Arguments

db

A data frame returned from available.packages or installed.packages.

version

Version of the database, a self-defined text.

Details

It reformats the data frame of the package database into a pkg_db class object.

Value

A pkg_db class object. There are the following methods:

pkg_db$get_meta(package,field=NULL)

field can take values in "Package", "Version" and "Repository".

pkg_db$get_dependency_table(package)

Get the dependency table.

pkg_db$get_rev_dependency_table(package)

Get the reverse dependency table.

pkg_db$package_dependencies(package,recursive=FALSE,reverse=FALSE,which="strong",simplify=FALSE)

All the arguments are the same as in package_dependencies. Argument simplify controls whether to return a data frame or a simplied vector.

Examples

# \dontrun{
db = available.packages()
db2 = reformat_db(db)
#> prepare dependency table...
#> prepare reverse dependency table...

# a pkg_db object generated on 2021-10-28 can be loaded by load_pkg_db()
db2 = load_pkg_db(online = FALSE)
db2
#> A package database of 22392 packages.
#>   - 18901 CRAN / 3491 Bioconductor / 0 other packages.
db2$get_meta("ComplexHeatmap")
#>                       Package Version   Repository
#> ComplexHeatmap ComplexHeatmap  2.14.0 Bioconductor
db2$get_dependency_table("ComplexHeatmap")
#>       package          dependency        dep_fields
#>  [1,] "ComplexHeatmap" "methods"         "Depends" 
#>  [2,] "ComplexHeatmap" "grid"            "Depends" 
#>  [3,] "ComplexHeatmap" "graphics"        "Depends" 
#>  [4,] "ComplexHeatmap" "stats"           "Depends" 
#>  [5,] "ComplexHeatmap" "grDevices"       "Depends" 
#>  [6,] "ComplexHeatmap" "circlize"        "Imports" 
#>  [7,] "ComplexHeatmap" "GetoptLong"      "Imports" 
#>  [8,] "ComplexHeatmap" "colorspace"      "Imports" 
#>  [9,] "ComplexHeatmap" "clue"            "Imports" 
#> [10,] "ComplexHeatmap" "RColorBrewer"    "Imports" 
#> [11,] "ComplexHeatmap" "GlobalOptions"   "Imports" 
#> [12,] "ComplexHeatmap" "png"             "Imports" 
#> [13,] "ComplexHeatmap" "digest"          "Imports" 
#> [14,] "ComplexHeatmap" "IRanges"         "Imports" 
#> [15,] "ComplexHeatmap" "matrixStats"     "Imports" 
#> [16,] "ComplexHeatmap" "foreach"         "Imports" 
#> [17,] "ComplexHeatmap" "doParallel"      "Imports" 
#> [18,] "ComplexHeatmap" "codetools"       "Imports" 
#> [19,] "ComplexHeatmap" "testthat"        "Suggests"
#> [20,] "ComplexHeatmap" "knitr"           "Suggests"
#> [21,] "ComplexHeatmap" "markdown"        "Suggests"
#> [22,] "ComplexHeatmap" "dendsort"        "Suggests"
#> [23,] "ComplexHeatmap" "jpeg"            "Suggests"
#> [24,] "ComplexHeatmap" "tiff"            "Suggests"
#> [25,] "ComplexHeatmap" "fastcluster"     "Suggests"
#> [26,] "ComplexHeatmap" "EnrichedHeatmap" "Suggests"
#> [27,] "ComplexHeatmap" "dendextend"      "Suggests"
#> [28,] "ComplexHeatmap" "grImport"        "Suggests"
#> [29,] "ComplexHeatmap" "grImport2"       "Suggests"
#> [30,] "ComplexHeatmap" "glue"            "Suggests"
#> [31,] "ComplexHeatmap" "GenomicRanges"   "Suggests"
#> [32,] "ComplexHeatmap" "gridtext"        "Suggests"
#> [33,] "ComplexHeatmap" "pheatmap"        "Suggests"
#> [34,] "ComplexHeatmap" "gridGraphics"    "Suggests"
#> [35,] "ComplexHeatmap" "gplots"          "Suggests"
#> [36,] "ComplexHeatmap" "rmarkdown"       "Suggests"
#> [37,] "ComplexHeatmap" "Cairo"           "Suggests"
db2$get_rev_dependency_table("ComplexHeatmap")
#>        package                     dependency       dep_fields
#>   [1,] "CIARA"                     "ComplexHeatmap" "Suggests"
#>   [2,] "CNVScope"                  "ComplexHeatmap" "Suggests"
#>   [3,] "IOHanalyzer"               "ComplexHeatmap" "Suggests"
#>   [4,] "IntLIM"                    "ComplexHeatmap" "Imports" 
#>   [5,] "MKomics"                   "ComplexHeatmap" "Imports" 
#>   [6,] "MOSS"                      "ComplexHeatmap" "Suggests"
#>   [7,] "MitoHEAR"                  "ComplexHeatmap" "Imports" 
#>   [8,] "PALMO"                     "ComplexHeatmap" "Imports" 
#>   [9,] "RNAseqQC"                  "ComplexHeatmap" "Imports" 
#>  [10,] "RVA"                       "ComplexHeatmap" "Imports" 
#>  [11,] "SCpubr"                    "ComplexHeatmap" "Suggests"
#>  [12,] "armada"                    "ComplexHeatmap" "Imports" 
#>  [13,] "bulkAnalyseR"              "ComplexHeatmap" "Imports" 
#>  [14,] "circlize"                  "ComplexHeatmap" "Suggests"
#>  [15,] "conos"                     "ComplexHeatmap" "Imports" 
#>  [16,] "countToFPKM"               "ComplexHeatmap" "Depends" 
#>  [17,] "eclust"                    "ComplexHeatmap" "Suggests"
#>  [18,] "grandR"                    "ComplexHeatmap" "Suggests"
#>  [19,] "i2dash"                    "ComplexHeatmap" "Suggests"
#>  [20,] "missoNet"                  "ComplexHeatmap" "Imports" 
#>  [21,] "multipanelfigure"          "ComplexHeatmap" "Suggests"
#>  [22,] "pkgndep"                   "ComplexHeatmap" "Imports" 
#>  [23,] "rKOMICS"                   "ComplexHeatmap" "Imports" 
#>  [24,] "scITD"                     "ComplexHeatmap" "Imports" 
#>  [25,] "spiralize"                 "ComplexHeatmap" "Suggests"
#>  [26,] "tidyHeatmap"               "ComplexHeatmap" "Imports" 
#>  [27,] "tinyarray"                 "ComplexHeatmap" "Suggests"
#>  [28,] "visxhclust"                "ComplexHeatmap" "Imports" 
#>  [29,] "wilson"                    "ComplexHeatmap" "Imports" 
#>  [30,] "AMARETTO"                  "ComplexHeatmap" "Depends" 
#>  [31,] "ASURAT"                    "ComplexHeatmap" "Imports" 
#>  [32,] "BindingSiteFinder"         "ComplexHeatmap" "Suggests"
#>  [33,] "BioNERO"                   "ComplexHeatmap" "Imports" 
#>  [34,] "BiocOncoTK"                "ComplexHeatmap" "Imports" 
#>  [35,] "BloodGen3Module"           "ComplexHeatmap" "Imports" 
#>  [36,] "BrainSABER"                "ComplexHeatmap" "Suggests"
#>  [37,] "CATALYST"                  "ComplexHeatmap" "Imports" 
#>  [38,] "CNVRanger"                 "ComplexHeatmap" "Suggests"
#>  [39,] "COCOA"                     "ComplexHeatmap" "Imports" 
#>  [40,] "COTAN"                     "ComplexHeatmap" "Imports" 
#>  [41,] "CeTF"                      "ComplexHeatmap" "Imports" 
#>  [42,] "DEComplexDisease"          "ComplexHeatmap" "Imports" 
#>  [43,] "DEGreport"                 "ComplexHeatmap" "Imports" 
#>  [44,] "DEP"                       "ComplexHeatmap" "Imports" 
#>  [45,] "ELMER"                     "ComplexHeatmap" "Imports" 
#>  [46,] "EnrichedHeatmap"           "ComplexHeatmap" "Depends" 
#>  [47,] "EnrichmentBrowser"         "ComplexHeatmap" "Suggests"
#>  [48,] "FLAMES"                    "ComplexHeatmap" "Imports" 
#>  [49,] "GRaNIE"                    "ComplexHeatmap" "Imports" 
#>  [50,] "GeneTonic"                 "ComplexHeatmap" "Imports" 
#>  [51,] "GenomicSuperSignature"     "ComplexHeatmap" "Imports" 
#>  [52,] "HilbertCurve"              "ComplexHeatmap" "Suggests"
#>  [53,] "InterCellar"               "ComplexHeatmap" "Imports" 
#>  [54,] "InteractiveComplexHeatmap" "ComplexHeatmap" "Depends" 
#>  [55,] "LineagePulse"              "ComplexHeatmap" "Imports" 
#>  [56,] "MOMA"                      "ComplexHeatmap" "Imports" 
#>  [57,] "MWASTools"                 "ComplexHeatmap" "Imports" 
#>  [58,] "MatrixQCvis"               "ComplexHeatmap" "Imports" 
#>  [59,] "MesKit"                    "ComplexHeatmap" "Imports" 
#>  [60,] "NanoporeRNASeq"            "ComplexHeatmap" "Suggests"
#>  [61,] "POMA"                      "ComplexHeatmap" "Imports" 
#>  [62,] "PathoStat"                 "ComplexHeatmap" "Imports" 
#>  [63,] "PeacoQC"                   "ComplexHeatmap" "Imports" 
#>  [64,] "QFeatures"                 "ComplexHeatmap" "Suggests"
#>  [65,] "RLSeq"                     "ComplexHeatmap" "Imports" 
#>  [66,] "SPIAT"                     "ComplexHeatmap" "Imports" 
#>  [67,] "SPONGE"                    "ComplexHeatmap" "Imports" 
#>  [68,] "TBSignatureProfiler"       "ComplexHeatmap" "Imports" 
#>  [69,] "TCGAbiolinks"              "ComplexHeatmap" "Suggests"
#>  [70,] "TCGAutils"                 "ComplexHeatmap" "Suggests"
#>  [71,] "Xeva"                      "ComplexHeatmap" "Imports" 
#>  [72,] "YAPSA"                     "ComplexHeatmap" "Imports" 
#>  [73,] "airpart"                   "ComplexHeatmap" "Imports" 
#>  [74,] "artMS"                     "ComplexHeatmap" "Suggests"
#>  [75,] "bambu"                     "ComplexHeatmap" "Suggests"
#>  [76,] "blacksheepr"               "ComplexHeatmap" "Imports" 
#>  [77,] "celda"                     "ComplexHeatmap" "Imports" 
#>  [78,] "clustifyr"                 "ComplexHeatmap" "Suggests"
#>  [79,] "cola"                      "ComplexHeatmap" "Imports" 
#>  [80,] "cytoKernel"                "ComplexHeatmap" "Imports" 
#>  [81,] "diffUTR"                   "ComplexHeatmap" "Imports" 
#>  [82,] "diffcyt"                   "ComplexHeatmap" "Imports" 
#>  [83,] "dittoSeq"                  "ComplexHeatmap" "Suggests"
#>  [84,] "fCCAC"                     "ComplexHeatmap" "Imports" 
#>  [85,] "gCrisprTools"              "ComplexHeatmap" "Imports" 
#>  [86,] "gmoviz"                    "ComplexHeatmap" "Imports" 
#>  [87,] "gtrellis"                  "ComplexHeatmap" "Suggests"
#>  [88,] "hermes"                    "ComplexHeatmap" "Imports" 
#>  [89,] "iSEE"                      "ComplexHeatmap" "Imports" 
#>  [90,] "microbiomeMarker"          "ComplexHeatmap" "Imports" 
#>  [91,] "monaLisa"                  "ComplexHeatmap" "Imports" 
#>  [92,] "msImpute"                  "ComplexHeatmap" "Suggests"
#>  [93,] "muscat"                    "ComplexHeatmap" "Imports" 
#>  [94,] "musicatk"                  "ComplexHeatmap" "Imports" 
#>  [95,] "pareg"                     "ComplexHeatmap" "Suggests"
#>  [96,] "pipeComp"                  "ComplexHeatmap" "Imports" 
#>  [97,] "plotgardener"              "ComplexHeatmap" "Suggests"
#>  [98,] "profileplyr"               "ComplexHeatmap" "Imports" 
#>  [99,] "projectR"                  "ComplexHeatmap" "Suggests"
#> [100,] "proteasy"                  "ComplexHeatmap" "Suggests"
#> [101,] "recoup"                    "ComplexHeatmap" "Depends" 
#> [102,] "scDblFinder"               "ComplexHeatmap" "Suggests"
#> [103,] "sechm"                     "ComplexHeatmap" "Imports" 
#> [104,] "segmenter"                 "ComplexHeatmap" "Imports" 
#> [105,] "signifinder"               "ComplexHeatmap" "Imports" 
#> [106,] "simplifyEnrichment"        "ComplexHeatmap" "Imports" 
#> [107,] "singleCellTK"              "ComplexHeatmap" "Imports" 
#> [108,] "sparrow"                   "ComplexHeatmap" "Imports" 
#> [109,] "spiky"                     "ComplexHeatmap" "Suggests"
#> [110,] "weitrix"                   "ComplexHeatmap" "Suggests"
db2$package_dependencies("ComplexHeatmap")
#>       package          dependency      dep_fields
#>  [1,] "ComplexHeatmap" "methods"       "Depends" 
#>  [2,] "ComplexHeatmap" "grid"          "Depends" 
#>  [3,] "ComplexHeatmap" "graphics"      "Depends" 
#>  [4,] "ComplexHeatmap" "stats"         "Depends" 
#>  [5,] "ComplexHeatmap" "grDevices"     "Depends" 
#>  [6,] "ComplexHeatmap" "circlize"      "Imports" 
#>  [7,] "ComplexHeatmap" "GetoptLong"    "Imports" 
#>  [8,] "ComplexHeatmap" "colorspace"    "Imports" 
#>  [9,] "ComplexHeatmap" "clue"          "Imports" 
#> [10,] "ComplexHeatmap" "RColorBrewer"  "Imports" 
#> [11,] "ComplexHeatmap" "GlobalOptions" "Imports" 
#> [12,] "ComplexHeatmap" "png"           "Imports" 
#> [13,] "ComplexHeatmap" "digest"        "Imports" 
#> [14,] "ComplexHeatmap" "IRanges"       "Imports" 
#> [15,] "ComplexHeatmap" "matrixStats"   "Imports" 
#> [16,] "ComplexHeatmap" "foreach"       "Imports" 
#> [17,] "ComplexHeatmap" "doParallel"    "Imports" 
#> [18,] "ComplexHeatmap" "codetools"     "Imports" 
db2$package_dependencies("ComplexHeatmap", recursive = TRUE)
#>       package          dependency      dep_fields 
#>  [1,] "ComplexHeatmap" "methods"       "Depends"  
#>  [2,] "ComplexHeatmap" "grid"          "Depends"  
#>  [3,] "ComplexHeatmap" "graphics"      "Depends"  
#>  [4,] "ComplexHeatmap" "stats"         "Depends"  
#>  [5,] "ComplexHeatmap" "grDevices"     "Depends"  
#>  [6,] "ComplexHeatmap" "circlize"      "Imports"  
#>  [7,] "ComplexHeatmap" "GetoptLong"    "Imports"  
#>  [8,] "ComplexHeatmap" "colorspace"    "Imports"  
#>  [9,] "ComplexHeatmap" "clue"          "Imports"  
#> [10,] "ComplexHeatmap" "RColorBrewer"  "Imports"  
#> [11,] "ComplexHeatmap" "GlobalOptions" "Imports"  
#> [12,] "ComplexHeatmap" "png"           "Imports"  
#> [13,] "ComplexHeatmap" "digest"        "Imports"  
#> [14,] "ComplexHeatmap" "IRanges"       "Imports"  
#> [15,] "ComplexHeatmap" "matrixStats"   "Imports"  
#> [16,] "ComplexHeatmap" "foreach"       "Imports"  
#> [17,] "ComplexHeatmap" "doParallel"    "Imports"  
#> [18,] "ComplexHeatmap" "codetools"     "Imports"  
#> [19,] "circlize"       "graphics"      "Depends"  
#> [20,] "circlize"       "GlobalOptions" "Imports"  
#> [21,] "circlize"       "shape"         "Imports"  
#> [22,] "circlize"       "grDevices"     "Imports"  
#> [23,] "circlize"       "utils"         "Imports"  
#> [24,] "circlize"       "stats"         "Imports"  
#> [25,] "circlize"       "colorspace"    "Imports"  
#> [26,] "circlize"       "methods"       "Imports"  
#> [27,] "circlize"       "grid"          "Imports"  
#> [28,] "GetoptLong"     "rjson"         "Imports"  
#> [29,] "GetoptLong"     "GlobalOptions" "Imports"  
#> [30,] "GetoptLong"     "methods"       "Imports"  
#> [31,] "GetoptLong"     "crayon"        "Imports"  
#> [32,] "colorspace"     "methods"       "Depends"  
#> [33,] "colorspace"     "graphics"      "Imports"  
#> [34,] "colorspace"     "grDevices"     "Imports"  
#> [35,] "colorspace"     "stats"         "Imports"  
#> [36,] "clue"           "stats"         "Imports"  
#> [37,] "clue"           "cluster"       "Imports"  
#> [38,] "clue"           "graphics"      "Imports"  
#> [39,] "clue"           "methods"       "Imports"  
#> [40,] "GlobalOptions"  "methods"       "Depends"  
#> [41,] "GlobalOptions"  "utils"         "Imports"  
#> [42,] "digest"         "utils"         "Imports"  
#> [43,] "IRanges"        "methods"       "Depends"  
#> [44,] "IRanges"        "utils"         "Depends"  
#> [45,] "IRanges"        "stats"         "Depends"  
#> [46,] "IRanges"        "BiocGenerics"  "Depends"  
#> [47,] "IRanges"        "S4Vectors"     "Depends"  
#> [48,] "IRanges"        "stats4"        "Imports"  
#> [49,] "IRanges"        "S4Vectors"     "LinkingTo"
#> [50,] "foreach"        "codetools"     "Imports"  
#> [51,] "foreach"        "utils"         "Imports"  
#> [52,] "foreach"        "iterators"     "Imports"  
#> [53,] "doParallel"     "foreach"       "Depends"  
#> [54,] "doParallel"     "iterators"     "Depends"  
#> [55,] "doParallel"     "parallel"      "Depends"  
#> [56,] "doParallel"     "utils"         "Depends"  
#> [57,] "shape"          "stats"         "Imports"  
#> [58,] "shape"          "graphics"      "Imports"  
#> [59,] "shape"          "grDevices"     "Imports"  
#> [60,] "crayon"         "grDevices"     "Imports"  
#> [61,] "crayon"         "methods"       "Imports"  
#> [62,] "crayon"         "utils"         "Imports"  
#> [63,] "cluster"        "graphics"      "Imports"  
#> [64,] "cluster"        "grDevices"     "Imports"  
#> [65,] "cluster"        "stats"         "Imports"  
#> [66,] "cluster"        "utils"         "Imports"  
#> [67,] "BiocGenerics"   "methods"       "Depends"  
#> [68,] "BiocGenerics"   "utils"         "Depends"  
#> [69,] "BiocGenerics"   "graphics"      "Depends"  
#> [70,] "BiocGenerics"   "stats"         "Depends"  
#> [71,] "BiocGenerics"   "methods"       "Imports"  
#> [72,] "BiocGenerics"   "utils"         "Imports"  
#> [73,] "BiocGenerics"   "graphics"      "Imports"  
#> [74,] "BiocGenerics"   "stats"         "Imports"  
#> [75,] "S4Vectors"      "methods"       "Depends"  
#> [76,] "S4Vectors"      "utils"         "Depends"  
#> [77,] "S4Vectors"      "stats"         "Depends"  
#> [78,] "S4Vectors"      "stats4"        "Depends"  
#> [79,] "S4Vectors"      "BiocGenerics"  "Depends"  
#> [80,] "iterators"      "utils"         "Depends"  
# }