about summary refs log tree commit diff
path: root/README.md
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-10 22:35:45 +0000
committerPjotr <wrk@bosa.lan>2026-11-10 22:35:45 +0000
commitb3811de4f2fb0e1d65ade757ad3ea992eb3f9f67 (patch)
treeaad2b1cb2b97f08e202f1931bcd590ecba408e56 /README.md
parent62cc5f73cb94fe85c31a2f177d1d150e643e84b1 (diff)
downloadgenenetwork4-b3811de4f2fb0e1d65ade757ad3ea992eb3f9f67.tar.gz
traits: genotypes at a confirmed peak, and the plot of them
Returning genotypes is the one thing this API otherwise never does, so it
is fenced and the fence is the feature:

  GET /groups/{group}/traits/{trait_id}/peak-genotypes?marker=<marker>

  * the server re-runs the R/qtl scan for the trait -- the same machinery
    and gate as /compute/rqtl -- and takes the peak from that run, rather
    than trusting a client that names a marker;
  * the marker must lie within ?window= Mb of that peak (default 10), or
    the answer is 422 not_the_peak quoting the peak's marker, chromosome,
    Mb and LOD;
  * the peak must reach ?min_lod= (default 3), or 422 not_a_hit;
  * only animals that have a value for the trait are listed, and only
    this marker's calls. Nothing else of the matrix leaves.

On DOL 10003 that is UNCHS026345 (chr9 75.76 Mb, LOD 5.86) with 192 animals
across A 110 / B 8 / H 74 -- the two a class of eight being exactly the
thing worth seeing.

POST /plot/genotypes draws R/qtl's Fig 4.1 from it: post the reply's
`animals` (or its `genotypes` map) with the trait's values and get an SVG
with one point per animal, genotype class across, value up, class means
marked. Nothing is recomputed -- the plot is of the numbers the client
sends, like the other plots. New script scripts/plot-genotypes.py
(stdlib-only SVG, like its siblings) and the GENOTYPE_PLOTTER key.

tests/peakgenotypes.rs: the peak's calls for animals with values (with the
counts agreeing with the rows), the SVG, and a marker on another
chromosome refused with the peak quoted.

Also keeps /compute/rqtl's error order: naming both a group and a file is
"ambiguous" even when the request also forgot its values.
Diffstat (limited to 'README.md')
-rw-r--r--README.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/README.md b/README.md
index 11efbe6..d52f6bd 100644
--- a/README.md
+++ b/README.md
@@ -486,6 +486,43 @@ fails if any link does not answer 200.
   `GET /genes/Shh/traits?sort=lod` → 1 225 rows over 17 datasets and 13
   probesets, strongest first (`HXB_Liver_1208 / 1387584_at`, LOD 18.46).
 
+- `GET /groups/{group}/traits/{trait_id}/peak-genotypes?marker=…` - **the
+  genotypes of the animals at one marker of a confirmed hit**, which is the one
+  place this API returns genotypes. It is fenced, because a genotype matrix is
+  the thing GeneNetwork does not hand out:
+
+  * the server **re-runs the R/qtl scan** for the trait (the same machinery and
+    gate as `/compute/rqtl`) and takes the peak from *that* run;
+  * the marker must lie within `?window=` Mb of it (default 10) -- a marker
+    elsewhere is `422 not_the_peak`, quoting the peak's marker, chromosome, Mb
+    and LOD;
+  * the peak must reach `?min_lod=` (default 3.0), or the answer is
+    `422 not_a_hit`;
+  * only animals **that have a value** for the trait are listed, and only this
+    marker's calls -- nothing else of the matrix leaves.
+
+  ```json
+  {"marker": "UNCHS026345", "chr": "9", "pos": 75.7627, "lod": 5.856,
+   "peak": {"marker": "UNCHS026345", "chr": "9", "pos": 75.7627, "lod": 5.856},
+   "counts": {"A": 110, "B": 8, "H": 74},
+   "animals": [{"individual": "TB001", "genotype": "A", "value": 4.3}, …]}
+  ```
+
+  Which is the data behind R/qtl's Fig 4.1, and
+  `POST /plot/genotypes` draws it: post that reply's `animals` (or its
+  `genotypes` map) with the trait's values from
+  `/groups/{g}/traits/{id}/values`, and get an SVG with one point per animal,
+  genotype class across, value up, class means marked:
+
+  ```json
+  {"marker": "UNCHS026345",
+   "genotypes": {"TB001": "A", "TB002": "A", …},
+   "values": [{"name": "TB001", "value": 4.3}, …]}
+  ```
+
+  A class with a couple of animals in it is visible at a glance -- the same
+  warning `.../markers/{marker}/classes` puts in numbers.
+
 - `GET /genes/{symbol}/aliases` - **Wikidata's aliases for a gene symbol**, the
   list a trait page shows next to the symbol. Two SPARQL queries against
   `WIKIDATA_ENDPOINT` (the entity, then its `skos:altLabel`s), kept in an LMDB