Creates a standard region table from a gene boundary table. Each gene becomes one region for variant-set analysis.
define_regions_gene(genes_info = NULL, chr = NULL, extend = 0L)Data frame with gene boundaries. Default NULL uses the bundled STAARpipeline genes_info (18,445 protein-coding genes). Accepts STAARpipeline format (hgnc_symbol, chromosome_name, start_position, end_position) or simplified format (gene, chr, start, end).
Integer or character chromosome(s) to include. NULL for all.
Integer bp to extend gene boundaries on each side. Default 0.
Data frame with columns: region_id, chr, start, end, label.
# With a user-provided gene table
my_genes <- data.frame(
gene = c("BRCA1", "TP53"),
chr = c("17", "17"),
start = c(43044295L, 7668402L),
end = c(43125364L, 7687550L)
)
regions <- define_regions_gene(my_genes)
regions
#> region_id chr start end label
#> 1 BRCA1 17 43044295 43125364 BRCA1
#> 2 TP53 17 7668402 7687550 TP53
# Extend boundaries by 1kb on each side
regions_ext <- define_regions_gene(my_genes, extend = 1000)