///|
/// Demo for pgsea module: Parametric Gene Set Enrichment Analysis.
fn main {
  println("=== pgsea Demo: Parametric Gene Set Enrichment ===")
  println("")

  // Example 1: Score matrix for gene sets
  println("--- Step 1: Score Matrix ---")
  let expr = [
    [1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
    [2.0, 3.0, 4.0, 5.0, 6.0, 7.0],
    [5.0, 4.0, 3.0, 2.0, 1.0, 0.0],
    [3.0, 3.0, 3.0, 3.0, 3.0, 3.0],
  ]
  let genes = ["G1", "G2", "G3", "G4"]
  let sets = [("UP", ["G1", "G2"]), ("DOWN", ["G3"]), ("CONST", ["G4"])]
  let (matrix, names) = @src.pgsea_score_matrix(expr, genes, sets)
  println(
    "Score matrix: " +
    matrix.length().to_string() +
    " sets x " +
    matrix[0].length().to_string() +
    " samples",
  )
  println("Set names: " + repr(names))
  for i in 0.. 200 { 200 } else { tsv.length() }].to_owned(),
  )
  println("")

  // Example 5: t-distribution p-value
  println("--- Step 5: t Distribution P-value ---")
  let p1 = @src.pgsea_t_pvalue(5.0, 10.0)
  let p2 = @src.pgsea_t_pvalue(0.5, 10.0)
  println("t=5.0, df=10: p=" + p1.to_string())
  println("t=0.5, df=10: p=" + p2.to_string())
  println("")

  println("=== pgsea Demo Complete ===")
}