aboutsummaryrefslogtreecommitdiff
path: root/gn/data/strains.scm
blob: 275c4cdcc0a8b8a19d55397da08c6ce8a6e91119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(define-module (gn data strains)
  #:use-module (json)
  #:use-module (ice-9 match)
  #:use-module (ice-9 format)
  #:use-module (ice-9 iconv)
  #:use-module (ice-9 receive)
  #:use-module (ice-9 string-fun)
  ;; #:use-module (gn db sparql)
  #:use-module (dbi dbi)
  #:use-module (gn db mysql)
  #:use-module (gn data group)
  #:use-module (web gn-uri)

  #:export (
            strain-names
            ))

(define (strain-names)
  (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;")
      (get-rows-apply db (lambda (r) `(,(assoc-ref r "StrainId") . ,(assoc-ref r "Name"))) '()))))