Class: Chem::OpenBabel::OBSmarts

Inherits:
Object
  • Object
show all
Defined in:
lib/chem/utils/openbabel.rb

Instance Method Summary collapse

Constructor Details

#initialize(smarts) ⇒ OBSmarts

Returns a new instance of OBSmarts.



90
91
92
93
94
95
# File 'lib/chem/utils/openbabel.rb', line 90

def initialize(smarts)
  require 'openbabel'
  @pat = ::OpenBabel::OBSmartsPattern.new
  @pat.init(smarts)
  @pat
end

Instance Method Details

#get_umap_listObject



102
103
104
# File 'lib/chem/utils/openbabel.rb', line 102

def get_umap_list
  @pat.get_umap_list.collect{|ary| ary.collect{|i| i.to_i}}
end

#match(mol) ⇒ Object



97
98
99
100
# File 'lib/chem/utils/openbabel.rb', line 97

def match(mol)
  mol.use_open_babel if mol.ob_mol.nil?
  @pat.match(mol.ob_mol)
end