Search Shortcut cmd + k | ctrl + k
gorz

Read GORpipe .gorz and .gord files and write .gorz as native DuckDB tables

Maintainer(s): gorfather

Installing and Loading

INSTALL gorz FROM community;
LOAD gorz;

Example

-- Write a query result out as a GORZ file (rows must be in GOR order),
-- then read it back — with an optional GOR -p style range filter.
COPY (SELECT * FROM (VALUES ('chr1', 1000, 'A', 'G'), ('chr1', 2000, 'C', 'T'))
        t(chrom, pos, ref, alt) ORDER BY chrom, pos)
  TO 'variants.gorz' (FORMAT gorz);

SELECT * FROM read_gor('variants.gorz', range := 'chr1:1500-2500');

About gorz

The gorz extension reads and writes GORpipe genomic files — block-compressed .gorz and .gord dictionaries — as native DuckDB tables. Files it writes are read and seeked natively by gorpipe, and vice-versa.

Reading

  • read_gor(path) — auto-detects .gorz vs .gord by extension.
  • read_gorz(path) / read_gord(path) — force the kind.
  • A replacement scan, so a bare literal works: SELECT count(*) FROM 'variants.gord';
  • Projection & parallel scan — only selected columns are read; large files scan across threads.
  • WHERE chrom/pos → block seek — range predicates seek into the right block instead of scanning the whole file.
  • range := 'chrN:start-end' — GOR's -p semantics as a hard positional filter (also 'chrN', 'chrN:start-', 'chrN:pos').
  • Partition filtersread_gor(dict, f := [...], ff := [...]), the -f / -ff GOR semantics, prune a .gord's file list.
  • Object stores — paths resolve through DuckDB's FileSystem, so s3://… works when httpfs is loaded.

Writing

COPY (SELECT chrom, pos, ref, alt FROM my_variants ORDER BY chrom, pos)
  TO 'out.gorz' (FORMAT gorz);   -- or (FORMAT gor) for plain sorted TSV

Single-threaded, standard block-zip; validates GOR order (chromosomes ascend lexicographically, positions non-decreasing) and errors out otherwise.

Added Functions

function_name function_type description comment examples
read_gor table NULL NULL  
read_gord table NULL NULL  
read_gorz table NULL NULL  

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

This extension does not add any settings.