From 0369fc21eaa54466bd64f3b12d1fe6a1dbc81de0 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 18 Jan 2024 13:13:52 +0300 Subject: UI: Select from existing ProbeSet datasets. --- .../templates/rqtl2/select-probeset-dataset.html | 45 +++++++++++++++++++++- qc_app/upload/rqtl2.py | 44 ++++++++++++++++++--- 2 files changed, 81 insertions(+), 8 deletions(-) diff --git a/qc_app/templates/rqtl2/select-probeset-dataset.html b/qc_app/templates/rqtl2/select-probeset-dataset.html index c0c6401..8b9e5ed 100644 --- a/qc_app/templates/rqtl2/select-probeset-dataset.html +++ b/qc_app/templates/rqtl2/select-probeset-dataset.html @@ -1,5 +1,5 @@ {%extends "base.html"%} -{%from "flash_messages.html" import flash_messages%} +{%from "flash_messages.html" import flash_all_messages%} {%block title%}Upload R/qtl2 Bundle{%endblock%} @@ -8,10 +8,51 @@
The R/qtl2 bundle you uploaded contains (a) "pheno" - file(s). This data needs to be organised under a dataset..
+ file(s). This data needs to be organised under a dataset.This page gives you the ability to do that.
Under Construction
{%endblock%} diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index 0d80776..fc4e0e8 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -172,7 +172,7 @@ def upload_rqtl2_bundle(species_id: int, population_id: int): flash("".join(exc.args), "alert-error alert-rqtl2") return this_page_with_errors -def check_errors(conn, *args, **kwargs): +def check_errors(conn, *args, **kwargs):#pylint: disable=[too-many-return-statements] """Check for select errors in the forms and return a page to redirect to.""" species_id = kwargs.get("species_id") or request.form.get("species_id") population_id = (kwargs.get("population_id") @@ -208,14 +208,21 @@ def check_errors(conn, *args, **kwargs): pgsrc="error"), code=307) + summary_page = redirect(url_for("upload.rqtl2.select_dataset_info", + species_id=species_id, + population_id=population_id, + pgsrc="error"), + code=307) + if ("probe-study-id" in args and not bool(request.form.get("probe-study-id"))): flash("No probeset study was selected!", "alert-error alert-rqtl2") - return redirect(url_for("upload.rqtl2.select_probeset_study", - species_id=species_id, - population_id=population_id, - pgsrc="error"), - code=307) + return summary_page + + if ("probe-dataset-id" in args and + not bool(request.form.get("probe-dataset-id"))): + flash("No probeset dataset was selected!", "alert-error alert-rqtl2") + return summary_page return None @@ -325,6 +332,28 @@ def select_probeset_study(species_id: int, population_id: int): return summary_page +@rqtl2.route(("/upload/species/