aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2023-08-24 19:28:36 +0000
committerzsloan2023-08-24 19:30:51 +0000
commit42559337bc4ebfb6f4fd8b09bbc9accf78472db2 (patch)
treee3115e66999b6b69e02ec7c9025a68a40c162a3d
parentd5d0c4718a49c5a9d26a069c5d5964d58bb324f9 (diff)
downloadgenenetwork3-42559337bc4ebfb6f4fd8b09bbc9accf78472db2.tar.gz
Change get_pheno_csv_sample_data to use group ID instead of phenotype ID
-rw-r--r--gn3/db/sample_data.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/gn3/db/sample_data.py b/gn3/db/sample_data.py
index 1f9d519..38fa3d9 100644
--- a/gn3/db/sample_data.py
+++ b/gn3/db/sample_data.py
@@ -143,7 +143,7 @@ ORDER BY st.Name""", (trait_name, phenotype_id))
return sample_data
def get_pheno_csv_sample_data(
- conn: Any, trait_name: int, phenotype_id: int, sample_list: list
+ conn: Any, trait_name: int, group_id: int, sample_list: list
) -> str:
"""Fetch a phenotype (Publish in DB) trait and return it as a csv string"""
with conn.cursor() as cursor:
@@ -151,11 +151,11 @@ def get_pheno_csv_sample_data(
SELECT DISTINCT st.Name, concat(st.Name, ',', ifnull(pd.value, 'x'), ',',
ifnull(ps.error, 'x'), ',', ifnull(ns.count, 'x')) AS 'Data'
FROM PublishFreeze pf JOIN PublishXRef px ON px.InbredSetId = pf.InbredSetId
-JOIN PublishData pd ON pd.Id = px.DataId JOIN Strain st ON pd.StrainId = st.Id
-LEFT JOIN PublishSE ps ON ps.DataId = pd.Id AND ps.StrainId = pd.StrainId
-LEFT JOIN NStrain ns ON ns.DataId = pd.Id AND ns.StrainId = pd.StrainId
-WHERE px.Id = %s AND px.PhenotypeId = %s ORDER BY st.Name""",
- (trait_name, phenotype_id))
+ JOIN PublishData pd ON pd.Id = px.DataId JOIN Strain st ON pd.StrainId = st.Id
+ LEFT JOIN PublishSE ps ON ps.DataId = pd.Id AND ps.StrainId = pd.StrainId
+ LEFT JOIN NStrain ns ON ns.DataId = pd.Id AND ns.StrainId = pd.StrainId
+WHERE px.Id = %s AND px.InbredSetId = %s ORDER BY st.Name""",
+ (trait_name, group_id))
if not (data := cursor.fetchall()):
return "No Sample Data Found"