summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2010-08-06 13:30:15 +0200
committerChristoph Helma <helma@in-silico.ch>2010-08-06 13:30:15 +0200
commit4315a4ef2bfc625dc2f3ed69dd6c90ddb0dd5593 (patch)
tree82d7520fba83cb2d5652ae7f61767cb112e72f94
parent05ed7ad074f48cf36b60740665c1a0962ff0a55d (diff)
lazar details implemented
-rw-r--r--application.rb53
-rw-r--r--helper.rb48
-rw-r--r--views/compound_image.haml2
-rw-r--r--views/confidence.haml7
-rw-r--r--views/feature_table.haml28
-rw-r--r--views/js_link.haml5
-rw-r--r--views/layout.haml2
-rw-r--r--views/lazar.haml206
-rw-r--r--views/lazar_algorithm.haml44
-rw-r--r--views/neighbors.haml45
-rw-r--r--views/neighbors_navigation.haml22
-rw-r--r--views/next.haml7
-rw-r--r--views/prediction.haml36
-rw-r--r--views/prev.haml8
-rw-r--r--views/significant_fragments.haml10
-rw-r--r--views/similarity.haml19
-rw-r--r--views/style.sass86
-rw-r--r--views/training_data.haml7
18 files changed, 379 insertions, 256 deletions
diff --git a/application.rb b/application.rb
index cd4cb54..7bbbafb 100644
--- a/application.rb
+++ b/application.rb
@@ -28,11 +28,11 @@ delete '/model/:id/?' do
begin
RestClient.delete model.uri if model.uri
RestClient.delete model.task_uri if model.task_uri
+ model.destroy!
+ flash[:notice] = "#{model.name} model deleted."
rescue
flash[:notice] = "#{model.name} model delete error."
end
- model.destroy!
- flash[:notice] = "#{model.name} model deleted."
redirect url_for('/models')
end
@@ -122,14 +122,20 @@ post '/upload' do # create a new model
redirect url_for('/create')
end
- validation_task_uri = OpenTox::Validation.crossvalidation(
- :algorithm_uri => OpenTox::Algorithm::Lazar.uri,
- :dataset_uri => parser.dataset_uri,
- :prediction_feature => feature_uri,
- :algorithm_params => "feature_generation_uri=#{OpenTox::Algorithm::Fminer.uri}"
- ).uri
- LOGGER.debug "Validation task: " + validation_task_uri
- @model.validation_task_uri = validation_task_uri
+=begin
+ begin
+ validation_task_uri = OpenTox::Validation.crossvalidation(
+ :algorithm_uri => OpenTox::Algorithm::Lazar.uri,
+ :dataset_uri => parser.dataset_uri,
+ :prediction_feature => feature_uri,
+ :algorithm_params => "feature_generation_uri=#{OpenTox::Algorithm::Fminer.uri}"
+ ).uri
+ LOGGER.debug "Validation task: " + validation_task_uri
+ @model.validation_task_uri = validation_task_uri
+ rescue
+ flash[:notice] = "Model validation failed."
+ end
+=end
=begin
if parser.nr_compounds < 10
@@ -170,7 +176,6 @@ post '/predict/?' do # post chemical name to model
params[:selection].keys.each do |id|
model = ToxCreateModel.get(id.to_i)
model.process unless model.uri
- LOGGER.debug model.to_yaml
prediction = nil
confidence = nil
title = nil
@@ -178,12 +183,13 @@ post '/predict/?' do # post chemical name to model
#LOGGER.debug "curl -X POST -d 'compound_uri=#{@compound.uri}' -H 'Accept:application/x-yaml' #{model.uri}"
prediction = YAML.load(`curl -X POST -d 'compound_uri=#{@compound.uri}' -H 'Accept:application/x-yaml' #{model.uri}`)
#prediction = YAML.load(OpenTox::Model::Lazar.predict(params[:compound_uri],params[:model_uri]))
+ LOGGER.debug prediction.to_yaml
source = prediction.creator
if prediction.data[@compound.uri]
if source.to_s.match(/model/) # real prediction
prediction = prediction.data[@compound.uri].first.values.first
- LOGGER.debug prediction[File.join(@@config[:services]["opentox-model"],"lazar#classification")]
- LOGGER.debug prediction[File.join(@@config[:services]["opentox-model"],"lazar#confidence")]
+ #LOGGER.debug prediction[File.join(@@config[:services]["opentox-model"],"lazar#classification")]
+ #LOGGER.debug prediction[File.join(@@config[:services]["opentox-model"],"lazar#confidence")]
if !prediction[File.join(@@config[:services]["opentox-model"],"lazar#classification")].nil?
@predictions << {
:title => model.name,
@@ -215,7 +221,7 @@ end
post "/lazar/?" do
@page = 0
@page = params[:page].to_i if params[:page]
- @highlight = params[:highlight]
+ #@highlight = params[:highlight]
@model_uri = params[:model_uri]
@prediction = YAML.load(OpenTox::Model::Lazar.predict(params[:compound_uri],params[:model_uri]))
@compound = OpenTox::Compound.new(:uri => params[:compound_uri])
@@ -230,8 +236,7 @@ post "/lazar/?" do
end
@activity = p[feature]
@confidence = p[File.join(@@config[:services]["opentox-model"],"lazar#confidence")]
- @neighbors = p[File.join(@@config[:services]["opentox-model"],"lazar#neighbors")]#.sort{|a,b| b.last[:similarity] <=> a.last[:similarity]}
- #@training_activities = p[File.join(@@config[:services]["opentox-model"],"lazar#activities")]
+ @neighbors = p[File.join(@@config[:services]["opentox-model"],"lazar#neighbors")]
@features = p[File.join(@@config[:services]["opentox-model"],"lazar#features")]
else # database value
@measured_activities = @prediction.data[@compound.uri].first.values
@@ -242,6 +247,22 @@ post "/lazar/?" do
haml :lazar
end
+# proxy to get data from compound service
+# (jQuery load does not work with external URIs)
+get %r{/compound/(.*)} do |inchi|
+ OpenTox::Compound.new(:inchi => inchi).names.gsub(/\n/,', ')
+end
+
+=begin
+post "/neighbors" do
+ @neighbors = params[:neighbors]
+ @page = params[:page].to_i
+ LOGGER.debug @neighbors
+ LOGGER.debug @page
+ haml :neighbors
+end
+=end
+
delete '/?' do
ToxCreateModel.auto_migrate!
response['Content-Type'] = 'text/plain'
diff --git a/helper.rb b/helper.rb
index 4a5f739..9c4b04c 100644
--- a/helper.rb
+++ b/helper.rb
@@ -1,14 +1,40 @@
helpers do
- def activity(a)
- case a.to_s
- when "true"
- act = "active"
- when "false"
- act = "inactive"
- else
- act = "not available"
- end
- act
- end
+
+ def hide_link(destination)
+ @link_id = 0 unless @link_id
+ @link_id += 1
+ haml :js_link, :locals => {:name => "hide", :destination => destination, :method => "hide"}, :layout => false
+ end
+
+ def toggle_link(destination,name)
+ @link_id = 0 unless @link_id
+ @link_id += 1
+ haml :js_link, :locals => {:name => name, :destination => destination, :method => "toggle"}, :layout => false
+ end
+
+ def compound_image(compound,features)
+ haml :compound_image, :locals => {:compound => compound, :features => features}, :layout => false
+ end
+
+ def activity_markup(activity)
+ case activity.class.to_s
+ when /Float/
+ haml ".other #{sprintf('%.03g', activity)}", :layout => false
+ else
+ if activity #true
+ haml ".active active", :layout => false
+ elsif !activity # false
+ haml ".inactive inactive", :layout => false
+ else
+ haml ".other #{activity.to_s}", :layout => false
+ end
+ end
+ end
+
+ def neighbors_navigation
+ @page = 0 unless @page
+ haml :neighbors_navigation, :layout => false
+ end
+
end
diff --git a/views/compound_image.haml b/views/compound_image.haml
new file mode 100644
index 0000000..c6f962a
--- /dev/null
+++ b/views/compound_image.haml
@@ -0,0 +1,2 @@
+%img{:src => compound.display_smarts_uri(features[:activating].collect{|f| f[:smarts]},@features[:deactivating].collect{|f| f[:smarts]}), :alt => compound.smiles}
+
diff --git a/views/confidence.haml b/views/confidence.haml
new file mode 100644
index 0000000..2b72d63
--- /dev/null
+++ b/views/confidence.haml
@@ -0,0 +1,7 @@
+%dl#confidence{ :style => "display: none;" }
+ %dt
+ Confidence
+ (
+ = hide_link "#confidence"
+ )
+ %dd Indicates the applicability domain of a model. Predictions with a high confidence can be expected to be more reliable than predictions with low confidence. Confidence values may take any value between 0 and 1. For most models confidence &gt; 0.025 is a sensible (hard) cutoff to distiguish between reliable and unreliable predictions.
diff --git a/views/feature_table.haml b/views/feature_table.haml
new file mode 100644
index 0000000..4fa927c
--- /dev/null
+++ b/views/feature_table.haml
@@ -0,0 +1,28 @@
+%table
+ - unless features[:activating].empty?
+ %tr
+ %th
+ activating
+ (
+ %a{:href => "http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html"} SMARTS
+ )
+ %th p value
+ - if features[:activating]
+ - features[:activating].sort{|a,b| b[:p_value] <=> a[:p_value] }.each do |f|
+ %tr
+ %td= f[:smarts]
+ %td= f[:p_value]
+ - unless features[:deactivating].empty?
+ %tr
+ %th
+ deactivating
+ (
+ %a{:href => "http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html"} SMARTS
+ )
+ %th p value
+ - if features[:deactivating]
+ - features[:deactivating].sort{|a,b| b[:p_value] <=> a[:p_value] }.each do |f|
+ %tr
+ %td= f[:smarts]
+ %td= f[:p_value]
+
diff --git a/views/js_link.haml b/views/js_link.haml
new file mode 100644
index 0000000..7d8cdce
--- /dev/null
+++ b/views/js_link.haml
@@ -0,0 +1,5 @@
+%a{:href => "#{destination}", :id => "js_link#{@link_id}"} #{name}
+:javascript
+ $("a#js_link#{@link_id}").click(function () {
+ $("#{destination}").#{method}();
+ });
diff --git a/views/layout.haml b/views/layout.haml
index a301358..6c9202b 100644
--- a/views/layout.haml
+++ b/views/layout.haml
@@ -16,7 +16,7 @@
= link_to "Create", "/create"
%li{:class => ("selected" if /models/ =~ request.path )}
= link_to "Inspect", "/models"
- %li{:class => ("selected" if /predict/ =~ request.path )}
+ %li{:class => ("selected" if /predict|lazar/ =~ request.path )}
= link_to "Predict", "/predict"
%li{:class => ("selected" if /help/ =~ request.path )}
= link_to "Help", "/help"
diff --git a/views/lazar.haml b/views/lazar.haml
index 057b1cd..59d5396 100644
--- a/views/lazar.haml
+++ b/views/lazar.haml
@@ -1,163 +1,55 @@
+%p= link_to "New prediction", "/predict"
.lazar-predictions
- %table
- %tr
- %th= @title.gsub(/_lazar_.*$/,' ').capitalize
- %th Prediction
- %th
- %a{:href => "#", :id => "linkConfidence#{p.object_id}"} Confidence
- :javascript
- $("a#linkConfidence#{p.object_id}").click(function () {
- $("dl#confidence").toggle();
- });
- -#%th
- Significant fragments
- = haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => nil}, :layout => false
- -#%th Additional data
- %tr
- %td
- %img{:src => @compound.display_smarts_uri(@features[:activating].keys,@features[:deactivating].keys, params[:highlight]), :alt => @compound.smiles}
- %td
- - if @measured_activities
- %br
- - @measured_activities.each do |a|
- - if activity(a) == 'active'
- .active
- = activity(a)
- - elsif activity(a) == 'inactive'
- .inactive
- = activity(a)
- - else
- = a
- %br
- (
- %a{:href => "#", :id => "linkTrainingData#{p.object_id}"} Training data
- :javascript
- $("a#linkTrainingData#{p.object_id}").click(function () {
- $("dl#training_data").toggle();
- });
- )
+ -# explanations
+ = haml :lazar_algorithm, :layout => false
+ = haml :confidence, :layout => false
+ = haml :similarity, :layout => false
+ = haml :significant_fragments, :layout => false
+ = haml :training_data, :layout => false
- - else
- - if activity(@activity) == 'active'
- .active
- = activity(@activity)
- - elsif activity(@activity) == 'inactive'
- .inactive
- = activity(@activity)
- - elsif @activity.is_a?(Float)
- .other
- = sprintf('%.03g', @activity)
- - else
- .other
- %em= @activity.to_s
- %td= sprintf('%.03g', @confidence.to_f.abs) if @confidence
- -#%td
- %table
- - unless @features[:activating].empty?
- %tr
- %th activating
- %th p value
- - if @features[:activating]
- - @features[:activating].sort{|a,b| b.last <=> a.last }.each do |f|
- %tr
- - if @highlight == f[0]
- %td.selected= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[0]}, :layout => false
- %td.selected= f[1]
- - else
- %td= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[0]}, :layout => false
- %td= f[1]
- - unless @features[:deactivating].empty?
- %tr
- %th deactivating
- %th p value
- - if @features[:deactivating]
- - @features[:deactivating].sort{|a,b| b.last <=> a.last }.each do |f|
- %tr
- - if @highlight == f[0]
- %td.selected= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[0]}, :layout => false
- %td.selected= f[1]
- - else
- %td= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[0]}, :layout => false
- %td= f[1]
- -#%td
+ %a{:name => "prediction"}
+ %table
+ %thead
+ %tr
+ %th= @title.gsub(/_lazar_.*$/,' ').capitalize
+ %th= toggle_link("#lazar_algorithm","Prediction")
+ %th= toggle_link("#confidence","Confidence")
+ %th Supporting information
- %tr
- %th
- Neighbors
- = haml :prev, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => @highlight, :page => @page, :size => @neighbors.size}, :layout => false
- = "(#{5*@page+1}-#{5*@page+5}/#{@neighbors.size})"
- = haml :next, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => @highlight, :page => @page, :size => @neighbors.size}, :layout => false
- %th Activity
- %th Similarity (activity specific)
- -#%th
- Significant fragemnts
- = haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => nil}, :layout => false
- -#%th Additional data
- -#%th Exclude
- - first = 5*@page
- - last = first+4
- - @neighbors.sort{|a,b| b.last[:similarity] <=> a.last[:similarity]}[first..last].each do |uri,data|
- - c = OpenTox::Compound.new(:uri => uri)
%tr
- %td
- -#%br
- %a{:href => c.display_smarts_uri(data[:features][:activating].collect{|f| f[:smarts]}, data[:features][:deactivating].collect{|f| f[:smarts]}, params[:highlight])} #{c.smiles}
- %br
- %img{:src => c.display_smarts_uri(data[:features][:activating].collect{|f| f[:smarts]}, data[:features][:deactivating].collect{|f| f[:smarts]}, params[:highlight]), :alt => c.smiles}
- %td
- - data[:activities].each do |act|
- - if activity(act) == 'active'
- .active
- = activity(act)
- - elsif activity(act) == 'inactive'
- .inactive
- = activity(act)
- - elsif act.is_a?(Float)
- .other
- = sprintf('%.03g', act)
- - else
- .other
- %em= act.to_s
+ %td.image= compound_image(@compound,@features)
+ %td= activity_markup(@activity)
+ %td= sprintf('%.03g', @confidence.to_f.abs) if @confidence
%td
- = sprintf('%.03g', data[:similarity])
- -#%td
- %table
- - unless data[:features][:activating].empty?
- %tr
- %th activating
- %th p value
- - data[:features][:activating].sort{|a,b| b[:p_value] <=> a[:p_value] }.each do |f|
- %tr
- - if @highlight == f[:smarts]
- %td.selected= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[:smarts]}, :layout => false
- %td.selected= f[:p_value]
- - else
- %td= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[:smarts]}, :layout => false
- %td= f[:p_value]
- - unless data[:features][:deactivating].empty?
- %tr
- %th deactivating
- %th p value
- - data[:features][:deactivating].sort{|a,b| b[:p_value] <=> a[:p_value] }.each do |f|
- %tr
- - if @highlight == f[:smarts]
- %td.selected= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[:smarts]}, :layout => false
- %td.selected= f[:p_value]
- - else
- %td= haml :fragment, :locals => {:compound_uri => @compound.uri, :model_uri => @model_uri, :smarts => f[:smarts]}, :layout => false
- %td= f[:p_value]
- -#%td
- -#%td
-
-
-%dl#confidence{ :style => "display: none;" }
- %dt Confidence:
- %dd Indicates the applicability domain of a model. Predictions with a high confidence can be expected to be more reliable than predictions with low confidence. Confidence values may take any value between 0 and 1. For most models confidence &gt; 0.025 is a sensible (hard) cutoff to distiguish between reliable and unreliable predictions.
-
-
-%dl#training_data{ :style => "display: none;" }
- %dt Training data:
- %dd Experimental result(s) from the training dataset are displayed here.
-
-
+ %ul
+ %li
+ %a{:href => "#prediction", :id => "show_names"} Names and synonyms
+ :javascript
+ $("a#show_names").click(function () {
+ $("#compound_names").load("#{File.join("compound",@compound.inchi)}");
+ $("tr#names").toggle();
+ });
+ %li= toggle_link("#fragments","Significant fragments")
+ -# This does not work, ask nina/vedrin
+ -# %li
+ %a{:href => "http://ambit.uni-plovdiv.bg:8080/ambit2/query/structure/?search=#{@compound.smiles}"} Ambit data
+ -# %li
+ %a{:href => "http://www.ncbi.nlm.nih.gov/sites/entrez?cmd=PureSearch&db=pccompound&term=#{URI.encode('"'+@compound.inchi+'"[InChI]')}"} PubChem data
+ (external)
+ -# %li
+ %a{:href => "http://chem.sis.nlm.nih.gov/chemidplus/direct.jsp?result=advanced&inchi=#{URI.encode @compound.inchi}"} ToxNet data
+ -#http://chem.sis.nlm.nih.gov/chemidplus/direct.jsp?result=advanced&regno=000143157
+
+ %tr#names{ :style => "display: none;" }
+ %td{:colspan => '4'}
+ %a{:name => 'names'}
+ = hide_link('#names')
+ #compound_names
+ %tr#fragments{ :style => "display: none;" }
+ %td{:colspan => '4'}
+ = hide_link('#fragments')
+ = haml :feature_table, :locals => {:features => @features}, :layout => false
+
+ %tbody#neighbors
+ = haml :neighbors, :locals => {:neighbors => @neighbors, :page => @page}, :layout => :false
diff --git a/views/lazar_algorithm.haml b/views/lazar_algorithm.haml
new file mode 100644
index 0000000..6322b17
--- /dev/null
+++ b/views/lazar_algorithm.haml
@@ -0,0 +1,44 @@
+%dl#lazar_algorithm
+ %dt
+ %code lazar
+ prediction
+ (
+ = hide_link "#lazar_algorithm"
+ )
+ %dd
+ %p
+ %code lazar
+ searches the training dataset for
+ = toggle_link "#similarity", "similar"
+ compounds
+ %em (neighbors)
+ and calculates the prediction from their measured activities.
+ %code lazar
+ calculates predictions using
+ %ul
+ %li
+ a majority vote (weighted by compound similarity) for
+ %em classification
+ %li
+ a local QSAR model based on neighbors for
+ %em regression
+
+ %p
+ = toggle_link "#significant_fragments", "Significant fragments"
+ are highlighted in the structure display as follows:
+ %ul
+ %li
+ .active activating fragments
+ %li
+ .inactive deactivating fragments
+ %li
+ .inconclusive regions, where activating and deactivating fragments overlap
+ %li
+ .other inert parts
+
+ %p
+ Please keep in mind that predictions are based on the measured activities of neighbors.
+ = toggle_link "#significant_fragments", "Significant fragments"
+ are solely used to determine
+ = toggle_link "#similarity", "activity specific similarities"
+ of neighbors.
diff --git a/views/neighbors.haml b/views/neighbors.haml
new file mode 100644
index 0000000..82fafd2
--- /dev/null
+++ b/views/neighbors.haml
@@ -0,0 +1,45 @@
+%tr
+ %th
+ Neighbors
+ = neighbors_navigation
+ %th= toggle_link("#training_data","Measured activity")
+ %th= toggle_link("#similarity","Similarity")
+ %th Supporting information
+
+- first = 5*page
+- last = first+4
+- neighbor_id = 0
+- neighbors.sort{|a,b| b.last[:similarity] <=> a.last[:similarity]}[first..last].each do |uri,data|
+ - neighbor_id += 1
+ - compound = OpenTox::Compound.new(:uri => uri)
+ %tr
+ %td.image= compound_image(compound,data[:features])
+ %td
+ - data[:activities].each do |act|
+ = activity_markup(act)
+ %td= sprintf('%.03g', data[:similarity])
+ %td
+ %ul
+ %li
+ %a{:href => "#prediction", :id => "show_names#{neighbor_id}"} Names and synonyms
+ :javascript
+ $("a#show_names#{neighbor_id}").click(function () {
+ $("#compound_names#{neighbor_id}").load("#{File.join("compound",compound.inchi)}");
+ $("#names#{neighbor_id}").toggle();
+ });
+ %li= toggle_link("#fragments#{neighbor_id}","Significant fragments")
+ -#%li Ambit data
+ -# %li
+ %a{:href => "http://www.ncbi.nlm.nih.gov/sites/entrez?cmd=PureSearch&db=pccompound&term=#{URI.encode('"'+compound.inchi+'"[InChI]')}"} PubChem data
+ (external)
+ -# %li ToxNet data
+
+ %tr{:id => "names#{neighbor_id}", :style => "display: none;" }
+ %td{:colspan => '4'}
+ = hide_link("#names#{neighbor_id}")
+ %div{:id => "compound_names#{neighbor_id}"}
+ %tr{:id => "fragments#{neighbor_id}", :style => "display: none;" }
+ %td{:colspan => '4'}
+ = hide_link("#fragments#{neighbor_id}")
+ = haml :feature_table, :locals => {:features => data[:features]}, :layout => false
+
diff --git a/views/neighbors_navigation.haml b/views/neighbors_navigation.haml
new file mode 100644
index 0000000..43ec3ed
--- /dev/null
+++ b/views/neighbors_navigation.haml
@@ -0,0 +1,22 @@
+.neighbors_navigation
+
+ %form{:name => "nav", :action => url_for('/lazar#prediction'), :method => "post", :enctype => "multipart/form-data", :id => "nav"}
+ %input{:type => :hidden, :name => :compound_uri, :value => @compound.uri}
+ %input{:type => :hidden, :name => :model_uri, :value => @model_uri}
+ %input{:type => :hidden, :name => :page, :id => "page"}
+
+ #prev= "prev" unless @page.to_i == 0
+
+ = "(#{5*@page+1}-#{5*@page+5}/#{@neighbors.size})"
+
+ #next= "next" unless 5*@page.to_i+5 >= @neighbors.size
+
+ :javascript
+ $("#prev").click(function() {
+ $("#page").val(#{@page-1});
+ $("#nav").submit();
+ });
+ $("#next").click(function() {
+ $("#page").val(#{@page+1});
+ $("#nav").submit();
+ });
diff --git a/views/next.haml b/views/next.haml
deleted file mode 100644
index b7a2b3a..0000000
--- a/views/next.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-- unless 5*page.to_i+5 >= size
- %form{:name => "form", :action => url_for('/lazar'), :method => "post", :enctype => "multipart/form-data" }
- %input{:type => :hidden, :name => :compound_uri, :value => compound_uri}
- %input{:type => :hidden, :name => :model_uri, :value => model_uri}
- %input{:type => :hidden, :name => :highlight, :value => smarts}
- %input{:type => :hidden, :name => :page, :value => page.to_i+1}
- %input{ :type => "submit", :value => "&gt;&gt;"}
diff --git a/views/prediction.haml b/views/prediction.haml
index 94d7987..dd7d155 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -15,17 +15,10 @@
- if p[:measured_activities]
%br
- p[:measured_activities].each do |a|
- - if activity(a) == 'active'
- .active
- = activity(a)
- - elsif activity(a) == 'inactive'
- .inactive
- = activity(a)
- - else
- = a
+ = activity_markup(a)
%br
(
- %a{:href => "#", :id => "linkTrainingData#{p.object_id}"} Training data
+ %a{:href => "#", :id => "linkTrainingData#{p.object_id}"} Measured activity
:javascript
$("a#linkTrainingData#{p.object_id}").click(function () {
$("dl#training_data").toggle();
@@ -33,18 +26,7 @@
)
- else
- - if activity(p[:prediction]) == 'active'
- .active
- = activity(p[:prediction])
- - elsif activity(p[:prediction]) == 'inactive'
- .inactive
- = activity(p[:prediction])
- - elsif p[:prediction].is_a?(Float)
- .other
- = sprintf('%.03g', p[:prediction])
- - else
- .other
- %em= p[:prediction].to_s
+ = activity_markup(p[:prediction])
- if p[:confidence]
%br
(
@@ -61,13 +43,5 @@
%input{:type => :hidden, :name => :model_uri, :value => p[:model_uri]}
%input{ :type => "submit", :value => "Details"}
-%dl#confidence{ :style => "display: none;" }
- %dt Confidence:
- %dd Indicates the applicability domain of a model. Predictions with a high confidence can be expected to be more reliable than predictions with low confidence. Confidence values may take any value between 0 and 1. For most models confidence &gt; 0.025 is a sensible (hard) cutoff to distiguish between reliable and unreliable predictions.
-
-
-%dl#training_data{ :style => "display: none;" }
- %dt Training data:
- %dd Experimental result(s) from the training dataset are displayed here.
-
-
+= haml :confidence, :layout => false
+= haml :training_data, :layout => false
diff --git a/views/prev.haml b/views/prev.haml
deleted file mode 100644
index 9a00579..0000000
--- a/views/prev.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-- unless page.to_i == 0
- %form{:name => "form", :action => url_for('/lazar'), :method => "post", :enctype => "multipart/form-data" }
- %input{:type => :hidden, :name => :compound_uri, :value => compound_uri}
- %input{:type => :hidden, :name => :model_uri, :value => model_uri}
- %input{:type => :hidden, :name => :highlight, :value => smarts}
- %input{:type => :hidden, :name => :page, :value => page.to_i-1}
- %input{ :type => "submit", :value => "&lt;&lt;"}
-
diff --git a/views/significant_fragments.haml b/views/significant_fragments.haml
new file mode 100644
index 0000000..87cb113
--- /dev/null
+++ b/views/significant_fragments.haml
@@ -0,0 +1,10 @@
+%dl#significant_fragments{ :style => "display: none;" }
+ %dt
+ Significant fragments
+ (
+ = hide_link "#significant_fragments"
+ )
+ %dd
+ Substructures that occur (statistically significant) more frequently in active or inactive compounds. Substuctures can take any shape (without cycles) and are determined with the
+ %a{:href => "http://www.maunz.de/libfminer2-bbrc-doc/"} fminer
+ algorithm.
diff --git a/views/similarity.haml b/views/similarity.haml
new file mode 100644
index 0000000..659eb50
--- /dev/null
+++ b/views/similarity.haml
@@ -0,0 +1,19 @@
+%dl#similarity{ :style => "display: none;" }
+ %dt
+ Similarity
+ (
+ = hide_link "#similarity"
+ )
+ %dd
+ %code lazar
+ calculates
+ %em activity specific
+ similarities based on the presence of statistically
+ = toggle_link "#significant_fragments", "significant fragments"
+ This procedure will
+ %ul
+ %li consider only those parts of a chemical structure that are relevant for a particular endpoint
+ %li ignore inert parts of the structure
+ %li lead to different similarities, depending on the toxic endpoint
+ Similarities of 1 may be encountered even for structurally dissimilar compounds, because inert parts are ignored.
+
diff --git a/views/style.sass b/views/style.sass
index b64b919..4977da1 100644
--- a/views/style.sass
+++ b/views/style.sass
@@ -18,6 +18,7 @@ body
color: $ot_purple
a:hover
color: black
+
.headline
.logo
float: right
@@ -55,6 +56,7 @@ body
color: $bg_color
a
color: $text_color
+
.content
background-color: $bg_color
height: 100%
@@ -102,6 +104,7 @@ body
td
padding: 0.5em
border: 1px solid
+
.predictions
text-align: center
overflow: auto
@@ -121,57 +124,87 @@ body
img
padding: 0
height: 100%
+
.lazar-predictions
clear: both
margin-top: 2%
+ .neighbors_navigation
+ font-size: x-small
+ #prev
+ @extend a
+ display: inline
+ #next
+ @extend a
+ display: inline
+
+ dt
+ font-weight: bold
table
+ width: 100%
+ //height: 100%
+ background-color: $bg_color2
border-spacing: 0
border-collapse: collapse
margin: 0
+ tbody
+ height: 10em
+ overflow: scroll
th
+ text-align: center
border: 1px solid
color: $body_color
background-color: $fg_color
- //border: 1px solid
margin: 0.5em
+ a
+ text-decoration: underline
+ font-weight: bold
+ color: $bg_color
+
+ a:hover
+ color: $bg_color2
td
border: 1px solid
- background-color: $bg_color2
- padding: 0.5em
+ overflow: auto
+ ul
+ list-style-type: none
+ td.image
+ padding: 0
+ width: 150px
+ height: 150px
+
table
font-size: x-small
td
border: none
td.selected
background-color: blue
- //img
- padding: 0
- //height: 100%
+ //overflow-y: scroll;
+
.model
padding: 0em 1em
background-color: $bg_color2
border: 1px solid
margin-top: 0.6em
- dl
- dt
- width: 15em
- font-weight: bold
- float: left
- clear: both
- dd
- clear: right
- margin: 0.2em 0em
- dl
+ dl
+ dt
+ width: 15em
+ font-weight: bold
+ float: left
clear: both
- padding: 0em
- background-color: $bg_color2
- border: 0
- dt
- white-space: nowrap
- width: 16em
- font-weight: bold
- float: left
- clear: right
+ dd
+ clear: right
+ margin: 0.2em 0em
+ dl
+ clear: both
+ padding: 0em
+ background-color: $bg_color2
+ border: 0
+ dt
+ white-space: nowrap
+ width: 16em
+ font-weight: bold
+ float: left
+ clear: right
.footer
margin: 0.5em
@@ -183,6 +216,9 @@ body
.inactive
color: green
+.inconclusive
+ color: yellow
+
.other
color: black
diff --git a/views/training_data.haml b/views/training_data.haml
new file mode 100644
index 0000000..0593776
--- /dev/null
+++ b/views/training_data.haml
@@ -0,0 +1,7 @@
+%dl#training_data{ :style => "display: none;" }
+ %dt
+ Measured activity
+ (
+ = hide_link "#training_data"
+ )
+ %dd Experimental result(s) from the training dataset.