diff options
| author | Pjotr <wrk@bosa.lan> | 2026-10-08 13:37:57 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-10-08 13:37:57 +0000 |
| commit | 2edc685bb7c56d5f9f28da09378f300bfe81021d (patch) | |
| tree | 1120d7589a1143ef29a4f5d2e2a47437e8699552 /tests/mapping_methods.rs | |
| parent | 208eeac395079f46fcbe07b4185524e017c554ef (diff) | |
| download | genenetwork4-2edc685bb7c56d5f9f28da09378f300bfe81021d.tar.gz | |
* src/db.rs, src/routes: add mapping_method, tissue, /mapping-methods, /accessions.
Answers four more questions of aisearch's full_benchmark.csv from
tables the API did not expose.
* src/db.rs (Group, GroupDetail), src/routes/groups.rs: groups gain
`mapping_method`, the name of the MappingMethod row their
mapping_method_id points to (qtlreaper, Rqtl, ...), or null.
* src/db.rs (Dataset): datasets gain `tissue`, the Tissue their
ProbeFreeze points to (e.g. "Brain mRNA").
* src/routes/mapping_methods.rs: GET /mapping-methods lists the
MappingMethod table, including tools no group uses (PLINK, FastMap).
* src/routes/accessions.rs: GET /accessions/{accession} resolves a
GeneNetwork accession number (GN602, gn602 or 602) via InfoFiles to the
dataset's name, title, category (publish/probeset) and group.
* docs/genenetwork_datatypes.md: MappingMethodId is a key into the
MappingMethod table (the authoritative reading); GN2's code-based reading
is noted as superseded.
* tests/benchmark.rs, test/data/benchmark_search.json: add the 60 new
full-benchmark rows that pass (full rows 0..114; search rows run against
recorded production gn3, the rest need the database), and full rows 33
(mapping tools), 34 (Rqtl for outbred sets), 35 (GN602) and 44 (only
GTEx v8 has TPM datasets). The untested rows are listed in the file's
header comment with the reason for each.
* tests, test/python: tests for the new fields and endpoints; both
endpoints added to the OpenAPI and next-link crawl tests.
* README.md, RELEASE_NOTES.md: document the new fields and endpoints.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/mapping_methods.rs')
| -rw-r--r-- | tests/mapping_methods.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/mapping_methods.rs b/tests/mapping_methods.rs new file mode 100644 index 0000000..8cd5043 --- /dev/null +++ b/tests/mapping_methods.rs @@ -0,0 +1,31 @@ +use axum::http::StatusCode; +use http_body_util::BodyExt; +use serde_json::Value; + +mod common; + +/// Needs a live MariaDB connection (SQL_URI) and a valid token; skips +/// rather than fails when either is missing, same as groups.rs. +#[tokio::test] +async fn mapping_methods_lists_the_tools() { + if !common::db_available() { + eprintln!( + "skipping mapping_methods_lists_the_tools: no usable database (check SQL_URI credentials)" + ); + return; + } + let Some(token) = common::auth_token().await else { + eprintln!("skipping mapping_methods_lists_the_tools: no token (see docs/gn-auth.md)"); + return; + }; + + let response = common::get_with_token("GET /mapping-methods", "/mapping-methods", &token).await; + assert_eq!(response.status(), StatusCode::OK); + let body = response.into_body().collect().await.unwrap().to_bytes(); + let methods: Vec<Value> = common::data(&body); + + // The MappingMethod table lists tools no group uses (PLINK, FastMap). + let names: Vec<&str> = methods.iter().map(|m| m["name"].as_str().unwrap()).collect(); + assert_eq!(names, ["qtlreaper", "Rqtl", "HappyR", "PLINK", "FastMap"]); + assert_eq!(methods[0]["id"], 1); +} |
