blob: 8706c3c0e1630bdaf3bc7690c4ad4760f03fe98b (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#! /usr/bin/env guile
!#
(use-modules (srfi srfi-1)
(srfi srfi-26)
(ice-9 getopt-long)
(ice-9 match)
(ice-9 regex)
(transform strings)
(transform sql)
(transform triples)
(transform special-forms)
(web uri))
(define-transformer probesetxref->metadata
(tables (ProbeSetXRef
(inner-join ProbeSetFreeze "ON ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id")
(inner-join ProbeSet "ON ProbeSet.Id = ProbeSetXRef.ProbeSetId"))
"WHERE ProbeSetFreeze.public > 0 AND ProbeSetFreeze.confidentiality < 1")
(triples (string->identifier
"probeset_data"
(uri-encode
(format #f "~a_~a" (field ProbeSetFreeze Name ProbeSetFreezeName) (field ProbeSet Name ProbeSetName))) #:separator "_")
(set rdf:type 'gnc:molecular_trait_metadata)
(set dcat:distribution
(string->symbol
(sanitize-rdf-string
(format #f "gnd:~a.json"
(field ("CONCAT(ProbeSetFreeze.Name, '_', ProbeSet.Name)"
PublishFreeze))))) )
(set gnt:has_probeset (string->identifier "probeset" (field ProbeSet Name ProbeSetName)))
(set dcat:isPartOf (string->identifier "dataset" (field ProbeSetFreeze Name ProbeSetFreezeName)
#:separator "_"))
(set gnt:mean (annotate-field (field ("IFNULL(ProbeSetXRef.mean, '')" mean))
'^^xsd:double))
(set gnt:SE (annotate-field (field ("IFNULL(ProbeSetXRef.se, '')" se))
'^^xsd:double))
(set gnt:locus (sanitize-rdf-string (field ProbeSetXRef Locus)))
(set gnt:lod_score (annotate-field
(field ("IFNULL((ProbeSetXRef.LRS/4.604), '')" lrs))
'^^xsd:double))
(set gnt:pvalue (annotate-field
(field ("IFNULL((ProbeSetXRef.pValue), '')" pValue))
'^^xsd:double))
(set gnt:additive (annotate-field
(field ("IFNULL((ProbeSetXRef.additive), '')" additive))
'^^xsd:double))
(set gnt:h2 (annotate-field
(field ("IFNULL((ProbeSetXRef.h2), '')" h2))
'^^xsd:double))))
(let* ((option-spec
'((settings (single-char #\s) (value #t))
(output (single-char #\o) (value #t))
(documentation (single-char #\d) (value #t))))
(options (getopt-long (command-line) option-spec))
(settings (option-ref options 'settings #f))
(output (option-ref options 'output #f))
(documentation (option-ref options 'documentation #f))
(%connection-settings
(call-with-input-file settings
read)))
(call-with-target-database
%connection-settings
(lambda (db)
(with-documentation
(name "ProbeSet Experiments Metadata")
(connection %connection-settings)
(table-metadata? #f)
(total-rows (assoc-ref
(sql-find db "SELECT count(*) AS count from ProbeSetXRef")
"count"))
(rows-per-chunk 1000000)
(prefixes
'(("dcat:" "<http://www.w3.org/ns/dcat#>")
("gn:" "<http://rdf.genenetwork.org/v1/id/>")
("gnc:" "<http://rdf.genenetwork.org/v1/category/>")
("gnt:" "<http://rdf.genenetwork.org/v1/term/>")
("gnd:" "<https://cd.genenetwork.org/api3/lmdb/v1/data/traits/>")
("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
("kegg:" "<http://bio2rdf.org/ns/kegg#>")
("pubchem:" "<https://pubchem.ncbi.nlm.nih.gov/>")
("omim:" "<https://www.omim.org/entry/>")
("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
("uniprot:" "<http://purl.uniprot.org/uniprot/>")
("chebi:" "<http://purl.obolibrary.org/obo/CHEBI_>")
("dcat:" "<http://www.w3.org/ns/dcat#>")
("dct:" "<http://purl.org/dc/terms/>")
("owl:" "<http://www.w3.org/2002/07/owl#>")
("homologene:" "<https://bio2rdf.org/homologene:>")
("xsd:" "<http://www.w3.org/2001/XMLSchema#>")
("qb:" "<http://purl.org/linked-data/cube#>")
("sdmx-measure:" "<http://purl.org/linked-data/sdmx/2009/measure#>")
("skos:" "<http://www.w3.org/2004/02/skos/core#>")))
(inputs
(list probesetxref->metadata))
(outputs
`(#:documentation ,documentation
#:rdf ,output))))))
|