diff options
| author | Pjotr <wrk@bosa.lan> | 2026-11-07 15:33:28 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-11-07 15:33:28 +0000 |
| commit | 2fcb57a627ed261b6650522b256cc509ebd65ddd (patch) | |
| tree | dc356cc6fa962a3ec89eb393dbd9a0f4b15ca2fd /scripts | |
| parent | e5c333959af6675a0d80934c8cf76275d5571ef8 (diff) | |
| download | genenetwork4-2fcb57a627ed261b6650522b256cc509ebd65ddd.tar.gz | |
rqtl: refuse a phenotype whose sample count is not the cross's
Asked to map a 9-strain trait, the wrapper scanned it against the 6-individual fixture cross and returned six markers with LOD scores and `state: complete` -- a plausible answer belonging to nobody. R recycled and truncated the values silently, and nothing downstream could tell. GeneNetwork3's copy of this script has the same hole. The cross-file format carries no per-sample names, so the count is the only check available; order remains the caller's responsibility (and the reason values and genotype file must come from the same panel). With the check, the same request is a 502 rqtl_failed quoting both counts, and the correctly-shaped request still returns the documented LODs. * scripts/rqtl_wrapper.R: compare the pheno file's rows with nind() of the cross, and stop. * README.md (/compute/rqtl): the second fix relative to gn3, and what stays the caller's job. * docs/www/ai-instruction.md (4a): values and genotypes must describe the same individuals, one for one, in the same order. * docs/www/operator-checklist.md (Compute): what genotype files actually exist on this box (test fixtures, 198 BXD individuals) and why a database trait, with its own strain subset, cannot be mapped against them.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/rqtl_wrapper.R | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/rqtl_wrapper.R b/scripts/rqtl_wrapper.R index a2b4403..5c67d88 100644 --- a/scripts/rqtl_wrapper.R +++ b/scripts/rqtl_wrapper.R @@ -179,6 +179,20 @@ verbose_print('Generating cross object\n') scale_col <- if (toupper(opt$scale) == "CM") "cM" else "Mb" cross_object = geno_to_csvr(geno_file, trait_names, trait_vals, cross_file, type, mapping_scale = scale_col) +# Fail loudly when the phenotype and genotype disagree about how many +# individuals there are. The cross file format has no per-sample name +# matching (see README), so the only thing that ties the two together is +# position: a trait covering 9 strains scanned against a 6-individual +# cross otherwise comes back with a full, plausible-looking set of LOD +# scores that belong to nobody. (GeneNetwork3's copy of this script has +# the same hole.) +if (length(sample_names) != nind(cross_object)) { + stop(sprintf(paste("The phenotype file has %d samples but the genotype file has %d", + "individuals. Values are matched to individuals by position, so the", + "two must be one for one, in the genotype file's column order."), + length(sample_names), nind(cross_object)), call.=FALSE) +} + # Calculate genotype probabilities if (!is.null(opt$pairscan)) { verbose_print('Calculating genotype probabilities for pair-scan\n') |
