Stream selected model, gene, and sample combinations from an existing grom output on disk.
Arguments
- grom_pfx
Path prefix to an existing grom output without the file extension.
- models
Optional character vector of model IDs to retain. `NULL` selects all models.
- genes
Optional character vector of gene IDs to retain. `NULL` selects all genes.
- samples
Optional character vector of sample IDs to retain. `NULL` selects all samples.
Examples
library(gromtools)
pgen_dir <- system.file(
"extdata",
"synthetic_chromosomes",
package = "gromtools"
)
db_directory <- system.file(
"extdata",
"synth_small_variant_weights_db",
package = "gromtools"
)
model_weights_table <- read_db_dir(db_dir = db_directory)
out_dir <- file.path(tempdir(), "tmp_grom_run")
dir.create(out_dir, recursive = TRUE, showWarnings = FALSE)
grom_pfx <- file.path(out_dir, "synth_example")
grom_impute(
weights_table = model_weights_table,
grom_pfx = grom_pfx,
pgen_dir = pgen_dir
)
#> All chromosome tags were uniquely mapped to a .pgen file.
#> ### impute_grom() started at: 2026-04-20 01:57:32
#> ### impute_grom() completed at: 2026-04-20 01:57:32
#> Results stored under directory /tmp/RtmpLdOp7N/tmp_grom_run
grom_mat <- grom_read(
grom_pfx = grom_pfx,
models = c("AMR_subclass_IN_SST", "AMR_subclass_VLMC"),
genes = c("ENSG00000003987", "ENSG00000053900"),
samples = c(
"sample0001", "sample0014", "sample0034", "sample0039", "sample0043"
)
)
print(grom_mat)
#> AMR_subclass_IN_SST_ENSG00000003987
#> sample0001 0.3191238
#> sample0014 0.4542425
#> sample0034 0.4138578
#> sample0039 0.2676161
#> sample0043 0.3721308
#> AMR_subclass_IN_SST_ENSG00000053900
#> sample0001 0.2737647
#> sample0014 -0.4481538
#> sample0034 -0.2212396
#> sample0039 -0.3217697
#> sample0043 0.2609762
#> AMR_subclass_VLMC_ENSG00000053900
#> sample0001 -0.5058091
#> sample0014 -0.9249124
#> sample0034 -0.5259653
#> sample0039 -0.9044481
#> sample0043 -0.6188168