summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-02-23 17:50:41 +0100
committerChristoph Helma <helma@in-silico.de>2010-02-23 17:50:41 +0100
commitc5ae0bd5005d2f768bd7b41ed1e67c16ae873076 (patch)
treee507575be1f543c08e1159742ad5e163e141be4d
parentd88af1d6a75032d58017db1a4220bcfbfaf46532 (diff)
Michas changes merged
-rw-r--r--features/compound.feature8
-rw-r--r--features/step_definitions/common_steps.rb7
-rw-r--r--features/step_definitions/lazar_steps.rb15
3 files changed, 19 insertions, 11 deletions
diff --git a/features/compound.feature b/features/compound.feature
index 7ee2c03..f628f4b 100644
--- a/features/compound.feature
+++ b/features/compound.feature
@@ -11,8 +11,8 @@ Feature: Create compound URI
Examples:
|descriptor |mime-type |inchi |cansmi |
|F[B-](F)(F)F.[Na+] |chemical/x-daylight-smiles|InChI=1S/BF4.Na/c2-1(3,4)5;/q-1;+1 |[Na+].F[B-](F)(F)F |
- #|CC(=O)CC(C)C#N |chemical/x-daylight-smiles|InChI=1S/C6H9NO/c1-5(4-7)3-6(2)8/h5H,3H2,1-2H3 |CC(CC(=O)C)C#N |
- #|Benzene |text/plain |InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H |c1ccccc1 |
- #|N#[N+]C1=CC=CC=C1.F[B-](F)(F)F |chemical/x-daylight-smiles|InChI=1S/C6H5N2.BF4/c7-8-6-4-2-1-3-5-6;2-1(3,4)5/h1-5H;/q+1;-1|N#[N+]c1ccccc1.F[B-](F)(F)F|
- #|InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H|chemical/x-inchi |InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H |c1ccccc1 |
+ |CC(=O)CC(C)C#N |chemical/x-daylight-smiles|InChI=1S/C6H9NO/c1-5(4-7)3-6(2)8/h5H,3H2,1-2H3 |CC(CC(=O)C)C#N |
+ |Benzene |text/plain |InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H |c1ccccc1 |
+ |N#[N+]C1=CC=CC=C1.F[B-](F)(F)F |chemical/x-daylight-smiles|InChI=1S/C6H5N2.BF4/c7-8-6-4-2-1-3-5-6;2-1(3,4)5/h1-5H;/q+1;-1|N#[N+]c1ccccc1.F[B-](F)(F)F|
+ |InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H|chemical/x-inchi |InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H |c1ccccc1 |
diff --git a/features/step_definitions/common_steps.rb b/features/step_definitions/common_steps.rb
index e0d31e5..c912cee 100644
--- a/features/step_definitions/common_steps.rb
+++ b/features/step_definitions/common_steps.rb
@@ -11,6 +11,7 @@ When /^I post (.*) to the (.*) webservice$/ do |data,component|
@data = data
end
@uri = RestClient::Resource.new(@@config[:services]["opentox-#{component}"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0]).post data, :content_type => @content_type
+ puts @uri
@resources << @uri unless /compound|feature/ =~ component
end
@@ -27,7 +28,7 @@ When /^the task is completed$/ do
end
Then /^I should receive a valid URI$/ do
- puts @uri
+ #puts @uri
@response = RestClient.get @uri, :accept => '*/*'
#puts @response.to_yaml
end
@@ -43,8 +44,8 @@ Then /^the URI response should be (.+)$/ do |data|
when /^file:/
data = @data
end
- puts data
- puts @response
+ #puts data
+ #puts @response
assert data == @response, true
end
diff --git a/features/step_definitions/lazar_steps.rb b/features/step_definitions/lazar_steps.rb
index ae8c6b2..a049153 100644
--- a/features/step_definitions/lazar_steps.rb
+++ b/features/step_definitions/lazar_steps.rb
@@ -13,18 +13,25 @@ Then /^the model should predict (.*) for (.*)$/ do |activity,smiles|
#puts @uri
#puts compound_uri
resource = RestClient::Resource.new(@uri, :user => @@users[:users].keys[0], :password => @@users[:users].values[0])
- prediction = resource.post :compound_uri => compound_uri, :accept => "application/x-yaml"
+ prediction_rdf = resource.post :compound_uri => compound_uri#, :accept => "application/x-yaml"
model = Redland::Model.new Redland::MemoryStore.new
parser = Redland::Parser.new
- parser.parse_string_into_model(model,prediction,'/')
+ parser.parse_string_into_model(model,prediction_rdf,'/')
- #puts prediction
+ puts prediction_rdf
model.subjects(RDF['type'], OT['FeatureValue']).each do |v|
feature = model.object(v,OT['feature'])
feature_name = model.object(feature,DC['title']).to_s
prediction = model.object(v,OT['value']).to_s if feature_name.match(/classification/)
end
- #puts values.to_yaml
+=begin
+ model.subjects(RDF['type'], OT['FeatureValue']).each do |v|
+ feature = model.object(v,OT['feature'])
+ feature_name = model.object(feature,DC['title']).to_s
+ prediction = model.object(v,OT['value']).to_s if feature_name.match(/classification/)
+ end
+=end
+ puts prediction
assert_equal activity.to_s, prediction
end