rduckhts_somalier_find_sites: Select a Somalier Panel from Population Variants

View source: R/somalier_find_sites.R

rduckhts_somalier_find_sitesR Documentation

Select a Somalier Panel from Population Variants

Description

Select typed population variants on the caller's DuckDB connection. A table or view may be populated by 'read_bcf()'; Parquet and VCF/BCF paths are also supported. Input columns follow 'read_bcf()' ('CHROM', 'POS', 'REF', 'ALT', 'FILTER', and declared 'INFO_*' fields). Interval relations have 'chrom', 'start', 'end' in zero-based half-open BED coordinates, as returned by 'read_bed()'. A gnotate exclusion relation has 'chrom', 'pos', 'ref', 'alt' in one-based VCF coordinates.

Usage

rduckhts_somalier_find_sites(
  con,
  source_table = NULL,
  source_parquet = NULL,
  source_vcf = NULL,
  assembly,
  min_af = 0.15,
  min_an = 115000,
  af_field = "AF",
  an_field = "AN",
  snp_dist = 10000,
  target_af = 0.48,
  include_table = NULL,
  exclude_table = NULL,
  gnotate_exclude_table = NULL,
  compatibility_mode = c("somalier_v0.3.4", "generic"),
  max_autosomal = 65535,
  max_x = 10001,
  max_y = 5001,
  table_name = NULL,
  overwrite = FALSE,
  sex_spacing = c("upstream", "enforced"),
  tie_order = c("input", "lexical")
)

Arguments

con

A DuckDB connection with DuckHTS loaded.

source_table

A typed source table or view, including a view over read_bcf().

source_parquet

Parquet source path instead of source_table.

source_vcf

VCF/BCF path instead of source_table.

assembly

Nonempty assembly identifier.

min_af, min_an, af_field, an_field, snp_dist, target_af

Somalier find-sites thresholds and INFO field names; defaults match Somalier v0.3.4.

include_table, exclude_table

BED interval relations; NULL omits the gate.

gnotate_exclude_table

Optional allele-specific exclusion relation in place of Somalier's gnotate zip.

compatibility_mode

Named contig and REF=C policy.

max_autosomal, max_x, max_y

Site caps after greedy selection.

table_name

Optional output table, otherwise return a data frame.

overwrite

Whether to replace an existing output table.

sex_spacing

Whether to reproduce upstream's unspaced X/Y selection or enforce X/Y distances.

tie_order

Retain input scan order or use lexical position and allele order for equal AF scores.

Details

'somalier_v0.3.4' names the pinned human-contig rules. Upstream skips autosomal REF=C and restricts X to the inclusive zero-based range 2781479..154931044. By default X/Y selections do not enter the spacing state, as in upstream v0.3.4. 'sex_spacing = "enforced"' applies the X/Y distances to every selection. Upstream's stable AF-score sort retains input order on ties; this selector uses scan order by default, or lexical position and allele order with 'tie_order = "lexical"'. For a table or view, scan order is only reliable when its query explicitly orders the records. Only uppercase A/C/G/T biallelic SNVs enter the canonical panel. 'generic' does not interpret contig names as human sex chromosomes. The result can include X/Y, which 'duckhts_somalier_import_sites()' keeps as sex-chromosome sites for 'rduckhts_somalier_sex()'. Gnotate zip input is not supported: use an allele-specific exclusion relation. 'assembly' labels the input coordinates; this function does not run the liftover steps in Somalier's 'scripts/find_sites.sh'.

Value

A canonical panel relation with selection score, source AN and spacing-distance diagnostics.


Rduckhts documentation built on Oct. 25, 2026, 1:08 a.m.