diff options
| author | Pjotr <wrk@bosa.lan> | 2026-10-07 10:42:51 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-10-07 10:42:51 +0000 |
| commit | e912c87deaf220fd5fce1299d669e8fa992b5338 (patch) | |
| tree | 5a065b3178770291c8f9fda5c88e35d31d47243f /test/python/test_group_trait_info.py | |
| parent | 89c881605a5c94be75f27c2c82cb04cf8bb3b9a8 (diff) | |
| download | genenetwork4-e912c87deaf220fd5fce1299d669e8fa992b5338.tar.gz | |
* src/routes/search.rs (search): add lod, locus, and sort/order.
Search hits gain `lod` (lrs / 4.61) and `locus` (the peak marker name, looked up in PublishXRef in one batched query; null when the database is unavailable). `sort=lrs|lod` with `order=asc|desc` ranks hits: gn3 is asked for its first 1000 matches, those are ranked, then `limit` applies. * src/db.rs (LRS_PER_LOD, lod, get_publish_loci): add the shared LRS-to-LOD constant and the locus lookup; TraitInfo and ProbeSetInfo gain `lod`, computed in SQL from the same constant. * tests/search.rs, test/python/test_search.py: add the "highest LOD, locus marker and additive effect for serotonin in BXD male midbrain" scenario over a recorded production fixture, plus sort/order tests. * tests/group_trait_info.rs, tests/dataset_probeset_info.rs and their Python mirrors: assert lod (and locus for trait 17985). * README.md (Endpoints): document sort, order, lod and locus. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test/python/test_group_trait_info.py')
| -rw-r--r-- | test/python/test_group_trait_info.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/python/test_group_trait_info.py b/test/python/test_group_trait_info.py index d5a0761..1e4fab8 100644 --- a/test/python/test_group_trait_info.py +++ b/test/python/test_group_trait_info.py @@ -36,6 +36,21 @@ class GroupTraitInfoTest(ServerTestCase): finally: conn.close() + def test_group_trait_info_reports_lod_and_locus(self): + # The "highest LOD ... serotonin in BXD male midbrain" trait: see + # test_search.py. `lod` is `lrs` / 4.61. + if not database_reachable(): + self.skipTest("no database on 127.0.0.1:3306") + + response, body = self.get("/groups/BXD/traits/17985") + self.assertEqual(response.status, 200) + + info = json.loads(body) + self.assertEqual(info["locus"], "rsm10000012461") + self.assertAlmostEqual(info["lod"], info["lrs"] / 4.61) + self.assertAlmostEqual(info["lod"], 2.603, places=3) + self.assertAlmostEqual(info["additive"], -1.3041, places=4) + def test_group_trait_info_bxd_returns_phenotype_and_publication(self): if not database_reachable(): self.skipTest("no database on 127.0.0.1:3306") |
