aboutsummaryrefslogtreecommitdiff
path: root/gn/data/group.scm
blob: 014b68921b4e51085aef52a1aaf8b91d838da6c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(define-module (gn data group)
  #:use-module (srfi srfi-1)
  #: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 (web gn-uri)

  #:export (
            get-group-links
            get-group-data
            ))

(define (get-group-links gnid func)
  "Return all the URIs that link to group info, e.g. for Mus_musculus.
   Uses func to transform the link - if required."
  (let ([recs (car (cdr (compile-groups-meta)))]
        [uri (mk-gnid gnid)])
    (filter-map
     (lambda (r) (if (string=? (second r) uri)
                     (func (car r))
                     #f)) recs)
  ))

(define (get-group-data id)
  (car (cdr (make-pairs (lambda () (sparql-group-info (string-append "gn:" id))))
  )))