aboutsummaryrefslogtreecommitdiff
path: root/gn/data
diff options
context:
space:
mode:
authorPjotr Prins2023-11-17 12:19:15 +0100
committerPjotr Prins2023-11-17 12:19:15 +0100
commit71c8e03b77dc094567c3b522909d7aa6995585f4 (patch)
treebfe50eb15d185139b37fa9258e756ccb3657def9 /gn/data
parentc401f66de2dbcbc41dd9551490563543092de242 (diff)
downloadgn-guile-71c8e03b77dc094567c3b522909d7aa6995585f4.tar.gz
Now we have a list of strain names for the BXD
Diffstat (limited to 'gn/data')
-rw-r--r--gn/data/strains.scm19
1 files changed, 16 insertions, 3 deletions
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))