diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-04-26 17:38:15 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-04-26 17:38:15 +0200 |
commit | cfc64a2966ab38698e499f0b44f41208ee77a07f (patch) | |
tree | 408d4518e808a3e52a96e9e68cfe0723404dbf8b /lib/import.rb | |
parent | 6890687df6de0a6eaa3d35c6be66639614ea2ef2 (diff) |
first nanomaterial prediction
Diffstat (limited to 'lib/import.rb')
-rw-r--r-- | lib/import.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/import.rb b/lib/import.rb index 9091207..3c1edfe 100644 --- a/lib/import.rb +++ b/lib/import.rb @@ -30,7 +30,7 @@ module OpenTox $logger.debug File.join(np["compound"]["URI"],"study") effect["conditions"].delete_if { |k, v| v.nil? } feature = klass.find_or_create_by( - :source => File.join(np["compound"]["URI"],"study"), + #:source => File.join(np["compound"]["URI"],"study"), :name => "#{study["protocol"]["category"]["title"]} #{study["protocol"]["endpoint"]}", :unit => effect["result"]["unit"], :category => study["protocol"]["topcategory"], @@ -48,6 +48,22 @@ module OpenTox datasets.collect{|d| d.id} end +=begin + def self.import_ld # defunct, AMBIT JSON_LD does not have substance entries + #get list of bundle URIs + bundles = JSON.parse(RestClientWrapper.get('https://data.enanomapper.net/bundle?media=application%2Fjson'))["dataset"] + datasets = [] + bundles.each do |bundle| + uri = bundle["URI"] + study = JSON.parse(`curl -H 'Accept:application/ld+json' '#{uri}/substance'`) + study["@graph"].each do |i| + puts i.to_yaml if i.keys.include? "sio:has-value" + end + end + datasets.collect{|d| d.id} + end +=end + def self.dump #get list of bundle URIs `wget 'https://data.enanomapper.net/bundle?media=application%2Fjson' -O bundles.json` |