From 85553b339acf3f9285a1c03b2fff342d9ddb9b6b Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Wed, 11 Jan 2017 16:00:07 +0100 Subject: documentation for all classes --- lib/import.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/import.rb') diff --git a/lib/import.rb b/lib/import.rb index 7a68335..fd00fbe 100644 --- a/lib/import.rb +++ b/lib/import.rb @@ -1,12 +1,14 @@ module OpenTox + # Import data from external databases module Import class Enanomapper include OpenTox - # time critical step: JSON parsing (>99%), Oj brings only minor speed gains (~1%) + # Import from eNanoMapper def self.import + # time critical step: JSON parsing (>99%), Oj brings only minor speed gains (~1%) datasets = {} bundles = JSON.parse(RestClientWrapper.get('https://data.enanomapper.net/bundle?media=application%2Fjson'))["dataset"] bundles.each do |bundle| -- cgit v1.2.3 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