Function Reference¶
PlinkingDuck provides 11 SQL table functions: 5 file readers and 6 analysis functions.
File Readers¶
| Function | Input | Description |
|---|---|---|
read_pvar(path) |
.pvar / .bim |
Variant metadata (CHROM, POS, ID, REF, ALT) |
read_psam(path) |
.psam / .fam |
Sample metadata (FID, IID, SEX, phenotypes) |
read_pgen(path) |
.pgen |
Binary genotypes as ARRAY(TINYINT, N) |
read_pfile(prefix) |
.pgen + .pvar + .psam |
Complete fileset with orient mode support |
read_plink_vcf(path) |
.vcf / .vcf.gz |
Fast biallelic genotype extraction from VCF |
Analysis Functions¶
| Function | Input | Description |
|---|---|---|
plink_freq(path) |
.pgen |
Per-variant allele frequencies and genotype counts |
plink_hardy(path) |
.pgen |
Hardy-Weinberg equilibrium exact test p-values |
plink_missing(path) |
.pgen |
Per-variant or per-sample missingness rates |
plink_ld(path) |
.pgen |
Pairwise linkage disequilibrium (r², D') |
plink_score(path) |
.pgen |
Polygenic risk scoring |
plink_glm(prefix) |
pfile prefix | Per-variant GWAS regression (linear, logistic, Firth) |
Common Features¶
All functions support projection pushdown: columns not referenced in the query are not computed. For genotype-based functions, this means metadata-only queries skip genotype decoding entirely.
Analysis functions (except plink_ld) share a common set of named parameters documented in Common Parameters: pvar, psam, samples, and region.