From 3e50c29359da9cdd02ca585ae900ccb2e0f8668a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 29 Dec 2025 11:56:58 -0600 Subject: Phenotypes: Move feature to new UI templates. --- uploader/phenotypes/views.py | 17 +- .../templates/phenotypes/add-phenotypes-base.html | 17 +- .../phenotypes/add-phenotypes-raw-files.html | 18 - .../add-phenotypes-with-rqtl2-bundle.html | 18 - uploader/templates/phenotypes/base.html | 34 +- uploader/templates/phenotypes/job-status.html | 25 +- .../phenotypes/load-phenotypes-success.html | 20 +- uploader/templates/phenotypes/review-job-data.html | 4 - .../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/phenotypes/sui-job-status.html | 140 ---- .../phenotypes/sui-load-phenotypes-success.html | 26 - .../templates/phenotypes/sui-review-job-data.html | 121 --- .../templates/phenotypes/sui-view-dataset.html | 207 ----- uploader/templates/phenotypes/view-dataset.html | 14 +- uploader/templates/phenotypes/view-phenotype.html | 19 - 18 files changed, 43 insertions(+), 1835 deletions(-) delete mode 100644 uploader/templates/phenotypes/sui-add-phenotypes-base.html delete mode 100644 uploader/templates/phenotypes/sui-add-phenotypes-raw-files.html delete mode 100644 uploader/templates/phenotypes/sui-add-phenotypes-with-rqtl2-bundle.html delete mode 100644 uploader/templates/phenotypes/sui-base.html delete mode 100644 uploader/templates/phenotypes/sui-job-status.html delete mode 100644 uploader/templates/phenotypes/sui-load-phenotypes-success.html delete mode 100644 uploader/templates/phenotypes/sui-review-job-data.html delete mode 100644 uploader/templates/phenotypes/sui-view-dataset.html diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py index 42f2e34..c4c6170 100644 --- a/uploader/phenotypes/views.py +++ b/uploader/phenotypes/views.py @@ -31,9 +31,6 @@ from flask import (flash, from r_qtl import r_qtl2_qc as rqc from r_qtl import exceptions as rqe - -from uploader.sui import sui_template - from uploader import jobs from uploader import session from uploader.files import save_file @@ -197,7 +194,7 @@ def view_dataset(# pylint: disable=[unused-argument] start_at = max(safe_int(request.args.get("start_at") or 0), 0) count = int(request.args.get("count") or 20) - return render_template(sui_template("phenotypes/view-dataset.html"), + return render_template("phenotypes/view-dataset.html", species=species, population=population, dataset=dataset, @@ -420,9 +417,9 @@ def add_phenotypes(species: dict, population: dict, dataset: dict, **kwargs):# p if request.method == "GET": today = datetime.date.today() return render_template( - sui_template("phenotypes/add-phenotypes-with-rqtl2-bundle.html" - if use_bundle - else "phenotypes/add-phenotypes-raw-files.html"), + ("phenotypes/add-phenotypes-with-rqtl2-bundle.html" + if use_bundle + else "phenotypes/add-phenotypes-raw-files.html"), species=species, population=population, dataset=dataset, @@ -509,7 +506,7 @@ def job_status( except jobs.JobNotFound as _jnf: job = None - return render_template(sui_template("phenotypes/job-status.html"), + return render_template("phenotypes/job-status.html", species=species, population=population, dataset=dataset, @@ -589,7 +586,7 @@ def review_job_data( for filetype,meta in metadata.items() } _job_metadata = json.loads(job["job-metadata"]) - return render_template(sui_template("phenotypes/review-job-data.html"), + return render_template("phenotypes/review-job-data.html", species=species, population=population, dataset=dataset, @@ -980,7 +977,7 @@ def load_data_success( (_publication["Title"] or "")) if item != "") return render_template( - sui_template("phenotypes/load-phenotypes-success.html"), + "phenotypes/load-phenotypes-success.html", species=species, population=population, dataset=dataset, diff --git a/uploader/templates/phenotypes/add-phenotypes-base.html b/uploader/templates/phenotypes/add-phenotypes-base.html index 9909c20..690c7e1 100644 --- a/uploader/templates/phenotypes/add-phenotypes-base.html +++ b/uploader/templates/phenotypes/add-phenotypes-base.html @@ -1,26 +1,13 @@ {%extends "phenotypes/base.html"%} {%from "flash_messages.html" import flash_all_messages%} {%from "macro-table-pagination.html" import table_pagination%} -{%from "phenotypes/macro-display-pheno-dataset-card.html" import display_pheno_dataset_card%} {%block title%}Phenotypes{%endblock%} {%block pagetitle%}Phenotypes{%endblock%} -{%block lvl4_breadcrumbs%} -
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.
Process Status: {{job.status}}
- {%if metadata%} -| File | -Status | -Lines Processed | -Total Errors | -
|---|---|---|---|
| {{file}} | -{{meta.status}} | -{{meta.linecount}} | -{{meta["total-errors"]}} | -
- {%if errors | length == 0%} - Continue - {%else%} - - Cannot continue due to errors. Please fix the errors first. - - {%endif%} -
- {%endif%} -- - No errors found so far -
- {%else%} -| File | -Row | -Column | -Value | -Message | -
|---|---|---|---|---|
| {{error.filename}} | -{{error.rowtitle}} | -{{error.coltitle}} | -{%if error.cellvalue is not none and error.cellvalue | length > 25%} - {{error.cellvalue[0:24]}}… - {%else%} - {{error.cellvalue}} - {%endif%} - | -- {%if error.message | length > 250 %} - {{error.message[0:249]}}… - {%else%} - {{error.message}} - {%endif%} - | -
Could not find a job with the ID: {{job_id}}
-- Please go back to - - the '{{dataset.Name}}' dataset page - to upload new phenotypes or edit existing ones.
-You have successfully loaded - your - new phenotypes into the database.
- - -View your data - on GeneNetwork2. - You might need to login to GeneNetwork2 to view specific traits.
-- The data has NOT been added/saved yet. Review the details below - and click "Continue" to save the data.
-The “{{dataset.FullName}}” dataset from the - “{{population.FullName}}” population of the - species “{{species.SpeciesName}} ({{species.FullName}})” - will be updated as follows:
- -- Could not find a job with the ID: {{job_id}}.
-You will be redirected in - 20 second(s)
-- - If you are not redirected, please - click here to continue - -
-The basic dataset details are:
- -| Name | -Full Name | -Short Name | -
|---|---|---|
| {{dataset.Name}} | -{{dataset.FullName}} | -{{dataset.ShortName}} | -
Click on any of the phenotypes in the table below to view and edit that - phenotype's data.
-Use the search to filter through all the phenotypes and find specific - phenotypes of interest.
-| - | Index | -Record | -Description | -
|---|