bel 0.3.0.beta1-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/INSTALL.md +19 -0
- data/INSTALL_RUBY.md +107 -0
- data/LICENSE +191 -0
- data/README.md +319 -0
- data/bel.gemspec +67 -0
- data/bin/bel2rdf +134 -0
- data/bin/bel_compare +177 -0
- data/bin/bel_parse +60 -0
- data/bin/bel_rdfschema +72 -0
- data/bin/bel_summarize +86 -0
- data/bin/bel_upgrade +175 -0
- data/bin/bel_upgrade_term +163 -0
- data/ext/mri/bel-ast.c +221 -0
- data/ext/mri/bel-ast.h +82 -0
- data/ext/mri/bel-node-stack.c +83 -0
- data/ext/mri/bel-node-stack.h +26 -0
- data/ext/mri/bel-parse-statement.c +122296 -0
- data/ext/mri/bel-parse-term.c +117670 -0
- data/ext/mri/bel-parser.c +91 -0
- data/ext/mri/bel-parser.h +13 -0
- data/ext/mri/bel-token.c +161 -0
- data/ext/mri/bel-token.h +58 -0
- data/ext/mri/bel-tokenize-term.c +391 -0
- data/ext/mri/extconf.rb +8 -0
- data/ext/mri/libbel.c +5 -0
- data/ext/mri/libbel.def +26 -0
- data/lib/bel.rb +17 -0
- data/lib/bel/completion.rb +53 -0
- data/lib/bel/completion_rule.rb +236 -0
- data/lib/bel/language.rb +1052 -0
- data/lib/bel/namespace.rb +323 -0
- data/lib/bel/quoting.rb +29 -0
- data/lib/bel/rdf.rb +314 -0
- data/lib/bel/script.rb +239632 -0
- data/lib/features.rb +21 -0
- data/lib/libbel.rb +201 -0
- data/lib/libbel.so +0 -0
- data/lib/util.rb +125 -0
- metadata +269 -0
@@ -0,0 +1,323 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
require_relative '../features'
|
4
|
+
require_relative './language'
|
5
|
+
|
6
|
+
class String
|
7
|
+
def split_by_last(char=" ")
|
8
|
+
pos = self.rindex(char)
|
9
|
+
pos != nil ? [self[0...pos], self[pos+1..-1]] : [self]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module BEL
|
14
|
+
module Namespace
|
15
|
+
|
16
|
+
LATEST_PREFIX = 'http://resource.belframework.org/belframework/latest-release/'
|
17
|
+
DEFAULT_URI = 'http://www.openbel.org/bel/namespace/'
|
18
|
+
|
19
|
+
NAMESPACE_LATEST = {
|
20
|
+
AFFX: [
|
21
|
+
LATEST_PREFIX + 'namespace/affy-probeset-ids.belns',
|
22
|
+
'http://www.openbel.org/bel/namespace/affy-probeset'
|
23
|
+
],
|
24
|
+
CHEBI: [
|
25
|
+
LATEST_PREFIX + 'namespace/chebi.belns',
|
26
|
+
'http://www.openbel.org/bel/namespace/chebi'
|
27
|
+
],
|
28
|
+
CHEBIID: [
|
29
|
+
LATEST_PREFIX + 'namespace/chebi-ids.belns',
|
30
|
+
'http://www.openbel.org/bel/namespace/chebi'
|
31
|
+
],
|
32
|
+
DO: [
|
33
|
+
LATEST_PREFIX + 'namespace/disease-ontology.belns',
|
34
|
+
'http://www.openbel.org/bel/namespace/disease-ontology'
|
35
|
+
],
|
36
|
+
DOID: [
|
37
|
+
LATEST_PREFIX + 'namespace/disease-ontology-ids.belns',
|
38
|
+
'http://www.openbel.org/bel/namespace/disease-ontology'
|
39
|
+
],
|
40
|
+
EGID: [
|
41
|
+
LATEST_PREFIX + 'namespace/entrez-gene-ids.belns',
|
42
|
+
'http://www.openbel.org/bel/namespace/entrez-gene'
|
43
|
+
],
|
44
|
+
GOBP: [
|
45
|
+
LATEST_PREFIX + 'namespace/go-biological-process.belns',
|
46
|
+
'http://www.openbel.org/bel/namespace/go-biological-processes'
|
47
|
+
],
|
48
|
+
GOBPID: [
|
49
|
+
LATEST_PREFIX + 'namespace/go-biological-process-ids.belns',
|
50
|
+
'http://www.openbel.org/bel/namespace/go'
|
51
|
+
],
|
52
|
+
GOCC: [
|
53
|
+
LATEST_PREFIX + 'namespace/go-cellular-component.belns',
|
54
|
+
'http://www.openbel.org/bel/namespace/go-cellular-component'
|
55
|
+
],
|
56
|
+
GOCCID: [
|
57
|
+
LATEST_PREFIX + 'namespace/go-cellular-component-ids.belns',
|
58
|
+
'http://www.openbel.org/bel/namespace/go-cellular-component'
|
59
|
+
],
|
60
|
+
HGNC: [
|
61
|
+
LATEST_PREFIX + 'namespace/hgnc-human-genes.belns',
|
62
|
+
'http://www.openbel.org/bel/namespace/hgnc-human-genes'
|
63
|
+
],
|
64
|
+
MESHCS: [
|
65
|
+
LATEST_PREFIX + 'namespace/mesh-cellular-structures.belns',
|
66
|
+
'http://www.openbel.org/bel/namespace/mesh-cellular-structures'
|
67
|
+
],
|
68
|
+
MESHD: [
|
69
|
+
LATEST_PREFIX + 'namespace/mesh-diseases.belns',
|
70
|
+
'http://www.openbel.org/bel/namespace/mesh-diseases',
|
71
|
+
],
|
72
|
+
MESHPP: [
|
73
|
+
LATEST_PREFIX + 'namespace/mesh-processes.belns',
|
74
|
+
'http://www.openbel.org/bel/namespace/mesh-processes'
|
75
|
+
],
|
76
|
+
MGI: [
|
77
|
+
LATEST_PREFIX + 'namespace/mgi-mouse-genes.belns',
|
78
|
+
'http://www.openbel.org/bel/namespace/mgi-mouse-genes'
|
79
|
+
],
|
80
|
+
RGD: [
|
81
|
+
LATEST_PREFIX + 'namespace/rgd-rat-genes.belns',
|
82
|
+
'http://www.openbel.org/bel/namespace/rgd-rat-genes'
|
83
|
+
],
|
84
|
+
SCOMP: [
|
85
|
+
LATEST_PREFIX + 'namespace/selventa-named-complexes.belns',
|
86
|
+
'http://www.openbel.org/bel/namespace/selventa-named-complexes'
|
87
|
+
],
|
88
|
+
SCHEM: [
|
89
|
+
LATEST_PREFIX + 'namespace/selventa-legacy-chemicals.belns',
|
90
|
+
'http://www.openbel.org/bel/namespace/selventa-legacy-chemicals'
|
91
|
+
],
|
92
|
+
SDIS: [
|
93
|
+
LATEST_PREFIX + 'namespace/selventa-legacy-diseases.belns',
|
94
|
+
'http://www.openbel.org/bel/namespace/selventa-legacy-diseases'
|
95
|
+
],
|
96
|
+
SFAM: [
|
97
|
+
LATEST_PREFIX + 'namespace/selventa-protein-families.belns',
|
98
|
+
'http://www.openbel.org/bel/namespace/selventa-protein-families'
|
99
|
+
],
|
100
|
+
SP: [
|
101
|
+
LATEST_PREFIX + 'namespace/swissprot.belns',
|
102
|
+
'http://www.openbel.org/bel/namespace/swissprot'
|
103
|
+
],
|
104
|
+
SPAC: [
|
105
|
+
LATEST_PREFIX + 'namespace/swissprot-ids.belns',
|
106
|
+
'http://www.openbel.org/bel/namespace/swissprot-ids'
|
107
|
+
]
|
108
|
+
}
|
109
|
+
|
110
|
+
# XXX 1.0 namespaces without rdf support
|
111
|
+
NAMESPACE_BELNS = {
|
112
|
+
HGU95AV2: 'http://resource.belframework.org/belframework/1.0/namespace/affy-hg-u95av2.belns',
|
113
|
+
HGU133P2: 'http://resource.belframework.org/belframework/1.0/namespace/affy-hg-u133-plus2.belns',
|
114
|
+
HGU133AB: 'http://resource.belframework.org/belframework/1.0/namespace/affy-hg-u133ab.belns',
|
115
|
+
MGU74ABC: 'http://resource.belframework.org/belframework/1.0/namespace/affy-mg-u74abc.belns',
|
116
|
+
MG430AB: 'http://resource.belframework.org/belframework/1.0/namespace/affy-moe430ab.belns',
|
117
|
+
MG4302: 'http://resource.belframework.org/belframework/1.0/namespace/affy-mouse430-2.belns',
|
118
|
+
MG430A2: 'http://resource.belframework.org/belframework/1.0/namespace/affy-mouse430a-2.belns',
|
119
|
+
RG230AB: 'http://resource.belframework.org/belframework/1.0/namespace/affy-rae230ab-2.belns',
|
120
|
+
RG2302: 'http://resource.belframework.org/belframework/1.0/namespace/affy-rat230-2.belns',
|
121
|
+
CHEBIID: 'http://resource.belframework.org/belframework/1.0/namespace/chebi-ids.belns',
|
122
|
+
CHEBI: 'http://resource.belframework.org/belframework/1.0/namespace/chebi-names.belns',
|
123
|
+
EGID: 'http://resource.belframework.org/belframework/1.0/namespace/entrez-gene-ids-hmr.belns',
|
124
|
+
GOAC: 'http://resource.belframework.org/belframework/1.0/namespace/go-biological-processes-accession-numbers.belns',
|
125
|
+
GO: 'http://resource.belframework.org/belframework/1.0/namespace/go-biological-processes-names.belns',
|
126
|
+
GOCCACC: 'http://resource.belframework.org/belframework/1.0/namespace/go-cellular-component-accession-numbers.belns',
|
127
|
+
GOCCTERM: 'http://resource.belframework.org/belframework/1.0/namespace/go-cellular-component-terms.belns',
|
128
|
+
HGNC: 'http://resource.belframework.org/belframework/1.0/namespace/hgnc-approved-symbols.belns',
|
129
|
+
MESHPP: 'http://resource.belframework.org/belframework/1.0/namespace/mesh-biological-processes.belns',
|
130
|
+
MESHCL: 'http://resource.belframework.org/belframework/1.0/namespace/mesh-cellular-locations.belns',
|
131
|
+
MESHD: 'http://resource.belframework.org/belframework/1.0/namespace/mesh-diseases.belns',
|
132
|
+
MGI: 'http://resource.belframework.org/belframework/1.0/namespace/mgi-approved-symbols.belns',
|
133
|
+
RGD: 'http://resource.belframework.org/belframework/1.0/namespace/rgd-approved-symbols.belns',
|
134
|
+
SCHEM: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-legacy-chemical-names.belns',
|
135
|
+
SDIS: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-legacy-diseases.belns',
|
136
|
+
NCH: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-named-human-complexes.belns',
|
137
|
+
PFH: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-named-human-protein-families.belns',
|
138
|
+
NCM: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-named-mouse-complexes.belns',
|
139
|
+
PFM: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-named-mouse-protein-families.belns',
|
140
|
+
NCR: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-named-rat-complexes.belns',
|
141
|
+
PFR: 'http://resource.belframework.org/belframework/1.0/namespace/selventa-named-rat-protein-families.belns',
|
142
|
+
SPAC: 'http://resource.belframework.org/belframework/1.0/namespace/swissprot-accession-numbers.belns',
|
143
|
+
SP: 'http://resource.belframework.org/belframework/1.0/namespace/swissprot-entry-names.belns'
|
144
|
+
}
|
145
|
+
|
146
|
+
class ResourceIndex
|
147
|
+
include Enumerable
|
148
|
+
|
149
|
+
class << self
|
150
|
+
def openbel_published_index(version)
|
151
|
+
clean = version.to_s.strip
|
152
|
+
ResourceIndex.new("http://resource.belframework.org/belframework/#{clean}/index.xml")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
attr_writer :namespaces
|
157
|
+
attr_writer :annotations
|
158
|
+
|
159
|
+
def initialize(index, namespaces = [], annotations = [])
|
160
|
+
@index = index
|
161
|
+
@namespaces = namespaces
|
162
|
+
@annotations = annotations
|
163
|
+
@loaded = false
|
164
|
+
end
|
165
|
+
|
166
|
+
def namespaces
|
167
|
+
read_index if not @loaded
|
168
|
+
@namespaces
|
169
|
+
end
|
170
|
+
|
171
|
+
def annotations
|
172
|
+
read_index if not @loaded
|
173
|
+
@annotations
|
174
|
+
end
|
175
|
+
|
176
|
+
def each
|
177
|
+
read_index if not @loaded
|
178
|
+
@namespaces.each { |x| yield x }
|
179
|
+
@annotations.each { |x| yield x }
|
180
|
+
end
|
181
|
+
|
182
|
+
def each_namespace
|
183
|
+
read_index if not @loaded
|
184
|
+
@namespaces.each { |x| yield x }
|
185
|
+
end
|
186
|
+
|
187
|
+
def each_annotation
|
188
|
+
read_index if not @loaded
|
189
|
+
@annotations.each { |x| yield x }
|
190
|
+
end
|
191
|
+
|
192
|
+
def to_bel
|
193
|
+
map { |x| x.to_bel }
|
194
|
+
end
|
195
|
+
|
196
|
+
private
|
197
|
+
|
198
|
+
def read_index
|
199
|
+
return if not @index or @index.empty?
|
200
|
+
|
201
|
+
data = BEL::read_all(@index)
|
202
|
+
@namespaces += data.
|
203
|
+
scan(%r{<(idx:)?namespace (idx:)?resourceLocation="(.*)"}).
|
204
|
+
map { |matches|
|
205
|
+
url = matches[2]
|
206
|
+
prefix = BEL::read_lines(url).find { |line|
|
207
|
+
line.start_with? 'Keyword'
|
208
|
+
}.split('=').map(&:strip)[1].to_sym
|
209
|
+
NamespaceDefinition.new(prefix, url)
|
210
|
+
}
|
211
|
+
@annotations += data.
|
212
|
+
scan(%r{<(idx:)?annotationdefinition (idx:)?resourceLocation="(.*)"}).
|
213
|
+
map { |matches|
|
214
|
+
url = matches[2]
|
215
|
+
prefix = BEL::read_lines(url).find { |line|
|
216
|
+
line.start_with? 'Keyword'
|
217
|
+
}.split('=').map(&:strip)[1].to_sym
|
218
|
+
BEL::Language::AnnotationDefinition.new(:url, prefix, url)
|
219
|
+
}
|
220
|
+
|
221
|
+
@loaded = true
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
class NamespaceDefinition
|
226
|
+
include Enumerable
|
227
|
+
|
228
|
+
attr_reader :prefix
|
229
|
+
attr_reader :url
|
230
|
+
attr_reader :rdf_uri
|
231
|
+
|
232
|
+
def initialize(prefix, url, rdf_uri = DEFAULT_URI)
|
233
|
+
@prefix = prefix
|
234
|
+
@url = url
|
235
|
+
@rdf_uri = rdf_uri
|
236
|
+
@values = nil
|
237
|
+
end
|
238
|
+
|
239
|
+
def values
|
240
|
+
unless @values
|
241
|
+
reload(@url)
|
242
|
+
end
|
243
|
+
@values
|
244
|
+
end
|
245
|
+
|
246
|
+
def [](value)
|
247
|
+
return nil unless value
|
248
|
+
reload(@url) if not @values
|
249
|
+
sym = value.to_sym
|
250
|
+
encoding = @values[sym] || :""
|
251
|
+
Language::Parameter.new(self, sym, encoding)
|
252
|
+
end
|
253
|
+
|
254
|
+
def each &block
|
255
|
+
reload(@url) if not @values
|
256
|
+
@values.each do |val, enc|
|
257
|
+
if block_given?
|
258
|
+
block.call(Language::Parameter.new(self, val, enc))
|
259
|
+
else
|
260
|
+
yield Language::Parameter.new(self, val, enc)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
def hash
|
266
|
+
[@prefix, @url].hash
|
267
|
+
end
|
268
|
+
|
269
|
+
def ==(other)
|
270
|
+
return false if other == nil
|
271
|
+
@prefix == other.prefix && @url == other.url
|
272
|
+
end
|
273
|
+
|
274
|
+
alias_method :eql?, :'=='
|
275
|
+
|
276
|
+
def to_s
|
277
|
+
@prefix.to_s
|
278
|
+
end
|
279
|
+
|
280
|
+
def to_bel
|
281
|
+
%Q{DEFINE NAMESPACE #{@prefix} AS URL "#{@url}"}
|
282
|
+
end
|
283
|
+
|
284
|
+
private
|
285
|
+
# the backdoor
|
286
|
+
def reload(url)
|
287
|
+
@values = {}
|
288
|
+
BEL::read_lines(url).
|
289
|
+
drop_while { |i| not i.start_with? "[Values]" }.
|
290
|
+
drop(1).
|
291
|
+
each do |s|
|
292
|
+
val_enc = s.strip!.split_by_last('|').map(&:to_sym)
|
293
|
+
@values[val_enc[0]] = val_enc[1]
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
if BEL::Features.rdf_support?
|
299
|
+
require_relative 'rdf'
|
300
|
+
|
301
|
+
class NamespaceDefinition
|
302
|
+
def to_uri
|
303
|
+
@rdf_uri
|
304
|
+
end
|
305
|
+
|
306
|
+
def to_rdf_vocabulary
|
307
|
+
RUBYRDF::Vocabulary.new("#{@rdf_uri}/")
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# create classes for each standard prefix
|
313
|
+
DEFAULT_NAMESPACES =
|
314
|
+
NAMESPACE_LATEST.collect do |prefix, values|
|
315
|
+
rdf_uri = NAMESPACE_LATEST[prefix][1] || DEFAULT_URI
|
316
|
+
ns_definition = NamespaceDefinition.new(prefix, values[0], rdf_uri)
|
317
|
+
Namespace.const_set(prefix, ns_definition)
|
318
|
+
ns_definition
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
# vim: ts=2 sw=2:
|
323
|
+
# encoding: utf-8
|
data/lib/bel/quoting.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module BEL
|
2
|
+
module Quoting
|
3
|
+
|
4
|
+
NonWordMatcher = Regexp.compile(/[^0-9a-zA-Z_]/)
|
5
|
+
KeywordMatcher = Regexp.compile(/^(SET|DEFINE|a|g|p|r|m)$/)
|
6
|
+
|
7
|
+
def ensure_quotes identifier
|
8
|
+
return "" unless identifier
|
9
|
+
identifier.to_s.gsub! '"', '\"'
|
10
|
+
if quotes_required? identifier
|
11
|
+
%Q{"#{identifier}"}
|
12
|
+
else
|
13
|
+
identifier
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def always_quote identifier
|
18
|
+
return "" unless identifier
|
19
|
+
identifier.to_s.gsub! '"', '\"'
|
20
|
+
%Q("#{identifier}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def quotes_required? identifier
|
24
|
+
[NonWordMatcher, KeywordMatcher].any? { |m| m.match identifier }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
# vim: ts=2 sw=2:
|
29
|
+
# encoding: utf-8
|
data/lib/bel/rdf.rb
ADDED
@@ -0,0 +1,314 @@
|
|
1
|
+
# vim: ts=2 sw=2:
|
2
|
+
# Defines the RDF vocabulary for BEL structures.
|
3
|
+
|
4
|
+
unless BEL::Features.rdf_support?
|
5
|
+
# rdf and addressable are required
|
6
|
+
raise RuntimeError, %Q{BEL::RDF is not supported.
|
7
|
+
The rdf and addressable gems are required.
|
8
|
+
|
9
|
+
Install the gems:
|
10
|
+
gem install rdf
|
11
|
+
gem install addressable
|
12
|
+
gem install uuid}
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'rdf'
|
16
|
+
require 'addressable/uri'
|
17
|
+
require 'uuid'
|
18
|
+
|
19
|
+
# rename rdf module to avoid conflict within BEL::RDF
|
20
|
+
RUBYRDF = RDF
|
21
|
+
|
22
|
+
module BEL
|
23
|
+
module RDF
|
24
|
+
|
25
|
+
# uri prefixes
|
26
|
+
BELR = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/')
|
27
|
+
BELV = RUBYRDF::Vocabulary.new('http://www.openbel.org/vocabulary/')
|
28
|
+
PUBMED = RUBYRDF::Vocabulary.new('http://bio2rdf.org/pubmed:')
|
29
|
+
RDF = RUBYRDF
|
30
|
+
RDFS = RUBYRDF::RDFS
|
31
|
+
|
32
|
+
# annotations
|
33
|
+
Anatomy = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/anatomy/')
|
34
|
+
Cell = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/cell/')
|
35
|
+
CellLine = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/cell-line/')
|
36
|
+
CellStructure = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/cell-structure/')
|
37
|
+
Disease = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/disease/')
|
38
|
+
MeSHAnatomy = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/mesh-anatomy/')
|
39
|
+
MeSHDisease = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/mesh-diseases/')
|
40
|
+
Species = RUBYRDF::Vocabulary.new('http://www.openbel.org/bel/annotation/species-taxonomy-id/')
|
41
|
+
|
42
|
+
# maps outer function to bel/vocabulary class
|
43
|
+
FUNCTION_TYPE = {
|
44
|
+
a: BELV.Abundance,
|
45
|
+
g: BELV.GeneAbundance,
|
46
|
+
p: BELV.ProteinAbundance,
|
47
|
+
r: BELV.RNAAbundance,
|
48
|
+
m: BELV.microRNAAbundance,
|
49
|
+
complex: BELV.ComplexAbundance,
|
50
|
+
composite: BELV.CompositeAbundance,
|
51
|
+
bp: BELV.BiologicalProcess,
|
52
|
+
path: BELV.Pathology,
|
53
|
+
rxn: BELV.Reaction,
|
54
|
+
tloc: BELV.Translocation,
|
55
|
+
sec: BELV.CellSecretion,
|
56
|
+
deg: BELV.Degradation,
|
57
|
+
cat: BELV.AbundanceActivity,
|
58
|
+
chap: BELV.AbundanceActivity,
|
59
|
+
gtp: BELV.AbundanceActivity,
|
60
|
+
kin: BELV.AbundanceActivity,
|
61
|
+
act: BELV.AbundanceActivity,
|
62
|
+
pep: BELV.AbundanceActivity,
|
63
|
+
phos: BELV.AbundanceActivity,
|
64
|
+
ribo: BELV.AbundanceActivity,
|
65
|
+
tscript: BELV.AbundanceActivity,
|
66
|
+
tport: BELV.AbundanceActivity
|
67
|
+
}
|
68
|
+
|
69
|
+
RELATIONSHIP_TYPE = {
|
70
|
+
'association' => BELV.Association,
|
71
|
+
'--' => BELV.Association,
|
72
|
+
'biomarkerFor' => BELV.BiomarkerFor,
|
73
|
+
'causesNoChange' => BELV.CausesNoChange,
|
74
|
+
'decreases' => BELV.Decreases,
|
75
|
+
'-|' => BELV.Decreases,
|
76
|
+
'directlyDecreases' => BELV.DirectlyDecreases,
|
77
|
+
'=|' => BELV.DirectlyDecreases,
|
78
|
+
'directlyIncreases' => BELV.DirectlyIncreases,
|
79
|
+
'=>' => BELV.DirectlyIncreases,
|
80
|
+
'hasComponent' => BELV.HasComponent,
|
81
|
+
'hasMember' => BELV.HasMember,
|
82
|
+
'increases' => BELV.Increases,
|
83
|
+
'->' => BELV.Increases,
|
84
|
+
'isA' => BELV.IsA,
|
85
|
+
'negativeCorrelation' => BELV.NegativeCorrelation,
|
86
|
+
'positiveCorrelation' => BELV.PositiveCorrelation,
|
87
|
+
'prognosticBiomarkerFor' => BELV.PrognosticBiomarkerFor,
|
88
|
+
'rateLimitingStepOf' => BELV.RateLimitingStepOf,
|
89
|
+
'subProcessOf' => BELV.SubProcessOf,
|
90
|
+
':>' => BELV.TranscribedTo,
|
91
|
+
'>>' => BELV.TranslatedTo,
|
92
|
+
|
93
|
+
# Supported by schema
|
94
|
+
# 'actsIn' => BELV.ActsIn, # (BELV.hasChild)
|
95
|
+
|
96
|
+
# Unsupported in schema
|
97
|
+
#'analogous' => BELV.Analogous,
|
98
|
+
#'hasModification' => BELV.HasModification,
|
99
|
+
#'hasProduct' => BELV.HasProduct,
|
100
|
+
#'hasVariant' => BELV.HasVariant,
|
101
|
+
#'includes' => BELV.Includes,
|
102
|
+
#'orthologous' => BELV.Orthologous,
|
103
|
+
#'reactantIn' => BELV.ReactantIn,
|
104
|
+
#'transcribedTo' => BELV.TranscribedTo,
|
105
|
+
#'translatedTo' => BELV.TranslatedTo,
|
106
|
+
#'translocates' => BELV.Translocates,
|
107
|
+
|
108
|
+
# Macro statements - TODO needs parser AST translation
|
109
|
+
#'hasComponents' => BELV.HasComponents,
|
110
|
+
#'hasMembers' => BELV.HasMembers,
|
111
|
+
}
|
112
|
+
|
113
|
+
RELATIONSHIP_CLASSIFICATION = {
|
114
|
+
:'association' => BELV.CorrelativeRelationship,
|
115
|
+
:'--' => BELV.CorrelativeRelationship,
|
116
|
+
:'biomarkerFor' => BELV.BiomarkerFor,
|
117
|
+
:'causesNoChange' => BELV.CausesNoChange,
|
118
|
+
:'decreases' => BELV.Decreases,
|
119
|
+
:'-|' => BELV.Decreases,
|
120
|
+
:'directlyDecreases' => BELV.DirectlyDecreases,
|
121
|
+
:'=|' => BELV.DirectlyDecreases,
|
122
|
+
:'directlyIncreases' => BELV.DirectlyIncreases,
|
123
|
+
:'=>' => BELV.DirectlyIncreases,
|
124
|
+
:'hasComponent' => BELV.HasComponent,
|
125
|
+
:'hasMember' => BELV.HasMember,
|
126
|
+
:'increases' => BELV.Increases,
|
127
|
+
:'->' => BELV.Increases,
|
128
|
+
:'isA' => BELV.IsA,
|
129
|
+
:'negativeCorrelation' => BELV.NegativeCorrelation,
|
130
|
+
:'positiveCorrelation' => BELV.PositiveCorrelation,
|
131
|
+
:'prognosticBiomarkerFor' => BELV.PrognosticBiomarkerFor,
|
132
|
+
:'rateLimitingStepOf' => BELV.RateLimitingStepOf,
|
133
|
+
:'subProcessOf' => BELV.SubProcessOf
|
134
|
+
}
|
135
|
+
|
136
|
+
ACTIVITY_TYPE = {
|
137
|
+
cat: BELV.Catalytic,
|
138
|
+
chap: BELV.Chaperone,
|
139
|
+
gtp: BELV.GtpBound,
|
140
|
+
kin: BELV.Kinase,
|
141
|
+
act: BELV.Activity,
|
142
|
+
pep: BELV.Peptidase,
|
143
|
+
phos: BELV.Phosphatase,
|
144
|
+
ribo: BELV.Ribosylase,
|
145
|
+
tscript: BELV.Transcription,
|
146
|
+
tport: BELV.Transport
|
147
|
+
}
|
148
|
+
|
149
|
+
# maps modification types to bel/vocabulary class
|
150
|
+
MODIFICATION_TYPE = {
|
151
|
+
'P,S' => BELV.PhosphorylationSerine,
|
152
|
+
'P,T' => BELV.PhosphorylationThreonine,
|
153
|
+
'P,Y' => BELV.PhosphorylationTyrosine,
|
154
|
+
'A' => BELV.Acetylation,
|
155
|
+
'F' => BELV.Farnesylation,
|
156
|
+
'G' => BELV.Glycosylation,
|
157
|
+
'H' => BELV.Hydroxylation,
|
158
|
+
'M' => BELV.Methylation,
|
159
|
+
'P' => BELV.Phosphorylation,
|
160
|
+
'R' => BELV.Ribosylation,
|
161
|
+
'S' => BELV.Sumoylation,
|
162
|
+
'U' => BELV.Ubiquitination
|
163
|
+
}
|
164
|
+
|
165
|
+
# protein variant
|
166
|
+
PROTEIN_VARIANT = [:fus, :fusion, :sub, :substitution, :trunc, :truncation]
|
167
|
+
|
168
|
+
def self.vocabulary_rdf
|
169
|
+
[
|
170
|
+
# Classes
|
171
|
+
# Concept - Annotations
|
172
|
+
[BELV.AnnotationConcept, RDF::RDFS.subClassOf, RDF::SKOS.Concept],
|
173
|
+
[BELV.AnnotationConceptScheme, RDF::RDFS.subClassOf, RDF::SKOS.ConceptScheme],
|
174
|
+
# Concept - Namespaces
|
175
|
+
[BELV.AbundanceConcept, RDF::RDFS.subClassOf, BELV.NamespaceConcept],
|
176
|
+
[BELV.BiologicalProcessConcept, RDF::RDFS.subClassOf, BELV.NamespaceConcept],
|
177
|
+
[BELV.ComplexConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
|
178
|
+
[BELV.GeneConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
|
179
|
+
[BELV.MicroRNAConcept, RDF::RDFS.subClassOf, BELV.RNAConcept],
|
180
|
+
[BELV.NamespaceConceptScheme, RDF::RDFS.subClassOf, RDF::SKOS.ConceptScheme],
|
181
|
+
[BELV.NamespaceConcept, RDF::RDFS.subClassOf, RDF::SKOS.Concept],
|
182
|
+
[BELV.ProteinConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
|
183
|
+
[BELV.RNAConcept, RDF::RDFS.subClassOf, BELV.AbundanceConcept],
|
184
|
+
[BELV.PathologyConcept, RDF::RDFS.subClassOf, BELV.BiologicalProcessConcept],
|
185
|
+
# BEL Language
|
186
|
+
[BELV.Abundance, RDF.type, RDF::RDFS.Class],
|
187
|
+
[BELV.Activity, RDF.type, RDF::RDFS.Class],
|
188
|
+
[BELV.Evidence, RDF.type, RDF::RDFS.Class],
|
189
|
+
[BELV.Modification, RDF.type, RDF::RDFS.Class],
|
190
|
+
[BELV.Relationship, RDF.type, RDF::RDFS.Class],
|
191
|
+
[BELV.Statement, RDF.type, RDF::RDFS.Class],
|
192
|
+
[BELV.Term, RDF.type, RDF::RDFS.Class],
|
193
|
+
# Relationships
|
194
|
+
[BELV.Association, RDF::RDFS.subClassOf, BELV.CorrelativeRelationship],
|
195
|
+
[BELV.BiomarkerFor, RDF::RDFS.subClassOf, BELV.Relationship],
|
196
|
+
[BELV.CausesNoChange, RDF::RDFS.subClassOf, BELV.CausalRelationship],
|
197
|
+
[BELV.CausalRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
|
198
|
+
[BELV.CorrelativeRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
|
199
|
+
[BELV.Decreases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
|
200
|
+
[BELV.Decreases, RDF::RDFS.subClassOf, BELV.NegativeRelationship],
|
201
|
+
[BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
|
202
|
+
[BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.NegativeRelationship],
|
203
|
+
[BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.DirectRelationship],
|
204
|
+
[BELV.DirectlyDecreases, RDF::RDFS.subClassOf, BELV.Decreases],
|
205
|
+
[BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
|
206
|
+
[BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.PositiveRelationship],
|
207
|
+
[BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.DirectRelationship],
|
208
|
+
[BELV.DirectlyIncreases, RDF::RDFS.subClassOf, BELV.Increases],
|
209
|
+
[BELV.DirectRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
|
210
|
+
[BELV.HasComponent, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
|
211
|
+
[BELV.HasMember, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
|
212
|
+
[BELV.Increases, RDF::RDFS.subClassOf, BELV.CausalRelationship],
|
213
|
+
[BELV.Increases, RDF::RDFS.subClassOf, BELV.PositiveRelationship],
|
214
|
+
[BELV.IsA, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
|
215
|
+
[BELV.MembershipRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
|
216
|
+
[BELV.NegativeCorrelation, RDF::RDFS.subClassOf, BELV.CorrelativeRelationship],
|
217
|
+
[BELV.NegativeCorrelation, RDF::RDFS.subClassOf, BELV.NegativeRelationship],
|
218
|
+
[BELV.NegativeRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
|
219
|
+
[BELV.PositiveCorrelation, RDF::RDFS.subClassOf, BELV.CorrelativeRelationship],
|
220
|
+
[BELV.PositiveCorrelation, RDF::RDFS.subClassOf, BELV.PositiveRelationship],
|
221
|
+
[BELV.PositiveRelationship, RDF::RDFS.subClassOf, BELV.Relationship],
|
222
|
+
[BELV.PrognosticBiomarkerFor, RDF::RDFS.subClassOf, BELV.BiomarkerFor],
|
223
|
+
[BELV.RateLimitingStepOf, RDF::RDFS.subClassOf, BELV.Increases],
|
224
|
+
[BELV.RateLimitingStepOf, RDF::RDFS.subClassOf, BELV.CausalRelationship],
|
225
|
+
[BELV.RateLimitingStepOf, RDF::RDFS.subClassOf, BELV.SubProcessOf],
|
226
|
+
[BELV.SubProcessOf, RDF::RDFS.subClassOf, BELV.MembershipRelationship],
|
227
|
+
# Abundances
|
228
|
+
[BELV.AbundanceActivity, RDF::RDFS.subClassOf, BELV.Process],
|
229
|
+
[BELV.BiologicalProcess, RDF::RDFS.subClassOf, BELV.Process],
|
230
|
+
[BELV.CellSecretion, RDF::RDFS.subClassOf, BELV.Translocation],
|
231
|
+
[BELV.ComplexAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
|
232
|
+
[BELV.CompositeAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
|
233
|
+
[BELV.Degradation, RDF::RDFS.subClassOf, BELV.Transformation],
|
234
|
+
[BELV.GeneAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
|
235
|
+
[BELV.MicroRNAAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
|
236
|
+
[BELV.ModifiedProteinAbundance, RDF::RDFS.subClassOf, BELV.ProteinAbundance],
|
237
|
+
[BELV.Pathology, RDF::RDFS.subClassOf, BELV.BiologicalProcess],
|
238
|
+
[BELV.Process, RDF.type, RDF::RDFS.Class],
|
239
|
+
[BELV.ProteinAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
|
240
|
+
[BELV.ProteinVariantAbundance, RDF::RDFS.subClassOf, BELV.ProteinAbundance],
|
241
|
+
[BELV.Reaction, RDF::RDFS.subClassOf, BELV.Transformation],
|
242
|
+
[BELV.RNAAbundance, RDF::RDFS.subClassOf, BELV.Abundance],
|
243
|
+
[BELV.Transformation, RDF::RDFS.subClassOf, BELV.Process],
|
244
|
+
[BELV.Translocation, RDF::RDFS.subClassOf, BELV.Transformation],
|
245
|
+
# Activities
|
246
|
+
[BELV.Activity, RDF::RDFS.subClassOf, BELV.Activity],
|
247
|
+
[BELV.Catalytic, RDF::RDFS.subClassOf, BELV.Activity],
|
248
|
+
[BELV.Chaperone, RDF::RDFS.subClassOf, BELV.Activity],
|
249
|
+
[BELV.GtpBound, RDF::RDFS.subClassOf, BELV.Activity],
|
250
|
+
[BELV.Kinase, RDF::RDFS.subClassOf, BELV.Activity],
|
251
|
+
[BELV.Peptidase, RDF::RDFS.subClassOf, BELV.Activity],
|
252
|
+
[BELV.Phosphatase, RDF::RDFS.subClassOf, BELV.Activity],
|
253
|
+
[BELV.Ribosylase, RDF::RDFS.subClassOf, BELV.Activity],
|
254
|
+
[BELV.Transcription, RDF::RDFS.subClassOf, BELV.Activity],
|
255
|
+
[BELV.Transport, RDF::RDFS.subClassOf, BELV.Activity],
|
256
|
+
# Modifications
|
257
|
+
[BELV.Acetylation, RDF::RDFS.subClassOf, BELV.Modification],
|
258
|
+
[BELV.Farnesylation, RDF::RDFS.subClassOf, BELV.Modification],
|
259
|
+
[BELV.Glycosylation, RDF::RDFS.subClassOf, BELV.Modification],
|
260
|
+
[BELV.Hydroxylation, RDF::RDFS.subClassOf, BELV.Modification],
|
261
|
+
[BELV.Methylation, RDF::RDFS.subClassOf, BELV.Modification],
|
262
|
+
[BELV.Phosphorylation, RDF::RDFS.subClassOf, BELV.Modification],
|
263
|
+
[BELV.Ribosylation, RDF::RDFS.subClassOf, BELV.Modification],
|
264
|
+
[BELV.Sumoylation, RDF::RDFS.subClassOf, BELV.Modification],
|
265
|
+
[BELV.Ubiquitination, RDF::RDFS.subClassOf, BELV.Modification],
|
266
|
+
[BELV.PhosphorylationSerine, RDF::RDFS.subClassOf, BELV.Phosphorylation],
|
267
|
+
[BELV.PhosphorylationTyrosine, RDF::RDFS.subClassOf, BELV.Phosphorylation],
|
268
|
+
[BELV.PhosphorylationThreonine, RDF::RDFS.subClassOf, BELV.Phosphorylation],
|
269
|
+
|
270
|
+
# Properties
|
271
|
+
# Term
|
272
|
+
[BELV.hasActivityType, RDF.type, RDF.Property],
|
273
|
+
[BELV.hasActivityType, RDF::RDFS.range, BELV.Activity],
|
274
|
+
[BELV.hasActivityType, RDF::RDFS.domain, BELV.Term],
|
275
|
+
[BELV.hasChild, RDF.type, RDF.Property],
|
276
|
+
[BELV.hasChild, RDF::RDFS.range, BELV.Term],
|
277
|
+
[BELV.hasChild, RDF::RDFS.domain, BELV.Term],
|
278
|
+
[BELV.hasConcept, RDF.type, RDF.Property],
|
279
|
+
[BELV.hasConcept, RDF::RDFS.range, BELV.NamespaceConcept],
|
280
|
+
[BELV.hasConcept, RDF::RDFS.domain, BELV.Term],
|
281
|
+
[BELV.hasModificationPosition, RDF.type, RDF.Property],
|
282
|
+
[BELV.hasModificationPosition, RDF::RDFS.range, RDF::XSD.integer],
|
283
|
+
[BELV.hasModificationPosition, RDF::RDFS.domain, BELV.Term],
|
284
|
+
[BELV.hasModificationType, RDF.type, RDF.Property],
|
285
|
+
[BELV.hasModificationType, RDF::RDFS.range, BELV.Activity],
|
286
|
+
[BELV.hasModificationType, RDF::RDFS.domain, BELV.Term],
|
287
|
+
# Statement
|
288
|
+
[BELV.hasEvidence, RDF.type, RDF.Property],
|
289
|
+
[BELV.hasEvidence, RDF::RDFS.range, BELV.Evidence],
|
290
|
+
[BELV.hasEvidence, RDF::RDFS.domain, BELV.Statement],
|
291
|
+
[BELV.hasObject, RDF::RDFS.subPropertyOf, BELV.hasChild],
|
292
|
+
[BELV.hasObject, RDF::RDFS.range, BELV.Term],
|
293
|
+
[BELV.hasObject, RDF::RDFS.domain, BELV.Statement],
|
294
|
+
[BELV.hasRelationship, RDF.type, RDF.Property],
|
295
|
+
[BELV.hasRelationship, RDF::RDFS.range, BELV.Relationship],
|
296
|
+
[BELV.hasRelationship, RDF::RDFS.domain, BELV.Statement],
|
297
|
+
[BELV.hasSubject, RDF::RDFS.subPropertyOf, BELV.hasChild],
|
298
|
+
[BELV.hasSubject, RDF::RDFS.range, BELV.Term],
|
299
|
+
[BELV.hasSubject, RDF::RDFS.domain, BELV.Statement],
|
300
|
+
# Evidence
|
301
|
+
[BELV.hasAnnotation, RDF.type, RDF.Property],
|
302
|
+
[BELV.hasAnnotation, RDF::RDFS.range, BELV.AnnotationConcept],
|
303
|
+
[BELV.hasAnnotation, RDF::RDFS.domain, BELV.Evidence],
|
304
|
+
[BELV.hasCitation, RDF.type, RDF.Property],
|
305
|
+
[BELV.hasCitation, RDF::RDFS.domain, BELV.Evidence],
|
306
|
+
[BELV.hasEvidenceText, RDF::RDFS.range, RDF::XSD.string],
|
307
|
+
[BELV.hasEvidenceText, RDF::RDFS.domain, BELV.Evidence],
|
308
|
+
[BELV.hasStatement, RDF.type, RDF.Property],
|
309
|
+
[BELV.hasStatement, RDF::RDFS.range, BELV.Statement],
|
310
|
+
[BELV.hasStatement, RDF::RDFS.domain, BELV.Evidence]
|
311
|
+
]
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|