aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/datasets.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/gn3/db/datasets.py b/gn3/db/datasets.py
index 65ab1f8..9186875 100644
--- a/gn3/db/datasets.py
+++ b/gn3/db/datasets.py
@@ -33,6 +33,27 @@ def retrieve_sample_list(
samplelist = headers[3:]
return samplelist
+def retrieve_group_name(
+ group_id: int, connection: any):
+ """
+ Given the group id (InbredSet.Id in the database), retrieve its name
+ """
+ query = (
+ "SELECT Name "
+ "FROM InbredSet "
+ "WHERE "
+ "InbredSet.Id = %(group_id)s")
+ with connection.cursor() as cursor:
+ cursor.execute(
+ query,
+ {
+ "group_id": group_id
+ })
+ res = cursor.fetchone()
+ if res:
+ return res[0]
+ return None
+
def retrieve_probeset_trait_dataset_name(
threshold: int, name: str, connection: Any):
"""