about summary refs log tree commit diff
path: root/src/genoupload.rs
AgeCommit message (Collapse)Author
8 daysuploads: every engine maps an upload by name; same name replacesPjotr
Two things asked for, and one bug each. * POST /uploads/genotypes with an existing name now REPLACES it. A genotype is the user's file to keep, not a record the deployment curates; the digest in every reply says which version ran. * genotype_upload on all four engines -- /compute/{rqtl,gemma,qtl2, fitqtl} -- in place of genotype_file/group. The server writes the form each engine reads: a GN .geno for R/qtl and R/qtl2, a BIMBAM pair (new: genoupload::to_bimbam, coding from the base's @mat/@het/@pat, NA for missing, snps as marker/bp/chr) for GEMMA. No user path travels with a request. Verified against the full 3811-marker BXD.4 matrix uploaded as an update: rqtl 3811 rows, gemma 3809, qtl2 3730, fitqtl by marker. The bug worth naming: values given by name were being aligned against a file, and for GEMMA that file is BIMBAM, which has no individual names -- so the phenotype file came out empty and the wrapper failed with a Ruby backtrace that said nothing. GEMMA's values are now ordered by the upload's own individual list before the pair is written. The related fixes: rqtl and fitqtl align named values onto the file's individuals (they previously demanded its column order), and genotypes::align_to_file is the one place that does it. tests/genoupload.rs: mapping an upload on rqtl/qtl2/fitqtl with values by name, and replacing a name (one row in the listing, a new digest). GEMMA's LOCO kinship needs more markers per chromosome than a small fixture has, so it is exercised against a full panel rather than in the fixture.
8 daysuploads: map an uploaded genotype by name, and clean up after itPjotr
Three follow-ups from putting an upload through the whole loop. * /compute/qtl2's `genotype_file` branch only accepted positional `trait_values`, i.e. it demanded the file's column order -- which a caller with an uploaded population does not have. It now takes `samples` (name and value) or a `basket` and aligns them onto the cross by name, leaving individuals without a value as missing. Positional `trait_values` still work for a file whose order is known. * DELETE /uploads/genotypes/{name} now removes the .geno it wrote on demand: a file nobody can name is a file that confuses the next operator. * scripts/example-genotype-upload.py spreads its markers across chromosomes. One chromosome of markers is a poor example -- a leave-one-chromosome-out kinship has nothing to leave out, so the scan came back with no rows at all, which looked like a broken upload and was really a property of the example. 20 markers over the genome map cleanly (19 rows, the 20th used for the HMM), and the README says to use "kinship": "overall" if a file really has one chromosome.
8 daysuploads: a genotype matrix that updates an existing populationPjotr
Tab-delimited, header names the individuals from column 4, then marker, chr, pos (Mb). Named $USER-GENONAME, stored as text in the owner's own SQLite file -- nothing goes near MariaDB -- and written out on demand as a GN .geno carrying the base's @-metadata, so the R scripts read exactly what was uploaded. An upload updates a population, it does not invent one, and the checks say so: * the base version must exist (resolved through the same genotypes::resolve_named the rest of the API uses); * at most 50 individuals the base does not have, and at least one that it does -- no overlap is a different population, not an update; * at most 200 000 markers, and the refusal says the sysadmin has to organize a file that size, because this is a request path, not an ingest; * the values must be the same kind as the base's: letters, whole numbers or probabilities. A letters panel holding 0/1 would be read as the wrong thing silently, so it is refused naming both kinds. GET /uploads/genotypes lists them, /{name} its metadata (overlap, new individuals, kind, digest), /{name}/markers pages the marker table, and /{name}/geno writes the file and returns the path for `genotype_file` on the compute endpoints. DELETE removes one. scripts/example-genotype-upload.py turns any .geno into a valid update -- a subset of markers, a few individuals dropped and added -- and tests/genoupload.rs builds its own from the deployment's BXD.4 for the same reason: upload, page the markers, write the .geno and check the layout, delete, then break each rule (no overlap, numbers in a letters panel, commas) and check the refusal says which. Unit tests cover the three value kinds, missing cells, ragged rows, a non-numeric position, the 50-new-individual limit, and the .geno layout (Chr first, then the marker -- GN's order, not the upload's).