aboutsummaryrefslogtreecommitdiff
path: root/qc_app
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-04-12 09:13:20 +0300
committerFrederick Muriuki Muriithi2024-04-12 09:16:13 +0300
commit09b4b70aae5e65516c766882118a897c75a44974 (patch)
tree82f195fbf101bdec1fef88f4571f369e09a520d5 /qc_app
parent27a39c8465a49db5e65f83c36e531ea1f7769682 (diff)
downloadgn-uploader-09b4b70aae5e65516c766882118a897c75a44974.tar.gz
Provide tissue-id details to probeset dataset templates
Diffstat (limited to 'qc_app')
-rw-r--r--qc_app/db/tissues.py5
-rw-r--r--qc_app/templates/rqtl2/create-probe-dataset-success.html1
-rw-r--r--qc_app/templates/rqtl2/select-probeset-dataset.html4
-rw-r--r--qc_app/upload/rqtl2.py14
4 files changed, 20 insertions, 4 deletions
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}}" />
<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="tissueid" value="{{tissue.Id}}" />
<input type="hidden" name="probe-study-id" value="{{study.Id}}" />
<input type="hidden" name="probe-dataset-id" value="{{dataset.datasetid}}" />
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">
<legend class="heading">Select from existing ProbeSet datasets</legend>
- {{flash_messages("error-rqtl2-select-probeset-dataset")}}
+ {{flash_messages("error-rqtl2")}}
<input type="hidden" name="species_id" value="{{species.SpeciesId}}" />
<input type="hidden" name="population_id"
@@ -26,6 +26,7 @@
<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="tissueid" value="{{tissue.Id}}" />
<input type="hidden" name="probe-study-id" value="{{probe_study.Id}}" />
<fieldset>
@@ -75,6 +76,7 @@
<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="tissueid" value="{{tissue.Id}}" />
<input type="hidden" name="probe-study-id" value="{{probe_study.Id}}" />
<fieldset>
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))