about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scripts/insert_data.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/insert_data.py b/scripts/insert_data.py
index 72fc897..a441dcb 100644
--- a/scripts/insert_data.py
+++ b/scripts/insert_data.py
@@ -253,10 +253,27 @@ def insert_se(# pylint: disable = [too-many-arguments]
         "VALUES(%(DataId)s, %(StrainId)s, %(DataValue)s)")
     annotations = annotationinfo(dbconn, platformid, datasetid)
     if not bool(annotations):
-        print(
-            (f"ERROR: No annotations found for platform {platformid} and "
-             f"dataset {datasetid}. Quiting!"),
-            file=sys.stderr)
+        with dbconn.cursor(cursorclass=DictCursor) as cursor:
+            dquery = cursor.execute((
+                "SELECT "
+                "gc.GeneChipName AS platformname, pf.Name AS studyname, "
+                "psf.FullName AS datasetname "
+                "FROM GeneChip AS gc INNER JOIN ProbeFreeze AS pf "
+                "ON gc.Id=pf.ChipId INNER JOIN ProbeSetFreeze AS psf "
+                "ON pf.Id=psf.ProbeFreezeId "
+                "WHERE gc.Id=%s AND psf.Id=%s"),
+                                    (platformid, datasetid))
+
+            errorinfo = dquery.fetchone()
+            print(("ERROR: No annotations found for the "
+                   f"'{errorinfo['datasetname']}' dataset (Id: {datasetid}) "
+                   f"under the '{errorinfo['studyname']}' study linked to the "
+                   f"'{errorinfo['platformname']}' platform (Id: {platformid})."
+                   "\n\n"
+                   "       Please verify you selected the correct platform, "
+                   "study and dataset for the standard-error file(s) you were "
+                   "trying to upload."),
+                  file=sys.stderr)
         return 1
 
     se_values = (