aboutsummaryrefslogtreecommitdiff
path: root/gn/data/hits.scm
blob: 5108bd0717e5b0df44082f6599d4682aa11657cd (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
30
(define-module (gn data hits)
  #: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 (gn util convert)
  #:use-module (web gn-uri)

  #:export (
            get-precompute-hit
            set-precompute-hit-status!
            ))

(define (get-precompute-hit db prev-id)
  (dbi-query db (string-append "select Locus, DataId, ProbeSetId, ProbeSetFreezeId from ProbeSetXRef where DataId>" (int-to-string prev-id) " AND Locus_old is NULL ORDER BY DataId LIMIT 1"))
  (get-row db))

(define (set-precompute-hit-status! db data-id-str status-str)
  "Set status of precompute record - typically 'RUN' or 'NON-BXD'.
This is a temporary measure to get precompute going.
Note we are counting on automated MariaDB transactions to not compete."
  (dbi-query db (string-append "UPDATE ProbeSetXRef SET Locus_old=\"" status-str "\" WHERE DataId=" data-id-str " AND Locus_old is NULL"))
  (ensure db)
  )