blob: 5048bf2fd94ca21e9c3a95a8622041a4fca5315e (
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
#! /usr/bin/env guile
!#
(use-modules (srfi srfi-1)
(srfi srfi-26)
(ice-9 format)
(ice-9 getopt-long)
(ice-9 match)
(ice-9 regex)
(transform strings)
(transform sql)
(transform triples)
(transform special-forms)
(web uri))
(define-transformer genelist
(tables (GeneList
(left-join Species "USING (SpeciesId)")))
(schema-triples
(gnc:gene_symbol a rdfs:Class)
(gnc:gene_symbol rdfs:label "A gene symbol")
(gnt:gene rdfs:domain gnc:gene_symbol)
(gnt:has_species rdfs:domain gnc:gene_symbol)
(gnc:gene a rdfs:Class)
(gnc:gene rdfs:label "Gene")
(gnt:has_gene_id a owl:ObjectProperty)
(gnt:has_gene_id rdfs:domain gnc:ncbi_wiki_entry)
(gnt:has_gene_id skos:definition "The GeneId of this this resource")
(gnc:transcript rdfs:domain gnc:gene_symbol)
(gnt:transcript a owl:ObjectProperty)
(gnc:transcript rdfs:comments "The gene transcript of this resource")
(gnc:ebi_gwas_link rdfs:Class gnc:ResourceLink)
(gnc:ebi_gwas_link rdfs:label "EBI GWAS")
(gnc:ebi_gwas_link rdfs:comments "EBI GWAS")
(gnc:protein_atlas_link rdfs:Class gnc:ResourceLink)
(gnc:protein_atlas_link rdfs:label "Protein Atlas")
(gnc:protein_atlas_link rdfs:comments "Human Protein Atlas")
(gnc:genemania_link rdfs:Class gnc:ResourceLink)
(gnc:genemania_link rdfs:label "GeneMANIA")
(gnc:genemania_link rdfs:comments "GeneMANIA")
(gnc:gemma_link rdfs:Class gnc:ResourceLink)
(gnc:gemma_link rdfs:label "Gemma")
(gnc:gemma_link rdfs:comments "Meta-analysis of gene expression data")
(gnc:biogps_link rdfs:Class gnc:ResourceLink)
(gnc:biogps_link rdfs:label "BioGPS")
(gnc:biogps_link rdfs:comments "Expression across many tissues and cell types")
(gnc:aba_link rdfs:Class gnc:ResourceLink)
(gnc:aba_link rdfs:label "ABA")
(gnc:aba_link rdfs:comments "Allen Brain Atlas")
(gnc:panther_link rdfs:Class gnc:ResourceLink)
(gnc:panther_link rdfs:label "PANTHER")
(gnc:panther_link rdfs:comments "Gene and protein data resources from Celera-ABI")
(gnc:panther_link rdfs:Class gnc:ResourceLink)
(gnc:panther_link rdfs:label "STRING")
(gnc:panther_link rdfs:comments "Protein interactions: known and inferred")
(gnc:gtex_link rdfs:Class gnc:ResourceLink)
(gnc:gtex_link rdfs:label "GTEx Portal")
(gnc:gtex_link rdfs:comments "GTEx Portal")
(gnc:rgd_link rdfs:Class gnc:ResourceLink)
(gnc:rgd_link rdfs:label "Rat Genome DB")
(gnc:rgd_link rdfs:comments "Rat Genome DB")
(gnc:has_kg_id rdfs:domain gnc:gene_symbol)
(gnc:has_kg_id a owl:ObjectProperty)
(gnc:has_kg_id rdfs:comments "The kgID of this resource")
(gnc:has_unigen_id rdfs:domain gnc:gene_symbol)
(gnc:has_unigen_id a owl:ObjectProperty)
(gnc:has_unigen_id rdfs:comments "The UnigenID of this resource")
(gnc:has_protein_id rdfs:domain gnc:gene_symbol)
(gnt:has_protein_id a owl:ObjectProperty)
(gnc:has_protein_id rdfs:comments "The ProteinID of this resource")
(gnc:has_align_id rdfs:domain gnc:gene_symbol)
(gnt:has_align_id a owl:ObjectProperty)
(gnc:has_align_id rdfs:comments "The AlignID of this resource")
(gnt:tx_end rdfs:range xsd:double)
(gnt:tx_start rdfs:range xsd:double)
(gnt:has_target_seq rdfs:domain gnc:probeset))
(triples
(string->identifier
"gene" (normalize-string-field (string-trim-both
(field ("CONCAT_WS('_', GeneSymbol, GeneID, AlignID)" GENE_UID))))
#:separator "_")
(set rdf:type 'gnc:gene)
(set gnt:gene_symbol (field GeneList GeneSymbol))
(set dct:description (sanitize-rdf-string (field GeneList GeneDescription)))
(set gnt:has_gene_id (ontology 'gene: (field GeneList GeneId)))
(set dct:references
(let ((symbol (field GeneList GeneSymbol)))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"https://www.ebi.ac.uk/gwas/search?query="
(uri-encode
(string-trim-both symbol))
"a gnc:ebi_gwas_link"))
"")))
(set dct:references
(let ((symbol (field GeneList GeneSymbol))
(geneId (field GeneList GeneID))
(species (field Species Name)))
(if (and (not (string-blank? symbol))
(not (string-blank? species))
(or (string=? species "human")
(string=? species "mouse")))
(string->symbol
(format #f "<~0@*~a> .~%<~0@*~a> ~1@*~a"
"http://mouse.brain-map.org/search/show?search_type=gene&search_term="
"a gnc:aba_link"
(if (string=? species "mouse")
(uri-encode
(string-trim-both symbol))
geneId)))
"")))
(set dct:references
(let ((symbol (field GeneList GeneSymbol))
(species (field Species Name)))
(if (and (not (string-blank? symbol))
(not (string-blank? species))
(or
(string=? species "mouse")
(string=? species "human")))
(string->symbol
(format #f
"<~0@*~a~1@*~a~2@*~a~3@*~a> .~%<~0@*~a~1@*~a~2@*~a~3@*~a> ~4@*~a"
"https://rgd.mcw.edu/rgdweb/elasticResults.html?term="
(uri-encode
(string-trim-both symbol))
"&category=Gene&species="
(string-capitalize species)
"a gnc:rgd_link"))
"")))
(set dct:references
(let ((geneId (field GeneList GeneID))
(species (field Species Name)))
(if (and (not (string-blank? geneId))
(not (string-blank? species))
(or
(string=? species "mouse")
(string=? species "rat")
(string=? species "human")))
(string->symbol
(format #f
"<~0@*~a~1@*~a~2@*~a~3@*~a> .~%<~0@*~a~1@*~a~2@*~a~3@*~a> ~4@*~a"
"http://biogps.org/?org="
species
"#goto=genereport&id="
geneId
"a gnc:biogps_link"))
"")))
(set dct:references
(let ((geneId (field GeneList GeneID)))
(if (not (string-blank? geneId))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"http://www.chibi.ubc.ca/Gemma/gene/showGene.html?ncbiid="
geneId
"a gnc:gemma_link"))
"")))
(set dct:references
(let ((symbol (field GeneList GeneSymbol))
(species (lower-case-and-replace-spaces
(field Species FullName))))
(if (and (not (string-blank? symbol))
(not (string-blank? species))
(or
(string=? species "mus-musculus")
(string=? species "rattus-norvegicus")
(string=? species "homo-sapiens")))
(string->symbol
(format #f "<~0@*~a/~1@*~a/~2@*~a> .~%<~0@*~a/~1@*~a/~2@*~a> ~3@*~a"
"https://genemania.org/search"
species
(uri-encode
(string-trim-both symbol))
"a gnc:genemania_link"))
"")))
(set dct:references
(let ((symbol (field GeneList GeneSymbol)))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"http://www.pantherdb.org/genes/geneList.do?searchType=basic&fieldName=all&organism=all&listType=1&fieldValue="
(uri-encode
(string-trim-both symbol))
"a gnc:panther_link"))
"")))
(set dct:references
(let ((symbol (field GeneList GeneSymbol)))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"http://string-db.org/newstring_cgi/show_network_section.pl?identifier="
(uri-encode
(string-trim-both symbol))
"a gnc:panther_link"))
"")))
(set dct:references
(let ((symbol (field GeneList GeneSymbol)))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"https://www.gtexportal.org/home/gene/"
(uri-encode
(string-trim-both symbol))
"a gnc:gtex_link"))
"")))
(set dct:references
(let ((symbol (field GeneList GeneSymbol)))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"http://www.proteinatlas.org/search/"
(uri-encode
(string-trim-both symbol))
"a gnc:protein_atlas_link"))
"")))
(set gnt:chromosome (field GeneList Chromosome))
(set gnt:tx_start (annotate-field
(field GeneList TxStart)
'^^xsd:double))
(set gnt:tx_end (annotate-field
(field GeneList TxEnd)
'^^xsd:double))
(set gnt:strand (string-trim-both (field GeneList Strand)))
(set
gnt:has_species (string->identifier "" (remap-species-identifiers (field Species Fullname))))
(set
gnt:transcript
(ontology 'transcript:
(string-trim-both (field GeneList NM_ID))))
(set gnc:has_kg_id (string-trim-both (field GeneList kgID)))
(set gnc:has_unigen_id (string-trim-both (field GeneList UnigenID)))
(set gnt:has_protein_id (string-trim-both (field GeneList ProteinID)))
(set gnt:has_align_id (string-trim-both (field GeneList AlignID)))
(set gnt:has_rgd_id
(field ("IFNULL(RGD_ID, '')" RGD_ID)))))
(define-transformer genelist-rn33
(tables (GeneList_rn33))
(triples
(let ([gene-uid (field GeneList_rn33 id GENE_UID)])
(string->identifier
"gene_rn33"
(if (number? gene-uid)
(number->string
gene-uid)
gene-uid)
#:separator "_"))
(set rdf:type 'gnc:gene)
(set gnt:has_species 'gn:Rattus_norvegicus)
(set gnt:gene_symbol (string-trim-both (field GeneList_rn33 geneSymbol)))
(set gnt:chromosome (field GeneList_rn33 chromosome))
(set gnt:tx_start (annotate-field
(field GeneList_rn33 txStart)
'^^xsd:double))
(set gnt:tx_end (annotate-field
(field GeneList_rn33 txEnd)
'^^xsd:double))
(set gnt:strand (string-trim-both (field GeneList_rn33 strand)))
(set
gnt:transcript
(ontology
'transcript:
(string-trim-both (field GeneList_rn33 NM_ID))))
(set
gnc:has_kg_id
(string-trim-both (field GeneList_rn33 kgID)))
(set dct:references
(let ((symbol (field GeneList_rn33 geneSymbol)))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"http://www.pantherdb.org/genes/geneList.do?searchType=basic&fieldName=all&organism=all&listType=1&fieldValue="
(string-trim-both symbol)
"a gnc:PantherLink"))
"")))
(set dct:references
(let ((symbol (string-trim-both (field GeneList_rn33 geneSymbol))))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"https://www.ebi.ac.uk/gwas/search?query="
(string-trim-both symbol)
"a gnc:ebi_gwas_link"))
"")))
(set dct:references
(let ((symbol (string-trim-both (field GeneList_rn33 geneSymbol))))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"http://string-db.org/newstring_cgi/show_network_section.pl?identifier="
(uri-encode
(string-trim-both symbol))
"a gnc:panther_link"))
"")))
(set dct:references
(let ((symbol (string-trim-both (field GeneList_rn33 geneSymbol))))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"https://www.gtexportal.org/home/gene/"
(uri-encode
(string-trim-both symbol))
"a gnc:gtex_link"))
"")))
(set dct:references
(let ((symbol (string-trim-both (field GeneList_rn33 geneSymbol))))
(if (not (string-blank? symbol))
(string->symbol
(format #f
"<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
"http://www.proteinatlas.org/search/"
(uri-encode
(string-trim-both symbol))
"a gnc:protein_atlas_link"))
"")))))
(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)))
(with-documentation
(name "Gene Metadata")
(connection %connection-settings)
(table-metadata? #f)
(prefixes
'(("gn:" "<http://rdf.genenetwork.org/v1/id/>")
("probeset:" "<http://rdf.genenetwork.org/v1/probeset/>")
("gnc:" "<http://rdf.genenetwork.org/v1/category/>")
("gnt:" "<http://rdf.genenetwork.org/v1/term/>")
("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
("dct:" "<http://purl.org/dc/terms/>")
("owl:" "<http://www.w3.org/2002/07/owl#>")
("xsd:" "<http://www.w3.org/2001/XMLSchema#>")
("qb:" "<http://purl.org/linked-data/cube#>")
("gene:" "<http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=>")
("sdmx-measure:" "<http://purl.org/linked-data/sdmx/2009/measure#>")
("transcript:" "<https://portals.broadinstitute.org/gpp/public/trans/details?transName=>")
("skos:" "<http://www.w3.org/2004/02/skos/core#>")))
(inputs
(list genelist-rn33
genelist))
(outputs
`(#:documentation ,documentation
#:rdf ,output))))
|