blob: 0a6e07b72d45251d78427594f110df1e6151f32e (
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
#! /usr/bin/env guile
!#
(use-modules (srfi srfi-1)
(srfi srfi-26)
(ice-9 match)
(ice-9 regex)
(dump strings)
(dump sql)
(dump triples)
(dump special-forms))
(define %connection-settings
(call-with-input-file (list-ref (command-line) 1)
read))
(define %dump-directory
(list-ref (command-line) 2))
(define-dump dump-probeset-0
(tables (ProbeSet
(left-join GeneChip "ON GeneChip.Id = ProbeSet.ChipId"))
"LIMIT 2000000 OFFSET 0")
(schema-triples
(gn:name rdfs:range rdfs:Literal)
(gn:probeset rdfs:range rdfs:Literal))
(triples (ontology
'probeset:
(string-trim-both
(regexp-substitute/global
#f "[^A-Za-z0-9:]"
(field ("IFNULL(NULLIF(TRIM(ProbeSet.Name), ''), ProbeSet.Id)"
name))
'pre "_" 'post)))
(set rdf:type 'gn:probeset)
(set gn:chipOf (string->identifier "platform" (field GeneChip Name)))
(set gn:name (field ProbeSet Name))
(set gn:symbol (delete-substrings (field ProbeSet Symbol) "\""))
(set gn:description (sanitize-rdf-string
(field ProbeSet description)))
(set gn:chr (field ProbeSet Chr))
(set gn:mb (annotate-field (field ("IFNULL(ProbeSet.Mb, '')" Mb)) '^^xsd:double))
;; For now have the tissue, and alias as one line without
;; splitting to make the dump faster
;; (set gn:tissue (field ("IFNULL(ProbeSet.Tissue, '')" Tissue)))
;; (set gn:alias (field ProbeSet alias))
;; (set gn:generif (ontology 'generif: (field ProbeSet GeneId)))
(set gn:blatSeq (sanitize-rdf-string
(string-trim-both (field ProbeSet BlatSeq))))
(set gn:targetSeq (sanitize-rdf-string (field ProbeSet TargetSeq)))
;; (set gn:unigene (field ProbeSet UniGeneId))
;; (set gn:genbank (field ProbeSet GenbankId))
;; (set gn:omim (sanitize-rdf-string (string-trim-both (field ProbeSet OMIM))))
;; (set gn:RefSeq_TranscriptId (field ProbeSet RefSeq_TranscriptId))
(set gn:uniProtReference (ontology 'uniprot:
(field ProbeSet UniProtID)))))
(define-dump dump-probeset-1
(tables (ProbeSet
(left-join GeneChip "ON GeneChip.Id = ProbeSet.ChipId"))
"LIMIT 2000000 OFFSET 2000000")
(schema-triples
(gn:name rdfs:range rdfs:Literal)
(gn:probeset rdfs:range rdfs:Literal))
(triples (ontology
'probeset:
(string-trim-both
(regexp-substitute/global
#f "[^A-Za-z0-9:]"
(field ("IFNULL(NULLIF(TRIM(ProbeSet.Name), ''), ProbeSet.Id)"
name))
'pre "_" 'post)))
(set rdf:type 'gn:probeset)
(set gn:chipOf (string->identifier "platform" (field GeneChip Name)))
(set gn:name (field ProbeSet Name))
(set gn:symbol (delete-substrings (field ProbeSet Symbol) "\""))
(set gn:description (sanitize-rdf-string
(field ProbeSet description)))
(set gn:chr (field ProbeSet Chr))
(set gn:mb (annotate-field (field ("IFNULL(ProbeSet.Mb, '')" Mb)) '^^xsd:double))
(set gn:blatSeq (sanitize-rdf-string
(string-trim-both (field ProbeSet BlatSeq))))
(set gn:targetSeq (sanitize-rdf-string (field ProbeSet TargetSeq)))
(set gn:uniProtReference (ontology 'uniprot:
(field ProbeSet UniProtID)))))
(define-dump dump-probeset-2
(tables (ProbeSet
(left-join GeneChip "ON GeneChip.Id = ProbeSet.ChipId"))
"WHERE ProbeSet.Name IS NOT NULL LIMIT 2000000 OFFSET 4000000")
(schema-triples
(gn:name rdfs:range rdfs:Literal)
(gn:probeset rdfs:range rdfs:Literal))
(triples (ontology
'probeset:
(string-trim-both
(regexp-substitute/global
#f "[^A-Za-z0-9:]"
(field ("IFNULL(ProbeSet.Name, ProbeSet.Id)"
name))
'pre "_" 'post)))
(set rdf:type 'gn:probeset)
(set gn:chipOf (string->identifier "platform" (field GeneChip Name)))
(set gn:name (field ProbeSet Name))
(set gn:symbol (delete-substrings (field ProbeSet Symbol) "\""))
(set gn:description (sanitize-rdf-string
(field ProbeSet description)))
(set gn:chr (field ProbeSet Chr))
(set gn:mb (annotate-field (field ("IFNULL(ProbeSet.Mb, '')" Mb)) '^^xsd:double))
(set gn:blatSeq (sanitize-rdf-string
(string-trim-both (field ProbeSet BlatSeq))))
(set gn:targetSeq (sanitize-rdf-string (field ProbeSet TargetSeq)))
(set gn:uniProtReference (ontology 'uniprot:
(field ProbeSet UniProtID)))))
(call-with-target-database
%connection-settings
(lambda (db)
(with-output-to-file (string-append %dump-directory "dump-probeset-0.ttl")
(lambda ()
(prefix "dct:" "<http://purl.org/dc/terms/>")
(prefix "foaf:" "<http://xmlns.com/foaf/0.1/>")
(prefix "generif:" "<http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=>")
(prefix "gn:" "<http://genenetwork.org/>")
(prefix "owl:" "<http://www.w3.org/2002/07/owl#>")
(prefix "phenotype:" "<http://genenetwork.org/phenotype/>")
(prefix "pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>")
(prefix "rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
(prefix "rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
(prefix "uniprot:" "<http://purl.uniprot.org/uniprot/>")
(prefix "up:" "<http://purl.uniprot.org/core/>")
(prefix "xsd:" "<http://www.w3.org/2001/XMLSchema#>")
(prefix "probeset:" "<http://genenetwork.org/probeset/>")
(newline)
(dump-probeset-0 db))
#:encoding "utf8")
(with-output-to-file (string-append %dump-directory "dump-probeset-1.ttl")
(lambda ()
(prefix "dct:" "<http://purl.org/dc/terms/>")
(prefix "foaf:" "<http://xmlns.com/foaf/0.1/>")
(prefix "generif:" "<http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=>")
(prefix "gn:" "<http://genenetwork.org/>")
(prefix "owl:" "<http://www.w3.org/2002/07/owl#>")
(prefix "phenotype:" "<http://genenetwork.org/phenotype/>")
(prefix "pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>")
(prefix "rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
(prefix "rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
(prefix "uniprot:" "<http://purl.uniprot.org/uniprot/>")
(prefix "up:" "<http://purl.uniprot.org/core/>")
(prefix "xsd:" "<http://www.w3.org/2001/XMLSchema#>")
(prefix "probeset:" "<http://genenetwork.org/probeset/>")
(newline)
(dump-probeset-1 db))
#:encoding "utf8")
(with-output-to-file (string-append %dump-directory "dump-probeset-2.ttl")
(lambda ()
(prefix "dct:" "<http://purl.org/dc/terms/>")
(prefix "foaf:" "<http://xmlns.com/foaf/0.1/>")
(prefix "generif:" "<http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=>")
(prefix "gn:" "<http://genenetwork.org/>")
(prefix "owl:" "<http://www.w3.org/2002/07/owl#>")
(prefix "phenotype:" "<http://genenetwork.org/phenotype/>")
(prefix "pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>")
(prefix "rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
(prefix "rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
(prefix "uniprot:" "<http://purl.uniprot.org/uniprot/>")
(prefix "up:" "<http://purl.uniprot.org/core/>")
(prefix "xsd:" "<http://www.w3.org/2001/XMLSchema#>")
(prefix "probeset:" "<http://genenetwork.org/probeset/>")
(newline)
(dump-probeset-2 db))
#:encoding "utf8")))
|