Skip to contents

Load all SQLite model databases in a directory into a single weights table.

Usage

read_db_dir(db_dir, extra_cols = NULL)

Arguments

db_dir

Path to a directory containing `.db` model files.

extra_cols

Optional character vector of additional columns to read from each database when available.

Value

A `data.table` combining the contents of all `.db` files in `db_dir`.

Examples

library(gromtools)

db_directory <- system.file(
  "extdata",
  "synth_small_variant_weights_db",
  package = "gromtools"
)

model_weights_table <- read_db_dir(db_dir = db_directory)
head(model_weights_table)
#>               model_ID            gene        rsid chromosomes position
#>                 <char>          <char>      <char>      <char>    <num>
#> 1: AMR_subclass_IN_SST ENSG00000228594  rs28625089        chr1   904947
#> 2: AMR_subclass_IN_SST ENSG00000228594  rs12080505        chr1  1110226
#> 3: AMR_subclass_IN_SST ENSG00000228594   rs6604971        chr1  1135812
#> 4: AMR_subclass_IN_SST ENSG00000228594  rs13374146        chr1  1180851
#> 5: AMR_subclass_IN_SST ENSG00000228594   rs4970443        chr1  1381507
#> 6: AMR_subclass_IN_SST ENSG00000228594 rs368836064        chr1  1382885
#>    ref_allele eff_allele      weight
#>        <char>     <char>       <num>
#> 1:          G          A -0.07537545
#> 2:          A          C  0.14694625
#> 3:          T          C  0.08669795
#> 4:          T          C -0.09174421
#> 5:          G          A -0.03473008
#> 6:          A          G -0.03415348