///|
/// Bioconductor SNPRelate Demo - SNP genetic relationship analysis.
///
/// Demonstrates the port of the Bioconductor `SNPRelate` package
/// (Zheng & Weir, 2016): per-SNP statistics, KING-robust kinship,
/// KING homo IBD (k0/k1), IBS distances, EIGMIX-style PCA and greedy
/// LD pruning with a sliding window. Rows are SNPs, columns are
/// samples; -1 marks a missing call.

///|
/// 8 SNPs x 6 samples drawn from two ancestry clusters (samples 0-2 vs
/// 3-5) with a missing call at SNP7/Sample4.
fn demo_dosages() -> Array[Array[Int32]] {
  [
    [0, 1, 0, 2, 2, 2],
    [1, 1, 0, 2, 1, 2],
    [0, 0, 1, 1, 2, 2],
    [2, 2, 2, 0, 0, 1],
    [1, 2, 2, 0, 0, 0],
    [2, 1, 2, 0, 1, 0],
    [0, 1, 2, 2, 1, 1],
    [1, 1, 1, 0, -1, 2],
  ]
}

///|
fn main raise {
  let dosages = demo_dosages()

  println("=== snpgdsSnpStats ===")
  let stats = @src.snpgds_snp_stats(dosages)
  for k in 0..