bel 0.3.1-x64-mingw32 → 0.3.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTgyMmZlN2NlOWJjNjllNWIwNzNkODEzOWZiYThiYmRiNGI2YzQ2Mw==
5
- data.tar.gz: !binary |-
6
- YzlhN2RhZDNjOWExZWI1NzM5ODM1Njc1Mjk4MGU5MDE3MGVmMTUyZg==
2
+ SHA1:
3
+ metadata.gz: 4bf833ee1a0b785b9f6b8f465127642c23424751
4
+ data.tar.gz: 2d73e08feffa2f234bfb9a1fc0a57a50c759d37f
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- M2Q3MDUxODExN2QxYjlmNWQxOTA5MGUzY2UzMjZiZWU0ZjBkNjM1NzIxZDUx
10
- NzhiNDhlMzEwY2RlMWM4NzZlMTQ3Nzg0OGNiM2Y1Y2EzZWNhYmExMTk1Njky
11
- ZDQyMDQ1YTZhYWFmMmJhMTIwZWE1NjMxZTRiMDZmYTNjMTRmODg=
12
- data.tar.gz: !binary |-
13
- YTk1NGNlMjYzZDRmOTM1YTZmNjNlMzNlMDI0NjdkODQ2Y2NmZmZkZGE0OWMz
14
- ZmQ4MWRiM2Y2MmM1NTE3ZTdiNTc3NmEyNTVmMmFiNGViZWYwMWRhYjRjOWEx
15
- ZmZiYThkZGYzNzRjYTJiZDQ0NzQyMjlmNTBiN2NlN2ViMmVlODQ=
6
+ metadata.gz: e5df2dbc07c414825258383b53569ec596ecb1bf8e8f56142b68741fb167a3716370b8d4ba583a3343815db3ca940947f88e10fd6618cd5d7b31a7f9221a795d
7
+ data.tar.gz: d11e1a8a6c5ca6a3e42b7d3f6e9df1b413dbef5277a8073c290c8bd914b63948ac902be8faece67a524d337e63dc66e20d5191519330605057c2cf71007f515d
data/README.md CHANGED
@@ -3,6 +3,14 @@ bel ruby
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/bel.svg)](http://badge.fury.io/rb/bel)
5
5
 
6
+ [![Changelog](https://img.shields.io/badge/bel.rb-changelog-brightgreen.svg)](https://github.com/OpenBEL/bel.rb/blob/master/CHANGELOG.md)
7
+
8
+ [![Issues](https://img.shields.io/github/issues/OpenBEL/bel.rb.svg)](https://github.com/OpenBEL/bel.rb/issues)
9
+
10
+ [![Dependencies](https://img.shields.io/gemnasium/OpenBEL/bel.rb.svg)]()
11
+
12
+ [![Join the chat at https://gitter.im/OpenBEL/bel.rb](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OpenBEL/bel.rb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
13
+
6
14
  The bel ruby gem allows the reading, writing, and processing of BEL (Biological Expression Language) with a natural DSL.
7
15
 
8
16
  Learn more on [BEL](http://www.openbel.org/content/bel-lang-language).
@@ -22,6 +30,8 @@ Dependencies
22
30
 
23
31
  Install / Build: See [INSTALL](INSTALL.md).
24
32
 
33
+ A changelog is maintained at [CHANGELOG][CHANGELOG].
34
+
25
35
  branches
26
36
  --------
27
37
 
@@ -53,7 +63,7 @@ executable commands
53
63
  upgrade
54
64
 
55
65
 
56
- bel 0.3.1
66
+ bel 0.3.2
57
67
  Copyright (C) 2015 OpenBEL
58
68
  Apache License, Version 2.0, January 2004
59
69
  http://www.apache.org/licenses/
@@ -355,3 +365,5 @@ api examples
355
365
  end
356
366
  end
357
367
  ```
368
+
369
+ [CHANGELOG]: https://github.com/OpenBEL/bel.rb/blob/master/CHANGELOG.md
data/bel.gemspec CHANGED
@@ -57,12 +57,15 @@ Gem::Specification.new do |spec|
57
57
  spec.add_dependency 'ffi', '1.9.8'
58
58
 
59
59
  # test rdf functionality
60
- spec.add_development_dependency 'uuid', '~> 2.3'
61
60
  spec.add_development_dependency 'addressable', '~> 2.3'
62
61
  spec.add_development_dependency 'rdf', '~> 1.1'
63
62
  spec.add_development_dependency 'rdf-turtle', '~> 1.1'
63
+ spec.add_development_dependency 'uuid', '~> 2.3'
64
64
 
65
65
  # development gems
66
+ spec.add_development_dependency 'byebug', '~> 5.0'
67
+ spec.add_development_dependency 'minitest', '~> 5.7'
68
+ spec.add_development_dependency 'pry-byebug', '~> 3.2'
66
69
  spec.add_development_dependency 'rake', '~> 10.4'
67
70
  spec.add_development_dependency 'rake-compiler', '~> 0.9'
68
71
  spec.add_development_dependency 'rdoc', '~> 4.2'
data/bin/bel CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ $: << File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib')
2
3
  require 'erb'
3
4
  require 'bel'
4
5
  require 'bel/vendor/trollop'
data/bin/bel2rdf.rb CHANGED
@@ -128,9 +128,9 @@ end
128
128
  # read bel content
129
129
  content =
130
130
  if options[:bel]
131
- File.open(options[:bel]).read
131
+ File.open(options[:bel], :external_encoding => 'UTF-8')
132
132
  else
133
- $stdin.read
133
+ $stdin
134
134
  end
135
135
 
136
136
  # parse and write rdf
data/bin/bel_compare.rb CHANGED
@@ -46,11 +46,11 @@ threads = []
46
46
  first_groups = {}
47
47
  second_groups = {}
48
48
  threads << Thread.new {
49
- first_groups.update(fetch_groups(File.read(ARGV[0])))
49
+ first_groups.update(fetch_groups(File.open(ARGV[0], :external_encoding => 'UTF-8')))
50
50
  }
51
51
 
52
52
  threads << Thread.new {
53
- second_groups.update(fetch_groups(File.read(ARGV[1])))
53
+ second_groups.update(fetch_groups(File.open(ARGV[1], :external_encoding => 'UTF-8')))
54
54
  }
55
55
 
56
56
  threads.each { |t| t.join }
data/bin/bel_parse.rb CHANGED
@@ -35,7 +35,7 @@ end
35
35
  # read bel content
36
36
  content =
37
37
  if options[:bel]
38
- File.open(options[:bel])
38
+ File.open(options[:bel], :external_encoding => 'UTF-8')
39
39
  else
40
40
  $stdin
41
41
  end
data/bin/bel_summarize.rb CHANGED
@@ -21,7 +21,7 @@ end.parse!
21
21
  # read bel content
22
22
  content =
23
23
  if options[:bel]
24
- File.open(options[:bel])
24
+ File.open(options[:bel], :external_encoding => 'UTF-8')
25
25
  else
26
26
  $stdin
27
27
  end
data/bin/bel_upgrade.rb CHANGED
@@ -52,7 +52,7 @@ end
52
52
  # read bel content
53
53
  content =
54
54
  if options[:bel]
55
- File.open(options[:bel])
55
+ File.open(options[:bel], :external_encoding => 'UTF-8')
56
56
  else
57
57
  $stdin
58
58
  end
@@ -60,7 +60,7 @@ end
60
60
  # read change log
61
61
  changelog = nil
62
62
  if File.exists? options[:change_log]
63
- File.open(options[:change_log]) do |f|
63
+ File.open(options[:change_log], :external_encoding => 'UTF-8') do |f|
64
64
  changelog = JSON.parse(f.read)
65
65
  end
66
66
  else
Binary file
Binary file
Binary file
@@ -6,7 +6,7 @@ module BEL
6
6
  def valid?
7
7
  return false unless value
8
8
  return true unless @ns
9
- @ns.respond_to?(:values) && ns.values.include?(value)
9
+ @ns.respond_to?(:values) && ns.values.include?(value.to_sym)
10
10
  end
11
11
  end
12
12
 
@@ -9,10 +9,56 @@ module BEL
9
9
  @arguments = (arguments ||= []).flatten
10
10
  end
11
11
 
12
+ def initialize(fx, *arguments)
13
+ @fx = case fx
14
+ when String
15
+ BEL::Language::Function.new(FUNCTIONS[fx.to_sym])
16
+ when Symbol
17
+ BEL::Language::Function.new(FUNCTIONS[fx.to_sym])
18
+ when BEL::Language::Function
19
+ fx
20
+ when nil
21
+ raise ArgumentError, 'fx must not be nil'
22
+ end
23
+ @arguments = (arguments ||= []).flatten
24
+ @signature = Signature.new(
25
+ @fx[:short_form],
26
+ *@arguments.map { |arg|
27
+ case arg
28
+ when Term
29
+ F.new(arg.fx.return_type)
30
+ when Parameter
31
+ E.new(arg.enc)
32
+ when nil
33
+ NullE.new
34
+ end
35
+ })
36
+ end
37
+
12
38
  def <<(item)
13
39
  @arguments << item
14
40
  end
15
41
 
42
+ def valid?
43
+ invalid_signatures = @arguments.find_all { |arg|
44
+ arg.is_a? Term
45
+ }.find_all { |term|
46
+ not term.valid?
47
+ }
48
+ return false if not invalid_signatures.empty?
49
+
50
+ sigs = @fx.signatures
51
+ sigs.any? do |sig| (@signature <=> sig) >= 0 end
52
+ end
53
+
54
+ def valid_signatures
55
+ @fx.signatures.find_all { |sig| (@signature <=> sig) >= 0 }
56
+ end
57
+
58
+ def invalid_signatures
59
+ @fx.signatures.find_all { |sig| (@signature <=> sig) < 0 }
60
+ end
61
+
16
62
  def hash
17
63
  [@fx, @arguments].hash
18
64
  end
@@ -25,9 +71,10 @@ module BEL
25
71
 
26
72
  def to_bel
27
73
  arguments = [@arguments].flatten.map(&:to_bel).join(',')
28
- "#@fx(#{arguments})"
74
+ "#{@fx.short_form}(#{arguments})"
29
75
  end
30
76
  alias_method :to_s, :to_bel
31
77
  end
32
78
  end
33
79
  end
80
+
@@ -129,6 +129,7 @@ module BEL::Extension::Format
129
129
  bel_statements.map { |bel_statement|
130
130
  graph_name = graph[:label] || graph[:id] || 'BEL Graph'
131
131
  metadata = ::BEL::Model::Metadata.new
132
+ references = ::BEL::Model::References.new
132
133
 
133
134
  # establish document header
134
135
  metadata.document_header[:Name] = graph_name
@@ -153,7 +154,7 @@ module BEL::Extension::Format
153
154
  }
154
155
  ]
155
156
  end
156
- metadata.annotation_definitions = annotations if annotations
157
+ references.annotation_definitions = annotations if annotations
157
158
 
158
159
  # establish namespace definitions
159
160
  namespaces = graph.fetch(:metadata, {}).
@@ -170,11 +171,12 @@ module BEL::Extension::Format
170
171
  }
171
172
  ]
172
173
  end
173
- metadata.namespace_definitions = namespaces if namespaces
174
+ references.namespace_definitions = namespaces if namespaces
174
175
 
175
176
  ::BEL::Model::Evidence.create(
176
177
  :bel_statement => bel_statement,
177
- :metadata => metadata
178
+ :metadata => metadata,
179
+ :references => references
178
180
  )
179
181
  }
180
182
  end
@@ -27,147 +27,163 @@ module BEL
27
27
  # maps outer function to bel/vocabulary class
28
28
  FUNCTION_TYPE = {
29
29
  a: BELV.Abundance,
30
- abundance: BELV.Abundance,
31
- g: BELV.GeneAbundance,
32
- geneAbundance: BELV.GeneAbundance,
33
- p: BELV.ProteinAbundance,
34
- proteinAbundance: BELV.ProteinAbundance,
35
- r: BELV.RNAAbundance,
36
- rnaAbundance: BELV.RNAAbundance,
37
- m: BELV.microRNAAbundance,
38
- microRNAAbundance: BELV.microRNAAbundance,
30
+ act: BELV.AbundanceActivity,
31
+ bp: BELV.BiologicalProcess,
32
+ cat: BELV.AbundanceActivity,
33
+ chap: BELV.AbundanceActivity,
39
34
  complex: BELV.ComplexAbundance,
40
- complexAbundance: BELV.ComplexAbundance,
41
35
  composite: BELV.CompositeAbundance,
42
- compositeAbundance: BELV.CompositeAbundance,
43
- bp: BELV.BiologicalProcess,
44
- biologicalProcess: BELV.BiologicalProcess,
36
+ deg: BELV.Degradation,
37
+ fus: BELV.Fusion,
38
+ g: BELV.GeneAbundance,
39
+ gtp: BELV.AbundanceActivity,
40
+ kin: BELV.AbundanceActivity,
41
+ m: BELV.microRNAAbundance,
42
+ p: BELV.ProteinAbundance,
45
43
  path: BELV.Pathology,
46
- pathology: BELV.Pathology,
44
+ pep: BELV.AbundanceActivity,
45
+ phos: BELV.AbundanceActivity,
46
+ pmod: BELV.ProteinModification,
47
+ r: BELV.RNAAbundance,
48
+ ribo: BELV.AbundanceActivity,
47
49
  rxn: BELV.Reaction,
48
- reaction: BELV.Reaction,
49
- tloc: BELV.Translocation,
50
- translocation: BELV.Translocation,
51
50
  sec: BELV.CellSecretion,
52
- cellSecretion: BELV.CellSecretion,
53
- deg: BELV.Degradation,
54
- degradation: BELV.Degradation,
55
- cat: BELV.AbundanceActivity,
51
+ sub: BELV.Substitution,
52
+ surf: BELV.CellSurfaceExpression,
53
+ tloc: BELV.Translocation,
54
+ tport: BELV.AbundanceActivity,
55
+ tscript: BELV.AbundanceActivity,
56
+ abundance: BELV.Abundance,
57
+ biologicalProcess: BELV.BiologicalProcess,
56
58
  catalyticActivity: BELV.AbundanceActivity,
57
- chap: BELV.AbundanceActivity,
59
+ cellSecretion: BELV.CellSecretion,
60
+ cellSurfaceExpression: BELV.CellSurfaceExpression,
58
61
  chaperoneActivity: BELV.AbundanceActivity,
59
- gtp: BELV.AbundanceActivity,
62
+ complexAbundance: BELV.ComplexAbundance,
63
+ compositeAbundance: BELV.CompositeAbundance,
64
+ degradation: BELV.Degradation,
65
+ fusion: BELV.Fusion,
66
+ geneAbundance: BELV.GeneAbundance,
60
67
  gtpBoundActivity: BELV.AbundanceActivity,
61
- kin: BELV.AbundanceActivity,
62
68
  kinaseActivity: BELV.AbundanceActivity,
63
- act: BELV.AbundanceActivity,
69
+ list: BELV.List,
70
+ microRNAAbundance: BELV.microRNAAbundance,
64
71
  molecularActivity: BELV.AbundanceActivity,
65
- pep: BELV.AbundanceActivity,
72
+ pathology: BELV.Pathology,
66
73
  peptidaseActivity: BELV.AbundanceActivity,
67
- phos: BELV.AbundanceActivity,
68
74
  phosphataseActivity: BELV.AbundanceActivity,
69
- ribo: BELV.AbundanceActivity,
75
+ products: BELV.Products,
76
+ proteinAbundance: BELV.ProteinAbundance,
77
+ proteinModification: BELV.ProteinModification,
78
+ reactants: BELV.Reactants,
79
+ reaction: BELV.Reaction,
70
80
  ribosylationActivity: BELV.AbundanceActivity,
71
- tscript: BELV.AbundanceActivity,
81
+ rnaAbundance: BELV.RNAAbundance,
82
+ substitution: BELV.Substitution,
72
83
  transcriptionalActivity: BELV.AbundanceActivity,
73
- tport: BELV.AbundanceActivity,
74
- transportActivity: BELV.AbundanceActivity
84
+ translocation: BELV.Translocation,
85
+ transportActivity: BELV.AbundanceActivity,
86
+ truncation: BELV.Truncation,
75
87
  }
76
88
 
77
89
  RELATIONSHIP_TYPE = {
78
- 'association' => BELV.Association,
79
90
  '--' => BELV.Association,
91
+ '-|' => BELV.Decreases,
92
+ '=|' => BELV.DirectlyDecreases,
93
+ '=>' => BELV.DirectlyIncreases,
94
+ '->' => BELV.Increases,
95
+ ':>' => BELV.TranscribedTo,
96
+ '>>' => BELV.TranslatedTo,
97
+ 'actsIn' => BELV.ActsIn,
98
+ 'analogous' => BELV.Analogous,
99
+ 'association' => BELV.Association,
80
100
  'biomarkerFor' => BELV.BiomarkerFor,
81
101
  'causesNoChange' => BELV.CausesNoChange,
82
102
  'decreases' => BELV.Decreases,
83
- '-|' => BELV.Decreases,
84
103
  'directlyDecreases' => BELV.DirectlyDecreases,
85
- '=|' => BELV.DirectlyDecreases,
86
104
  'directlyIncreases' => BELV.DirectlyIncreases,
87
- '=>' => BELV.DirectlyIncreases,
88
105
  'hasComponent' => BELV.HasComponent,
106
+ 'hasComponents' => BELV.HasComponents,
89
107
  'hasMember' => BELV.HasMember,
108
+ 'hasMembers' => BELV.HasMembers,
109
+ 'hasModification' => BELV.HasModification,
110
+ 'hasProduct' => BELV.HasProduct,
111
+ 'hasVariant' => BELV.HasVariant,
112
+ 'includes' => BELV.Includes,
90
113
  'increases' => BELV.Increases,
91
- '->' => BELV.Increases,
92
114
  'isA' => BELV.IsA,
93
115
  'negativeCorrelation' => BELV.NegativeCorrelation,
116
+ 'orthologous' => BELV.Orthologous,
94
117
  'positiveCorrelation' => BELV.PositiveCorrelation,
95
118
  'prognosticBiomarkerFor' => BELV.PrognosticBiomarkerFor,
96
119
  'rateLimitingStepOf' => BELV.RateLimitingStepOf,
120
+ 'reactantIn' => BELV.ReactantIn,
97
121
  'subProcessOf' => BELV.SubProcessOf,
98
- ':>' => BELV.TranscribedTo,
99
- '>>' => BELV.TranslatedTo,
100
-
101
- # Supported by schema
102
- # 'actsIn' => BELV.ActsIn, # (BELV.hasChild)
103
-
104
- # Unsupported in schema
105
- #'analogous' => BELV.Analogous,
106
- #'hasModification' => BELV.HasModification,
107
- #'hasProduct' => BELV.HasProduct,
108
- #'hasVariant' => BELV.HasVariant,
109
- #'includes' => BELV.Includes,
110
- #'orthologous' => BELV.Orthologous,
111
- #'reactantIn' => BELV.ReactantIn,
112
- #'transcribedTo' => BELV.TranscribedTo,
113
- #'translatedTo' => BELV.TranslatedTo,
114
- #'translocates' => BELV.Translocates,
115
-
116
- # Macro statements - TODO needs parser AST translation
117
- #'hasComponents' => BELV.HasComponents,
118
- #'hasMembers' => BELV.HasMembers,
122
+ 'transcribedTo' => BELV.TranscribedTo,
123
+ 'translatedTo' => BELV.TranslatedTo,
124
+ 'translocates' => BELV.Translocates,
119
125
  }
120
126
 
121
127
  RELATIONSHIP_CLASSIFICATION = {
122
- :'association' => BELV.CorrelativeRelationship,
123
128
  :'--' => BELV.CorrelativeRelationship,
129
+ :'-|' => BELV.Decreases,
130
+ :'=|' => BELV.DirectlyDecreases,
131
+ :'=>' => BELV.DirectlyIncreases,
132
+ :'->' => BELV.Increases,
133
+ :'association' => BELV.CorrelativeRelationship,
124
134
  :'biomarkerFor' => BELV.BiomarkerFor,
125
135
  :'causesNoChange' => BELV.CausesNoChange,
126
136
  :'decreases' => BELV.Decreases,
127
- :'-|' => BELV.Decreases,
128
137
  :'directlyDecreases' => BELV.DirectlyDecreases,
129
- :'=|' => BELV.DirectlyDecreases,
130
138
  :'directlyIncreases' => BELV.DirectlyIncreases,
131
- :'=>' => BELV.DirectlyIncreases,
132
139
  :'hasComponent' => BELV.HasComponent,
133
140
  :'hasMember' => BELV.HasMember,
134
141
  :'increases' => BELV.Increases,
135
- :'->' => BELV.Increases,
136
142
  :'isA' => BELV.IsA,
137
143
  :'negativeCorrelation' => BELV.NegativeCorrelation,
138
144
  :'positiveCorrelation' => BELV.PositiveCorrelation,
139
145
  :'prognosticBiomarkerFor' => BELV.PrognosticBiomarkerFor,
140
146
  :'rateLimitingStepOf' => BELV.RateLimitingStepOf,
141
- :'subProcessOf' => BELV.SubProcessOf
147
+ :'subProcessOf' => BELV.SubProcessOf,
142
148
  }
143
149
 
144
150
  ACTIVITY_TYPE = {
145
- cat: BELV.Catalytic,
146
- chap: BELV.Chaperone,
147
- gtp: BELV.GtpBound,
148
- kin: BELV.Kinase,
149
- act: BELV.Activity,
150
- pep: BELV.Peptidase,
151
- phos: BELV.Phosphatase,
152
- ribo: BELV.Ribosylase,
153
- tscript: BELV.Transcription,
154
- tport: BELV.Transport
151
+ act: BELV.Activity,
152
+ cat: BELV.Catalytic,
153
+ chap: BELV.Chaperone,
154
+ gtp: BELV.GtpBound,
155
+ kin: BELV.Kinase,
156
+ pep: BELV.Peptidase,
157
+ phos: BELV.Phosphatase,
158
+ ribo: BELV.Ribosylase,
159
+ tport: BELV.Transport,
160
+ tscript: BELV.Transcription,
161
+ catalyticActivity: BELV.Catalytic,
162
+ chaperoneActivity: BELV.Chaperone,
163
+ gtpBoundActivity: BELV.GtpBound,
164
+ kinaseActivity: BELV.Kinase,
165
+ molecularActivity: BELV.Activity,
166
+ peptidaseActivity: BELV.Peptidase,
167
+ phosphataseActivity: BELV.Phosphatase,
168
+ ribosylationActivity: BELV.Ribosylase,
169
+ transcriptionalActivity: BELV.Transcription,
170
+ transportActivity: BELV.Transport,
155
171
  }
156
172
 
157
173
  # maps modification types to bel/vocabulary class
158
174
  MODIFICATION_TYPE = {
159
- 'P,S' => BELV.PhosphorylationSerine,
160
- 'P,T' => BELV.PhosphorylationThreonine,
161
- 'P,Y' => BELV.PhosphorylationTyrosine,
162
175
  'A' => BELV.Acetylation,
163
176
  'F' => BELV.Farnesylation,
164
177
  'G' => BELV.Glycosylation,
165
178
  'H' => BELV.Hydroxylation,
166
179
  'M' => BELV.Methylation,
167
180
  'P' => BELV.Phosphorylation,
181
+ 'P,S' => BELV.PhosphorylationSerine,
182
+ 'P,T' => BELV.PhosphorylationThreonine,
183
+ 'P,Y' => BELV.PhosphorylationTyrosine,
168
184
  'R' => BELV.Ribosylation,
169
185
  'S' => BELV.Sumoylation,
170
- 'U' => BELV.Ubiquitination
186
+ 'U' => BELV.Ubiquitination,
171
187
  }
172
188
 
173
189
  # protein variant