dbSequence

dbSequence provides a DuckDB-backed interface for genomic interval and sequence-derived data that are too large to work with comfortably in memory. It imports common genomics file formats into DuckDB, keeps range operations lazy, and interoperates with Bioconductor classes such as GRanges through BiocIO, GenomicRanges, IRanges, Rsamtools, rtracklayer, and VariantAnnotation.

Installation

Once dbSequence is available in Bioconductor, install it with:

if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}
BiocManager::install("dbSequence")

Development versions can be installed from GitHub with:

# install.packages("pak")
pak::pak("dbverse-org/dbsequence-r")

Example

library(dbSequence)
library(GenomicRanges)

bed_file <- system.file("extdata", "example.bed", package = "dbSequence")

# Import BED data into DuckDB; the result is lazy and database-backed
fragments <- read_bed(bed_file)

# Restrict to a region of interest without collecting into memory
promoter <- GRanges("chr1:100-500")
promoter_fragments <- filter_by_overlaps(fragments, promoter)

# Materialize only when Bioconductor-native ranges are needed
as_granges(promoter_fragments)

Features

Documentation

The package includes executable vignettes covering: