diff options
author | Frederick Muriuki Muriithi | 2024-01-18 15:03:36 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-18 15:03:36 +0300 |
commit | 8b6785be9a61d7ba17a2320a79184bee0914a2f1 (patch) | |
tree | 68be72ee3879d25890684cc0cd5a053f9ecda0a9 /qc_app | |
parent | af485aff7d25c1f5128586c550ca36debe24fd66 (diff) | |
download | gn-uploader-8b6785be9a61d7ba17a2320a79184bee0914a2f1.tar.gz |
UI: Display summary information.
Diffstat (limited to 'qc_app')
-rw-r--r-- | qc_app/db/datasets.py | 15 | ||||
-rw-r--r-- | qc_app/templates/rqtl2/summary-info.html | 28 | ||||
-rw-r--r-- | qc_app/upload/rqtl2.py | 25 |
3 files changed, 66 insertions, 2 deletions
diff --git a/qc_app/db/datasets.py b/qc_app/db/datasets.py index 5816146..448db18 100644 --- a/qc_app/db/datasets.py +++ b/qc_app/db/datasets.py @@ -1,5 +1,6 @@ """Functions for accessing the database relating to datasets.""" from datetime import date +from typing import Optional import MySQLdb as mdb from MySQLdb.cursors import DictCursor @@ -109,7 +110,7 @@ def probeset_create_dataset(conn: mdb.Connection,#pylint: disable=[too-many-argu } cursor.execute( """ - insert into ProbeSetFreeze( + INSERT INTO ProbeSetFreeze( ProbeFreezeId, AvgId, Name, Name2, FullName, ShortName, CreateTime, public, DataScale) VALUES( @@ -118,3 +119,15 @@ def probeset_create_dataset(conn: mdb.Connection,#pylint: disable=[too-many-argu """, dataset) return {**dataset, "datasetid": cursor.lastrowid} + +def probeset_dataset_by_id( + conn: mdb.Connection, datasetid: int) -> Optional[dict]: + """Fetch a ProbeSet dataset by its ID""" + with conn.cursor(cursorclass=DictCursor) as cursor: + cursor.execute("SELECT * FROM ProbeSetFreeze WHERE Id=%s", + (datasetid,)) + result = cursor.fetchone() + if bool(result): + return dict(result) + + return None diff --git a/qc_app/templates/rqtl2/summary-info.html b/qc_app/templates/rqtl2/summary-info.html index c3a2ac0..3882c9c 100644 --- a/qc_app/templates/rqtl2/summary-info.html +++ b/qc_app/templates/rqtl2/summary-info.html @@ -21,6 +21,34 @@ <dt>Genotype Dataset</dt> <dd>{{geno_dataset.Name}} ({{geno_dataset.FullName}})</dd> + + <dt>ProbeSet Study</dt> + <dd>{{probe_study.Name}} ({{probe_study.FullName}})</dd> + + <dt>ProbeSet Dataset</dt> + <dd>{{probe_dataset.Name2}} ({{probe_dataset.FullName}})</dd> </dl> +<form id="frm:confirm-rqtl2bundle-details" + action="{{url_for('upload.rqtl2.confirm_bundle_details', + species_id=species.SpeciesId, + population_id=population.InbredSetId)}}" + method="POST" + enctype="multipart/form-data"> + <legend class="heading">Create ProbeSet dataset</legend> + + <input type="hidden" name="species_id" value="{{species.SpeciesId}}" /> + <input type="hidden" name="population_id" + value="{{population.InbredSetId}}" /> + <input type="hidden" name="rqtl2_bundle_file" value="{{rqtl2_bundle_file}}" /> + <input type="hidden" name="geno-dataset-id" value="{{geno_dataset.Id}}" /> + <input type="hidden" name="probe-study-id" value="{{probe_study.Id}}" /> + <input type="hidden" name="probe-dataset-id" value="{{probe_dataset.Id}}" /> + + <fieldset> + <input type="submit" + value="continue" + class="btn btn-main form-col-2" /> + </fieldset> +</form> {%endblock%} diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index 0b446ac..7609fa9 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -34,6 +34,7 @@ from qc_app.db.datasets import ( probeset_study_by_id, probeset_create_study, + probeset_dataset_by_id, probeset_create_dataset, probeset_datasets_by_study, probeset_studies_by_species_and_population) @@ -512,8 +513,30 @@ def select_dataset_info(species_id: int, population_id: int): datasets=probeset_datasets_by_study( conn, int(form["probe-study-id"])), avgmethods=averaging_methods(conn)) + probeset_study = probeset_study_by_id( + conn, int(form["probe-study-id"])) + probeset_dataset = probeset_dataset_by_id( + conn, int(form["probe-dataset-id"])) return render_template("rqtl2/summary-info.html", species=species, population=population, - geno_dataset=geno_dataset) + geno_dataset=geno_dataset, + probe_study=probeset_study, + probe_dataset=probeset_dataset) + + + +@rqtl2.route(("/upload/species/<int:species_id>/population/<int:population_id>" + "/rqtl2-bundle/confirm-bundle-details"), + methods=["POST"]) +def confirm_bundle_details(species_id: int, population_id: int): + """Confirm the details and trigger R/qtl2 bundle processing...""" + with database_connection(app.config["SQL_URI"]) as conn: + error = check_errors( + conn, "species", "population", "rqtl2_bundle_file", "geno-dataset", + "probe-study-id", "probe-dataset-id") + if bool(error): + return error + + raise NotImplementedError |