diff options
author | Christoph Helma <helma@in-silico.ch> | 2017-01-12 17:57:03 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2017-01-12 17:57:03 +0100 |
commit | d7504cc422bbaeee3546589d87e7baeb4e977c0b (patch) | |
tree | f5c06159d0a529f263ea25f6354f89825fc41410 /lib/import.rb | |
parent | 85553b339acf3f9285a1c03b2fff342d9ddb9b6b (diff) |
source uris for core and coating
Diffstat (limited to 'lib/import.rb')
-rw-r--r-- | lib/import.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/import.rb b/lib/import.rb index fd00fbe..96e7ad1 100644 --- a/lib/import.rb +++ b/lib/import.rb @@ -22,6 +22,7 @@ module OpenTox uri = c["component"]["compound"]["URI"] uri = CGI.escape File.join(uri,"&media=application/json") data = JSON.parse(RestClientWrapper.get "https://data.enanomapper.net/query/compound/url/all?media=application/json&search=#{uri}") + source = data["dataEntry"][0]["compound"]["URI"] smiles = data["dataEntry"][0]["values"]["https://data.enanomapper.net/feature/http%3A%2F%2Fwww.opentox.org%2Fapi%2F1.1%23SMILESDefault"] names = [] names << data["dataEntry"][0]["values"]["https://data.enanomapper.net/feature/http%3A%2F%2Fwww.opentox.org%2Fapi%2F1.1%23ChemicalNameDefault"] @@ -33,6 +34,7 @@ module OpenTox else compound = Compound.find_or_create_by(:name => names.first,:names => names.compact) end + compound.source = source compound.save if c["relation"] == "HAS_CORE" core_id = compound.id.to_s |