aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/sample_data.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gn3/db/sample_data.py b/gn3/db/sample_data.py
index a410978..e3e1676 100644
--- a/gn3/db/sample_data.py
+++ b/gn3/db/sample_data.py
@@ -68,6 +68,15 @@ def get_sample_data_ids(conn: Any, publishxref_id: int,
(publishxref_id, phenotype_id, strain_name))
if _result := cursor.fetchone():
strain_id, publishdata_id, inbredset_id = _result
+ if not all([strain_id, publishdata_id, inbredset_id]):
+ # Applies for data to be inserted:
+ cursor.execute("SELECT DataId, InbredSetId FROM PublishXRef "
+ "WHERE Id = %s AND PhenotypeId = %s",
+ (publishxref_id, phenotype_id))
+ publishdata_id, inbredset_id = cursor.fetchone()
+ cursor.execute("SELECT Id FROM Strain WHERE Name = %s",
+ (strain_name,))
+ strain_id = cursor.fetchone()
return (strain_id, publishdata_id, inbredset_id)