From 18d18b1c125c06dd67dcf54ccbd89eb128643737 Mon Sep 17 00:00:00 2001 From: Pjotr Date: Sat, 7 Nov 2026 17:10:28 +0000 Subject: genotypes: expose the metadata, never the genotype calls The listing named versions but not files; a caller could pick one and still not see what was in it. Three token-gated routes now describe a version completely, short of the matrix: GET /groups/{group}/genotypes versions, files, sizes, current GET /groups/{group}/genotypes/{version} file name, header labels, individuals, strains, chromosomes GET /groups/{group}/genotypes/{version}/markers markers (name, chr, cM, Mb), paged The detail reads the file's own `@`-labels (type, mat, pat, het, unk, scale) and its panel in column order, and reports both the whole panel and the strains a mapping uses after the parents/F1s rule -- so a caller can check a request before sending it and interpret a result after. Markers come back as positional rows with `meta.columns`, paged with `?page`/`?limit` and filterable with `?chr`, following /compute/gemma's shape rather than inventing one. The genotype calls stay on the server: file_meta() reads the matrix to skip it, and nothing returns a cell. * src/genotypes.rs (Marker, FileMeta, file_meta; GenotypeFile::file): header labels, individuals and marker positions; unit test. * src/routes/genotypes.rs: the two new handlers, token-gated like the listing, plus `file` in the listing and counts in the detail. * tests/genotypes.rs: the listing carries file names but no paths. * README.md, docs/genotypes.md, docs/www/ai-instruction.md: what the three routes give, and that the matrix is not among them. --- tests/genotypes.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/genotypes.rs b/tests/genotypes.rs index 8b94e95..5d5f575 100644 --- a/tests/genotypes.rs +++ b/tests/genotypes.rs @@ -59,12 +59,14 @@ async fn the_listing_names_versions_without_paths_and_maps_by_group() { assert!(version["individuals"].as_u64().unwrap() > 0, "{version}"); assert!(version["markers"].as_u64().unwrap() > 0, "{version}"); } + // No paths -- but the file *name* is part of the metadata now. let text = listing.to_string(); assert!(!text.contains('/'), "no path in the listing: {text}"); - assert!( - !text.contains(".geno"), - "no file name in the listing: {text}" - ); + for version in versions { + let file = version["file"].as_str().expect("a file name"); + assert!(file.ends_with(".geno"), "{version}"); + assert!(!file.contains('/'), "{version}"); + } // The group record points at it. let response = get_with_token("GET /groups/BXD", "/groups/BXD", &token).await; -- cgit 1.4.1