From bc9d5b9266e18d39ab5fd83db272bffde98c4161 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Wed, 19 Jun 2013 16:29:43 +0200 Subject: openbabel requirement removed. initial descriptor classes. --- lib/compound.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'lib/compound.rb') diff --git a/lib/compound.rb b/lib/compound.rb index 89bf840..daeabb9 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -1,4 +1,4 @@ -require "openbabel" +#require "openbabel" CACTUS_URI="http://cactus.nci.nih.gov/chemical/structure/" module OpenTox @@ -110,6 +110,27 @@ module OpenTox end =begin + # Match a smarts string + # @example + # compound = OpenTox::Compound.from_name("Benzene") + # compound.match?("cN") # returns false + # @param [String] smarts Smarts string + def match?(smarts) + matcher = Algorithm.new File.join($algorithm[:uri],"descriptor","smarts") + matcher.run :compound_uri => @uri, :smarts => smarts, :count => false + end + + # Match an array of smarts strings, returns array with matching smarts + # @example + # compound = OpenTox::Compound.from_name("Benzene") + # compound.match(['cc','cN']) # returns ['cc'] + # @param [Array] smarts_array Array with Smarts strings + # @return [Array] Array with matching Smarts strings + def match(smarts_array) + matcher = Algorithm.new File.join($algorithm[:uri],"descriptor","smarts") + matcher.run :compound_uri => @uri, :smarts => smarts_array, :count => false + end + # Match a smarts string # @example # compound = OpenTox::Compound.from_name("Benzene") -- cgit v1.2.3