Skip to content

Commit

Permalink
BugFix: Use reworked retrieve_phenotype_group_name function
Browse files Browse the repository at this point in the history
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
genenetwork/genenetwork3@088b618
for the reworked function.
  • Loading branch information
fredmanglis committed Jul 18, 2023
1 parent 1bbb043 commit 82f401c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions wqflask/wqflask/metadata_edits.py
Expand Up @@ -46,7 +46,7 @@
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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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={
Expand Down

0 comments on commit 82f401c

Please sign in to comment.