aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-07-18 11:22:10 +0300
committerFrederick Muriuki Muriithi2023-07-18 11:22:10 +0300
commit82f401cc4dbc65352a368fca76d100e9e773088e (patch)
tree89d1d09b35db703147eafaaea94ff6416dd5a487
parent1bbb0430732b7fa5102d7dcbda80ebda252f5424 (diff)
downloadgenenetwork2-82f401cc4dbc65352a368fca76d100e9e773088e.tar.gz
BugFix: Use reworked `retrieve_phenotype_group_name` function
Use the reworked `retrieve_phenotype_group_name` to fetch the group name for phenotype datasets. == Bug Description == There was a subtle bug in the original calls to `retrieve_group_name` function where the `dataset_id` was passed in as an argument, rather than the group id. For some Datasets, the `group_id` and `dataset_id` share the same value, and would end up querying the correct values, but that was a fluke where doing the wrong thing ended up with the expected values. This commit fixes that by using the reworked function, which does the correct indirection from `dataset_id` to the appropriate `group_id`. See https://github.com/genenetwork/genenetwork3/commit/088b6181457ef4e528b7dcbf04b7aca29b274d1f for the reworked function.
-rw-r--r--wqflask/wqflask/metadata_edits.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py
index 501ddba0..a3b7f307 100644
--- a/wqflask/wqflask/metadata_edits.py
+++ b/wqflask/wqflask/metadata_edits.py
@@ -46,7 +46,7 @@ from gn3.db import fetchall
from gn3.db import fetchone
from gn3.db import insert
from gn3.db import update
-from gn3.db.datasets import retrieve_sample_list, retrieve_group_name, retrieve_trait_dataset
+from gn3.db.datasets import retrieve_sample_list, retrieve_phenotype_group_name, retrieve_trait_dataset
from gn3.db.metadata_audit import MetadataAudit
from gn3.db.phenotypes import Phenotype
from gn3.db.phenotypes import Probeset
@@ -133,7 +133,7 @@ def display_phenotype_metadata(dataset_id: str, name: str):
with database_connection(get_setting("SQL_URI")) as conn:
_d = edit_phenotype(conn=conn, name=name, dataset_id=dataset_id)
- group_name = retrieve_group_name(dataset_id, conn)
+ group_name = retrieve_phenotype_group_name(conn, dataset_id)
sample_list = retrieve_sample_list(group_name)
sample_data = get_trait_sample_data(conn, name, _d.get("publish_xref").phenotype_id)
@@ -196,7 +196,7 @@ def update_phenotype(dataset_id: str, name: str):
)
diff_data = {}
with database_connection(get_setting("SQL_URI")) as conn:
- group_name = retrieve_group_name(dataset_id, conn)
+ group_name = retrieve_phenotype_group_name(conn, dataset_id)
sample_list = retrieve_sample_list(group_name)
headers = ["Strain Name", "Value", "SE", "Count"]
base_csv = get_trait_csv_sample_data(
@@ -499,8 +499,8 @@ def get_sample_data_as_csv(dataset_id: str, phenotype_id: int):
conn=conn,
trait_name=str(dataset_id),
phenotype_id=str(phenotype_id),
- sample_list=retrieve_sample_list(retrieve_group_name(
- dataset_id, conn))
+ sample_list=retrieve_sample_list(
+ retrieve_phenotype_group_name(conn, dataset_id))
),
mimetype="text/csv",
headers={