Class OpenTox::Compound
In: lib/opentox-ruby-api-wrapper.rb
Parent: OpenTox

Methods

match   match?   new   smiles  

Public Class methods

Initialize with :uri => uri, :smiles => smiles or :name => name (name can be also an InChI/InChiKey, CAS number, etc)

[Source]

# File lib/opentox-ruby-api-wrapper.rb, line 18
                def initialize(params)
                        if params[:uri]
                                @uri = params[:uri].to_s
                        elsif params[:smiles]
                                @uri = RestClient.post ENV['OPENTOX_COMPOUNDS'] ,:smiles => uri_escape(params[:smiles])
                        elsif params[:name]
                                @uri = RestClient.post ENV['OPENTOX_COMPOUNDS'] ,:name => uri_escape(params[:name])
                        end
                end

Public Instance methods

Match an array of smarts features, returns matching features

[Source]

# File lib/opentox-ruby-api-wrapper.rb, line 43
                def match(smarts_features)
                        smarts_features.collect{ |smarts| smarts if self.match?(smarts.name) }.compact
                end

Matchs a smarts string

[Source]

# File lib/opentox-ruby-api-wrapper.rb, line 34
                def match?(smarts)
                        if RestClient.get(@uri + '/match/' + uri_escape(smarts)) == 'true'
                                true
                        else
                                false
                        end
                end

Get the (canonical) smiles

[Source]

# File lib/opentox-ruby-api-wrapper.rb, line 29
                def smiles
                        RestClient.get @uri
                end

[Validate]