name	kind	category	signature	returns	r_wrapper	description	examples
read_bcf	table	Readers	read_bcf(path, region := NULL, index_path := NULL, tidy_format := FALSE, additional_csq_column_types := NULL)	table	rduckhts_bcf	Read VCF and BCF variant data with typed INFO, FORMAT, typed CSQ/ANN/BCSQ subfields, optional tidy sample output, and optional bcftools-style CSQ type overrides.	SELECT CHROM, POS, REF, ALT FROM read_bcf('vcf_file.bcf') LIMIT 5;
read_bam	table	Readers	read_bam(path, standard_tags := FALSE, auxiliary_tags := FALSE, region := NULL, index_path := NULL, reference := NULL, sequence_encoding := 'string', quality_representation := 'string', decompression_threads := 2)	table	rduckhts_bam	Read SAM, BAM, and CRAM alignments with optional typed SAMtags and auxiliary tag maps. Use sequence_encoding := 'nt16' to return SEQ as UTINYINT[] and quality_representation := 'phred' to return QUAL as UTINYINT[] instead of VARCHAR. decompression_threads controls per-file htslib worker threads and defaults to 2; use 0 to disable worker threads.	SELECT QNAME, FLAG, RNAME, POS FROM read_bam('range.bam') LIMIT 5;
read_fasta	table	Readers	read_fasta(path, region := NULL, index_path := NULL, sequence_encoding := 'string')	table	rduckhts_fasta	Read FASTA records or indexed FASTA regions as sequence rows. Use sequence_encoding := 'nt16' to return SEQUENCE as UTINYINT[] (htslib nt16 4-bit codes) instead of VARCHAR.	SELECT NAME, length(SEQUENCE) FROM read_fasta('ce.fa');
read_bed	table	Readers	read_bed(path, region := NULL, index_path := NULL)	table	rduckhts_bed	Read BED3-BED12 interval files with canonical typed columns and optional tabix-backed region filtering.	"SELECT chrom, start, ""end"", name FROM read_bed('targets.bed') LIMIT 5;"
fasta_nuc	table	Readers	fasta_nuc(path, bed_path := NULL, bin_width := NULL, region := NULL, index_path := NULL, bed_index_path := NULL, include_seq := FALSE)	table	rduckhts_fasta_nuc	Compute bedtools nuc-style nucleotide composition for supplied BED intervals or generated fixed-width bins over a FASTA reference.	"SELECT chrom, start, ""end"", pct_gc FROM fasta_nuc('ce.fa', bin_width := 1000) LIMIT 5;"
duckhts_cgranges_create	scalar	Intervals	duckhts_cgranges_create(name)	BOOLEAN		Create an empty session-scoped cgranges registry entry that can be populated with intervals and finalized for overlap queries.	SELECT duckhts_cgranges_create('targets_idx');
duckhts_cgranges_add	scalar	Intervals	duckhts_cgranges_add(name, chrom, start, end[, label])	BOOLEAN		Append an interval to a session-scoped cgranges registry entry before finalization. Labels may be BIGINT-like, DOUBLE, VARCHAR, or BOOLEAN.	SELECT duckhts_cgranges_add('targets_idx', 'chr1', 10, 20, 'exon1');
duckhts_cgranges_index	scalar	Intervals	duckhts_cgranges_index(name)	BOOLEAN		Finalize a populated cgranges registry entry and build its immutable overlap index for subsequent queries.	SELECT duckhts_cgranges_index('targets_idx');
duckhts_cgranges_destroy	scalar	Intervals	duckhts_cgranges_destroy(name)	BOOLEAN		Destroy a session-scoped cgranges registry entry and release its indexed interval storage when it is not in active use.	SELECT duckhts_cgranges_destroy('targets_idx');
duckhts_cgranges_from_query	scalar	Intervals	duckhts_cgranges_from_query(name, query, chrom_col, start_col, end_col[, label_col])	BOOLEAN		Execute a SQL query on an extension-owned DuckDB connection, append its interval rows into a session-scoped cgranges registry entry, and leave the populated index ready for explicit finalization with duckhts_cgranges_index(...).	"SELECT duckhts_cgranges_from_query('targets_idx', 'SELECT chrom, start, ""end"", name FROM targets', 'chrom', 'start', 'end', 'name');"
duckhts_cgranges_from_table	scalar	Intervals	duckhts_cgranges_from_table(name, table_name, chrom_col, start_col, end_col[, label_col])	BOOLEAN		Reserved convenience constructor for bulk cgranges population from a table name. The current implementation is intentionally deferred and directs callers to duckhts_cgranges_from_query(...).	SELECT duckhts_cgranges_from_table('targets_idx', 'targets', 'chrom', 'start', 'end', 'name');
duckhts_cgranges_has_overlap	scalar	Intervals	duckhts_cgranges_has_overlap(name, chrom, start, end[, mode])	BOOLEAN		Vectorized scalar predicate for streaming provider rows through a finalized session-scoped cgranges index. Returns TRUE when the query interval overlaps at least one indexed interval, or when mode = 'contain' and it fully contains at least one indexed interval; NULL inputs return NULL.	"SELECT * FROM read_bed('queries.bed') WHERE duckhts_cgranges_has_overlap('targets_idx', chrom, start, ""end"");"
duckhts_cgranges_count_overlaps	scalar	Intervals	duckhts_cgranges_count_overlaps(name, chrom, start, end[, mode])	BIGINT		Vectorized scalar overlap counter for streaming provider rows through a finalized session-scoped cgranges index. Returns the number of indexed intervals that overlap the query interval, or with mode = 'contain' the number fully contained by it; NULL inputs return NULL.	"SELECT chrom, start, ""end"", duckhts_cgranges_count_overlaps('targets_idx', chrom, start, ""end"") AS n_targets FROM read_bed('queries.bed');"
duckhts_cgranges_overlaps_list	scalar	Intervals	duckhts_cgranges_overlaps_list(name, chrom, start, end[, mode])	STRUCT(interval_ordinal BIGINT, label VARCHAR, label_type VARCHAR, interval_chrom VARCHAR, interval_start INTEGER, interval_end INTEGER)[]		Vectorized scalar overlap expander for streaming provider rows through a finalized session-scoped cgranges index. Returns a LIST of hit STRUCTs that can be expanded with UNNEST, preserving provider columns while emitting one row per matching indexed interval. Because scalar return types are fixed, labels are returned as text with label_type describing the original cgranges label kind; NULL inputs return NULL.	"SELECT q.*, hit.interval_chrom, hit.interval_start, hit.interval_end, hit.label FROM read_bed('queries.bed') AS q CROSS JOIN UNNEST(duckhts_cgranges_overlaps_list('targets_idx', q.chrom, q.start, q.""end"")) AS u(hit);"
duckhts_cgranges_overlaps	table	Intervals	duckhts_cgranges_overlaps(name, chrom, start, end, mode := 'overlap', query_row_id := NULL)	table		Query a finalized session-scoped cgranges registry entry and return one row per overlapping or containing indexed interval, preserving the original label type and interval coordinates.	SELECT * FROM duckhts_cgranges_overlaps('targets_idx', 'chr1', 100, 150);
duckhts_cgranges_overlaps_bulk	table	Intervals	duckhts_cgranges_overlaps_bulk(name, query, chrom_col, start_col, end_col, mode := 'overlap', query_row_id_col := NULL)	table		Run a SQL query that yields overlap probes, stream those rows through a finalized session-scoped cgranges registry entry, and return one row per matching indexed interval. The probe query runs on the extension-owned helper connection, so it must reference regular tables/views rather than connection-local temp tables. When query_row_id_col is omitted, query_row_id defaults to the 1-based probe row ordinal.	"SELECT * FROM duckhts_cgranges_overlaps_bulk('targets_idx', 'SELECT probe_id, chrom, start, ""end"" FROM probes', 'chrom', 'start', 'end', query_row_id_col := 'probe_id');"
read_fastq	table	Readers	read_fastq(path, interleaved := FALSE, mate_path := NULL, sequence_encoding := 'string', quality_representation := 'string', input_quality_encoding := 'phred33')	table	rduckhts_fastq	Read single-end, paired-end, or interleaved FASTQ files with optional legacy quality decoding. By default, FASTQ qualities are interpreted as modern Phred+33 input. Use sequence_encoding := 'nt16' to return SEQUENCE as UTINYINT[] and quality_representation := 'phred' to return QUALITY as UTINYINT[] instead of VARCHAR. input_quality_encoding accepts 'phred33', 'auto', 'phred64', or 'solexa64'.	SELECT NAME, MATE FROM read_fastq('r1.fq', mate_path := 'r2.fq') LIMIT 5;
detect_quality_encoding	table	Metadata	detect_quality_encoding(path, max_records := 10000)	table	rduckhts_detect_quality_encoding	Inspect a FASTQ file's observed quality ASCII range and report compatible legacy encodings with a heuristic guessed encoding.	SELECT * FROM detect_quality_encoding('reads.fq.gz');
read_gff	table	Readers	read_gff(path, header_names := NULL, header := FALSE, column_types := NULL, auto_detect := FALSE, attributes_map := FALSE, attributes_list := FALSE, attributes_pairs := FALSE, strict := FALSE, region := NULL, index_path := NULL)	table	rduckhts_gff	Read GFF annotations with optional raw scalar and richer list/pair parsed attribute columns, strict GFF3 structural validation, and indexed region filtering.	"SELECT seqname, feature, start, ""end"" FROM read_gff('gff_file.gff.gz') LIMIT 5;"
read_gtf	table	Readers	read_gtf(path, header_names := NULL, header := FALSE, column_types := NULL, auto_detect := FALSE, attributes_map := FALSE, attributes_list := FALSE, attributes_pairs := FALSE, region := NULL, index_path := NULL)	table	rduckhts_gtf	Read GTF annotations with optional raw scalar and richer list/pair parsed attribute columns and indexed region filtering.	"SELECT seqname, feature, start, ""end"" FROM read_gtf('annotations.gtf.gz') LIMIT 5;"
read_tabix	table	Readers	read_tabix(path, header_names := NULL, header := FALSE, column_types := NULL, auto_detect := FALSE, region := NULL, index_path := NULL)	table	rduckhts_tabix	Read generic tabix-indexed text data with optional header handling and type inference.	SELECT * FROM read_tabix('meta_tabix.tsv.gz') LIMIT 5;
fasta_index	table	Readers	fasta_index(path, index_path := NULL)	table	rduckhts_fasta_index	Build a FASTA index (.fai) and return a single row with columns success (BOOLEAN) and index_path (VARCHAR).	SELECT * FROM fasta_index('ce.fa');
bgzip	table	Compression	bgzip(path, output_path := NULL, threads := 4, level := -1, keep := TRUE, overwrite := FALSE)	table	rduckhts_bgzip	Compress a plain file to BGZF and return the created output path and byte counts.	SELECT * FROM bgzip('regions.bed');
bgunzip	table	Compression	bgunzip(path, output_path := NULL, threads := 4, keep := TRUE, overwrite := FALSE)	table	rduckhts_bgunzip	Decompress a BGZF-compressed file and return the created output path and byte counts.	SELECT * FROM bgunzip('regions.bed.gz');
bam_index	table	Indexing	bam_index(path, index_path := NULL, min_shift := 0, threads := 4)	table	rduckhts_bam_index	Build a BAM or CRAM index and report the written index path and format.	SELECT * FROM bam_index('range.bam');
bcf_index	table	Indexing	bcf_index(path, index_path := NULL, min_shift := NULL, threads := 4)	table	rduckhts_bcf_index	Build a TBI or CSI index for a VCF or BCF file and report the written index path and format.	SELECT * FROM bcf_index('formatcols.vcf.gz');
tabix_index	table	Indexing	tabix_index(path, preset := 'vcf', index_path := NULL, min_shift := 0, threads := 4, seq_col := NULL, start_col := NULL, end_col := NULL, comment_char := NULL, skip_lines := NULL)	table	rduckhts_tabix_index	Build a tabix index for a BGZF-compressed text file using a preset or explicit coordinate columns.	SELECT * FROM tabix_index('gff_file.gff.gz', preset := 'gff');
bam_bin_counts	table	Coverage	bam_bin_counts(path, bin_width, chrom := NULL, reference := NULL, index_path := NULL, mapq := 0, require_flags := 0, exclude_flags := 0, rmdup := 'none', stats := NULL)	table	rduckhts_bam_bin_counts	Count BAM or CRAM read starts into fixed-width bins. Returns one row per bin across the selected contig span, including zero-count bins, with total, forward, and reverse counts; `rmdup := 'streaming'` applies the WisecondorX-style larp/larp2 consecutive-position deduplication, `rmdup := 'flag'` drops SAM duplicate-flagged reads, and `stats := 'gc'`, `'mq'`, or `'gc,mq'` adds per-bin pre/post-filter GC and MAPQ sufficient statistics, including reference GC when `reference` is provided.	SELECT * FROM bam_bin_counts('fixture_mixed.cram', 5000, reference := 'fixture_ref.fa', rmdup := 'streaming', stats := 'gc,mq');
duckhts_bam_bed_coverage	table	Coverage	duckhts_bam_bed_coverage(path, bed_path, reference := NULL, index_path := NULL, bed_index_path := NULL, mapq := 0, min_baseq := 0, min_read_len := 0, require_flags := 0, exclude_flags := 1796, min_depth := 1, max_depth := 1000000, decompression_threads := 0, fragment_mode := FALSE, strand_outputs := TRUE, processing_threads := 0)	table	rduckhts_bam_bed_coverage	Compute samtools coverage-like regional summaries for BAM or CRAM input over a BED target set, returning one row per BED interval with DuckHTS-specific pre/post-filter read counts, covered bases, percentage covered, mean depth, mean baseQ, mean mapQ, and strand-specific post-filter summaries in read mode. Indexed BAM/CRAM input is required in the current implementation. decompression_threads controls htslib worker threads for BAM/CRAM decoding; use 0 to disable them.	"SELECT chrom, start, ""end"", numreads_post, covbases_post, coverage_post FROM duckhts_bam_bed_coverage('fixture_mixed.bam', 'fixture_mixed_regions.bed');"
duckhts_mosdepth	table	Coverage	duckhts_mosdepth(prefix, path, chrom := NULL, by := NULL, fasta := NULL, read_groups := NULL, no_per_base := FALSE, threads := 2, processing_threads := 2, flag := 1796, include_flag := 0, fast_mode := FALSE, fragment_mode := FALSE, use_median := FALSE, mapq := 0, min_frag_len := -1, max_frag_len := -1, precision_digits := 2, quantize := NULL, thresholds := NULL, index_path := NULL, overwrite := FALSE)	table	rduckhts_mosdepth	Write native mosdepth-compatible coverage outputs for indexed BAM or CRAM input. Produces mosdepth-style summary, global distribution, per-base BED.gz + CSI, optional window/BED region outputs, optional quantized BED.gz + CSI, and optional threshold counts for `by`; `fast_mode` defaults to FALSE to match upstream mosdepth, default mode performs CIGAR-aware coverage with mate-overlap correction, `fragment_mode` switches coverage to full-fragment insert spans for proper pairs, `use_median` switches `by` outputs from mean to median, `read_groups` filters by comma-separated RG IDs, `min_frag_len` and `max_frag_len` filter on absolute template length, `fasta` is required for CRAM when htslib needs a reference, `precision_digits` controls decimal places in the text outputs, and `processing_threads` enables parallel contig processing (0 = sequential, >0 = number of worker threads).	SELECT * FROM duckhts_mosdepth('sample', 'range.cram', fasta := 'ce.fa', by := '1000', fragment_mode := TRUE, read_groups := '1', use_median := TRUE, min_frag_len := 50, max_frag_len := 500, quantize := ':1:4:', thresholds := '1,10,20', precision_digits := 4, overwrite := TRUE);
duckhts_samtools_idxstats	table	Metadata	duckhts_samtools_idxstats(path, output := NULL, index_path := NULL, threads := 0, overwrite := FALSE)	table	rduckhts_samtools_idxstats	Write samtools idxstats-compatible TAB-delimited output for BAM, CRAM, or SAM input. Indexed BAM uses `hts_idx_get_stat(...)` for the fast path; CRAM, SAM, and unindexed BAM fall back to a full scan while preserving samtools-style contig rows plus the final `*` row.	SELECT * FROM duckhts_samtools_idxstats('range.bam', output := 'range.idxstats.txt', overwrite := TRUE);
read_hts_header	table	Metadata	read_hts_header(path, format := NULL, mode := NULL)	table	rduckhts_hts_header	Inspect HTS headers in parsed, raw, or combined form across supported formats.	SELECT record_type, id FROM read_hts_header('formatcols.vcf.gz') LIMIT 10;
read_hts_index	table	Metadata	read_hts_index(path, format := NULL, index_path := NULL)	table	rduckhts_hts_index	Inspect high-level HTS index metadata such as sequence names and mapped counts.	SELECT seqname, index_type FROM read_hts_index('vcf_file.bcf');
read_hts_index_spans	table	Metadata	read_hts_index_spans(path, format := NULL, index_path := NULL)	table	rduckhts_hts_index_spans	Expand index metadata into span and chunk rows suitable for low-level index inspection.	SELECT seqname, chunk_beg_vo, chunk_end_vo FROM read_hts_index_spans('vcf_file.bcf') LIMIT 5;
read_hts_index_raw	table_macro	Metadata	read_hts_index_raw(path, format := NULL, index_path := NULL)	table	rduckhts_hts_index_raw	Return the raw on-disk HTS index blob together with basic identifying metadata.	SELECT length(raw) FROM read_hts_index_raw('formatcols.vcf.gz');
bcftools_liftover	scalar	Variants	bcftools_liftover(chrom, pos, ref, alt, chain_path, dst_fasta_ref, src_fasta_ref, max_snp_gap, max_indel_inc, lift_mt, end_pos, no_left_align)	STRUCT	rduckhts_liftover	Row-oriented liftover kernel intended to mirror bcftools +liftover semantics as closely as possible while returning one STRUCT per input row with fields: src_chrom, src_pos, src_ref, src_alt, dest_chrom, dest_pos, dest_end, dest_ref, dest_alt, mapped, reverse_complemented, swap, reject_reason, and note. Set no_left_align := true to skip post-liftover left-alignment of lifted indels (mirrors --no-left-align in bcftools +liftover).	SELECT (bcftools_liftover(chrom, pos, ref, alt, 'hg19ToHg38.over.chain.gz', 'hg38.fa', 'hg19.fa', 1, 250, false, NULL::BIGINT, false)).dest_pos FROM variants;
duckdb_liftover	table_macro	Variants	duckdb_liftover(table_name, chrom_col, pos_col, ref_col := NULL, alt_col := NULL, chain_path := NULL, dst_fasta_ref := NULL, src_fasta_ref := NULL, max_snp_gap := 1, max_indel_inc := 250, lift_mt := false, end_pos_col := NULL, no_left_align := false)	table	rduckhts_liftover	DuckDB-specific wrapper over bcftools_liftover that takes either a table name or a derived-table expression plus column-name strings for chrom/pos/ref/alt and returns the lifted table. The no_left_align parameter mirrors --no-left-align in bcftools +liftover.	SELECT * FROM duckdb_liftover('variants', 'chrom', 'pos', ref_col := 'ref', alt_col := 'alt', chain_path := 'hg19ToHg38.over.chain.gz', dst_fasta_ref := 'hg38.fa'); || SELECT * FROM duckdb_liftover('(SELECT chrom, pos, ref, alt FROM variants) AS v', 'chrom', 'pos', ref_col := 'ref', alt_col := 'alt', chain_path := 'hg19ToHg38.over.chain.gz', dst_fasta_ref := 'hg38.fa');
bcftools_score	table	Variants	bcftools_score(bcf_path, summary_path_or_list, use := NULL, columns := 'PLINK', columns_file := NULL, q_score_thr := NULL, summaries_list_file := NULL, log_path := NULL, use_variant_id := FALSE, counts := FALSE, samples := NULL, force_samples := FALSE, regions := NULL, regions_file := NULL, regions_overlap := 1, targets := NULL, targets_file := NULL, targets_overlap := 0, apply_filters := NULL, include := NULL, exclude := NULL)	table	rduckhts_score	Compute polygenic scores from one genotype BCF/VCF and one or more summary-statistics files with bcftools +score-compatible GT/DS/HDS/AP/GP/AS dosage semantics, sample subsetting, and region/target/FILTER-string controls. The second argument accepts a scalar path or a DuckDB LIST/array of paths; TSV/SSF summaries produce one PRS column per file in a single genotype scan, while GWAS-VCF summaries still produce one PRS column per FORMAT sample. Use summaries_list_file with a NULL second argument to read paths from a file or directory; list-file entries are interpreted as written, matching upstream `bcftools +score --summaries` behavior, while directory inputs scan supported regular summary files in lexicographic order and ignore index sidecars. Use log_path to write per-PRS loaded/matched/allele-mismatch/duplicate-marker audit counts.	SELECT * FROM bcftools_score('cohort.bcf', 'gwas.tsv.gz', columns := 'PLINK') LIMIT 5; || SELECT * FROM bcftools_score('cohort.bcf', ['score1.tsv.gz', 'score2.tsv.gz'], columns := 'GWAS-SSF') LIMIT 5; || SELECT * FROM bcftools_score('cohort.bcf', NULL, columns := 'GWAS-SSF', summaries_list_file := 'scores.list', log_path := 'score.log') LIMIT 5;
bcftools_munge_row	scalar	Variants	bcftools_munge_row(chrom, pos, a1, a2, id, p, z, or, beta, n, n_cas, n_con, info, frq, se, lp, ac, neff, neffdiv2, het_i2, het_p, het_lp, dire, fasta_ref, iffy_tag := 'IFFY', mismatch_tag := 'REF_MISMATCH', ns := NULL, nc := NULL, ne := NULL)	STRUCT		Normalize one summary-statistics row into GWAS-VCF-style fields (chrom/pos/ref/alt/effect metrics), resolving REF/ALT orientation against a FASTA reference and applying swap-aware sign/frequency/count transforms. The output flag `alleles_swapped` means REF/ALT orientation was swapped to match the FASTA reference.	SELECT (bcftools_munge_row('chr1', 12345, 'A', 'G', 'rs1', 0.01, NULL, NULL, 0.12, 1000, NULL, NULL, NULL, 0.3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'ref.fa')).ref;
duckdb_munge	table_macro	Variants	duckdb_munge(table_name, preset := '', column_map := map([''], ['']), column_map_file := '', fasta_ref := NULL, iffy_tag := 'IFFY', mismatch_tag := 'REF_MISMATCH', ns := NULL, nc := NULL, ne := NULL)	table	rduckhts_munge	DuckDB macro wrapper over bcftools_munge_row that maps source columns (via preset or explicit map) and returns normalized GWAS-VCF-style rows with lean outputs and explicit `alleles_swapped` semantics. Output columns: chrom, pos, id, ref, alt, alleles_swapped, filter, ns, ez, nc, es, se, lp, af, ac, ne (16 columns). For METAL meta-analysis output with SI/I2/CQ/ED columns, use duckdb_munge_metal.	SELECT * FROM duckdb_munge('gwas_table', preset := 'PLINK', fasta_ref := 'ref.fa'); || SELECT * FROM duckdb_munge('(SELECT * FROM gwas_table) AS s', column_map := map(['CHR','BP','A1','A2','SNP'], ['chrom','pos','ea','nea','id']), fasta_ref := 'ref.fa');
duckdb_munge_metal	table_macro	Variants	duckdb_munge_metal(table_name, preset := '', column_map := map([''], ['']), column_map_file := '', fasta_ref := NULL, iffy_tag := 'IFFY', mismatch_tag := 'REF_MISMATCH', ns := NULL, nc := NULL, ne := NULL)	table	rduckhts_munge	Extended munge macro with METAL meta-analysis output columns. Same as duckdb_munge but additionally emits: si (imputation info, from INFO input), i2 (Cochran's I² heterogeneity, from HET_I2), cq (Cochran's Q -log10 p, from HET_LP or -log10(HET_P)), and ed (effect direction string, from DIRE; +/- flipped on allele swap). The R wrapper rduckhts_munge() auto-dispatches to this macro when metal keys (INFO, HET_I2, HET_P, HET_LP, DIRE) are present in the resolved column map.	SELECT * FROM duckdb_munge_metal('metal_results', preset := 'METAL', fasta_ref := 'ref.fa'); || SELECT * FROM duckdb_munge_metal('meta', column_map := map(['CHR','BP','A1','A2','SNP','HET_I2','DIRE'], ['chr','pos','ea','nea','snp','HetISq','Direction']), fasta_ref := 'ref.fa');
hts_union_query	scalar_macro	Readers	hts_union_query(reader, pattern, params := '')	VARCHAR	rduckhts_bam_multi, rduckhts_bcf_multi, rduckhts_fastq_multi, rduckhts_fasta_multi, rduckhts_bed_multi, rduckhts_tabix_multi, rduckhts_gff_multi, rduckhts_gtf_multi	Generate a UNION ALL BY NAME query string that reads every file matching a glob pattern through the named reader function. The result includes a 'filename' column identifying the source file for each row. Assign to a variable with SET VARIABLE and execute via query(getvariable(...)). Optional params string is appended to each reader call. In R, use the typed rduckhts_*_multi() helpers instead, which accept file vectors with optional per-file parameters and create DuckDB tables directly.	SET VARIABLE q = hts_union_query('read_bam', 'samples/*.bam'); SELECT * FROM query(getvariable('q')); || SET VARIABLE q = hts_union_query('read_bcf', 'cohort/*.vcf.gz', 'tidy_format := true'); SELECT * FROM query(getvariable('q'));
seq_revcomp	scalar	Sequence UDFs	seq_revcomp(sequence)	VARCHAR		Compute the reverse complement of a DNA sequence using A, C, G, T, and N bases.	SELECT seq_revcomp('ACGTN');
seq_canonical	scalar	Sequence UDFs	seq_canonical(sequence)	VARCHAR		Return the lexicographically smaller of a sequence and its reverse complement.	SELECT seq_canonical('ACGTN');
seq_hash_2bit	scalar	Sequence UDFs	seq_hash_2bit(sequence)	UBIGINT		Encode a short DNA sequence as a 2-bit unsigned integer hash.	SELECT seq_hash_2bit('ACGT');
seq_encode_4bit	scalar	Sequence UDFs	seq_encode_4bit(sequence)	UTINYINT[]		Encode an IUPAC DNA sequence as a list of 4-bit base codes, preserving ambiguity symbols including N.	SELECT seq_encode_4bit('ACGTRYSWKMBDHVN');
seq_decode_4bit	scalar	Sequence UDFs	seq_decode_4bit(codes)	VARCHAR		Decode a list of 4-bit IUPAC DNA base codes back into a sequence string.	SELECT seq_decode_4bit(seq_encode_4bit('ACGTRYSWKMBDHVN'));
seq_gc_content	scalar	Sequence UDFs	seq_gc_content(sequence)	DOUBLE		Compute GC fraction for a DNA sequence as a value between 0 and 1.	SELECT seq_gc_content('ACGT');
seq_kmers	table	Sequence UDFs	seq_kmers(sequence, k, canonical := FALSE)	table		Expand a sequence into positional k-mers with optional canonicalization.	SELECT * FROM seq_kmers('ACGT', 2);
sam_flag_bits	scalar	SAM Flag UDFs	sam_flag_bits(flag)	STRUCT		Decode a SAM flag into a struct of boolean bit fields using explicit SAM-oriented names such as `is_paired`, `is_proper_pair`, `is_next_segment_unmapped`, and `is_supplementary`.	SELECT (sam_flag_bits(99)).is_proper_pair;
sam_flag_has	scalar	SAM Flag UDFs	sam_flag_has(flag, mask)	BOOLEAN		Test whether any bits from the provided SAM flag mask are set in a flag value.	SELECT sam_flag_has(99, 2);
is_forward_aligned	scalar	SAM Flag UDFs	is_forward_aligned(flag)	BOOLEAN		Test whether a mapped segment is aligned to the forward strand. Returns `NULL` for unmapped segments because SAM flag `0x10` does not define genomic strand when `0x4` is set.	SELECT is_forward_aligned(0);
cigar_has_soft_clip	scalar	CIGAR Utils	cigar_has_soft_clip(cigar)	BOOLEAN		Test whether a CIGAR string contains any soft-clipped segment (`S`).	SELECT cigar_has_soft_clip('5S90M5S');
cigar_has_hard_clip	scalar	CIGAR Utils	cigar_has_hard_clip(cigar)	BOOLEAN		Test whether a CIGAR string contains any hard-clipped segment (`H`).	SELECT cigar_has_hard_clip('5H95M');
cigar_left_soft_clip	scalar	CIGAR Utils	cigar_left_soft_clip(cigar)	BIGINT		Return the left-end soft-clipped length from a CIGAR string, or zero if the alignment does not start with `S`.	SELECT cigar_left_soft_clip('5S90M5S');
cigar_right_soft_clip	scalar	CIGAR Utils	cigar_right_soft_clip(cigar)	BIGINT		Return the right-end soft-clipped length from a CIGAR string, or zero if the alignment does not end with `S`.	SELECT cigar_right_soft_clip('5S90M5S');
cigar_query_length	scalar	CIGAR Utils	cigar_query_length(cigar)	BIGINT		Return the query-consuming length from a CIGAR string, counting `M`, `I`, `S`, `=`, and `X`.	SELECT cigar_query_length('5S90M5I');
cigar_aligned_query_length	scalar	CIGAR Utils	cigar_aligned_query_length(cigar)	BIGINT		Return the aligned query length from a CIGAR string, counting `M`, `=`, and `X` but excluding clips and insertions.	SELECT cigar_aligned_query_length('5S90M5I');
cigar_reference_length	scalar	CIGAR Utils	cigar_reference_length(cigar)	BIGINT		Return the reference-consuming length from a CIGAR string, counting `M`, `D`, `N`, `=`, and `X`.	SELECT cigar_reference_length('90M5D');
cigar_has_op	scalar	CIGAR Utils	cigar_has_op(cigar, op)	BOOLEAN		Test whether a CIGAR string contains at least one instance of the requested operator.	SELECT cigar_has_op('5S90M5S', 'S');
is_paired	scalar	SAM Flag UDFs	is_paired(flag)	BOOLEAN		Test whether the SAM flag indicates that the template has multiple segments in sequencing (`0x1`).	SELECT is_paired(99);
is_proper_pair	scalar	SAM Flag UDFs	is_proper_pair(flag)	BOOLEAN		Test whether the SAM flag indicates that each segment is properly aligned according to the aligner (`0x2`).	SELECT is_proper_pair(99);
is_unmapped	scalar	SAM Flag UDFs	is_unmapped(flag)	BOOLEAN		Test whether the read itself is unmapped according to the SAM flag.	SELECT is_unmapped(4);
is_next_segment_unmapped	scalar	SAM Flag UDFs	is_next_segment_unmapped(flag)	BOOLEAN		Test whether the next segment in the template is flagged as unmapped (`0x8`).	SELECT is_next_segment_unmapped(9);
is_reverse_complemented	scalar	SAM Flag UDFs	is_reverse_complemented(flag)	BOOLEAN		Test whether `SEQ` is stored reverse complemented (`0x10`); for mapped reads this corresponds to reverse-strand alignment.	SELECT is_reverse_complemented(16);
is_next_segment_reverse_complemented	scalar	SAM Flag UDFs	is_next_segment_reverse_complemented(flag)	BOOLEAN		Test whether `SEQ` of the next segment in the template is stored reverse complemented (`0x20`).	SELECT is_next_segment_reverse_complemented(32);
is_first_segment	scalar	SAM Flag UDFs	is_first_segment(flag)	BOOLEAN		Test whether the read is marked as the first segment in the template.	SELECT is_first_segment(64);
is_last_segment	scalar	SAM Flag UDFs	is_last_segment(flag)	BOOLEAN		Test whether the read is marked as the last segment in the template.	SELECT is_last_segment(128);
is_secondary	scalar	SAM Flag UDFs	is_secondary(flag)	BOOLEAN		Test whether the alignment is marked as secondary.	SELECT is_secondary(256);
is_qc_fail	scalar	SAM Flag UDFs	is_qc_fail(flag)	BOOLEAN		Test whether the read failed vendor or pipeline quality checks.	SELECT is_qc_fail(512);
is_duplicate	scalar	SAM Flag UDFs	is_duplicate(flag)	BOOLEAN		Test whether the alignment is flagged as a duplicate.	SELECT is_duplicate(1024);
is_supplementary	scalar	SAM Flag UDFs	is_supplementary(flag)	BOOLEAN		Test whether the alignment is marked as supplementary.	SELECT is_supplementary(2048);
