summaryrefslogtreecommitdiff
path: root/views/prediction.haml
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2013-09-25 00:12:04 +0200
committergebele <gebele@in-silico.ch>2013-09-25 00:12:04 +0200
commit13ffab048630cc30a4af9e9113c1843ae5af0a09 (patch)
tree7f8ad39ed45eac0c3cb11ece7928d3769c875d92 /views/prediction.haml
parent42a6facfda144d0ed70063fd5b3887697578faa3 (diff)
several major changes in code, several minor changes in style; prepared for OT meeting
Diffstat (limited to 'views/prediction.haml')
-rw-r--r--views/prediction.haml129
1 files changed, 88 insertions, 41 deletions
diff --git a/views/prediction.haml b/views/prediction.haml
index f902504..4002cbd 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -4,7 +4,7 @@
%img{:src=>"/images/arrow_left_float.png", :alt=>"<"}
%a{:href => to('/predict')} New Prediction
- / displays all prediction results
+ / displays all prediction result in first table
.overview
%table{:width=>"100%", :cellspacing=>"1", :id=>"overview"}
%thead
@@ -17,9 +17,9 @@
%td{:id=>"compound"}
%a{:href => to("/prediction/#{CGI.escape(@compound.uri)}/details"), :id=>"linkCompound", :target=>"details_overview"}
%img{:src=>"#{@compound.uri}/image", :alt=>"Compound image not available", :width=>"150", :height=>"150"}
- %br
- %br
- %img{:src=>"/images/arrow_up_float.png", :alt=>"^"}
+ %p
+ %a{:href => to("/prediction/#{CGI.escape(@compound.uri)}/details"), :id=>"linkCompound", :target=>"details_overview"} Names and synonyms
+ %p
:javascript
$(function() {
$("a#linkCompound").on('click', function(e) {
@@ -27,18 +27,18 @@
});
});
- count=0
- / var for rule to load neighbors page.
- - @@neighbors_available = 1
- - @@predictions.each do |pa|
- / prediction of one model
+ - @predictions.each do |pa|
+ / unpack to single array/prediction
+ / if p.data_entries array[0].size == 3 -> database hit
+ / change 'result' if database hit
+ / change 'confidence' if database hit
- pa.each do |p|
- - $logger.debug "inspect p: #{p.inspect}\n"
- - $logger.debug "inspect data_entries: #{p.data_entries}\n"
- / p.data_entries > 1 = neighbors available
- - p.data_entries.length > 1 ? @@neighbors_available = p.data_entries.length : @@neighbors_available
/ prevent conversion of nil
+ /- $logger.debug "data entries in prediction array:\t#{p.data_entries}\n"
+ - database_hit = 0
+ - if p.data_entries[0].size == 3
+ - database_hit = 1
- c = p.data_entries[0][0] != nil ? p.data_entries[0][0] : ''
- - $logger.debug "inspect c: #{c.inspect}\n"
- case c
- when /(0|false)/
- c = "non-carcinogen"
@@ -46,15 +46,17 @@
- c = "carcinogen"
- else
- c = Array.new
- - c[0] = (p.data_entries[0][0].class == Float) ? p.data_entries[0][0].round(3) : (p.data_entries[0][0] != nil ? p.data_entries[0][0] : "no value")
+ - c[0] = (p.data_entries[0][0].class == Float) ? p.data_entries[0][0].round(3) : (p.data_entries[0][0] != nil ? p.data_entries[0][0] : "no prediction")
%td
%b{:class => "title"}
- = @@prediction_models[count].title.split(" ").first
- %br
- %br
- / classification, regression
- %b Type:
- %br
+ = @prediction_models[count].title.split(" ").first
+ - @model_uri = @prediction_models[count].uri
+ %p
+ / model type (classification|regression)
+ %b Type:
+ = @model_type[count]
+ %p
+ - unless database_hit > 0
%b Result:
%b{:class => c[0]}
- if c.class == String
@@ -76,18 +78,18 @@
%li a majority vote (weighted by compound similarity) for
%em classification
(
- %a{:href=>"http://www.in-silico.de/articles/modi020905.pdf"} original publication
+ %a{:href=>"http://www.frontiersin.org/Journal/10.3389/fphar.2013.00038/abstract", :target=>"_blank"} original publication
)
%li a local QSAR model based on neighbors for
%em regression
(
- %a{:href=>"http://www.in-silico.de/articles/mh_tf.pdf"} original publication
+ %a{:href=>"http://www.frontiersin.org/Journal/10.3389/fphar.2013.00038/abstract", :target=>"_blank"} original publication
)
Please keep in mind that predictions are based on the measured activities of neighbors.
- %br
+ %p
.confidence
%b Confidence:
- = p.data_entries[0][1] != nil ? p.data_entries[0][1].round(3) : ""
+ = p.data_entries[0][1] != nil ? p.data_entries[0][1].round(3) : "-"
/ title must be empty for tooltip
%a{:href=>"#confidence", :title=>"", :id=>"confidence"}
%img{:src=>"/images/info_white.png"}
@@ -101,20 +103,65 @@
Confidence values may take any value between 0 and 1.
For most models confidence > 0.025 is a sensible (hard) cutoff to distiguish between
reliable and unreliable predictions.
- %br
- %a{:href=> "#tabs", :id=>"link#{count}"}
- %img{:src=>"/images/arrow_down_float.png", :alt=>"v"}
- :javascript
- $("a#link#{count}").click(function () {
- $(".results").show();
- document.getElementById('tabs').focus();
- $("#tabs").tabs({ active: "#{count}" });
- });
- - count+=1
-
- - if @@neighbors_available > 1
- = haml :neighbors, :layout => false
- - else
- %h2
- no neighbors available
-%iframe{:id=>"iframe_overview", :name=>"details_overview", :height=>"90%", :width=>"90%", :style=>"display:none;border:0px"}
+ %p
+ /TODO add tooltip for significant ftagments and descriptors
+ - if @model_type[count] =~ /classification/i
+ / Significant fragments:
+ %a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[count]}/#{CGI.escape(@compound.uri)}/fingerprints"), :id=>"linkPredictionSf", :target=>"details_overview"}Significant fragments
+ :javascript
+ $(function() {
+ $("a#linkPredictionSf").on('click', function(e) {
+ $('#iframe_overview').bPopup();
+ });
+ });
+ - if @model_type[count] =~ /regression/i
+ / Descriptors
+ %a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[count]}/#{CGI.escape(@compound.uri)}/fingerprints"), :id=>"linkPredictionSf", :target=>"details_overview"} Descriptors
+ :javascript
+ $(function() {
+ $("a#linkPredictionSf").on('click', function(e) {
+ $('#iframe_overview').bPopup();
+ });
+ });
+ / title must be empty for tooltip
+ -#%a{:href =>"#sfragments", :title=>"", :id=>"sfragments"}
+ %img{:src=>"/images/info_white.png"}
+ -#.tooltip{:style=>"font-weight: normal; font-size: 1em; width: 50%; text-align: left;"}
+ %dt
+ Significant fragments
+ %dd
+ Significant fragments are solely used to determine activity specific similarities of neighbors.
+ %p
+ %b Neighbors:
+ %a{:href=> "#tabs", :id=>"link#{count}"}
+ %img{:src=>"/images/arrow_down_float.png", :alt=>"v"}
+ :javascript
+ $("a#link#{count}").click(function () {
+ $(".results").show();
+ document.getElementById('tabs').focus();
+ $("#tabs").tabs({ active: "#{count}" });
+ });
+ %p
+ - count+=1
+ - else # database hit
+ %b Database hit:
+ %br Compound found in training dataset
+ %p
+ %b Measured activity:
+ = p.data_entries[0][2]
+ %p
+ %b Neighbors:
+ %a{:href=> "#tabs", :id=>"link#{count}"}
+ %img{:src=>"/images/arrow_down_float.png", :alt=>"v"}
+ :javascript
+ $("a#link#{count}").click(function () {
+ $(".results").show();
+ document.getElementById('tabs').focus();
+ $("#tabs").tabs({ active: "#{count}" });
+ });
+
+ - count+=1
+
+ / always show the neighbors table, message is given there
+ = haml :neighbors, :layout => false, :model_type => @model_type
+%iframe{:id=>"iframe_overview", :name=>"details_overview", :height=>"95%", :width=>"95%", :style=>"display:none;border:0px"}