bel_parser 1.0.0.alpha.11 → 1.0.0.alpha.12

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 102eb6c434bb351a77b6c48cb79819b4bbd6c02d
4
- data.tar.gz: a018453c3f5a83b1ec952460c58462f9086b05c5
3
+ metadata.gz: b28b03b903a5a3a1a62f4c36063c81292714cbd6
4
+ data.tar.gz: 631a26bb0628a77abc19f4c35a028b6851939838
5
5
  SHA512:
6
- metadata.gz: fe0528010d3ad24d9afa719bf8509965b5f9ee447049d67a27ca412b96d5781a8ba54de98d100a710648e60120a3195e2d7531ac0d332f7aa7d0a6d2d8d3b658
7
- data.tar.gz: d85096c8ffacc3b2887b43907949c36c155d26a925f7fa41e0ccee3138c902858be4898e9689d67c4db3c18e2e4d84b5d5b90df6cdb379718d7358571d7382f3
6
+ metadata.gz: cb71fff841dfba8b106cd03e5929fd7ff353796c17155b18703f481a142d2c67886c1322cca1a6d9443f278a104e0fcc57dc5205249624482ef6a47a080d3c81
7
+ data.tar.gz: 2349ecf4f921f28c9b9431cd9b6f66369b46e94aa3dc27eb27c0f95f5945ce1e98eb686bd4538bf85fbc2c7c65de66292b10b82afb38d0068723bf7d68e240f6
data/.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  'Anthony Bargnesi',
12
12
  'Nick Bargnesi',
13
13
  ]
14
- spec.date = %q{2016-04-14}
14
+ spec.date = %q{2016-04-15}
15
15
  spec.email = %q{abargnesi@selventa.com}
16
16
  spec.files = [
17
17
  Dir.glob('lib/**/*.{rb,rl}'),
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.alpha.11
1
+ 1.0.0.alpha.12
@@ -0,0 +1,56 @@
1
+ module BELParser
2
+ module Language
3
+ # CovalentProteinModification defines a controlled vocabulary of
4
+ # post-translational protein modifications.
5
+ #
6
+ # see https://en.wikipedia.org/wiki/Post-translational_modification
7
+ module CovalentProteinModification
8
+ Acetylation = [:Acetylation, :A].freeze
9
+ Farnesylation = [:Farnesylation, :F].freeze
10
+ Glycosylation = [:Glycosylation, :G].freeze
11
+ Hydroxylation = [:Hydroxylation, :H].freeze
12
+ Methylation = [:Methylation, :M].freeze
13
+ Phosphorylation = [:Phosphorylation, :P].freeze
14
+ Ribosylation = [:Ribosylation, :R].freeze
15
+ Sumoylation = [:Sumoylation, :S].freeze
16
+ Ubiquitination = [:Ubiquitination, :U].freeze
17
+
18
+ # Determines if +sym+ represents a covalent protein modification.
19
+ #
20
+ # @param [#to_sym] sym covalent protein modification code
21
+ # @return [Boolean] +true+ if +sym+ code is included in supported
22
+ # covalent protein modifications; +false+ if not supported
23
+ def self.includes?(sym)
24
+ @hash.key?(sym.to_sym)
25
+ end
26
+
27
+ # Gets all supported covalent protein modification.
28
+ def self.names
29
+ @names
30
+ end
31
+
32
+ # Gets all supported covalent protein modification (i.e. name, 1-Letter).
33
+ def self.values
34
+ @values
35
+ end
36
+
37
+ unless defined? @hash
38
+ @hash = {}
39
+ constants.map(&method(:const_get)).each do |values|
40
+ @hash.update(
41
+ Hash[values.map { |v| [v, values.first] }]
42
+ )
43
+ end
44
+ @hash.freeze
45
+ end
46
+
47
+ unless defined? @names
48
+ @names = constants.map(&method(:const_get)).map(&:first).sort.freeze
49
+ end
50
+
51
+ unless defined? @values
52
+ @values = constants.map(&method(:const_get)).map(&:to_a).flatten.freeze
53
+ end
54
+ end
55
+ end
56
+ end
@@ -154,8 +154,8 @@ module BELParser
154
154
  SemanticEncodingOf.new(encoding_types, **properties)
155
155
  end
156
156
 
157
- def covalent_modification_of(*covalent_mod_types, **properties)
158
- SemanticCovalentModificationOf.new(covalent_mod_types, **properties)
157
+ def covalent_protein_modification_of(*mod_types, **properties)
158
+ SemanticCovalentProteinModificationOf.new(mod_types, **properties)
159
159
  end
160
160
 
161
161
  def amino_acid_of(*amino_acids, **properties)
@@ -546,14 +546,14 @@ module BELParser
546
546
  end
547
547
  end
548
548
 
549
- # AST node for CovalentModificationOf is a semantic AST.
550
- class SemanticCovalentModificationOf < SemanticASTNode
551
- def initialize(covalent_mod_types, **properties)
552
- properties[:hashed] = Hash[covalent_mod_types.map { |t| [t, true] }]
553
- super(:covalent_modification_of, covalent_mod_types, properties)
549
+ # AST node for CovalentProteinModificationOf is a semantic AST.
550
+ class SemanticCovalentProteinModificationOf < SemanticASTNode
551
+ def initialize(mod_types, **properties)
552
+ properties[:hashed] = Hash[mod_types.map { |t| [t, true] }]
553
+ super(:covalent_protein_modification_of, mod_types, properties)
554
554
  end
555
555
 
556
- def covalent_mod_types
556
+ def covalent_protein_modification_types
557
557
  children
558
558
  end
559
559
 
@@ -2,6 +2,7 @@ require_relative '../../version1_0'
2
2
  require_relative '../../function'
3
3
  require_relative '../../signature'
4
4
  require_relative '../../amino_acid'
5
+ require_relative '../../covalent_protein_modification'
5
6
  require_relative '../../semantics'
6
7
 
7
8
  module BELParser
@@ -15,7 +16,8 @@ module BELParser
15
16
 
16
17
  SHORT = :pmod
17
18
  LONG = :proteinModification
18
- RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::ProteinModification
19
+ RETURN_TYPE = BELParser::Language::Version1_0::ReturnTypes::
20
+ ProteinModification
19
21
  DESCRIPTION = 'Denotes a covalently modified protein
20
22
  bundance'.freeze
21
23
 
@@ -57,7 +59,8 @@ module BELParser
57
59
  any),
58
60
  value(
59
61
  value_type(
60
- encoding_of(:*))))),
62
+ covalent_protein_modification_of(
63
+ *CovalentProteinModification.values))))),
61
64
  argument(
62
65
  parameter(
63
66
  prefix(
@@ -76,8 +79,12 @@ module BELParser
76
79
  private_constant :AST
77
80
 
78
81
  STRING_FORM =
79
- 'proteinModification(E:*,T:AminoAcid,E:*)proteinModification'
80
- .freeze
82
+ <<-SIG.delete("\s\n").freeze
83
+ proteinModification(
84
+ T:CovalentProteinModification,
85
+ T:AminoAcid,
86
+ T:SequencePosition)proteinModification
87
+ SIG
81
88
  private_constant :STRING_FORM
82
89
 
83
90
  def self.semantic_ast
@@ -106,7 +113,8 @@ module BELParser
106
113
  any),
107
114
  value(
108
115
  value_type(
109
- encoding_of(:*))))),
116
+ covalent_protein_modification_of(
117
+ *CovalentProteinModification.values))))),
110
118
  argument(
111
119
  parameter(
112
120
  prefix(
@@ -118,8 +126,11 @@ module BELParser
118
126
  private_constant :AST
119
127
 
120
128
  STRING_FORM =
121
- 'proteinModification(E:*,T:AminoAcid)proteinModification'
122
- .freeze
129
+ <<-SIG.delete("\s\n").freeze
130
+ proteinModification(
131
+ T:CovalentProteinModification,
132
+ T:AminoAcid)proteinModification
133
+ SIG
123
134
  private_constant :STRING_FORM
124
135
 
125
136
  def self.semantic_ast
@@ -148,11 +159,16 @@ module BELParser
148
159
  any),
149
160
  value(
150
161
  value_type(
151
- encoding_of(:*))))))
162
+ covalent_protein_modification_of(
163
+ *CovalentProteinModification.values))))))
152
164
  end
153
165
  private_constant :AST
154
166
 
155
- STRING_FORM = 'proteinModification(E:*)proteinModification'.freeze
167
+ STRING_FORM =
168
+ <<-SIG.delete("\s\n").freeze
169
+ proteinModification(
170
+ T:CovalentProteinModification)proteinModification
171
+ SIG
156
172
  private_constant :STRING_FORM
157
173
 
158
174
  def self.semantic_ast
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bel_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.11
4
+ version: 1.0.0.alpha.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Bargnesi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-14 00:00:00.000000000 Z
12
+ date: 2016-04-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Implements language versions 1.0 and 2.0.
15
15
  email: abargnesi@selventa.com
@@ -31,6 +31,7 @@ files:
31
31
  - lib/bel_parser/expression/validator.rb
32
32
  - lib/bel_parser/language.rb
33
33
  - lib/bel_parser/language/amino_acid.rb
34
+ - lib/bel_parser/language/covalent_protein_modification.rb
34
35
  - lib/bel_parser/language/expression_validator.rb
35
36
  - lib/bel_parser/language/function.rb
36
37
  - lib/bel_parser/language/quoting.rb