bel_parser 1.0.0.alpha.1 → 1.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemspec +1 -1
- data/VERSION +1 -1
- data/bin/bel2_termcheck +2 -2
- data/lib/bel_parser/expression/term_semantics.rb +2 -2
- data/lib/bel_parser/language/expression_validator.rb +42 -0
- data/lib/bel_parser/language/function.rb +8 -0
- data/lib/bel_parser/language/relationship.rb +57 -0
- data/lib/bel_parser/language/{semantic_ast.rb → semantics/semantic_ast.rb} +5 -27
- data/lib/bel_parser/language/semantics/semantic_match.rb +28 -0
- data/lib/bel_parser/language/semantics.rb +2 -0
- data/lib/bel_parser/language/specification.rb +34 -10
- data/lib/bel_parser/language/syntax.rb +0 -0
- data/lib/bel_parser/language/{version1 → version1_0}/functions/abundance.rb +4 -4
- data/lib/bel_parser/language/{version1 → version1_0}/functions/biological_process.rb +4 -4
- data/lib/bel_parser/language/{version1 → version1_0}/functions/catalytic_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/cell_secretion.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/cell_surface_expression.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/chaperone_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/complex_abundance.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/composite_abundance.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/degradation.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/fusion.rb +4 -4
- data/lib/bel_parser/language/{version1 → version1_0}/functions/gene_abundance.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/gtp_bound_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/kinase_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/list.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/micro_rna_abundance.rb +4 -4
- data/lib/bel_parser/language/{version1 → version1_0}/functions/molecular_activity.rb +5 -5
- data/lib/bel_parser/language/{version2 → version1_0}/functions/pathology.rb +4 -4
- data/lib/bel_parser/language/{version1 → version1_0}/functions/peptidase_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/phosphatase_activity.rb +6 -6
- data/lib/bel_parser/language/{version2 → version1_0}/functions/products.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/protein_abundance.rb +8 -8
- data/lib/bel_parser/language/{version1 → version1_0}/functions/protein_modification.rb +4 -4
- data/lib/bel_parser/language/{version2 → version1_0}/functions/reactants.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/reaction.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/ribosylation_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/rna_abundance.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/substitution.rb +4 -4
- data/lib/bel_parser/language/{version1 → version1_0}/functions/transcriptional_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/translocation.rb +5 -5
- data/lib/bel_parser/language/{version1 → version1_0}/functions/transport_activity.rb +6 -6
- data/lib/bel_parser/language/{version1 → version1_0}/functions/truncation.rb +4 -4
- data/lib/bel_parser/language/version1_0/relationships/acts_in.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/analogous.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/association.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/biomarker_for.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/causes_no_change.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/decreases.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/directly_decreases.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/directly_increases.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/has_component.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/has_components.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/has_member.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/has_members.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/has_modification.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/has_product.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/has_variant.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/includes.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/increases.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/is_a.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/negative_correlation.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/orthologous.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/positive_correlation.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/prognostic_biomarker_for.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/rate_limiting_step_of.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/reactant_in.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/sub_process_of.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/transcribed_to.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/translated_to.rb +31 -0
- data/lib/bel_parser/language/version1_0/relationships/translocates.rb +31 -0
- data/lib/bel_parser/language/{version2 → version1_0}/return_types/abundance.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/any.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/biological_process.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/catalytic_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/chaperone_activity.rb +1 -1
- data/lib/bel_parser/language/{version2 → version1_0}/return_types/complex_abundance.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/fusion.rb +1 -1
- data/lib/bel_parser/language/{version2 → version1_0}/return_types/gene_abundance.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/gtp_bound_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/kinase_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/list.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/micro_rna_abundance.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/molecular_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/pathology.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/peptidase_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/phosphatase_activity.rb +1 -1
- data/lib/bel_parser/language/{version2 → version1_0}/return_types/products.rb +1 -1
- data/lib/bel_parser/language/{version2 → version1_0}/return_types/protein_abundance.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/protein_modification.rb +1 -1
- data/lib/bel_parser/language/{version2 → version1_0}/return_types/reactants.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/ribosylation_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/rna_abundance.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/substitution.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/transcriptional_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/transport_activity.rb +1 -1
- data/lib/bel_parser/language/{version1 → version1_0}/return_types/truncation.rb +1 -1
- data/lib/bel_parser/language/version1_0/syntax/function.rb +29 -0
- data/lib/bel_parser/language/version1_0.rb +89 -0
- data/lib/bel_parser/language/{version2 → version2_0}/functions/abundance.rb +6 -6
- data/lib/bel_parser/language/{version2 → version2_0}/functions/activity.rb +7 -7
- data/lib/bel_parser/language/{version2 → version2_0}/functions/biological_process.rb +4 -4
- data/lib/bel_parser/language/{version2 → version2_0}/functions/cell_secretion.rb +5 -5
- data/lib/bel_parser/language/{version2 → version2_0}/functions/cell_surface_expression.rb +5 -5
- data/lib/bel_parser/language/{version2 → version2_0}/functions/complex_abundance.rb +8 -8
- data/lib/bel_parser/language/{version2 → version2_0}/functions/composite_abundance.rb +5 -5
- data/lib/bel_parser/language/{version2 → version2_0}/functions/degradation.rb +5 -5
- data/lib/bel_parser/language/{version2 → version2_0}/functions/fragment.rb +4 -4
- data/lib/bel_parser/language/{version2 → version2_0}/functions/from_location.rb +4 -4
- data/lib/bel_parser/language/{version2 → version2_0}/functions/fusion.rb +4 -4
- data/lib/bel_parser/language/{version2 → version2_0}/functions/gene_abundance.rb +7 -7
- data/lib/bel_parser/language/{version2 → version2_0}/functions/list.rb +5 -5
- data/lib/bel_parser/language/{version2 → version2_0}/functions/location.rb +4 -4
- data/lib/bel_parser/language/{version2 → version2_0}/functions/micro_rna_abundance.rb +6 -6
- data/lib/bel_parser/language/{version2 → version2_0}/functions/molecular_activity.rb +4 -4
- data/lib/bel_parser/language/{version1 → version2_0}/functions/pathology.rb +4 -4
- data/lib/bel_parser/language/{version1 → version2_0}/functions/products.rb +5 -5
- data/lib/bel_parser/language/{version2 → version2_0}/functions/protein_abundance.rb +9 -9
- data/lib/bel_parser/language/{version2 → version2_0}/functions/protein_modification.rb +7 -7
- data/lib/bel_parser/language/{version1 → version2_0}/functions/reactants.rb +5 -5
- data/lib/bel_parser/language/{version2 → version2_0}/functions/reaction.rb +6 -6
- data/lib/bel_parser/language/{version2 → version2_0}/functions/rna_abundance.rb +11 -11
- data/lib/bel_parser/language/{version2 → version2_0}/functions/to_location.rb +4 -4
- data/lib/bel_parser/language/{version2 → version2_0}/functions/translocation.rb +8 -8
- data/lib/bel_parser/language/{version2 → version2_0}/functions/variant.rb +4 -4
- data/lib/bel_parser/language/version2_0/relationships/acts_in.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/analogous.rb +35 -0
- data/lib/bel_parser/language/version2_0/relationships/association.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/biomarker_for.rb +35 -0
- data/lib/bel_parser/language/version2_0/relationships/causes_no_change.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/decreases.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/directly_decreases.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/directly_increases.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/has_component.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/has_components.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/has_member.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/has_members.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/has_modification.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/has_product.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/has_variant.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/includes.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/increases.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/is_a.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/negative_correlation.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/orthologous.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/positive_correlation.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/prognostic_biomarker_for.rb +35 -0
- data/lib/bel_parser/language/version2_0/relationships/rate_limiting_step_of.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/reactant_in.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/regulates.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/sub_process_of.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/transcribed_to.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/translated_to.rb +31 -0
- data/lib/bel_parser/language/version2_0/relationships/translocates.rb +31 -0
- data/lib/bel_parser/language/{version1 → version2_0}/return_types/abundance.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/activity.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/any.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/biological_process.rb +1 -1
- data/lib/bel_parser/language/{version1 → version2_0}/return_types/complex_abundance.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/fragment.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/from_location.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/fusion.rb +1 -1
- data/lib/bel_parser/language/{version1 → version2_0}/return_types/gene_abundance.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/list.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/location.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/micro_rna_abundance.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/molecular_activity.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/pathology.rb +1 -1
- data/lib/bel_parser/language/{version1 → version2_0}/return_types/products.rb +1 -1
- data/lib/bel_parser/language/{version1 → version2_0}/return_types/protein_abundance.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/protein_modification.rb +1 -1
- data/lib/bel_parser/language/{version1 → version2_0}/return_types/reactants.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/rna_abundance.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/to_location.rb +1 -1
- data/lib/bel_parser/language/{version2 → version2_0}/return_types/variant.rb +1 -1
- data/lib/bel_parser/language/version2_0.rb +73 -0
- data/lib/bel_parser/language.rb +90 -2
- data/lib/bel_parser/parsers/ast/node.rb +11 -1
- metadata +172 -111
- data/lib/bel_parser/language/syntax/expression/incomplete_node.rb +0 -14
- data/lib/bel_parser/language/syntax/expression/invalid_term_function.rb +0 -22
- data/lib/bel_parser/language/version1.rb +0 -50
- data/lib/bel_parser/language/version2.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ab686251113e217ed255a26b59b00aa9b6a947
|
4
|
+
data.tar.gz: 87f55444534d215b579b4aec8d657cf38479ae1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 959bbb33f76a1888cabec4bc7bef6a00c130a45aeeac7a175e550403e2b14a78c9f75d147208e500a4aa400d5562e08d42a7733a6f53db38b688d0ba0c85a4e4
|
7
|
+
data.tar.gz: 4c43a80f6ad4263753a5e49d76e6bbb57237a32cb61cb6af3dc8349a417ca2d049df3b18af9f1fddfedc3ff89b5e4bc2f7661b39a751aed790eae0dd596ef4b7
|
data/.gemspec
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.alpha.
|
1
|
+
1.0.0.alpha.2
|
data/bin/bel2_termcheck
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib'))
|
3
3
|
|
4
4
|
require 'bel_parser'
|
5
|
-
require 'bel_parser/language/
|
5
|
+
require 'bel_parser/language/version2_0'
|
6
6
|
require 'bel_parser/language/semantics/analyzer'
|
7
7
|
|
8
8
|
module BELParser
|
@@ -16,7 +16,7 @@ module BELParser
|
|
16
16
|
|
17
17
|
def each(io)
|
18
18
|
if block_given?
|
19
|
-
v2 = BELParser::Language::
|
19
|
+
v2 = BELParser::Language::Version2_0::Specification.new
|
20
20
|
filtered_ast = FILTER.each(BELParser::ASTGenerator.new.each(io))
|
21
21
|
filtered_ast.each do |results|
|
22
22
|
term = results.last.first
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative '../ast_filter'
|
2
2
|
require_relative '../ast_generator'
|
3
3
|
require_relative '../parsers/expression'
|
4
|
-
require_relative '../language/
|
4
|
+
require_relative '../language/version2_0'
|
5
5
|
require_relative '../language/semantics/analyzer'
|
6
6
|
|
7
7
|
module BELParser
|
@@ -15,7 +15,7 @@ module BELParser
|
|
15
15
|
|
16
16
|
def each(io)
|
17
17
|
if block_given?
|
18
|
-
v2 = BELParser::Language::
|
18
|
+
v2 = BELParser::Language::Version2_0::Specification.new
|
19
19
|
filtered_ast = FILTER.each(BELParser::ASTGenerator.new.each(io))
|
20
20
|
filtered_ast.each do |results|
|
21
21
|
term = results.last.first
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module BELParser
|
2
|
+
module Language
|
3
|
+
class ExpressionValidator
|
4
|
+
def initialize(spec)
|
5
|
+
@spec = spec
|
6
|
+
end
|
7
|
+
|
8
|
+
def validate(expression_ast)
|
9
|
+
node_errors = check_syntax(expression_ast)
|
10
|
+
if !node_errors.empty?
|
11
|
+
node_errors.each do |node_error|
|
12
|
+
puts "Syntax error (#{node_error.syntax_errors}) with #{node_error.type}."
|
13
|
+
end
|
14
|
+
else
|
15
|
+
check_semantics(expression_ast)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def check_syntax(ast)
|
22
|
+
# Clear syntax checks.
|
23
|
+
ast.traverse.each do |node|
|
24
|
+
node.syntax_errors.clear
|
25
|
+
end
|
26
|
+
|
27
|
+
# Run syntax checks, sets syntax_errors on nodes.
|
28
|
+
@spec.syntax.each do |syntax|
|
29
|
+
syntax.match(ast)
|
30
|
+
end
|
31
|
+
|
32
|
+
ast.traverse.select do |node|
|
33
|
+
!node.syntax_errors.empty?
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_semantics(ast)
|
38
|
+
BELParser::Language::Semantics.check_term(ast, @spec)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -27,6 +27,14 @@ module BELParser
|
|
27
27
|
raise NotImplementedError, "#{__method__} is not implemented."
|
28
28
|
end
|
29
29
|
|
30
|
+
# Indicates whether this function is deprecated. Override in your
|
31
|
+
# function to mark as deprecated.
|
32
|
+
#
|
33
|
+
# @return [Boolean] false
|
34
|
+
def deprecated?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
30
38
|
def ===(other)
|
31
39
|
return false if other.nil?
|
32
40
|
short == other || long == other
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module BELParser
|
2
|
+
module Language
|
3
|
+
# Relationship allows you to describe the type of BEL Relationship.
|
4
|
+
#
|
5
|
+
# BEL Relationships represent an interaction between a subject and object
|
6
|
+
# in the BEL expression.
|
7
|
+
module Relationship
|
8
|
+
def short
|
9
|
+
raise NotImplementedError, "#{__method__} is not implemented."
|
10
|
+
end
|
11
|
+
|
12
|
+
def long
|
13
|
+
raise NotImplementedError, "#{__method__} is not implemented."
|
14
|
+
end
|
15
|
+
|
16
|
+
def description
|
17
|
+
raise NotImplementedError, "#{__method__} is not implemented."
|
18
|
+
end
|
19
|
+
|
20
|
+
# Indicates whether this relationship is deprecated. Override in your
|
21
|
+
# relationship to mark as deprecated.
|
22
|
+
#
|
23
|
+
# @return [Boolean] false
|
24
|
+
def deprecated?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def ===(other)
|
29
|
+
return false if other.nil?
|
30
|
+
short == other || long == other
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_sym(form = :short)
|
34
|
+
value = _form_value(form)
|
35
|
+
return nil unless value
|
36
|
+
value.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_s(form = :short)
|
40
|
+
value = _form_value(form)
|
41
|
+
return nil unless value
|
42
|
+
value.to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def _form_value(form = :short)
|
48
|
+
case form
|
49
|
+
when :short
|
50
|
+
short
|
51
|
+
when :long
|
52
|
+
long
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative '../
|
1
|
+
require_relative 'semantic_match'
|
2
|
+
require_relative '../quoting'
|
3
|
+
require_relative '../../parsers/ast/node'
|
3
4
|
|
4
5
|
module BELParser
|
5
6
|
module Language
|
@@ -49,29 +50,6 @@ module BELParser
|
|
49
50
|
match_results.flatten
|
50
51
|
end
|
51
52
|
|
52
|
-
# MatchResult holds the results of an input AST to semantic AST match.
|
53
|
-
class MatchResult
|
54
|
-
attr_reader :input_node, :semantic_node
|
55
|
-
|
56
|
-
def initialize(success, input_node, semantic_node)
|
57
|
-
@success = success
|
58
|
-
@input_node = input_node
|
59
|
-
@semantic_node = semantic_node
|
60
|
-
end
|
61
|
-
|
62
|
-
def success?
|
63
|
-
@success
|
64
|
-
end
|
65
|
-
|
66
|
-
def failure?
|
67
|
-
!@success
|
68
|
-
end
|
69
|
-
|
70
|
-
def to_s
|
71
|
-
msg
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
53
|
# Builder contains methods to build semantic AST nodes.
|
76
54
|
# A convenient {Builder.build} method allows you to use these
|
77
55
|
# methods within a block scope.
|
@@ -211,11 +189,11 @@ module BELParser
|
|
211
189
|
end
|
212
190
|
|
213
191
|
def success(node)
|
214
|
-
[
|
192
|
+
[SemanticMatch.new(true, node, self)]
|
215
193
|
end
|
216
194
|
|
217
195
|
def failure(node)
|
218
|
-
[
|
196
|
+
[SemanticMatch.new(false, node, self)]
|
219
197
|
end
|
220
198
|
end
|
221
199
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module BELParser
|
2
|
+
module Language
|
3
|
+
module Semantics
|
4
|
+
# SemanticMatch holds the results of an input AST to semantic AST match.
|
5
|
+
class SemanticMatch
|
6
|
+
attr_reader :input_node, :semantic_node
|
7
|
+
|
8
|
+
def initialize(success, input_node, semantic_node)
|
9
|
+
@success = success
|
10
|
+
@input_node = input_node
|
11
|
+
@semantic_node = semantic_node
|
12
|
+
end
|
13
|
+
|
14
|
+
def success?
|
15
|
+
@success
|
16
|
+
end
|
17
|
+
|
18
|
+
def failure?
|
19
|
+
!@success
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
msg
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -7,43 +7,67 @@ module BELParser
|
|
7
7
|
@indexed_functions[short_or_long_form]
|
8
8
|
end
|
9
9
|
|
10
|
+
def relationship(short_or_long_form)
|
11
|
+
@indexed_relationships[short_or_long_form]
|
12
|
+
end
|
13
|
+
|
10
14
|
def return_type(return_type)
|
11
15
|
@indexed_return_types[return_type]
|
12
16
|
end
|
13
17
|
|
14
18
|
def functions(*short_or_long_form)
|
15
19
|
if short_or_long_form.empty?
|
16
|
-
@functions
|
20
|
+
@functions.freeze
|
17
21
|
else
|
18
22
|
@indexed_functions.values_at(*short_or_long_form)
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
26
|
+
def relationships(*short_or_long_form)
|
27
|
+
if short_or_long_form.empty?
|
28
|
+
@relationships.freeze
|
29
|
+
else
|
30
|
+
@indexed_relationships.values_at(*short_or_long_form)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
22
34
|
def return_types(*return_types)
|
23
35
|
if return_types.empty?
|
24
|
-
@return_types
|
36
|
+
@return_types.freeze
|
25
37
|
else
|
26
38
|
@indexed_return_types.values_at(*return_types)
|
27
39
|
end
|
28
40
|
end
|
29
41
|
|
30
|
-
def
|
42
|
+
def syntax
|
43
|
+
@syntax
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [Array<#long,#short>] language_objects to be indexed by
|
47
|
+
# +long+ and +short+ method return
|
48
|
+
def index_long_short(language_objects)
|
31
49
|
Hash[
|
32
|
-
|
33
|
-
[[
|
50
|
+
language_objects.flat_map do |obj|
|
51
|
+
[[obj.short, obj], [obj.long, obj]]
|
34
52
|
end
|
35
53
|
]
|
36
54
|
end
|
37
|
-
protected :
|
55
|
+
protected :index_long_short
|
38
56
|
|
39
|
-
|
57
|
+
# @param [Array<#to_sym>] language_objects to be indexed by
|
58
|
+
# +to_sym+ method return
|
59
|
+
def index_sym(language_objects)
|
40
60
|
Hash[
|
41
|
-
|
42
|
-
[
|
61
|
+
language_objects.map do |obj|
|
62
|
+
[obj.to_sym, obj]
|
43
63
|
end
|
44
64
|
]
|
45
65
|
end
|
46
|
-
protected :
|
66
|
+
protected :index_sym
|
67
|
+
|
68
|
+
def version
|
69
|
+
@version
|
70
|
+
end
|
47
71
|
end
|
48
72
|
end
|
49
73
|
end
|
File without changes
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# Abundance: Denotes the abundance of an entity
|
11
11
|
class Abundance
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :a
|
15
15
|
LONG = :abundance
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::Abundance
|
17
17
|
DESCRIPTION = 'Denotes the abundance of an entity'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# BiologicalProcess: Denotes a process or population of events
|
11
11
|
class BiologicalProcess
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :bp
|
15
15
|
LONG = :biologicalProcess
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::BiologicalProcess
|
17
17
|
DESCRIPTION = 'Denotes a process or population of events'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# CatalyticActivity: Denotes the frequency or abundance of events where a member acts as an enzymatic catalyst of biochecmial reactions
|
11
11
|
class CatalyticActivity
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :cat
|
15
15
|
LONG = :catalyticActivity
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::CatalyticActivity
|
17
17
|
DESCRIPTION = 'Denotes the frequency or abundance of events where a member acts as an enzymatic catalyst of biochecmial reactions'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -52,7 +52,7 @@ module BELParser
|
|
52
52
|
term(
|
53
53
|
function(
|
54
54
|
identifier(
|
55
|
-
return_type_of(BELParser::Language::
|
55
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::ComplexAbundance))))))
|
56
56
|
end
|
57
57
|
private_constant :AST
|
58
58
|
|
@@ -82,7 +82,7 @@ module BELParser
|
|
82
82
|
term(
|
83
83
|
function(
|
84
84
|
identifier(
|
85
|
-
return_type_of(BELParser::Language::
|
85
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::ProteinAbundance))))))
|
86
86
|
end
|
87
87
|
private_constant :AST
|
88
88
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# CellSecretion: Denotes the frequency or abundance of events in which members of an abundance move from cells to regions outside of the cells
|
11
11
|
class CellSecretion
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :sec
|
15
15
|
LONG = :cellSecretion
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::Abundance
|
17
17
|
DESCRIPTION = 'Denotes the frequency or abundance of events in which members of an abundance move from cells to regions outside of the cells'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -52,7 +52,7 @@ module BELParser
|
|
52
52
|
term(
|
53
53
|
function(
|
54
54
|
identifier(
|
55
|
-
return_type_of(BELParser::Language::
|
55
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::Abundance))))))
|
56
56
|
end
|
57
57
|
private_constant :AST
|
58
58
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# CellSurfaceExpression: Denotes the frequency or abundance of events in which members of an abundance move to the surface of cells
|
11
11
|
class CellSurfaceExpression
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :surf
|
15
15
|
LONG = :cellSurfaceExpression
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::Abundance
|
17
17
|
DESCRIPTION = 'Denotes the frequency or abundance of events in which members of an abundance move to the surface of cells'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -52,7 +52,7 @@ module BELParser
|
|
52
52
|
term(
|
53
53
|
function(
|
54
54
|
identifier(
|
55
|
-
return_type_of(BELParser::Language::
|
55
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::Abundance))))))
|
56
56
|
end
|
57
57
|
private_constant :AST
|
58
58
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# ChaperoneActivity: Denotes the frequency or abundance of events in which a member binds to some substrate and acts as a chaperone for the substrate
|
11
11
|
class ChaperoneActivity
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :chap
|
15
15
|
LONG = :chaperoneActivity
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::ChaperoneActivity
|
17
17
|
DESCRIPTION = 'Denotes the frequency or abundance of events in which a member binds to some substrate and acts as a chaperone for the substrate'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -52,7 +52,7 @@ module BELParser
|
|
52
52
|
term(
|
53
53
|
function(
|
54
54
|
identifier(
|
55
|
-
return_type_of(BELParser::Language::
|
55
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::ComplexAbundance))))))
|
56
56
|
end
|
57
57
|
private_constant :AST
|
58
58
|
|
@@ -82,7 +82,7 @@ module BELParser
|
|
82
82
|
term(
|
83
83
|
function(
|
84
84
|
identifier(
|
85
|
-
return_type_of(BELParser::Language::
|
85
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::ProteinAbundance))))))
|
86
86
|
end
|
87
87
|
private_constant :AST
|
88
88
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# ComplexAbundance: Denotes the abundance of a molecular complex
|
11
11
|
class ComplexAbundance
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :complex
|
15
15
|
LONG = :complexAbundance
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::ComplexAbundance
|
17
17
|
DESCRIPTION = 'Denotes the abundance of a molecular complex'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -87,7 +87,7 @@ module BELParser
|
|
87
87
|
term(
|
88
88
|
function(
|
89
89
|
identifier(
|
90
|
-
return_type_of(BELParser::Language::
|
90
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::Abundance))))))
|
91
91
|
end
|
92
92
|
private_constant :AST
|
93
93
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# CompositeAbundance: Denotes the frequency or abundance of events in which members are present
|
11
11
|
class CompositeAbundance
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :composite
|
15
15
|
LONG = :compositeAbundance
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::Abundance
|
17
17
|
DESCRIPTION = 'Denotes the frequency or abundance of events in which members are present'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -52,7 +52,7 @@ module BELParser
|
|
52
52
|
term(
|
53
53
|
function(
|
54
54
|
identifier(
|
55
|
-
return_type_of(BELParser::Language::
|
55
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::Abundance))))))
|
56
56
|
end
|
57
57
|
private_constant :AST
|
58
58
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# Degradation: Denotes the frequency or abundance of events in which a member is degraded in some way such that it is no longer a member
|
11
11
|
class Degradation
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :deg
|
15
15
|
LONG = :degradation
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::Abundance
|
17
17
|
DESCRIPTION = 'Denotes the frequency or abundance of events in which a member is degraded in some way such that it is no longer a member'.freeze
|
18
18
|
|
19
19
|
def self.short
|
@@ -52,7 +52,7 @@ module BELParser
|
|
52
52
|
term(
|
53
53
|
function(
|
54
54
|
identifier(
|
55
|
-
return_type_of(BELParser::Language::
|
55
|
+
return_type_of(BELParser::Language::Version1_0::ReturnTypes::Abundance))))))
|
56
56
|
end
|
57
57
|
private_constant :AST
|
58
58
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require_relative '../../
|
1
|
+
require_relative '../../version1_0'
|
2
2
|
require_relative '../../function'
|
3
3
|
require_relative '../../signature'
|
4
|
-
require_relative '../../
|
4
|
+
require_relative '../../semantics'
|
5
5
|
|
6
6
|
module BELParser
|
7
7
|
module Language
|
8
|
-
module
|
8
|
+
module Version1_0
|
9
9
|
module Functions
|
10
10
|
# Fusion: Specifies the abundance of a protein translated from the fusion of a gene
|
11
11
|
class Fusion
|
@@ -13,7 +13,7 @@ module BELParser
|
|
13
13
|
|
14
14
|
SHORT = :fus
|
15
15
|
LONG = :fusion
|
16
|
-
RETURN_TYPE = BELParser::Language::
|
16
|
+
RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::Fusion
|
17
17
|
DESCRIPTION = 'Specifies the abundance of a protein translated from the fusion of a gene'.freeze
|
18
18
|
|
19
19
|
def self.short
|