about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-11-20 15:49:41 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-11-20 15:49:41 +0000
commit87314c6dbde26343d577423942d967b5acc37db5 (patch)
tree51d55fea603e6bd694eaca4686cd9f74d951e059 /scripts
parentf681a06b58879968e7b385e22d6c0560fa0588ba (diff)
downloadgenenetwork4-87314c6dbde26343d577423942d967b5acc37db5.tar.gz
docs: the HMM imputation is a modelling choice now, not a pangemma workaround
The script's rationale still said pangemma "cannot represent a missing
genotype (one NA makes the whole kinship matrix NaN, silently)" -- the third
copy of a claim that stopped being true when pangemma learned to keep gaps in
its GRM.  It is worth keeping the history straight, because it is the reason
the step exists at all: measure it, and `impute: none` through the pangemma
engine answers the same rows and the same allele frequencies as GEMMA.

What the script is for, then: the BIMBAM carries 0.1% unknown calls and the
riself conversion R/qtl2 uses drops 12.7% (every heterozygous call), and a
marker mean invents data where the HMM has a real prediction -- one that
/compute/qtl2 maps on as well, so a GEMMA scan and a qtl2 scan over this file
describe the same data.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/qtl2-impute-bimbam.R22
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/qtl2-impute-bimbam.R b/scripts/qtl2-impute-bimbam.R
index ae95b48..4d33d51 100755
--- a/scripts/qtl2-impute-bimbam.R
+++ b/scripts/qtl2-impute-bimbam.R
@@ -2,13 +2,21 @@
 # qtl2-impute-bimbam.R -- write a BIMBAM genotype file from qtl2's HMM, so that
 # pangemma's mdb can be built from the same genotype calls /compute/qtl2 uses.
 #
-# Why this exists: pangemma's LMDB path cannot represent a missing genotype
-# (one NA makes the whole kinship matrix NaN, silently), while the BIMBAM the
-# GEMMA path uses carries 0.1% unknown calls and the riself conversion used by
-# R/qtl2 drops 12.7% (every heterozygous call).  Filling those with a marker
-# mean would be inventing data where there is a real prediction to be had, so
-# the calls come from qtl2's HMM instead: `maxmarg` on the cached genotype
-# probabilities, which predicts a missing call from its flanking markers.
+# Why this exists: the BIMBAM the GEMMA path uses carries 0.1% unknown calls
+# and the riself conversion used by R/qtl2 drops 12.7% (every heterozygous
+# call).  Filling those with a marker mean would be inventing data where there
+# is a real prediction to be had, so the calls come from qtl2's HMM instead:
+# `maxmarg` on the cached genotype probabilities, which predicts a missing call
+# from its flanking markers -- and that is the call set /compute/qtl2 maps on,
+# so a GEMMA scan and a qtl2 scan over this file describe the same data.
+#
+# It is not here because an engine cannot cope: an older pangemma could not
+# hold a gap in its GRM (one NA made the whole kinship matrix NaN, silently),
+# which is what introduced this step, but the current build keeps the gaps
+# (NaN in a Gf store, 255 in a Gb one) and mean-substitutes them per marker as
+# GEMMA does -- measured: `impute: none` through pangemma answers the same
+# rows and the same allele frequencies as GEMMA.  So this is a modelling
+# choice, not a workaround.
 #
 #   qtl2-impute-bimbam.R <cross dir> <probs.rds> <out prefix> [minprob]
 #