From 684d9e37381120f171aff5f9f9a58ceaefa1901e Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 17 Aug 2023 19:53:54 +0000 Subject: Fix query for fetching DataId when inserting ProbeSet data --- gn3/db/sample_data.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'gn3/db') diff --git a/gn3/db/sample_data.py b/gn3/db/sample_data.py index 4cf1058..1f9d519 100644 --- a/gn3/db/sample_data.py +++ b/gn3/db/sample_data.py @@ -192,11 +192,14 @@ WHERE ps.Id = %s AND psf.Name= %s AND st.Name = %s""", (probeset_id, dataset_nam strain_id, probesetdata_id, inbredset_id = _result if not all([strain_id, probesetdata_id, inbredset_id]): # Applies for data to be inserted: - cursor.execute( - "SELECT DataId, InbredSetId FROM ProbeSetXRef " - "WHERE Id = %s", - (probesetxref_id), - ) + cursor.execute(""" +SELECT psx.DataId, pf.InbredSetId +FROM ProbeFreeze pf + JOIN ProbeSetFreeze psf ON psf.ProbeFreezeId = pf.Id + JOIN ProbeSetXRef psx ON psx.ProbeSetFreezeId = psf.Id +WHERE psx.ProbeSetId = %s AND + psf.Name = %s""", (probeset_id, dataset_name)) + probesetdata_id, inbredset_id = cursor.fetchone() cursor.execute( "SELECT Id FROM Strain WHERE Name = %s", (strain_name,) -- cgit v1.2.3