diff options
Diffstat (limited to 'gn/data/strains.scm')
-rw-r--r-- | gn/data/strains.scm | 19 |
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)) |