From 09b4b70aae5e65516c766882118a897c75a44974 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 12 Apr 2024 09:13:20 +0300 Subject: Provide tissue-id details to probeset dataset templates --- qc_app/db/tissues.py | 5 ++--- qc_app/templates/rqtl2/create-probe-dataset-success.html | 1 + qc_app/templates/rqtl2/select-probeset-dataset.html | 4 +++- qc_app/upload/rqtl2.py | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'qc_app') diff --git a/qc_app/db/tissues.py b/qc_app/db/tissues.py index 062e824..9fe7bab 100644 --- a/qc_app/db/tissues.py +++ b/qc_app/db/tissues.py @@ -11,11 +11,10 @@ def all_tissues(conn: mdb.Connection) -> tuple[dict, ...]: return tuple(dict(row) for row in cursor.fetchall()) -def tissue_by_id(conn: mdb.Connection, tissueid: int) -> Optional[dict]: +def tissue_by_id(conn: mdb.Connection, tissueid) -> Optional[dict]: """Retrieve a tissue by its ID""" with conn.cursor(cursorclass=DictCursor) as cursor: - cursor.execute("SELECT * FROM Tissue WHERE Id=%s", - (tissueid,)) + cursor.execute("SELECT * FROM Tissue WHERE Id=%s", (tissueid,)) result = cursor.fetchone() if bool(result): return dict(result) diff --git a/qc_app/templates/rqtl2/create-probe-dataset-success.html b/qc_app/templates/rqtl2/create-probe-dataset-success.html index 33612c4..71ff7ac 100644 --- a/qc_app/templates/rqtl2/create-probe-dataset-success.html +++ b/qc_app/templates/rqtl2/create-probe-dataset-success.html @@ -47,6 +47,7 @@ value="{{population.InbredSetId}}" /> + diff --git a/qc_app/templates/rqtl2/select-probeset-dataset.html b/qc_app/templates/rqtl2/select-probeset-dataset.html index d00d6aa..0b2a8f2 100644 --- a/qc_app/templates/rqtl2/select-probeset-dataset.html +++ b/qc_app/templates/rqtl2/select-probeset-dataset.html @@ -18,7 +18,7 @@ species_id=species.SpeciesId, population_id=population.Id)}}" id="frm:select-probeset-dataset"> Select from existing ProbeSet datasets - {{flash_messages("error-rqtl2-select-probeset-dataset")}} + {{flash_messages("error-rqtl2")}} +
@@ -75,6 +76,7 @@ +
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index 66c95b9..bf392a9 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -870,6 +870,19 @@ def select_dataset_info(species_id: int, population_id: int): platforms=platforms_by_species(conn, species_id), tissues=all_tissues(conn)) + tissue = tissue_by_id(conn, form.get("tissueid", "").strip()) + if "pheno" in cdata and not bool(tissue): + return render_template( + "rqtl2/select-tissue.html", + species=species, + population=population, + rqtl2_bundle_file=thefile.name, + geno_dataset=geno_dataset, + studies=probeset_studies_by_species_and_population( + conn, species_id, population_id), + platforms=platforms_by_species(conn, species_id), + tissues=all_tissues(conn)) + return render_template( "rqtl2/select-probeset-study-id.html", species=species, @@ -891,6 +904,7 @@ def select_dataset_info(species_id: int, population_id: int): rqtl2_bundle_file=thefile.name, geno_dataset=geno_dataset, probe_study=probeset_study, + tissue=tissue, datasets=probeset_datasets_by_study( conn, int(form["probe-study-id"])), avgmethods=averaging_methods(conn)) -- cgit v1.2.3