aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-04-19 14:42:31 +0300
committerFrederick Muriuki Muriithi2023-04-19 15:13:04 +0300
commit9a0c6fd1759e13fa7a934852f87e9aa4c62d7dfd (patch)
treeb21dd6bfa8896332d848992cb32e2119cc6d9c4f /scripts
parent85610fc9670c0496bff045be0e148e3d2b3357d3 (diff)
downloadgenenetwork3-9a0c6fd1759e13fa7a934852f87e9aa4c62d7dfd.tar.gz
auth: Setup selected traits correctly
Fix bugs with setting up of the selected traits for use while filtering the search results.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/search_phenotypes.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/search_phenotypes.py b/scripts/search_phenotypes.py
index 7049834..2f7fcf3 100644
--- a/scripts/search_phenotypes.py
+++ b/scripts/search_phenotypes.py
@@ -11,6 +11,7 @@ from datetime import datetime, timedelta
import click
import redis
import requests
+from MySQLdb.cursors import DictCursor
from gn3 import jobs
from gn3.auth import db as authdb
@@ -92,13 +93,13 @@ def search(# pylint: disable=[too-many-arguments, too-many-locals]
try:
search_query = f"species:{species}" + (
f" AND ({query})" if bool(query) else "")
- filter_keys = ("SpeciesName", "InbredSetName", "dataset_name",
- "PublishXRefId")
- selected_traits = tuple(tuple(item[key] for key in filter_keys)
- for item in json.loads(selected))
- linked = tuple(tuple(row[key] for key in filter_keys)
- for row in linked_phenotype_data(
- authconn, gn3conn, species))
+ selected_traits = tuple(
+ (item["species"], item["group"], item["dataset"], item["name"])
+ for item in json.loads(selected))
+ linked = tuple(
+ (row["SpeciesName"], row["InbredSetName"], row["dataset_name"],
+ row["PublishXRefId"])
+ for row in linked_phenotype_data(authconn, gn3conn, species))
page = 1
count = 0
while count < per_page: