rubabel 0.1.1 → 0.1.5

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/Rakefile CHANGED
@@ -16,7 +16,6 @@ interface attempts to be a ruby-ish analogue of pybel.}
16
16
  gem.authors = ["John T. Prince"]
17
17
  [
18
18
  ["openbabel", "~> 2.3.1.2"],
19
- ["commander", "~> 4.1.2"],
20
19
  ["andand", "~> 1.3.3"]
21
20
  ].each do |args|
22
21
  gem.add_dependency(*args)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.5
data/bin/fragmenter.rb ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'trollop'
4
+ require 'rubabel'
5
+ require 'rubabel/molecule/fragmentable'
6
+
7
+
8
+ parser = Trollop::Parser.new do
9
+ banner "usage: #{File.basename($0)} [OPTIONS|RULES] <SMARTS> ..."
10
+ text "\noptions:"
11
+ opt :ph, "the pH to use (experimental option)", :default => Rubabel::Molecule::Fragmentable::DEFAULT_OPTIONS[:ph]
12
+ #opt :uniq, "no repeated fragments", :default => false
13
+ text "\nrules:"
14
+ Rubabel::Molecule::Fragmentable::RULES.each do |rule|
15
+ opt rule, rule.to_s.gsub("_",' ')
16
+ end
17
+ text "\nexample:"
18
+ text "fragmenter.rb -aecsoxn 'CCC(=O)OCCC' 'CCC(=O)OCCC(=O)O'"
19
+ end
20
+
21
+ rules = parser.parse(ARGV)
22
+ options = {rules: []}
23
+ options[:ph] = rules.delete(:ph)
24
+ options[:uniq] = rules.delete(:uniq)
25
+ rules.each do |k,v|
26
+ options[:rules] << k if v && k.to_s !~ /_given/
27
+ end
28
+
29
+ if ARGV.size == 0
30
+ parser.educate && exit
31
+ end
32
+
33
+ ARGV.each do |mol|
34
+ mol = Rubabel[mol]
35
+ puts "\nmolecule: #{mol.csmiles}"
36
+ fragment_sets = mol.fragment(options)
37
+ fragment_sets.each do |frag_set|
38
+ puts ""
39
+ frag_set.each do |frag|
40
+ puts "#{frag.mass.round(5)} #{frag.csmiles}"
41
+ end
42
+ end
43
+ end
data/lib/rubabel.rb CHANGED
@@ -146,3 +146,5 @@ if(success)
146
146
  }
147
147
  }
148
148
  =end
149
+
150
+
data/lib/rubabel/bond.rb CHANGED
@@ -14,12 +14,23 @@ module Rubabel
14
14
  include Enumerable
15
15
 
16
16
  class << self
17
- def [](atom1, atom2)
17
+ =begin
18
+ def [](atom1, atom2, bond_order=1, index=0)
19
+ abort 'cannot get bond generated properly yet, arghhh!'
20
+ flags = 0
18
21
  obbond = OpenBabel::OBBond.new
19
- obbond.set_begin(atom1.ob)
20
- obbond.set_end(atom2.ob)
22
+ p obbond
23
+ obbond.set(index, atom1.ob, atom2.ob, bond_order, flags)
24
+ #obbond.set_end(atom2.ob)
25
+ p obbond
26
+ puts "GEGIN:"
27
+ p obbond.get_begin_atom.get_id
28
+ puts "END:"
29
+ p obbond.get_end_atom.get_id
30
+ obbond.set_bond_order(bond_order)
21
31
  self.new(obbond)
22
32
  end
33
+ =end
23
34
  end
24
35
 
25
36
  attr_accessor :ob
@@ -0,0 +1,13 @@
1
+
2
+ module Enumerable
3
+ # File activesupport/lib/active_support/core_ext/enumerable.rb, line 94
4
+ def index_by
5
+ return to_enum :index_by unless block_given?
6
+ Hash[map { |elem| [yield(elem), elem] }]
7
+ end
8
+
9
+ def uniq_by
10
+ h = {}
11
+ inject([]) {|a,x| h[yield(x)] ||= a << x}
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+
2
+ # puts if $VERBOSE
3
+ def putsv(*args)
4
+ if $VERBOSE
5
+ puts(*args)
6
+ end
7
+ end
8
+
9
+ # puts to $stderr if $VERBOSE
10
+ def putsev(*args)
11
+ if $VERBOSE
12
+ $stderr.puts(*args)
13
+ end
14
+ end
@@ -41,8 +41,22 @@ module Rubabel
41
41
  def from_string(string, type=DEFAULT_IN_TYPE)
42
42
  Rubabel.molecule_from_string(string, type)
43
43
  end
44
+
45
+ def from_atoms_and_bonds(atoms=[], bonds=[])
46
+ obj = self.new( OpenBabel::OBMol.new )
47
+ atoms.each {|atom| obj.add_atom(atom) }
48
+ bonds.each {|bond| obj.add_bond(bond) }
49
+ obj
50
+ end
51
+ end
52
+
53
+ def add_atom(atom)
54
+ @ob.add_atom(atom.ob)
44
55
  end
45
56
 
57
+ def delete_atom(atom)
58
+ @ob.delete_atom(atom.ob, false)
59
+ end
46
60
 
47
61
  # attributes
48
62
  def title() @ob.get_title end
@@ -69,8 +83,8 @@ module Rubabel
69
83
 
70
84
 
71
85
  def initialize(obmol, obconv=nil)
72
- @obconv = obconv
73
86
  @ob = obmol
87
+ @obconv = obconv
74
88
  end
75
89
 
76
90
  # returns a list of atom indices matching the patterns (corresponds to
@@ -267,20 +281,43 @@ module Rubabel
267
281
  def delete(obj)
268
282
  case obj
269
283
  when Rubabel::Bond
270
- delete_bond(obj)
284
+ delete_bond(obj, false)
271
285
  when Rubabel::Atom
272
- delete_atom(obj)
286
+ delete_atom(obj, false)
273
287
  else
274
288
  raise(ArgumentError, "don't know how to delete objects of type: #{obj.class}")
275
289
  end
276
290
  end
277
291
 
278
292
  def delete_bond(bond)
279
- @ob.delete_bond(bond.ob)
293
+ @ob.delete_bond(bond.ob, false)
280
294
  end
281
295
 
282
296
  def delete_atom(atom)
283
- @ob.delete_atom(atom.ob)
297
+ @ob.delete_atom(atom.ob, false)
298
+ end
299
+
300
+ # swaps to_move1 for to_move2 on the respective anchors
301
+ # returns self
302
+ def swap!(anchor1, to_move1, anchor2, to_move2)
303
+ OpenBabel::OBBuilder.swap(@ob, *[anchor1, to_move1, anchor2, to_move2].map {|at| at.ob.get_idx } )
304
+ self
305
+ end
306
+
307
+ # takes a Rubabel::Bond object or a pair of Rubabel::Atom objects
308
+ def add_bond(*args)
309
+ case args.size
310
+ when 1
311
+ ob_bond = args.first.ob
312
+ @ob.add_bond(ob_bond)
313
+ ob_bond.get_begin_atom.add_bond(ob_bond)
314
+ ob_bond.get_end_atom.add_bond(ob_bond)
315
+ when 2
316
+ ob_bond = Rubabel::Bond[ *args ].ob
317
+ ob_bond.get_begin_atom.add_bond(ob_bond)
318
+ ob_bond.get_end_atom.add_bond(ob_bond)
319
+ @ob.add_bond(ob_bond)
320
+ end
284
321
  end
285
322
 
286
323
  # yields self after deleting the specified bonds. When the block is
@@ -297,6 +334,8 @@ module Rubabel
297
334
  reply
298
335
  end
299
336
 
337
+ # splits the molecules at the given bonds and returns the fragments. Does
338
+ # not alter the caller.
300
339
  def split(*bonds)
301
340
  delete_and_restore_bonds(*bonds) do |mol|
302
341
  mol.ob.separate.map(&:upcast)
@@ -1,9 +1,19 @@
1
+ require 'set'
2
+ require 'rubabel/core_ext/putsv'
3
+ require 'rubabel/core_ext/enumerable'
1
4
 
2
5
  module Rubabel
3
6
  class Molecule
4
7
  module Fragmentable
5
- RULES = [:co]
8
+
9
+ #:sp3c_oxygen_asymmetric_far_sp3, :sp3c_nitrogen_asymmetric_far_sp3,
10
+ RULES = Set[ :alcohol_to_aldehyde, :peroxy_to_carboxy, :co2_loss,
11
+ :sp3c_oxygen_double_bond_far_side_sp3, :sp3c_oxygen_double_bond_far_side_sp2, :sp3c_oxygen_double_bond_water_loss, :sp3c_nitrogen_double_bond,
12
+ ]
6
13
  #ADDUCTS = [:lioh, :nh4cl, :nh4oh]
14
+ CO_RULES = Set[:alcohol_to_aldehyde, :peroxy_to_carboxy, :co2_loss,
15
+ :sp3c_oxygen_double_bond_water_loss, :sp3c_oxygen_double_bond_far_side_sp2, :sp3c_oxygen_double_bond_far_side_sp3, :sp3c_oxygen_asymmetric_far_sp3
16
+ ]
7
17
 
8
18
  DEFAULT_OPTIONS = {
9
19
  rules: RULES,
@@ -24,21 +34,124 @@ module Rubabel
24
34
  self.num_atoms == frags.map(&:num_atoms).reduce(:+)
25
35
  end
26
36
 
37
+ # add_h! to self, then selects allowable fragments
38
+ def allowable_fragment_sets!(fragment_sets)
39
+ self.add_h!
40
+ fragment_sets.select do |_frags|
41
+ putsv "ExMAIN:"
42
+ putsv _frags.inspect
43
+ putsv self.allowable_fragmentation?(_frags)
44
+ self.allowable_fragmentation?(_frags)
45
+ end
46
+ end
47
+
27
48
  # will turn bond into a double bond, yield the changed molecule, then
28
49
  # return the bond to the original state when the block is closed
29
50
  # returns whatever the block returned
30
- def feint_double_bond(bond, &block)
51
+ def feint_double_bond(bond, give_e_pair=nil, get_e_pair=nil, &block)
31
52
  orig = bond.bond_order
32
53
  bond.bond_order = 2
33
- reply = block.call(self)
54
+ reply =
55
+ if give_e_pair || get_e_pair
56
+ feint_e_transfer(give_e_pair, get_e_pair, &block)
57
+ else
58
+ block.call(self)
59
+ end
34
60
  bond.bond_order = orig
35
61
  reply
36
62
  end
37
63
 
64
+ # warning, this method adds_h! to the calling molecule
65
+ def electrophile_snatches_electrons(carbon, electrophile)
66
+ self.add_h!
67
+ frags = self.split(carbon.get_bond(electrophile))
68
+ raise NotImplementedError
69
+ # don't check for allowable fragments because it
70
+ #allowable_fragment_sets!([frag_set])
71
+ end
72
+
73
+ def feint_e_transfer(give_e_pair=nil, get_e_pair=nil, &block)
74
+ if give_e_pair
75
+ gc_orig = give_e_pair.charge
76
+ give_e_pair.charge = gc_orig + 1
77
+ end
78
+ if get_e_pair
79
+ rc_orig = get_e_pair.charge
80
+ get_e_pair.charge = rc_orig - 1
81
+ end
82
+
83
+ reply = block.call(self)
84
+
85
+ give_e_pair.charge = gc_orig if give_e_pair
86
+ get_e_pair.charge = rc_orig if get_e_pair
87
+
88
+ reply
89
+ end
90
+
91
+ def near_side_double_bond_break(carbon, electrophile)
92
+ frag_sets = carbon.atoms.select {|atom| atom.type == "C3" }.map do |near_c3|
93
+ frags = feint_double_bond(carbon.get_bond(near_c3)) do |_mol|
94
+ frags = _mol.split(electrophile.get_bond(carbon))
95
+ frags.map(&:add_h!)
96
+ end
97
+ end
98
+ allowable_fragment_sets!(frag_sets)
99
+ end
100
+
101
+ def alcohol_to_aldehyde(carbon, oxygen, carbon_nbrs)
102
+ # alcohol becomes a ketone and one R group is released
103
+ frag_sets = carbon_nbrs.select {|atom| atom.type == 'C3' }.map do |_atom|
104
+ frags = feint_double_bond(carbon.get_bond(oxygen)) do |_mol|
105
+ frags = _mol.split(carbon.get_bond(_atom))
106
+ frags.map(&:add_h!)
107
+ end
108
+ end
109
+ allowable_fragment_sets!(frag_sets)
110
+ end
111
+
112
+ def co2_loss(carbon, oxygen, c3_nbr)
113
+ # carboxyl rules ...
114
+ # neutral carbon dioxide loss with anion gain on attaching group
115
+ # (if carbon)
116
+ frags = feint_double_bond(carbon.get_bond(oxygen), oxygen, c3_nbr) do |_mol|
117
+ frags = _mol.split(c3_nbr.get_bond(carbon))
118
+ frags.map(&:add_h!)
119
+ end
120
+ allowable_fragment_sets!([frags])
121
+ end
122
+
123
+ def peroxy_to_carboxy(carbon, oxygen, carbon_nbrs, oxygen_nbr)
124
+ if oxygen_nbr.el == :o # has a neighbor oxygen
125
+ distal_o = oxygen_nbr
126
+ if distal_o.bonds.size == 1 # this is a peroxy
127
+ frag_sets = carbon_nbrs.select {|atom| atom.type == 'C3' }.map do |_atom|
128
+ self.swap!(carbon, _atom, oxygen, distal_o)
129
+ frags = feint_double_bond(carbon.get_bond(oxygen)) do |_mol|
130
+
131
+ # we swapped the atoms so the bond to split off is now
132
+ # attached to the oxygen
133
+ frags = _mol.split(oxygen.get_bond(_atom))
134
+ frags.map(&:add_h!)
135
+ end
136
+ self.swap!(carbon, distal_o, oxygen, _atom)
137
+ frags
138
+ end
139
+ allowable_fragment_sets!(frag_sets)
140
+ end
141
+ end
142
+
143
+ end
144
+
38
145
  # to ensure proper fragmentation, will add_h!(ph) first at the given ph
39
146
  # an empty array is returned if there are no fragments generated.
147
+ #
148
+ # :ph => 7.4
149
+ # :uniq => false
40
150
  def fragment(opts={})
41
151
  opts = DEFAULT_OPTIONS.merge(opts)
152
+ opts[:rules].each do |rule|
153
+ raise ArgumentError, "bad rule: #{rule}" unless RULES.include?(rule)
154
+ end
42
155
 
43
156
  had_hydrogens = self.h_added?
44
157
 
@@ -46,84 +159,94 @@ module Rubabel
46
159
  self.remove_h!
47
160
 
48
161
  rules = opts[:rules]
49
- fragments = []
50
- self.each_match("CO").each do |_atoms|
51
- (carbon, oxygen) = _atoms
52
- carbon_nbrs = carbon.atoms.reject {|atom| atom == oxygen }
53
- c3_nbrs = carbon_nbrs.select {|atm| atm.type == 'C3' }
54
- c2_nbrs = carbon_nbrs.select {|atm| atm.type == 'C2' }
55
- num_oxygen_bonds = oxygen.bonds.size
56
- # pulling this out here causes it to work incorrectly internally
57
- # (not sure why)
58
- #co_bond = carbon.get_bond(oxygen)
59
-
60
- case num_oxygen_bonds
61
- when 1 # an alcohol
62
- # water loss
63
- if (c3_nbrs.size > 0 || c2_nbrs.size > 0) && !carbon.carboxyl_carbon?
64
- if rules.include?(:h2oloss)
65
- frag_sets = (c2_nbrs + c3_nbrs).map do |dbl_bondable_atom|
66
- frags = feint_double_bond(dbl_bondable_atom.get_bond(carbon)) do |_mol|
67
- # TODO: check accuracy before completely splitting for efficiency
68
- frags = _mol.split(carbon.get_bond(oxygen))
69
- frags.map(&:add_h!)
70
- end
71
- end
162
+ fragment_sets = []
163
+ if rules.any? {|rule| CO_RULES.include?(rule) }
164
+ putsv "matching C-O"
165
+ self.each_match("CO").each do |_atoms|
166
+ # note: this will *not* match C=O
167
+ (carbon, oxygen) = _atoms
168
+ carbon_nbrs = carbon.atoms.reject {|atom| atom == oxygen }
169
+ c3_nbrs = carbon_nbrs.select {|atm| atm.type == 'C3' }
170
+ # pulling this out here causes it to work incorrectly internally
171
+ # (not sure why)
172
+ #co_bond = carbon.get_bond(oxygen)
72
173
 
73
- self.add_h!
74
- frag_sets.select! do |_frags|
75
- self.allowable_fragmentation?(_frags)
174
+ case oxygen.bonds.size # non-hydrogen bonds
175
+ when 1 # *must* be an alcohol or a carboxylic acid
176
+ putsv "#{csmiles} oxygen has no other bonds besides C-O (alcohol or carboxylic acid)"
177
+ if carbon.type == 'C3'
178
+ if rules.include?(:sp3c_oxygen_double_bond_water_loss)
179
+ putsv "rule :sp3c_oxygen_double_bond_water_loss"
180
+ fragment_sets.push *near_side_double_bond_break(carbon, oxygen)
76
181
  end
77
- fragments.push *frag_sets
78
- end
79
- if rules.include?(:co)
80
- # alcohol becomes a ketone and one R group is released
81
- frag_sets = c3_nbrs.map do |neighbor_atom|
82
- frags = feint_double_bond(carbon.get_bond(oxygen)) do |_mol|
83
- frags = _mol.split(carbon.get_bond(neighbor_atom))
84
- frags.map(&:add_h!)
85
- end
182
+ if rules.include?(:alcohol_to_aldehyde)
183
+ putsv "rule :alcohol_to_aldehyde"
184
+ fragment_sets.push *alcohol_to_aldehyde(carbon, oxygen, carbon_nbrs)
86
185
  end
87
-
88
- self.add_h!
89
- frag_sets.select! do |_frags|
90
- self.allowable_fragmentation?(_frags)
186
+ elsif carbon.carboxyl_carbon?
187
+ if rules.include?(:co2_loss)
188
+ putsv "rule :co2_loss"
189
+ if c3_nbr = c3_nbrs.first
190
+ fragment_sets.push *co2_loss(carbon, oxygen, c3_nbr)
191
+ end
91
192
  end
92
- fragments.push *frag_sets
93
193
  end
194
+ when 2
195
+ putsv "#{csmiles} c-o & oxygen has 2 non-hydrogen bonds"
196
+ oxygen_nbr = oxygen.atoms.reject {|atom| atom.idx == carbon.idx }.first
197
+ if carbon.type == 'C3'
198
+ if rules.include?(:peroxy_to_carboxy)
199
+ fragment_sets.push *peroxy_to_carboxy(carbon, oxygen, carbon_nbrs, oxygen_nbr)
200
+ end
201
+ # ester and ethers (look *only* on close side for places to make
202
+ # double bond)
94
203
 
95
- if rules.include?(:co) && (num_oxygen_bonds == 2)
96
- if oxygen
97
-
98
-
99
- # alcohol becomes a ketone and one R group is released
100
- frag_sets = c3_nbrs.map do |neighbor_atom|
101
- frags = feint_double_bond(carbon.get_bond(oxygen)) do |_mol|
102
- frags = _mol.split(carbon.get_bond(neighbor_atom))
103
- frags.map(&:add_h!)
104
- end
204
+ if oxygen_nbr.type == 'C3'
205
+ putsv "oxygen nbr is C3"
206
+ if rules.include?(:sp3c_oxygen_double_bond_far_side_sp3)
207
+ putsv "rule :sp3c_oxygen_double_bond_far_side_sp3"
208
+ fragment_sets.push *near_side_double_bond_break(carbon, oxygen)
105
209
  end
106
-
107
- self.add_h!
108
- frag_sets.select! do |_frags|
109
- self.allowable_fragmentation?(_frags)
210
+ if rules.include?(:sp3c_oxygen_asymmetric_far_sp3)
211
+ putsv "rule :sp3c_oxygen_asymmetric_far_sp3"
212
+ # only returns a single frag set
213
+ fragment_sets.push electrophile_snatches_electrons(carbon, oxygen)
110
214
  end
111
- fragments.push *frag_sets
112
215
  end
113
-
216
+ if oxygen_nbr.type == 'C2'
217
+ if rules.include?(:sp3c_oxygen_double_bond_far_side_sp2)
218
+ putsv "rule :sp3c_oxygen_double_bond_far_side_sp2"
219
+ fragment_sets.push *near_side_double_bond_break(carbon, oxygen)
220
+ end
221
+ end
222
+ # note: the case of a carboxy is found with CO search
223
+ end
224
+ end
225
+ end
226
+ end
227
+ if rules.include?(:sp3c_nitrogen_double_bond)
228
+ self.each_match("CN") do |_atoms|
229
+ (carbon, nitrogen) = _atoms
230
+ num_nitrogen_bonds = nitrogen.bonds.size
231
+ case num_nitrogen_bonds
232
+ when 2
233
+ if carbon.type == 'C3'
234
+ fragment_sets.push *near_side_double_bond_break(carbon, nitrogen)
114
235
  end
115
236
  end
116
- # oxygen bonded to something else (per-oxide??)
117
- # also could be ether situation...
118
- when 2
119
- raise NotImplementedError
120
237
  end
121
238
  end
239
+
122
240
  unless had_hydrogens
123
- fragments.each {|set| set.each(&:remove_h!) }
241
+ fragment_sets.each {|set| set.each(&:remove_h!) }
124
242
  self.remove_h!
125
243
  end
126
- fragments
244
+ if opts[:uniq]
245
+ # TODO: impelent properly
246
+ #fragment_sets = fragment_sets.uniq_by(&:csmiles)
247
+ raise NotImplementedError
248
+ end
249
+ fragment_sets
127
250
  end
128
251
 
129
252
  end
@@ -131,79 +254,3 @@ module Rubabel
131
254
  end
132
255
  end
133
256
 
134
-
135
- # co_bond = carbon.get_bond(oxygen)
136
- # left_to_c_bond = carbon.get_bond(left)
137
- # right_to_c_bond = carbon.get_bond(right)
138
- #
139
- # co_bond.bond_order = 2
140
- #
141
- # [left_to_c_bond, right_to_c_bond].flat_map do |other_to_c_bond|
142
- # mol.ob.delete_bond(other_to_c_bond.ob, false)
143
- # pieces = mol.ob.separate.map(&:upcast)
144
- # mol.ob.add_bond(other_to_c_bond.ob)
145
- # pieces
146
- # end
147
-
148
-
149
- =begin
150
-
151
- # duplicate the molecule so we can do what we like with it
152
- mol = self.dup
153
-
154
- has_hydrogens_added = h_added?
155
- mol.remove_h! if has_hydrogens_added
156
-
157
- mol.correct_for_ph!(opts[:ph])
158
-
159
- rules = opts[:rules]
160
- fragments = []
161
- if rules.include?(:co)
162
- mol.each_match("C(O)").flat_map do |_atoms|
163
- carbon = _atoms.first
164
- non_oxygen = carbon.each_bond.reject {|bond| bond.include?(_atoms.last) }
165
- non_oxygen.each {|bond| p mol.split(bond) }
166
-
167
- fragments.push *non_oxygen.flat_map {|bond| mol.split(bond) }
168
- end
169
- end
170
- p fragments
171
- abort 'here'
172
- fragments.each(&:add_h!) if has_hydrogens_added
173
- fragments
174
- end
175
- end
176
-
177
- =end
178
-
179
-
180
- # [[left_to_c_bond, left], [right_to_c_bond, right]].flat_map do |other_to_carbony_c, other|
181
- # puts "INSIDE!!!"
182
- # pieces = mol.split(other_to_carbony_c)
183
- # c_in_pieces = nil
184
- # oxy_in_pieces = nil
185
- # other_in_pieces = nil
186
- # pieces.each do |piece|
187
- # piece.each_atom do |atom|
188
- # p piece
189
- # p [atom.id, other.id]
190
- # other_in_pieces = atom if atom.id == other.id
191
- # c_in_pieces = atom if atom.id == carbon.id
192
- # oxy_in_pieces = atom if atom.id == oxygen.id
193
- # break if c_in_pieces && oxy_in_pieces
194
- # end
195
- # break if c_in_pieces && oxy_in_pieces
196
- # end
197
- # oxygen_bond = c_in_pieces.get_bond(oxy_in_pieces)
198
- # oxygen_bond.bond_order = 2
199
- #
200
- # puts "EXAMINE:other"
201
- # p other_in_pieces.ob
202
- # p other_in_pieces.mol.csmiles
203
- # other_mol = other_in_pieces.mol
204
- # ob_atom = other_mol.ob.new_atom
205
- # ob_atom.set_atomic_num 1
206
- # newbond = OpenBabel::OBBond.new
207
- # ob_atom
208
- #
209
-
Binary file
data/rubabel.gemspec CHANGED
@@ -5,14 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rubabel"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John T. Prince"]
12
- s.date = "2012-05-31"
12
+ s.date = "2012-08-08"
13
13
  s.description = "Ruby interface to the openbabel ruby bindings (or the openbabel gem). The\ninterface attempts to be a ruby-ish analogue of pybel."
14
14
  s.email = "jtprince@gmail.com"
15
- s.executables = ["rubabel"]
15
+ s.executables = ["fragmenter.rb"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
18
18
  "README.rdoc"
@@ -24,10 +24,12 @@ Gem::Specification.new do |s|
24
24
  "README.rdoc",
25
25
  "Rakefile",
26
26
  "VERSION",
27
- "bin/rubabel",
27
+ "bin/fragmenter.rb",
28
28
  "lib/rubabel.rb",
29
29
  "lib/rubabel/atom.rb",
30
30
  "lib/rubabel/bond.rb",
31
+ "lib/rubabel/core_ext/enumerable.rb",
32
+ "lib/rubabel/core_ext/putsv.rb",
31
33
  "lib/rubabel/fingerprint.rb",
32
34
  "lib/rubabel/molecule.rb",
33
35
  "lib/rubabel/molecule/fragmentable.rb",
@@ -39,6 +41,7 @@ Gem::Specification.new do |s|
39
41
  "reference/arity_method_list_CLASS.txt",
40
42
  "reference/atom_methods.txt",
41
43
  "reference/bond_methods.txt",
44
+ "reference/fragmentation_rules_.pdf",
42
45
  "reference/get_methods.rb",
43
46
  "reference/mol_methods.txt",
44
47
  "rubabel.gemspec",
@@ -67,7 +70,7 @@ Gem::Specification.new do |s|
67
70
  s.homepage = "http://github.com/princelab/rubabel"
68
71
  s.licenses = ["MIT"]
69
72
  s.require_paths = ["lib"]
70
- s.rubygems_version = "1.8.18"
73
+ s.rubygems_version = "1.8.23"
71
74
  s.summary = "Ruby interface to the OpenBabel ruby bindings similar to pybel"
72
75
 
73
76
  if s.respond_to? :specification_version then
@@ -75,14 +78,12 @@ Gem::Specification.new do |s|
75
78
 
76
79
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
77
80
  s.add_runtime_dependency(%q<openbabel>, ["~> 2.3.1.2"])
78
- s.add_runtime_dependency(%q<commander>, ["~> 4.1.2"])
79
81
  s.add_runtime_dependency(%q<andand>, ["~> 1.3.3"])
80
82
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
81
83
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
82
84
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
83
85
  else
84
86
  s.add_dependency(%q<openbabel>, ["~> 2.3.1.2"])
85
- s.add_dependency(%q<commander>, ["~> 4.1.2"])
86
87
  s.add_dependency(%q<andand>, ["~> 1.3.3"])
87
88
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
88
89
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -90,7 +91,6 @@ Gem::Specification.new do |s|
90
91
  end
91
92
  else
92
93
  s.add_dependency(%q<openbabel>, ["~> 2.3.1.2"])
93
- s.add_dependency(%q<commander>, ["~> 4.1.2"])
94
94
  s.add_dependency(%q<andand>, ["~> 1.3.3"])
95
95
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
96
96
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
@@ -2,37 +2,133 @@ require 'spec_helper'
2
2
 
3
3
  require 'rubabel'
4
4
 
5
+ $VERBOSE = nil
6
+
5
7
  describe Rubabel::Molecule::Fragmentable do
6
- describe 'the :co rule' do
7
8
 
8
- describe 'water loss' do
9
+ # :peroxy_to_carboxy
10
+ # :oxygen_asymmetric_sp3, :nitrogen_asymmetric_sp3,
11
+ # :internal_phosphoester
12
+
13
+ describe 'fragmentation rules' do
14
+ # coenzyme: CC1=CC(=O)C=CC1=O
15
+ # 2-methylcyclohexa-2,5-diene-1,4-dione
16
+
17
+ let(:test_mol) { "COP(=O)(O)OCNCOCC(OO)C(=O)O" }
18
+
19
+ it 'raises an error for a bad rule' do
20
+ mol = Rubabel["CCNC"]
21
+ expect { mol.fragment(rules: [:wackiness]) }.to raise_error
22
+ end
23
+
24
+ describe ':sp3c_nitrogen_double_bond' do
25
+
26
+ it 'cleaves like an ether a secondary NH group if possible' do
27
+ mol = Rubabel["CCNC"]
28
+ frag_sets = mol.fragment(rules: [:sp3c_nitrogen_double_bond])
29
+ frag_sets.size.should == 1
30
+ csmiles = frag_sets.first.map(&:csmiles)
31
+ csmiles.should include("C=C")
32
+ csmiles.should include("C[NH3+]")
33
+ end
34
+
35
+ it 'will not cleave if not possible' do
36
+ mol = Rubabel["CNC"]
37
+ frag_sets = mol.fragment(rules: [:sp3c_nitrogen_double_bond])
38
+ frag_sets.should be_empty
39
+ end
40
+
41
+ end
42
+
43
+ describe ':co2_loss' do
44
+ it 'loss of CO2 from carboxy group with charge transfer' do
45
+ mol = Rubabel["NCC(=O)O"]
46
+ frag_sets = mol.fragment( rules: [:co2_loss] )
47
+ frag_sets.size.should == 1
48
+ csmiles = frag_sets.first.map(&:csmiles)
49
+
50
+ csmiles.should include("[CH2-][NH3+]")
51
+ csmiles.should include("O=C=O")
52
+ end
53
+
54
+ it "doesn't remove CO2 if adjacent is not c3" do
55
+ mol = Rubabel["C=CC(=O)O"]
56
+ fragments = mol.fragment( rules: [:co2_loss] )
57
+ fragments.should be_empty
58
+ end
9
59
 
10
- it ':h2oloss' do
60
+ end
61
+
62
+ describe ':peroxy_to_carboxy' do
63
+ it 'works' do
64
+ mol = Rubabel["NCCC(OO)CC"]
65
+ frag_sets = mol.fragment( rules: [:peroxy_to_carboxy] )
66
+ frag_sets.size.should == 2
67
+ frag_sets.flatten(1).map(&:csmiles).sort.should == ["CC", "CCC(=O)O", "CC[NH3+]", "OC(=O)CC[NH3+]"]
68
+ end
69
+ end
70
+
71
+ describe ':sp3c_oxygen_asymmetric_far_sp3', :pending do
72
+ it 'splits like sp3c_oxygen_double_bond except oxygen takes the electrons' do
73
+ $VERBOSE = 3
74
+ mol = Rubabel["NCCCOCC"]
75
+ frag_sets = mol.fragment( rules: [:sp3c_oxygen_asymmetric_far_sp3] )
76
+ $VERBOSE = nil
77
+ frag_sets.size.should == 2
78
+ #mol = Rubabel["NCCOCC"]
79
+ #p mol.fragment( rules: [:sp3c_oxygen_asymmetric_far_sp3] )
80
+ #mol = Rubabel["NCOC"]
81
+ #p mol.fragment( rules: [:sp3c_oxygen_asymmetric_far_sp3] )
82
+ end
83
+ end
84
+
85
+ describe ':sp3c_oxygen_double_bond_water_loss' do
86
+
87
+ it 'does h2o loss of alcohol' do
11
88
  mol = Rubabel["NCCC(O)CC"]
12
- fragments = mol.fragment( rules: [:h2oloss] )
89
+ fragments = mol.fragment( rules: [:sp3c_oxygen_double_bond_water_loss] )
13
90
  fragments.flatten(1).map(&:csmiles).sort.should == ["CC=CCC[NH3+]", "CCC=CC[NH3+]", "O", "O"]
14
91
  end
15
92
 
16
- it ':h2oloss [does not allow bad chemistry]' do
93
+ it 'h2o loss does not allow bad chemistry' do
17
94
  # lone pair and double bond resonance ?
18
95
  mol = Rubabel["NCC(O)CC"]
19
- fragments = mol.fragment( rules: [:h2oloss] )
96
+ fragments = mol.fragment( rules: [:sp3c_oxygen_double_bond_water_loss] )
20
97
  fragments.flatten(1).map(&:csmiles).sort.should == ["CC=CC[NH3+]", "O"]
21
98
 
22
99
  mol = Rubabel["NC(O)CC"]
23
- fragments = mol.fragment( rules: [:h2oloss] )
100
+ fragments = mol.fragment( rules: [:sp3c_oxygen_double_bond_water_loss] )
24
101
  fragments.flatten(1).map(&:csmiles).sort.should == []
25
102
  end
26
103
  end
27
104
 
28
- describe 'backbone cleavage' do
105
+ describe 'sp3c_oxygen_double_bond_far_side_sp2' do
106
+
107
+ it 'does not cleave esters without sp3 carbons available for double bond' do
108
+ mol = Rubabel["NCCC(=O)OC"]
109
+ pieces = mol.fragment( rules: [:sp3c_oxygen_double_bond_far_side_sp2] )
110
+ pieces.should be_empty
111
+ end
29
112
 
30
- it 'cleaves beside alcohols yielding aldehydes' do
113
+ it 'cleaves esters on far side of singly bonded oxygen' do
114
+ mol = Rubabel["NCCC(=O)OCC"]
115
+ pieces = mol.fragment( rules: [:sp3c_oxygen_double_bond_far_side_sp2] )
116
+ pieces.size.should == 1 # one set
117
+ the_pair = pieces.first
118
+ csmiles = the_pair.map(&:csmiles)
119
+ csmiles.should include("OC(=O)CC[NH3+]")
120
+ csmiles.should include("C=C")
121
+ end
122
+
123
+ end
124
+
125
+ describe ':alcohol_to_aldehyde' do
126
+ it 'cleaves beside alcohols to generate an aldehyde' do
31
127
  mol = Rubabel["NCCC(O)CC"]
32
128
  mol.correct_for_ph!
33
129
  total_mass = mol.add_h!.mass
34
130
 
35
- pieces = mol.fragment(rules: [:co])
131
+ pieces = mol.fragment(rules: [:alcohol_to_aldehyde])
36
132
  pieces.size.should == 2
37
133
  pieces.map(&:size).should == [2,2]
38
134
  pieces.flatten(1).map(&:csmiles).should == ["CC[NH3+]", "CCC=O", "C(C=O)C[NH3+]", "CC"]
@@ -40,12 +136,7 @@ describe Rubabel::Molecule::Fragmentable do
40
136
  pair.map(&:mass).reduce(:+).should == total_mass
41
137
  end
42
138
  end
43
-
44
- xit 'does not cleave esters' do
45
- mol = Rubabel["NCCC(=O)OC"]
46
- pieces = mol.fragment( rules: [:co] )
47
- pieces.should be_empty
48
- end
49
139
  end
140
+
50
141
  end
51
142
  end
@@ -25,7 +25,33 @@ describe Rubabel::Molecule do
25
25
  end
26
26
  end
27
27
 
28
- it '#dup creates an entirely new molecule based on the first' do
28
+ # specify '#add_bond adds a bond (and updates atoms)' do
29
+ # c = Rubabel::Atom[:c]
30
+ # o = Rubabel::Atom[:o]
31
+ # mol = Rubabel::Molecule.from_atoms_and_bonds([c,o])
32
+ # mol.add_bond(c,o)
33
+ # puts "BONDS:"
34
+ # p mol.bonds
35
+ # puts "ATOMS:"
36
+ # p mol.atoms
37
+ # puts "C ATOMS:"
38
+ # p c.atoms
39
+ # puts "O ATOMS:"
40
+ # p o.atoms
41
+ # end
42
+
43
+ specify '#swap! can swap atoms around' do
44
+ mol = Rubabel["NCC(=O)O"]
45
+ carboxy_carbon = mol.atoms.find {|atom| atom.type == 'Cac' }
46
+ single_bonded_oxygen = mol.atoms.find {|atom| atom.type == 'O.co2' && atom.get_bond(carboxy_carbon).bond_order == 1 }
47
+ nit_carbon = mol.atoms.find {|atom| atom.atoms.any? {|nbr| nbr.type == 'N3' } }
48
+ nitrogen = mol.atoms.find {|atom| atom.el == :n }
49
+ swapped = mol.swap!(nit_carbon, nitrogen, carboxy_carbon, single_bonded_oxygen)
50
+ swapped.should == mol
51
+ swapped.csmiles.should == 'NC(=O)CO'
52
+ end
53
+
54
+ specify '#dup creates an entirely new molecule based on the first' do
29
55
  another = @mol.dup
30
56
  # this is a deep copy all the way. Even the atoms are duplicated so that
31
57
  # they can be modified in one and do not affect the other at all.
@@ -33,7 +59,7 @@ describe Rubabel::Molecule do
33
59
  @mol.charge.should_not == another.charge
34
60
  end
35
61
 
36
- it '#each iterates through each atom in id order' do
62
+ specify '#each iterates through each atom in id order' do
37
63
  cnt = 0
38
64
  @mol.each do |atom|
39
65
  atom.id.should == cnt
@@ -44,7 +70,7 @@ describe Rubabel::Molecule do
44
70
  @mol.atoms.size.should == 74
45
71
  end
46
72
 
47
- it '#hydrogens_added?' do
73
+ specify '#hydrogens_added?' do
48
74
  @mol.hydrogens_added?.should be_false
49
75
  @mol.atoms.size.should == 33
50
76
  @mol.add_h!
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,25 @@
1
1
  require 'rspec'
2
2
  require 'stringio'
3
3
 
4
- # Requires supporting files with custom matchers and macros, etc,
5
- # in ./support/ and its subdirectories.
6
- #Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
4
+ require 'rspec/core/formatters/progress_formatter'
5
+ # doesn't say so much about pending guys
6
+ class QuietPendingFormatter < RSpec::Core::Formatters::ProgressFormatter
7
+ def example_pending(example)
8
+ output.print yellow('*')
9
+ end
10
+ end
11
+
12
+ require 'rspec/core/formatters/documentation_formatter'
13
+ class QuietPendingDocFormatter < RSpec::Core::Formatters::DocumentationFormatter
14
+ def example_pending(example)
15
+ output.puts yellow( "<pending>: #{example.execution_result[:pending_message]}" )
16
+ end
17
+ end
18
+
7
19
 
8
20
  RSpec.configure do |config|
9
- config.formatter = :documentation
21
+ config.treat_symbols_as_metadata_keys_with_true_values = true
22
+ config.formatter = QuietPendingDocFormatter
10
23
  config.color = true
11
24
  end
12
25
 
@@ -31,6 +44,4 @@ module Kernel
31
44
  ensure
32
45
  $stderr = STDERR
33
46
  end
34
-
35
-
36
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubabel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-31 00:00:00.000000000 Z
12
+ date: 2012-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: openbabel
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 2.3.1.2
30
- - !ruby/object:Gem::Dependency
31
- name: commander
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ~>
36
- - !ruby/object:Gem::Version
37
- version: 4.1.2
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 4.1.2
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: andand
48
32
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +96,7 @@ description: ! 'Ruby interface to the openbabel ruby bindings (or the openbabel
112
96
  interface attempts to be a ruby-ish analogue of pybel.'
113
97
  email: jtprince@gmail.com
114
98
  executables:
115
- - rubabel
99
+ - fragmenter.rb
116
100
  extensions: []
117
101
  extra_rdoc_files:
118
102
  - LICENSE
@@ -124,10 +108,12 @@ files:
124
108
  - README.rdoc
125
109
  - Rakefile
126
110
  - VERSION
127
- - bin/rubabel
111
+ - bin/fragmenter.rb
128
112
  - lib/rubabel.rb
129
113
  - lib/rubabel/atom.rb
130
114
  - lib/rubabel/bond.rb
115
+ - lib/rubabel/core_ext/enumerable.rb
116
+ - lib/rubabel/core_ext/putsv.rb
131
117
  - lib/rubabel/fingerprint.rb
132
118
  - lib/rubabel/molecule.rb
133
119
  - lib/rubabel/molecule/fragmentable.rb
@@ -139,6 +125,7 @@ files:
139
125
  - reference/arity_method_list_CLASS.txt
140
126
  - reference/atom_methods.txt
141
127
  - reference/bond_methods.txt
128
+ - reference/fragmentation_rules_.pdf
142
129
  - reference/get_methods.rb
143
130
  - reference/mol_methods.txt
144
131
  - rubabel.gemspec
@@ -184,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
171
  version: '0'
185
172
  requirements: []
186
173
  rubyforge_project:
187
- rubygems_version: 1.8.18
174
+ rubygems_version: 1.8.23
188
175
  signing_key:
189
176
  specification_version: 3
190
177
  summary: Ruby interface to the OpenBabel ruby bindings similar to pybel
data/bin/rubabel DELETED
@@ -1,229 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'commander/import'
5
- require 'rubabel'
6
-
7
- program :version, Rubabel::VERSION
8
- program :description, 'tools for manipulating molecules with rubabel'
9
-
10
- =begin
11
- filename = filename.first unless options[:string_format]
12
- mol_iter =
13
- if str_f=options[:string_format]
14
- # assumes you aren't passing massive numbers of molecules as strings
15
- # on the commandline
16
- filename.map {|str| Rubabel.read_string(str, str_f.to_sym) }.each
17
- else
18
- Rubabel.foreach(ARGV.first)
19
- end
20
- mol_iter.each do |mol|
21
- mol.add_h! unless mol.ob.has_hydrogens_added
22
- mol.ob.get_title ||
23
-
24
- end
25
- =end
26
-
27
- def mol_iterator(args, strings)
28
-
29
- end
30
-
31
-
32
- command :babel do |c|
33
- c.syntax = 'rubabel babel [options]'
34
- c.summary = ''
35
- c.description = ''
36
- c.example 'description', 'command example'
37
- c.option '--some-switch', 'Some switch that does something'
38
- c.action do |args, options|
39
- # Do something or c.when_called Rubabel::Commands::Babel
40
- end
41
- end
42
-
43
- command :obabel do |c|
44
- c.syntax = 'rubabel obabel [options]'
45
- c.summary = ''
46
- c.description = ''
47
- c.example 'description', 'command example'
48
- c.option '--some-switch', 'Some switch that does something'
49
- c.action do |args, options|
50
- # Do something or c.when_called Rubabel::Commands::Obabel
51
- end
52
- end
53
-
54
- command :chiral do |c|
55
- c.syntax = 'rubabel chiral [options]'
56
- c.summary = ''
57
- c.description = ''
58
- c.example 'description', 'command example'
59
- c.option '--some-switch', 'Some switch that does something'
60
- c.action do |args, options|
61
- # Do something or c.when_called Rubabel::Commands::Chiral
62
- end
63
- end
64
-
65
- command :conformer do |c|
66
- c.syntax = 'rubabel conformer [options]'
67
- c.summary = ''
68
- c.description = ''
69
- c.example 'description', 'command example'
70
- c.option '--some-switch', 'Some switch that does something'
71
- c.action do |args, options|
72
- # Do something or c.when_called Rubabel::Commands::Conformer
73
- end
74
- end
75
-
76
- command :energy do |c|
77
- c.syntax = 'rubabel energy [options]'
78
- c.summary = ''
79
- c.description = ''
80
- c.example 'description', 'command example'
81
- c.option '--some-switch', 'Some switch that does something'
82
- c.action do |args, options|
83
- # Do something or c.when_called Rubabel::Commands::Energy
84
- end
85
- end
86
-
87
- command :fit do |c|
88
- c.syntax = 'rubabel fit [options]'
89
- c.summary = ''
90
- c.description = ''
91
- c.example 'description', 'command example'
92
- c.option '--some-switch', 'Some switch that does something'
93
- c.action do |args, options|
94
- # Do something or c.when_called Rubabel::Commands::Fit
95
- end
96
- end
97
-
98
- command :gen do |c|
99
- c.syntax = 'rubabel gen [options]'
100
- c.summary = ''
101
- c.description = ''
102
- c.example 'description', 'command example'
103
- c.option '--some-switch', 'Some switch that does something'
104
- c.action do |args, options|
105
- # Do something or c.when_called Rubabel::Commands::Gen
106
- end
107
- end
108
-
109
- command :grep do |c|
110
- c.syntax = 'rubabel grep [options]'
111
- c.summary = ''
112
- c.description = ''
113
- c.example 'description', 'command example'
114
- c.option '--some-switch', 'Some switch that does something'
115
- c.action do |args, options|
116
- # Do something or c.when_called Rubabel::Commands::Grep
117
- end
118
- end
119
-
120
- command :gui do |c|
121
- c.syntax = 'rubabel gui [options]'
122
- c.summary = ''
123
- c.description = ''
124
- c.example 'description', 'command example'
125
- c.option '--some-switch', 'Some switch that does something'
126
- c.action do |args, options|
127
- # Do something or c.when_called Rubabel::Commands::Gui
128
- end
129
- end
130
-
131
- command :minimize do |c|
132
- c.syntax = 'rubabel minimize [options]'
133
- c.summary = ''
134
- c.description = ''
135
- c.example 'description', 'command example'
136
- c.option '--some-switch', 'Some switch that does something'
137
- c.action do |args, options|
138
- # Do something or c.when_called Rubabel::Commands::Minimize
139
- end
140
- end
141
-
142
- command :probe do |c|
143
- c.syntax = 'rubabel probe [options]'
144
- c.summary = ''
145
- c.description = ''
146
- c.example 'description', 'command example'
147
- c.option '--some-switch', 'Some switch that does something'
148
- c.action do |args, options|
149
- # Do something or c.when_called Rubabel::Commands::Probe
150
- end
151
- end
152
-
153
- command :prop do |c|
154
- c.syntax = 'rubabel prop [options]'
155
- c.summary = ''
156
- c.description = ''
157
- c.example 'description', 'command example'
158
- c.option '--some-switch', 'Some switch that does something'
159
- c.action do |args, options|
160
- # Do something or c.when_called Rubabel::Commands::Prop
161
- end
162
- end
163
-
164
- command :probe do |c|
165
- c.syntax = 'rubabel probe [options]'
166
- c.summary = ''
167
- c.description = ''
168
- c.example 'description', 'command example'
169
- c.option '--some-switch', 'Some switch that does something'
170
- c.action do |args, options|
171
- # Do something or c.when_called Rubabel::Commands::Probe
172
- end
173
- end
174
-
175
- command :prop do |c|
176
- c.syntax = 'rubabel prop [options]'
177
- c.summary = ''
178
- c.description = ''
179
- c.example 'description', 'command example'
180
- c.option '--some-switch', 'Some switch that does something'
181
- c.action do |args, options|
182
- # Do something or c.when_called Rubabel::Commands::Prop
183
- end
184
- end
185
-
186
- command :rotamer do |c|
187
- c.syntax = 'rubabel rotamer [options]'
188
- c.summary = ''
189
- c.description = ''
190
- c.example 'description', 'command example'
191
- c.option '--some-switch', 'Some switch that does something'
192
- c.action do |args, options|
193
- # Do something or c.when_called Rubabel::Commands::Rotamer
194
- end
195
- end
196
-
197
- command :rotate do |c|
198
- c.syntax = 'rubabel rotate [options]'
199
- c.summary = ''
200
- c.description = ''
201
- c.example 'description', 'command example'
202
- c.option '--some-switch', 'Some switch that does something'
203
- c.action do |args, options|
204
- # Do something or c.when_called Rubabel::Commands::Rotate
205
- end
206
- end
207
-
208
- command :spectrophore do |c|
209
- c.syntax = 'rubabel spectrophore [options]'
210
- c.summary = ''
211
- c.description = ''
212
- c.example 'description', 'command example'
213
- c.option '--some-switch', 'Some switch that does something'
214
- c.action do |args, options|
215
- # Do something or c.when_called Rubabel::Commands::Spectrophore
216
- end
217
- end
218
-
219
- command :roundtrip do |c|
220
- c.syntax = 'rubabel roundtrip [options]'
221
- c.summary = ''
222
- c.description = ''
223
- c.example 'description', 'command example'
224
- c.option '--some-switch', 'Some switch that does something'
225
- c.action do |args, options|
226
- # Do something or c.when_called Rubabel::Commands::Roundtrip
227
- end
228
- end
229
-