summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2013-09-27 12:09:55 +0200
committergebele <gebele@in-silico.ch>2013-09-27 12:09:55 +0200
commitda701f22287f855b499145c181106f3736392d47 (patch)
tree557e91115066ff5f5188ee9c5fef3f855ea049ac
parent50d1d8bf543f02a7daaceae90d399c34fc48f48c (diff)
serveral minor changes;pass values active/inactive
-rw-r--r--application.rb11
-rw-r--r--views/details.haml3
-rw-r--r--views/neighbors.haml21
-rw-r--r--views/predict.haml6
-rw-r--r--views/prediction.haml43
-rw-r--r--views/significant_fragments.haml16
6 files changed, 59 insertions, 41 deletions
diff --git a/application.rb b/application.rb
index 13d98cb..0bbf18a 100644
--- a/application.rb
+++ b/application.rb
@@ -77,8 +77,17 @@ get '/prediction/:model_uri/:type/:compound_uri/fingerprints/?' do
feature_calc_algo = p[RDF::OT.paramValue].object
end
}
+
+ @desc = []
fingerprints = OpenTox::Algorithm::Descriptor.send( feature_calc_algo, [ @compound ], feature_dataset.features.collect{ |f| f[RDF::DC.title] } )
- fingerprints.each{|x, h| h.each{|descriptor, value| @significant_fragments << [descriptor, [value]]}}
+ fingerprints.each{|x, h| h.each{|descriptor, value| @desc << [descriptor, [value]]}}
+
+ pc_descriptor_titles_descriptions = {}
+ feature_dataset.features.collect{ |f|
+ pc_descriptor_titles_descriptions[f[RDF::DC.title]]= f[RDF::DC.description]
+ }
+
+ @desc.each{|d, v| @significant_fragments << [pc_descriptor_titles_descriptions[d], v] }
end
haml :significant_fragments, :layout => false
diff --git a/views/details.haml b/views/details.haml
index b69f1af..9f6915f 100644
--- a/views/details.haml
+++ b/views/details.haml
@@ -17,7 +17,10 @@
%br
%b="Names:"
%p{:style=>"padding-left:0.5em;"}
+ - if @names !~ /^no names/i
= @names.join("; ")
+ - else
+ = @names
%p{:style=>"padding-left:0.5em;"}
/ pubchem link
%a{:href=>"http://aop.in-silico.ch/", :title=>"link opens in new tab", :alt=>"pubchem link", :target=>"_blank"} PubChem read across
diff --git a/views/neighbors.haml b/views/neighbors.haml
index df03b85..7785eaa 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -42,9 +42,10 @@
sortList: [[2,1]]
});
});
- %h2= "Neighbors: "
+ /%h2= "Neighbors: "
- $logger.debug "neighbors compounds:\t#{p.data_entries[0]}\n"
- if p.data_entries[0][2] != nil && p.data_entries[0].size != 3
+ %h2= "Neighbors: "
%table{:id=>"#{count_rs}", :class=>"tablesorter", :cellspacing=>"1"}
%thead
%tr
@@ -90,22 +91,24 @@
/ prevent conversion of nil
- c = p.data_entries[count][2] != nil ? p.data_entries[count][2] : ''
- case c
- - when /(0|false|inactive)/
+ - when /(false|true|inactive|active)/i
+ - c = c
+ -#- when /(0|false|inactive)/
- c = "non-carcinogen"
- - when /(1|true|active)/
+ -#- when /(1|true|active)/
- c = "carcinogen"
- else
- - c = Array.new
- - c[0] = p.data_entries[count][2]
+ /- c = Array.new
+ - c = p.data_entries[count][2].round(3)
%tr
%td.compound
%img{:src=>"#{neighbor_compound.uri}/image", :alt=>"Compound image not available", :title=>"#{neighbor_compound.smiles}", :width=>"150px"}
- %td{:class => c[0]}
+ %td
- if c.class == String
= c
- else
- = c[0]
- %td{:class => c[0]}
+ = c
+ %td
= p.data_entries[count][3] != nil ? p.data_entries[count][3].round(3) : "Not enough similar compounds in training dataset."
%td
-#- if p.data_entries[count][3] != nil
@@ -129,7 +132,7 @@
});
});
- count += 1
- - else
+ -#- else
%h3
Not enough similar compounds in training dataset
diff --git a/views/predict.haml b/views/predict.haml
index 6340def..d515902 100644
--- a/views/predict.haml
+++ b/views/predict.haml
@@ -79,7 +79,7 @@
%div{:id => model_title}
%input{:type => "checkbox", :name => "selection[#{model_title}]", :id => "selection[#{model_title}]", :value => true, :disabled => false}
%label{:for => "selection[#{model_title}]"}
- = model.title
+ = model.title.gsub("_", " ")
%a{:href=>"#details", :id => "linkDetails#{model_title}", :title=>"#{model_title} details", :style=>"font-size:small;"}
[Details]
@@ -112,7 +112,7 @@
%div{:id => model_title}
%input{:type => "checkbox", :name => "selection[#{model_title}]", :id => "selection[#{model_title}]", :value => true, :disabled => false}
%label{:for => "selection[#{model_title}]"}
- = model.title
+ = model.title.gsub("_", " ")
%a{:href=>"#details", :id => "linkDetails#{@detail_count}", :title=>"#{model_title} details", :style=>"font-size:small;"}
[Details]
@@ -146,7 +146,7 @@
%div{:id => model_title}
%input{:type => "checkbox", :name => "selection[#{model_title}]", :id => "selection[#{model_title}]", :value => true, :disabled => false}
%label{:for => "selection[#{model_title}]"}
- = model.title
+ = model.title.gsub("_", " ")
%a{:href=>"#details", :id => "linkDetails#{model_title}", :title=>"#{model_title} details", :style=>"font-size:small;"}
[Details]
diff --git a/views/prediction.haml b/views/prediction.haml
index 5de0564..16101d3 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -16,7 +16,7 @@
%tr
%td{:id=>"compound", :style=>"align:center;"}
%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"}
+ %img{:src=>"#{@compound.uri}/image", :alt=>"Compound image not available", :title=>"#{@compound.smiles}", :width=>"150", :height=>"150"}
%p
%a{:href => to("/prediction/#{CGI.escape(@compound.uri)}/details"), :id=>"linkCompound", :target=>"details_overview"} Names and synonyms
%p
@@ -40,14 +40,16 @@
- database_hit = 1
- c = p.data_entries[0][0] != nil ? p.data_entries[0][0] : ''
- case c
- - when /(0|false|inactive)/
+ - when /(false|true|inactive|active)/i
+ - c = c
+ -#- when /(0|false|inactive)/
- c = "non-carcinogen"
- - when /(1|true|active)/
+ -#- when /(1|true|active)/
- 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 prediction")
- %td{:style=>"valign:top;"}
+ /- c = Array.new
+ - c = (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{:style=>"vertical-align:top;"}
%b{:class => "title"}
= @prediction_models[count].title.gsub("_", " ")
- @model_uri = @prediction_models[count].uri
@@ -58,11 +60,11 @@
%p
- unless database_hit > 0
%b Result:
- %b{:class => c[0]}
+ %b
- if c.class == String
= (c != '' ? c : "No prediction result.")
- else
- = (c[0] != '' ? c[0] : "No prediction result.")
+ = (c != '' ? c.round(3) : "No prediction result.")
/ title must be empty for tooltip
%a{:href=>"#result", :title=>"", :id=>"result"}
%img{:src=>"/images/info_white.png"}
@@ -89,7 +91,7 @@
%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] != 0.0) ? 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"}
@@ -105,7 +107,7 @@
reliable and unreliable predictions.
%p
/TODO add tooltip for significant ftagments and descriptors
- - if @model_type[count] =~ /classification/i
+ - if @model_type[count] =~ /classification/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0)
/ 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
@@ -114,7 +116,7 @@
$('#iframe_overview').bPopup();
});
});
- - if @model_type[count] =~ /regression/i
+ - if @model_type[count] =~ /regression/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0)
/ Descriptors
%a{:href => to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[count]}/#{CGI.escape(@compound.uri)}/fingerprints"), :id=>"linkPredictionSf", :target=>"details_overview"} Descriptors
:javascript
@@ -132,15 +134,16 @@
%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}" });
- });
+ - if c != ''
+ %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
diff --git a/views/significant_fragments.haml b/views/significant_fragments.haml
index 46cca5f..5bb4c31 100644
--- a/views/significant_fragments.haml
+++ b/views/significant_fragments.haml
@@ -12,9 +12,9 @@
- if !@significant_fragments.empty?
%table{:id => "sf1"}
%tr
- %th{:style=>"border:2px solid #C0C0C0;"}
- Predominantly in compounds with activity "non-carcinogen"
- %th{:style=>"border:2px solid #C0C0C0;"}
+ %th{:style=>"border:2px solid #E6E6E6;"}
+ Predominantly in compounds with activity "non-active"
+ %th{:style=>"border:2px solid #E6E6E6;"}
p value
- @significant_fragments.each do |fragments|
/ fragments == [1||2, smarts, pValue]
@@ -28,9 +28,9 @@
%td
%br
%tr
- %th{:style=>"border:2px solid #C0C0C0;"}
- Predominantly in compounds with activity "carcinogen"
- %th{:style=>"border:2px solid #C0C0C0;"}
+ %th{:style=>"border:2px solid #E6E6E6;"}
+ Predominantly in compounds with activity "active"
+ %th{:style=>"border:2px solid #E6E6E6;"}
p value
- @significant_fragments.each do |fragments|
/ fragments == [1||2, smarts, pValue]
@@ -50,9 +50,9 @@
- if !@significant_fragments.empty?
%table{:id => "sf2"}
%tr
- %th{:style=>"border:2px solid #C0C0C0;"}
+ %th{:style=>"border:2px solid #E6E6E6;"}
Descriptor
- %th{:style=>"border:2px solid #C0C0C0;"}
+ %th{:style=>"border:2px solid #E6E6E6;"}
value
- @significant_fragments.each do |fragments|
%tr