//! `GET /groups/{group}/genotypes` -- the genotype files a group can be //! mapped with, newest first. //! //! This is the listing that makes `/compute/rqtl` and `/compute/gemma` //! usable without knowing the deployment's filesystem: it names each //! version, says which one a mapping gets by default, and reports the //! panel and marker counts so a caller can size the request. It does //! **not** serve the files, or their paths -- `src/genotypes.rs` resolves //! those server-side from the group and version. use axum::Json; use axum::extract::{Path, Query}; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; use gnauth_macros::gnauth; use crate::auth::AuthToken; use crate::config::Config; use crate::error::{ApiError, Unauthorized}; use crate::genotypes::{self, GenotypeError, OrderSource}; use crate::response::{Ctx, Envelope, path_segment}; use crate::suggest; /// One genotype file, as the listing reports it. #[derive(Serialize, ToSchema)] pub struct GenotypeVersion { /// What a mapping request names in `genotype_version`, e.g. "BXD.8". /// `null` in `current` means "whatever `genotype_version` is now". pub version: String, /// The genotype file's name, e.g. "BXD.8.geno". pub file: String, /// The panel's own title for it, e.g. "WGS-based (Mar2022)". #[serde(skip_serializing_if = "Option::is_none")] pub title: Option, /// Individuals in the file (its header's sample columns). pub individuals: usize, /// Marker rows in the file. pub markers: usize, /// Whether GEMMA can run on it: a `bimbam/_geno.txt` + /// `_snps.txt` pair exists. pub gemma: bool, /// Whether R/qtl can run on it: the `.geno` exists. pub rqtl: bool, /// This is what a mapping request gets when it names no version. pub current: bool, } /// The listing for one group. #[derive(Serialize, ToSchema)] pub struct GroupGenotypes { pub group: String, pub versions: Vec, } /// One marker's position. #[derive(Serialize, ToSchema)] pub struct MarkerInfo { pub name: String, pub chr: String, #[serde(skip_serializing_if = "Option::is_none")] pub cm: Option, #[serde(skip_serializing_if = "Option::is_none")] pub mb: Option, } /// Everything about one genotype version except the genotypes. #[derive(Serialize, ToSchema)] pub struct GenotypeDetail { pub group: String, pub version: String, /// The genotype file's name, e.g. "BXD.8.geno". pub file: String, #[serde(skip_serializing_if = "Option::is_none")] pub title: Option, /// The panel's own `@`-labels (`type`, `mat`, `pat`, `het`, `unk`, /// `scale`, ...), as key/value pairs in file order. pub labels: Vec