about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-17 10:25:14 +0000
committerPjotr <wrk@bosa.lan>2026-11-17 10:25:14 +0000
commit2df90559ca597c0d35daf68e8648f8a46c823787 (patch)
tree8271acf86c37f3750a18e92682d0d0c6b17f2cfc /scripts
parentbce93d3deedfc4f0a00a931b1b06ee1c9e8520d1 (diff)
downloadgenenetwork4-2df90559ca597c0d35daf68e8648f8a46c823787.tar.gz
impute=hmm runs now: individuals from rownames, and a versioned cache
Two more faults, both measured, both in the plumbing rather than the statistics.

maxmarg returns individuals x markers, so colnames are *markers*: the
individuals file I added last commit listed 1 452 marker names, every trait
value aligned to nothing, and the workflow answered "number of analyzed
individuals equals 0".  It writes rownames now -- 235 names for BXD.8 -- and
impute=hmm completes: 200, 11 657 rows, 26 s, single machine, with both notes
("missing calls predicted by R/qtl2's HMM", "trait values aligned by name to the
235 individuals").

The second fault was the cache: the prepared files are keyed on (panel, mode)
and not on the code that writes them, so the corrected individuals file was
ignored and the run kept failing on the stale one.  The key now carries
IMPUTE_CACHE_VERSION, bumped when either script changes what it writes.

Three modes through the workflow, same trait, same machine:

  none 200, 21 055 rows
  mean 200, 21 056 rows
  hmm  200, 11 657 rows

none and mean agree as they should: identical top marker (rs32133186),
Spearman rho 1.00000, top-50 50/50, median |d(-log10 p)| 0.00004.

hmm disagrees, and that is a real finding rather than a rounding matter: rho
-0.07 against both, different top marker, and only 11 657 of the 20 453 markers
reported.  A rank correlation near zero means the genotypes and the markers are
not being paired the way the other two modes pair them, so the next thing to
check is the annotation file this path feeds GEMMA (it comes from the cross's
physical map, while the genotype rows come from the HMM's marker order) --
not the imputation itself, which the same-genotype comparison already showed to
be sound (rho 0.999971 against pangemma on the identical calls).
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/qtl2-impute-bimbam.R9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/qtl2-impute-bimbam.R b/scripts/qtl2-impute-bimbam.R
index df5f6d6..2e11a40 100755
--- a/scripts/qtl2-impute-bimbam.R
+++ b/scripts/qtl2-impute-bimbam.R
@@ -82,12 +82,15 @@ for (chr_name in names(imputed)) {
 
 writeLines(vapply(rows, paste, character(1), collapse = ","),
            paste0(out_prefix, ".bimbam.txt"))
-# The individual order of the calls, because it is the *cross's* order and not
-# necessarily the panel's: a caller that writes a phenotype file positionally
+# The individual order of the calls -- rownames, because maxmarg returns
+# individuals x markers and colnames are therefore markers (measured: writing
+# colnames put 1452 marker names in a file of individuals, every value aligned
+# to nothing, and the run reported "number of analyzed individuals equals 0") --
+# because it is the *cross's* order and not necessarily the panel's: a caller that writes a phenotype file positionally
 # has to align to this, or the two disagree by name and every individual is
 # missing (measured: gemma answered "no individuals in common" and ravanan
 # reported no association files at all).
-writeLines(colnames(imputed[[1]]), paste0(out_prefix, ".individuals.txt"))
+writeLines(rownames(imputed[[1]]), paste0(out_prefix, ".individuals.txt"))
 writeLines(vapply(snps, paste, character(1), collapse = ","),
            paste0(out_prefix, ".snps.txt"))