| Age | Commit message (Collapse) | Author |
|
If errors exist, exit with "GENERALERROR" category rather than with
the "OK" category.
|
|
- mark Stage 01 hand-off and missing-value symbols done
- update Stage 02/03 and job-chain tasks
- add untranspose tasks/considerations
|
|
- note missing-value symbols in the Stage 02 review page
- record the Stage 03 value QC implementation
|
|
- include missing-value symbols in the Stage 02 state
- capture QC value and ordering decisions
- capture the untranspose-transposed-files idea
|
|
- Store the genotype file path and collector config in the collector job
metadata so later stages can re-read the file.
- Seed `dot_geno_fields.unk` into the Stage 02 missing-value symbols default.
- Add `uploader.genotypes.qc` with value checks (empty and unknown symbols)
and a placeholder marker-ordering helper (chromosome, cM, Mb) that warns.
- Add the `uploader.scripts.genotypes.qc` worker that reads the collector job,
runs the checks and exits non-zero when errors are found.
- On Stage 02 save, schedule the QC job and record its id for idempotency.
|
|
Add `uploader/static/js/data_utils.js` with `parseSymbols`, the JS counterpart
of `r_qtl.utils.parse_missing_values_symbols`, and use it in the CSV previews
(files.js and the phenotypes raw-files template) instead of their inline
space-splitting. Load data_utils.js before files.js.
|
|
Move `parse_missing_values_symbols` from the genotypes views into
`r_qtl.utils` and use it in the genotypes Stage 01 collector config and the
phenotypes individual-file uploads, replacing their divergent inline splits
with the more robust whitespace/comma parsing. Move the tests to
`tests/r_qtl/test_utils.py`.
|
|
Add a missing-value symbol(s) input to the Stage 02 encoding form and a
`parse_missing_values_symbols` helper in the genotypes views. Parse the input
(whitespace/comma-separated, unique symbols) and store it in the collector
job's `stage02` metadata alongside the description and encoding; prefill the
input when the page is revisited.
|
|
Add tests for splitting a whitespace- and/or comma-separated symbol list into
unique, non-empty symbols.
|
|
|
|
- Stage 01 tasks and the job-chain task
- comment-collection and idempotency tasks
- Stage 02 task statuses
- sample/marker ordering QC tasks
|
|
- Stage 01 wiring progress in the implementation notes
- comment collection in the implementation notes
- Stage 02 review page and the type move
|
|
- the stage-job chain and Stage 02 description behaviour
- the job-status idempotency requirement
- Stage 02 state storage and the no-going-back consideration
- start a running QC/file-generation concerns list
|
|
|
|
Redirect the collector job's success handler to the new Stage 02 route,
carrying the collector job id. The `study_design` view loads the job, validates
it and parses the FileStats via `collector_job.file_stats`, then renders the
collected description, the genotype symbols, and the study-design/encoding
inputs.
POST stores the confirmed description and encoding in the collector job's
metadata (`stage02`) and redirects back to the review page (post/redirect/get),
which makes revisiting and re-submitting idempotent. Bind the study-design and
encoding fragments to the saved values.
|
|
Validate that a job is a completed genotype-stats job for the requested
species/population/dataset and parse its FileStats from the job's recorded
stdout.
|
|
Add tests for validating a collector job (type, completion, dataset
ownership) and parsing the FileStats from its recorded stdout.
|
|
Move `uploader/scripts/genotypes/types.py` to `uploader/genotypes/types.py` so
application code can use `FileStats` and friends without importing from
`uploader.scripts`. Update the collector script and tests to the new location.
|
|
|
|
|
|
Add a `description` field to `FileStats`, built by cleaning comment lines
(strip the configured comment character and surrounding whitespace) and joining
them with newlines. Detect comments using the configured comment character
rather than a hard-coded '#', and preserve comment order when merging chunks.
|
|
Add tests for cleaning comment lines (strip the comment character and
surrounding whitespace), honouring a configured comment character, exposing the
description on FileStats, and preserving comment order when merging chunks.
|
|
|
|
|
|
Add `collector_config.command` to build the collector CLI command from the
collector config. Replace the `_collect_geno_csv_stats_` stub in
`add_genotype_records` with a `gn_libs.jobs` background job that runs the
collector.
The standard background-job status/summary pages surface the collector's
stdout and stderr, so failures show the available diagnostics. JSON requests
receive a `redirect-to` for the job status page; HTML requests are redirected
there too.
Set the collector job's `success_handler` and add
`collect_genotype_stats_success_handler`, which currently redirects to the job
summary page (dumping the job details). It will be replaced by the Stage 02
study-design/encoding flow.
|
|
Add tests for translating the collector config into the collector CLI's
arguments (log level, file metadata, separator/comment/NA strings and the
transposed flag), with the file path as the final argument.
|
|
Add `uploader.genotypes.collector_config.from_form` to map the upload form's
metadata fields to the statistics collector's config keys (`markers`,
`chromosome`, `cm`, `mb`, `transposed`, `separator`, `comment.char`,
`na_strings`), falling back to the collector's defaults and normalising the
missing-value strings.
Use it in `add_genotype_records` instead of the previous `sep`/`na.strings`
stub metadata.
|
|
Add tests for mapping the upload form's metadata fields to the statistics
collector's config keys, including collector defaults, the transposed checkbox
and normalisation of the missing-value strings.
|
|
|
|
Update the genotypes-upload WIP docs for today's decisions and progress:
- design: record the decided comment -> description behaviour (strip '#',
trim whitespace, one line each, editable textbox, feeds the R/qtl2 control
file), with description storage still undecided;
- implementation: note the shared uploader.files.resolve_uploaded_file, the
genotypes wiring, and the phenotypes bug fixes; correct the stale claim that
the Stage 01 form inputs are missing;
- tasks: mark uploaded-file resolution done, correct the form-inputs task,
record the comment-description format, and add the deferred monadic-refactor
technical-debt item.
|
|
Replace the hand-rolled resumable/direct branching in
`process_phenotypes_individual_files` with `resolve_uploaded_file`, fixing
several bugs in the direct-upload path:
- optional files uploaded directly were skipped because presence was only
checked in `request.form`, never in `request.files`;
- `request.files[formkey]` raised `BadRequestKeyError` for a missing file,
making the friendly error branch unreachable;
- malformed/missing resumable data raised unhandled exceptions;
- the absolute path from `save_file` was unnecessarily re-prefixed with the
uploads directory.
Use the returned original name (basename) as the zip arcname and in the
control data, so both stay consistent.
|
|
Wire `add_genotype_records` to `uploader.files.resolve_uploaded_file` for both
the resumable and direct upload paths, replacing the incorrect
`form["uploaded-file"]` lookup. On failure, return a JSON error for JSON
requests, or flash and redirect back to the add-records page.
|
|
Add `resolve_uploaded_file(form, files, upload_dir, fieldname, hashed=True)`
to `uploader.files`. It resolves either a chunked/resumable upload (the JSON
blob produced by the resumable upload endpoint) or a direct multipart upload,
returning `Right((path, original_name))` or `Left(message)`.
This is generic: the only per-caller input is the form field name. It is the
consumer counterpart of the resumable upload contract already implemented in
`uploader.files.views`.
|
|
Add unit tests for a generic `resolve_uploaded_file` in the uploader.files
package: direct multipart and resumable uploads (returning both the path and
the original name), hashed vs unhashed saving, and the error cases (missing
file, malformed resumable data, wrong field).
|
|
The `scripts` package now lives under `uploader`, so update every reference
from `scripts.<...>` to `uploader.scripts.<...>`: Python imports, `-m` command
module strings, logging module names, test imports, CLI/gunicorn entry points,
lint/guix paths and the WIP documentation.
Note: the untracked `run-dev-flask.sh` and `run-dev-gunicorn.sh` helper scripts
still need their entry-point module updated manually.
|
|
Move the top-level `scripts` package to `uploader/scripts` so that it becomes
the `uploader.scripts` package. All files are moved unchanged; references are
updated in a follow-up commit.
|
|
Add WIP documents for the genotype upload feature following the
`<feature-name>-<purpose>[-<extra>].md` naming scheme:
- design notes: pipeline stages, cross-stage rules and open questions;
- implementation notes: what is built (the Stage 01 collector), integration
concerns and defects fixed;
- tasks and todos: prioritised checklist, including the new task to collect
comment lines into a multiline description and the Stage 02 symbol/encoding
behaviours;
|
|
|
|
Accept `Iterable[str]` for the lines arguments instead of `Iterator[str]`,
since lists of lines are valid inputs, and accept `Sequence[str]` for the
sample names. This fixes the mypy type errors without changing behaviour.
|
|
The genotype symbols were converted to a tuple straight from a set, so their
order depended on the set's iteration order. That made the output (and the
JSON emitted by the CLI) non-deterministic, and caused the multi-processed
result to differ from the single-threaded result once symbols were merged
across chunks. Sort the symbols so the output is stable and identical for
both implementations. The set of symbols, which is what consumers care
about, is unchanged.
|
|
Implement `file_stats_multiprocessing`, which streams the file lines into
bounded chunks, processes each chunk in a worker process and merges the
per-chunk statistics in file order so that the result matches
`file_stats_singlethread`.
The worker (`_process_chunk`) is a module-level function that only depends on
picklable data (headers, configuration and the chunk of lines), so it works
with any multiprocessing start method.
Also fix the file-size threshold check in `compute_statistics`: it compared
the size in megabytes against a threshold expressed in bytes, making the
multi-processed branch effectively unreachable. Compare bytes to bytes
instead.
|
|
Add pytest unit tests asserting that `file_stats_multiprocessing` produces
the same statistics as `file_stats_singlethread` for untransposed and
transposed files across a range of chunk sizes, that line errors keep their
order, and that `_read_chunks` groups lines correctly including the
partial final chunk and empty input.
|
|
Add `_merge_chunk_stats` to combine the statistics from two consecutive
chunks of a file while preserving file order, and `_merge_all_chunk_stats`
to fold an iterable of chunk statistics into a single value.
For transposed files, the markers of the last markers line win, falling back
to the earlier chunk when a later chunk saw no markers line. For
untransposed files, the markers are concatenated in order. Counters are
summed, genotype symbols are unioned, dot-geno fields are combined (later
values override earlier ones) and errors are concatenated in order.
|
|
Add pytest unit tests for `_merge_chunk_stats` and
`_merge_all_chunk_stats`, covering counter summation, symbol union,
error ordering, dot-geno field overriding, and the untransposed
(concatenate) and transposed (last markers line wins) marker semantics.
|
|
Move the per-line processing loop out of `file_stats_singlethread` into a
reusable `_accumulate` helper that returns a `_ChunkStats` value. This
makes the accumulation logic available to both the single-threaded and the
multi-processed implementations and allows a single source of truth for the
processing logic.
The new module-level `_make_line_splitter` and `_make_is_skippable_line`
helpers build the closures from plain configuration values, so callers no
longer need to pass unpicklable lambdas around.
`file_stats_singlethread` is re-expressed in terms of the extracted helpers
and its signature simplified to `(fileconfigs, headers, lines)`.
|
|
Add pytest unit tests for the extracted `_accumulate` helper and for
`file_stats_singlethread`, covering line-type counting, collection of
genotype symbols/markers/dot-geno fields, transposed files, and the
ordering of header validation errors before per-line errors.
|
|
|
|
Split the line in order to compare with tuple of headers.
|
|
If the file is larger (in bytes) than the value set in the
`FILE_SIZE_THRESHOLD` constant, then the file will be chunked and
processed with multiple processes, using the multiprocessing library,
otherwise, it will be processed in a single-thread process.
|
|
|