From b8cba2b0585604935d26bec6916aaadd114a2fcf Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 16 Dec 2025 12:24:36 -0600 Subject: Implement streamlined UI for phenotypes upload page. --- uploader/phenotypes/views.py | 6 +- .../macro-display-pheno-dataset-card.html | 28 +- .../phenotypes/sui-add-phenotypes-base.html | 155 ++++ .../phenotypes/sui-add-phenotypes-raw-files.html | 829 +++++++++++++++++++++ .../sui-add-phenotypes-with-rqtl2-bundle.html | 189 +++++ uploader/templates/phenotypes/sui-base.html | 25 + uploader/templates/populations/sui-base.html | 2 +- 7 files changed, 1230 insertions(+), 4 deletions(-) create mode 100644 uploader/templates/phenotypes/sui-add-phenotypes-base.html create mode 100644 uploader/templates/phenotypes/sui-add-phenotypes-raw-files.html create mode 100644 uploader/templates/phenotypes/sui-add-phenotypes-with-rqtl2-bundle.html create mode 100644 uploader/templates/phenotypes/sui-base.html diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 5b6f965..c4fd7fd 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -423,9 +423,11 @@ def add_phenotypes(species: dict, population: dict, dataset: dict, **kwargs):# p with Redis.from_url(_redisuri, decode_responses=True) as rconn: if request.method == "GET": today = datetime.date.today() + _sui="sui-" if request.args.get("streamlined_ui") else "" return render_template( - ("phenotypes/add-phenotypes-with-rqtl2-bundle.html" - if use_bundle else "phenotypes/add-phenotypes-raw-files.html"), + (f"phenotypes/{_sui}add-phenotypes-with-rqtl2-bundle.html" + if use_bundle + else f"phenotypes/{_sui}add-phenotypes-raw-files.html"), species=species, population=population, dataset=dataset, diff --git a/uploader/templates/phenotypes/macro-display-pheno-dataset-card.html b/uploader/templates/phenotypes/macro-display-pheno-dataset-card.html index 11b108b..641421d 100644 --- a/uploader/templates/phenotypes/macro-display-pheno-dataset-card.html +++ b/uploader/templates/phenotypes/macro-display-pheno-dataset-card.html @@ -1,4 +1,4 @@ -{%from "populations/macro-display-population-card.html" import display_population_card%} +{%from "populations/macro-display-population-card.html" import display_population_card, display_sui_population_card%} {%macro display_pheno_dataset_card(species, population, dataset)%} {{display_population_card(species, population)}} @@ -29,3 +29,29 @@ {%endmacro%} + +{%macro display_sui_pheno_dataset_card(species, population, dataset)%} +{{display_sui_population_card(species, population)}} + +
| Name | +{{dataset.Name}} | +
|---|---|
| Full Name | +{{dataset.FullName}} | +
| Short Name | +{{dataset.ShortName}} | +
This page will allow you to upload all the separate files that make up your + phenotypes. Here, you will have to upload each separate file individually. If + you want instead to upload all your files as a single ZIP file, + click here.
+{%endblock%} + +{%block frm_add_phenotypes_elements%} + + + +{%endif%} +{%endblock%} + + +{%block page_documentation%} +The following are the common expectations for ALL the + files provided in the form above: +
If you do not specify the separator character, then we will assume a + TAB character was used as your separator.
+ +We also assume you might include comments lines in your files. In that
+ case, if you do not specify what character denotes that a line in your files
+ is a comment line, we will assume the # character.
+ A comment MUST ALWAYS begin at the start of the line marked
+ with the comment character specified.
We request some details about your files to help us parse and process the + files correctly. The details we collect are:
+The data in this file is a matrix of phenotypes × metadata-fields. + Please note we use the term "metadata-fields" above loosely, due to lack of + a good word for this.
+The file MUST have columns in this order: +
You can add more columns after those three if you want to, but these 3 + MUST be present.
+The file would, for example, look like the following:
+id,description,units,…
+ pheno10001|Central nervous system, behavior, cognition; …|mg|…
+ pheno10002|Aging, metabolism, central nervous system: …|mg|…
+ ⋮
+
+ Note 01: The first usable row is the heading row.
+Note 02: This example demonstrates a subtle issue that
+ could make your CSV file invalid — the choice of your field separator
+ character.
+ In the example above, we use the pipe character (|) as our
+ field separator. This is because, if we follow the advice on how to write
+ good descriptions, then we cannot use the comma as our separator – if
+ we did, then our CSV file would be invalid because the system would have no
+ way to tell the difference between the comma as a field separator, and the
+ comma as a way to separate the "general category and ontology terms".
The data is a matrix of samples(or individuals) × phenotypes, e.g.
+
+ # num-cases: 2549
+ # num-phenos: 13
+ id,pheno10001,pheno10002,pheno10003,pheno10004,53.099998,…
+ IND001,61.400002,49,62.5,55.099998,…
+ IND002,54.099998,50.099998,53.299999,55.099998,…
+ IND003,483,403,501,403,…
+ IND004,49.799999,45.5,62.900002,NA,…
+ ⋮
+
+ where IND001,IND002,IND003,IND004,… are the
+ samples/individuals/cases in your study, and
+ pheno10001,pheno10002,pheno10004,pheno10004,… are the
+ identifiers for your phenotypes.
The lines beginning with the "#" symbol (i.e.
+ # num-cases: 2549 and # num-phenos: 13 are comment
+ lines and will be ignored
In this example, the comma (,) is used as the file separator.
+Select the zip file bundle containing information on the phenotypes you + wish to upload, then click the "Upload Phenotypes" button below to + upload the data.
+If you wish to upload the files individually instead, + click here.
+See the File Formats section below + to get an understanding of what is expected of the bundle files you + upload.
+{%endblock%} + +{%block frm_add_phenotypes_elements%} +We accept an extended form of the + + input files' format used with the R/qtl2 software as a single ZIP + file
+The files that are used for this feature are: +
Other files within the bundle will be ignored, for this feature.
+The following section will detail the expectations for each of the + different file types within the uploaded ZIP file bundle for phenotypes:
+ +There MUST be one, and only one file that acts + as the control file. This file can be: +
The control file is useful for defining things about the bundle such as:
+sep: ','). There can
+ only ever be one field separator and it MUST be the same
+ one for ALL files in the bundle.comment.char: '#'). Any
+ line that starts with this character will be considered a comment line and
+ be ignored in its entirety.na.strings: 'NA'). You
+ can specify more than one code to indicate missing values, e.g.
+ {…, "na.strings": ["NA", "N/A", "-"], …}These files are the main data files. You must have at least one of these + files in your bundle for it to be valid for this step.
+The data is a matrix of individuals × phenotypes by default, as
+ below:
+
+ id,10001,10002,10003,10004,…
+
+ BXD1,61.400002,54.099998,483,49.799999,…
+ BXD2,49,50.099998,403,45.5,…
+ BXD5,62.5,53.299999,501,62.900002,…
+ BXD6,53.099998,55.099998,403,NA,…
+ ⋮
If the pheno_transposed value is set to True,
+ then the data will be a phenotypes × individuals matrix as in the
+ example below:
+
+ id,BXD1,BXD2,BXD5,BXD6,…
+
+ 10001,61.400002,49,62.5,53.099998,…
+ 10002,54.099998,50.099998,53.299999,55.099998,…
+ 10003,483,403,501,403,…
+ 10004,49.799999,45.5,62.900002,NA,…
+ ⋮
+
At least one phenotypes metadata file with the metadata values such as + descriptions, PubMed Identifier, publication titles (if present), etc.
+The data in this/these file(s) is a matrix of + phenotypes × phenotypes-covariates. The first column is always the + phenotype names/identifiers — same as in the R/qtl2 format.
+phenocovar files should never be transposed!
+This file MUST be present in the bundle, and have data for
+ the bundle to be considered valid by our system for this step.
+ In addition to that, the following are the fields that must be
+ present, and
+ have values, in the file before the file is considered valid:
+
The following optional fields can also be provided: +
These files will be marked up in the control file with the
+ phenocovar key, as in the examples below:
+
{
+ ⋮,
+ "phenocovar": "your_covariates_file.csv",
+ ⋮
+ }
+
+ {
+ ⋮,
+ "phenocovar": [
+ "covariates_file_01.csv",
+ "covariates_file_01.csv",
+ ⋮
+ ],
+ ⋮
+ }
+
+
+ ⋮
+ phenocovar: your_covariates_file.csv
+ ⋮
+
+
+ ⋮
+ phenocovar:
+ - covariates_file_01.csv
+ - covariates_file_02.csv
+ - covariates_file_03.csv
+ …
+ ⋮
+
+ These are extensions to the R/qtl2 standard, i.e. these types ofs file are + not supported by the original R/qtl2 file format
+We use these files to upload the standard errors (phenose) when + the data file (pheno) is average data. In that case, the + phenonum file(s) contains the number of individuals that were + involved when computing the averages.
+Both types of files are matrices of individuals × phenotypes by
+ default. Like the related pheno files, if
+ pheno_transposed: True, then the file will be a matrix of
+ phenotypes × individuals.