aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn/data/strains.scm19
-rwxr-xr-xscripts/precompute/precompute-hits.scm14
2 files changed, 23 insertions, 10 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))
diff --git a/scripts/precompute/precompute-hits.scm b/scripts/precompute/precompute-hits.scm
index 5955fb1..acd7cdf 100755
--- a/scripts/precompute/precompute-hits.scm
+++ b/scripts/precompute/precompute-hits.scm
@@ -37,18 +37,18 @@
(display row)
)
(newline)
- (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;")
- (let [(row (get-row db))]
- (display row)
- )
+ ; (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;")
+ ; (let [(row (get-row db))]
+ ; (display row)
+ ; )
(let [(result (get-rows-apply db (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "Name"))) '()))]
(display (car result)))
(newline)
- (display (strain-names))
- ; (display (car ids))
+ (define bxd-strains (bxd-strain-id-names #:map? #t))
(newline)
- ; (display (assoc 5 ids))
+ (display bxd-strains)
+ (display (assoc 64728 bxd-strains))
(newline)
(newline)
(dbi-query db "SELECT * FROM ProbeSetXRef LIMIT 3")