From e6750fc8658df273dabc39db4a5b72731050e6c1 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 4 May 2010 10:13:52 +0200 Subject: 404 error for empty datasets --- application.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 2e56233..b2d872c 100644 --- a/application.rb +++ b/application.rb @@ -61,6 +61,7 @@ get '/:id' do LOGGER.warn e.backtrace halt 404, "Dataset #{params[:id]} not found." end + halt 404, "Dataset #{params[:id]} not found." if dataset.nil? # not sure how an empty cataset can be returned, but if this happens stale processes keep runing at 100% cpo case accept when /rdf/ # redland sends text/rdf instead of application/rdf+xml response['Content-Type'] = 'application/rdf+xml' -- cgit v1.2.3 From 514914973963270a9e040f159e20406a7cb3f123 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 7 May 2010 15:36:40 +0200 Subject: Initial changes from Martin merged --- application.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 32601f2..5114f23 100644 --- a/application.rb +++ b/application.rb @@ -19,9 +19,14 @@ class Dataset def to_owl data = YAML.load(yaml) owl = OpenTox::Owl.create 'Dataset', uri + owl.set "title", data.title + #owl.set "source", data.source +=begin ['title', 'source'].each do |method| - eval "owl.#{method} = data.#{method}" + #eval "owl.#{method} = data.#{method}" + owl.set(method, "data.#{method}" end +=end if data.data data.data.each do |compound,features| owl.add_data_entries compound,features -- cgit v1.2.3 From ba2d357cd97b41d9e305e2b24249509b75a47bef Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 11 May 2010 16:49:21 +0200 Subject: xls export of trainings data --- application.rb | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 2e56233..0702758 100644 --- a/application.rb +++ b/application.rb @@ -53,6 +53,9 @@ get '/:id' do when /.rdf$/ params[:id].sub!(/.rdf$/,'') accept = 'application/rdf+xml' + when /.xls$/ + params[:id].sub!(/.xls$/,'') + accept = 'application/vnd.ms-excel' end begin dataset = Dataset.get(params[:id]) @@ -72,7 +75,31 @@ get '/:id' do when /yaml/ response['Content-Type'] = 'application/x-yaml' dataset.yaml - else + when /ms-excel/ + require 'spreadsheet' + response['Content-Type'] = 'application/vnd.ms-excel' + book = Spreadsheet::Workbook.new + tmp = Tempfile.new('opentox-feature-xls') + sheet = book.create_worksheet :name => 'Training Data' + sheet.update_row(0, "Chemical Structure","Activity") + sheet.column(0).width = 100 + headline = Spreadsheet::Format.new :weight => :bold, :size => 12 + 2.times{|x| sheet.row(0).set_format(x , headline)} + i = 1 + YAML.load(dataset.yaml).data.each do |line| + smilestring = RestClient.get(line[0], :accept => 'chemical/x-daylight-smiles').to_s + line[1][0] ? val = line[1][0].first[1] ? "1" : "0" : val = "" + sheet.update_row(i, smilestring , val) + i+=1 + end + begin + book.write tmp.path + return tmp + rescue + + end + tmp.close! + else halt 400, "Unsupported MIME type '#{accept}'" end end -- cgit v1.2.3 From d4bfeb61ad7b738e0898267668dc22e3fcfde925 Mon Sep 17 00:00:00 2001 From: ch Date: Wed, 12 May 2010 14:12:23 +0200 Subject: opentox-api-wrapper version updated --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 5114f23..f88232f 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.4.0' +gem 'opentox-ruby-api-wrapper', '= 1.5.0' require 'opentox-ruby-api-wrapper' #require 'sinatra/respond_to' #Sinatra::Application.register Sinatra::RespondTo -- cgit v1.2.3 From 02375f9647baea6094a5b24e2654eae14990e727 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 18 May 2010 11:52:26 +0200 Subject: api-wrapper version 1.5.1 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index f88232f..6d2f7bd 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.0' +gem 'opentox-ruby-api-wrapper', '= 1.5.1' require 'opentox-ruby-api-wrapper' #require 'sinatra/respond_to' #Sinatra::Application.register Sinatra::RespondTo -- cgit v1.2.3 From d9bc1edaaa2bc26065ec1030a0ff4b335eca6dcd Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 20 May 2010 10:33:31 +0200 Subject: opentox-ruby-api-wrapper bumped to 1.5.2 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 68d238a..04f132f 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.1' +gem 'opentox-ruby-api-wrapper', '= 1.5.2' require 'opentox-ruby-api-wrapper' #require 'sinatra/respond_to' #Sinatra::Application.register Sinatra::RespondTo -- cgit v1.2.3 From 6763233ee1eab31b150bf4907ec51bd83f64a12a Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 12:42:08 +0200 Subject: opentox-ruby-api-wrapper bumped to 1.5.3 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 04f132f..31dc0df 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.2' +gem 'opentox-ruby-api-wrapper', '= 1.5.3' require 'opentox-ruby-api-wrapper' #require 'sinatra/respond_to' #Sinatra::Application.register Sinatra::RespondTo -- cgit v1.2.3 From cdc64f6c0f8ea1195a52ec566a365cd87639dd50 Mon Sep 17 00:00:00 2001 From: mr Date: Fri, 21 May 2010 14:45:10 +0200 Subject: xls export encoding, xls exp headlines removed, fix export error on empty smilesstring --- application.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index c7ad2a4..04e40e5 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.0' +gem 'opentox-ruby-api-wrapper', '= 1.5.1' require 'opentox-ruby-api-wrapper' #require 'sinatra/respond_to' #Sinatra::Application.register Sinatra::RespondTo @@ -84,20 +84,21 @@ get '/:id' do dataset.yaml when /ms-excel/ require 'spreadsheet' - response['Content-Type'] = 'application/vnd.ms-excel' + response['Content-Type'] = 'application/vnd.ms-excel' + Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet::Workbook.new tmp = Tempfile.new('opentox-feature-xls') sheet = book.create_worksheet :name => 'Training Data' - sheet.update_row(0, "Chemical Structure","Activity") sheet.column(0).width = 100 - headline = Spreadsheet::Format.new :weight => :bold, :size => 12 - 2.times{|x| sheet.row(0).set_format(x , headline)} - i = 1 + i = 0 YAML.load(dataset.yaml).data.each do |line| - smilestring = RestClient.get(line[0], :accept => 'chemical/x-daylight-smiles').to_s - line[1][0] ? val = line[1][0].first[1] ? "1" : "0" : val = "" - sheet.update_row(i, smilestring , val) - i+=1 + begin + smilestring = RestClient.get(line[0], :accept => 'chemical/x-daylight-smiles').to_s + line[1][0] ? val = line[1][0].first[1] ? "1" : "0" : val = "" + sheet.update_row(i, smilestring , val) + i+=1 + rescue + end end begin book.write tmp.path -- cgit v1.2.3 From ec6f4feef98c86716cbfaab54b443c1e3bbecbcf Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 16:47:50 +0200 Subject: opentox-api-wrapper bumped to 1.5.4 --- application.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 0f557bf..c242903 100644 --- a/application.rb +++ b/application.rb @@ -1,9 +1,6 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.3' +gem 'opentox-ruby-api-wrapper', '= 1.5.4' require 'opentox-ruby-api-wrapper' -#require 'sinatra/respond_to' -#Sinatra::Application.register Sinatra::RespondTo - LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 4d253c3fd5d981f8d219954ef8203597d34c8f2b Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 18:46:23 +0200 Subject: opentox-api-wrapper bumped to 1.5.5 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index c242903..26feb3b 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '= 1.5.4' +gem "opentox-ruby-api-wrapper", "= 1.5.4" require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 5d3c7af5309066b567fe7bbc5860f1b57f32b2f4 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 18:48:47 +0200 Subject: opentox-api-wrapper bumped to --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 26feb3b..e9e2356 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem "opentox-ruby-api-wrapper", "= 1.5.4" +gem "opentox-ruby-api-wrapper", "= " require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 591f2af97c01759f95656af6f4532d14274b8aa0 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 21 May 2010 18:57:53 +0200 Subject: opentox-api-wrapper bumped to 1.5.5 --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index e9e2356..01dab76 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem "opentox-ruby-api-wrapper", "= " +gem "opentox-ruby-api-wrapper", "= 1.5.5" require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3 From 8d570c40e61725b81c731f450522d91aea7eeeed Mon Sep 17 00:00:00 2001 From: ch Date: Fri, 28 May 2010 12:24:12 +0200 Subject: catching error during saving prediction dataset --- application.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 01dab76..23808e4 100644 --- a/application.rb +++ b/application.rb @@ -165,6 +165,7 @@ end delete '/?' do +=begin Dataset.all.each do |d| begin File.delete d.file @@ -173,6 +174,7 @@ delete '/?' do end #d.destroy! end +=end Dataset.auto_migrate! response['Content-Type'] = 'text/plain' "All datasets deleted." -- cgit v1.2.3 From 63d8fc920ccb1cfd2c5bb3ec2ff123480a9a8674 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 15 Jun 2010 17:17:51 +0200 Subject: updated for new datamapper release --- application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 23808e4..adff452 100644 --- a/application.rb +++ b/application.rb @@ -1,5 +1,5 @@ require 'rubygems' -gem "opentox-ruby-api-wrapper", "= 1.5.5" +gem "opentox-ruby-api-wrapper", "= 1.5.6" require 'opentox-ruby-api-wrapper' LOGGER.progname = File.expand_path(__FILE__) -- cgit v1.2.3