summaryrefslogtreecommitdiff
path: root/lib/compound.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2013-06-10 11:50:58 +0200
committerChristoph Helma <helma@in-silico.ch>2013-06-10 11:50:58 +0200
commit4dba36635f5d214c4453d2d0d67426d6f14f5b6b (patch)
tree9437ee36472f7e158414062032b0eabf02dc576c /lib/compound.rb
parent128ef342e71337fc53b980e549d0a477a768c294 (diff)
parentd1059d024ac3f87af041626b1ade3a928e8099e4 (diff)
Merge branch 'development' of github.com:opentox/opentox-client into development
Diffstat (limited to 'lib/compound.rb')
-rw-r--r--lib/compound.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/compound.rb b/lib/compound.rb
index d33c48e..89bf840 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -91,14 +91,18 @@ module OpenTox
RestClientWrapper.get("#{CACTUS_URI}#{inchi}/names").split("\n")
end
+ # @return [String] PubChem Compound Identifier (CID), derieved via restcall to pubchem
def cid
pug_uri = "http://pubchem.ncbi.nlm.nih.gov/rest/pug/"
@cid ||= RestClientWrapper.post(File.join(pug_uri, "compound", "inchi", "cids", "TXT"),{:inchi => inchi}).strip
end
+ # @todo
def chebi
+ raise_internal_error "not yet implemented"
end
+ # @return [String] ChEMBL database compound id, derieved via restcall to chembl
def chemblid
# https://www.ebi.ac.uk/chembldb/ws#individualCompoundByInChiKey
uri = "http://www.ebi.ac.uk/chemblws/compounds/smiles/#{smiles}.json"
@@ -190,11 +194,11 @@ module OpenTox
# Keys: matching smarts, values: number of non-unique hits, or 1
# @param [Array] smarts_array Array with Smarts strings
# @param use_hits [Boolean] Whether non-unique hits or 1 should be produced
- # @return [Array] Array with matching Smarts strings
- # @example {
+ # @return [Hash] Hash with matching Smarts as keys, nr-of-hits/1 as values
+ # @example
# compound = Compound.from_name("Benzene")
- # compound.match(['cc','cN']) # returns { 'cc' => 12, 'cN' => 0 }
- # }
+ # compound.match(['cc','cN'],true) # returns { 'cc' => 12 }, 'cN' is not included because it does not match
+ # compound.match(['cc','cN'],false) # returns { 'cc' => 1 }
def match_hits(smarts_array, use_hits=true)
obconversion = OpenBabel::OBConversion.new
obmol = OpenBabel::OBMol.new