From 71c8e03b77dc094567c3b522909d7aa6995585f4 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 17 Nov 2023 12:19:15 +0100 Subject: Now we have a list of strain names for the BXD --- gn/data/strains.scm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'gn/data/strains.scm') diff --git a/gn/data/strains.scm b/gn/data/strains.scm index 275c4cd..b3e6744 100644 --- a/gn/data/strains.scm +++ b/gn/data/strains.scm @@ -12,11 +12,24 @@ #:use-module (web gn-uri) #:export ( - strain-names + strain-id-names + bxd-strain-id-names )) -(define (strain-names) +(define* (strain-id-names inbred-set #:key (map? #f)) + "Return assoc list of tuples of strain id+names, e.g. + + ((4 . BXD1) (5 . BXD2) (6 . BXD5) (7 . BXD6)... +" (call-with-db (lambda (db) - (dbi-query db "SELECT StrainId,Strain.Name FROM Strain, StrainXRef WHERE StrainXRef.StrainId = Strain.Id AND StrainXRef.InbredSetId = 1 AND Used_for_mapping='Y' ORDER BY StrainId;") + (dbi-query db (string-append "SELECT StrainId,Strain.Name FROM Strain, StrainXRef WHERE StrainXRef.StrainId = Strain.Id AND StrainXRef.InbredSetId = " (format #f "~d" inbred-set) + (if map? + " AND Used_for_mapping='Y'" + "") + " ORDER BY StrainId;")) (get-rows-apply db (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "Name"))) '())))) + +(define* (bxd-strain-id-names #:key (map? #f)) + "Return assoc list of tuples of strain id + names. Same as strain-id-names, but just for the BXD" + (strain-id-names 1)) -- cgit v1.2.3