From 8f4a9512d7fb4ac518341f23a4b062ccf80e2a7d Mon Sep 17 00:00:00 2001 From: Pjotr Date: Tue, 10 Nov 2026 11:25:49 +0000 Subject: compute/qtl2: multiparent crosses, by name A multiparent population cannot come from a .geno. That file carries two codes per marker (B/D, A/H/B) -- a collapse, not a founder allele -- and the collapse is not invertible, so DOL's 194 DO animals cannot be fitted as a DO however much reference data appears. What can be is a cross that ships its own qtl2 control file with founder genotypes, so the endpoint now takes one by name: {"rqtl2_cross": "do", "trait_name": "DO::10001 (WBC)", "samples": ...} * resolve_control_file looks in genotype/rqtl2/{name}.json, then {name}/{name}.json (do/do.json), then {name}.json under GENOTYPE_FILES; prepare_control_cross reads the cross's pheno, maps and founder_geno headers without converting anything. It reports crosstype, founders and whether the cross is multiparent, and refuses a multiparent crosstype with no founder_geno rather than silently scanning it as biallelic. * Samples are matched to the cross's own population by name and the strays are counted in notes; rqtl2_cross cannot be combined with group or genotype_file. * The gate is given individuals x founders, because a multiparent scan fits one coefficient per founder allele at every marker. * Autosomes only now applies to shipped crosses as well: the DO's X is left out (369 markers) instead of being fitted without a sex covariate, and the script subsets with cross[, chr = autosomal]. Measured on the DO (WBC, 742 individuals, 8 founders, 6044 autosomal markers): probabilities 174 s / 1.39 GB (cached), LOCO kinship 15 s (cached), scan 21 s. scan1 runs on one core for a multiparent cross because its forked path stalls on allele probabilities here -- 25+ minutes at 8 cores with no CPU consumed, against 21 s serial. Two bugs found by running an actual published trait through it: * do_pmap.csv is in Mb, not the bp qtl2 documents, so every DO peak was reported at 0.0 Mb. The map's unit is now detected from its largest position and printed. * The phenotype file was read with the default whitespace separator, so a label with a space ("DO::10001 (WBC)") split into three fields and read.table stopped with "line 1 did not have 3 elements". Both the pheno and covariate reads are tab-separated now. The R error extraction also joins R's wrapped continuation line, so a complaint reads as a sentence rather than "Error in scan(...) :". --- docs/www/SKILL.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs') diff --git a/docs/www/SKILL.md b/docs/www/SKILL.md index 67ce622..2e63419 100644 --- a/docs/www/SKILL.md +++ b/docs/www/SKILL.md @@ -158,6 +158,12 @@ header (peak and, for GEMMA, the Bonferroni line). marker equals `/compute/rqtl`'s LOD at that marker; with one fitted it is a different model, so the two no longer match — quote the scan for "where", this for "how much". +* `/compute/qtl2` with `"rqtl2_cross": "do"`: a **multiparent** scan — 8 + founder alleles, an LMM with LOCO kinship. Only a cross that ships founder + genotypes can do this (a `.geno` is a biallelic collapse); `do` is the one + this deployment has. Pass `samples` by name; the LOD means "some founder + differs", not "this strain differs" — per-founder effects are not returned + yet. Minutes of genotype probabilities the first time, cached per cross. * `/compute/qtl2`: the same panel through **R/qtl2** — genotype probabilities and an LMM with `loco` kinship (`"kinship": "none"` turns it into a Haley-Knott scan on probabilities). Rows are `marker, chr, pos, lod`, -- cgit 1.4.1