From d7504cc422bbaeee3546589d87e7baeb4e977c0b Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 12 Jan 2017 17:57:03 +0100 Subject: source uris for core and coating --- lib/import.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/import.rb') 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 -- cgit v1.2.3