summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2016-09-22 10:29:10 +0000
committergebele <gebele@in-silico.ch>2016-09-22 10:29:10 +0000
commit79bcc6575eb30c4fddcc77ffdc183f79d2d1cc0d (patch)
treee29bb2dc768735c978a70ffac02bd8d7f5bd7788 /views
parentd420e64b3869130bc8526ff2659da6fd35bc6548 (diff)
added Ag
Diffstat (limited to 'views')
-rw-r--r--views/predict.haml38
-rw-r--r--views/prediction.haml41
2 files changed, 48 insertions, 31 deletions
diff --git a/views/predict.haml b/views/predict.haml
index 7c25def..ad263d1 100644
--- a/views/predict.haml
+++ b/views/predict.haml
@@ -11,10 +11,10 @@
- @prediction_models.each_with_index do |m, idx|
%li{:class => ("active" if idx == 0)}
%a{:href => "#model_#{idx}", :id => "linkTab#{idx}", data: {toggle:"tab"}}
- = "#{idx+1}. #{m.model.feature_selection_algorithm_parameters[:category].nil? ? "P-CHEM & Proteomics" : "P-CHEM" }"
+ = "#{idx+1}. #{m.model.feature_selection_algorithm_parameters[:category].nil? ? "Physchem & Proteomics" : "Physchem" }"
%div.tab-content
- @prediction_models.each_with_index do |m, idx|
- - m[:pc_model] ? example = @example_pc : example = @example_pcp
+ - m[:pc_model] ? (example = @example_pc; type = "pc") : (example = @example_pcp; type = "pcp")
#model.tab-pane{:id=>"#{idx}", :class => ("active" if idx == 0)}
%b Model:
%br
@@ -64,14 +64,33 @@
= "R square:\t"
= cv.r_squared.round(3) if cv.r_squared
%br
+ %b QSAR report
+ %br
+ %a{:href=>to('/qsar-report/'+m.id)} download
%hr
%form{:id=>idx, :role=>"form", :action=> to("/predict"), :method=>"post"}
%h3.help-block
Please characterise a nanoparticle:
#input
%div.form-group
+ // type pcp || pc
+ %input{:id=>"type",:type=>"hidden",:name=>"type",:value=>"#{type}"}
+ // example data to compare
+ %input{:id=>"example_core",:type=>"hidden",:name=>"example_core",:value=>"#{example.core}"}
+ %input{:id=>"example_coating",:type=>"hidden",:name=>"example_coating",:value=>"#{example.coating}"}
+ %input{:id=>"example_pc",:type=>"hidden",:name=>"example_pc",:value=>"#{example.physchem_descriptors}"}
+ - size = example.physchem_descriptors.size
+ %input{:id=>"size",:type=>"hidden",:name=>"size",:value=>size}
+ %input{:id=>"id",:type=>"hidden",:name=>"example_id",:value=>example.id}
+ // input form parameters to transfer
%h5 Core
- %input.input-sm.form-control{:id=>"core_name",:type=>"text",:name=>"core_name",:value=>example.core["name"], :disabled=>"true"}
+ %input.input-sm.form-control{:id=>"core",:type=>"text",:name=>"input_core",:value=>example.core["name"]}
+ %input{:id=>"input_core",:type=>"hidden",:name=>"in_core",:value=>"#{example.core}"}
+ %h5 Coating
+ %input.input-sm.form-control{:id=>"coating",:type=>"text",:name=>"input_coating",:value=>example.coating[0]["name"]}
+ %input{:id=>"input_coating",:type=>"hidden",:name=>"in_coating",:value=>example.coating}
+ // prediction model id
+ %input{:id=>"prediction_model",:type=>"hidden",:name=>"prediction_model",:value=>m.id}
- example.physchem_descriptors.each_with_index do |v,id|
- feature = OpenTox::Feature.find_by(:id => v[0])
- name = feature.name
@@ -82,18 +101,9 @@
- val = v[1]
- id = id + 1
%h5= name
- %input.form-control{:id=>id,:type=>"hidden",:name=>"input_key_#{id}",:value=>v[0]}
+ // input physchem parameters
%input.input-sm.form-control{:id=>id,:type=>"text",:name=>"input_value_#{id}",:value=>val[0]}
- %input.form-control{:id=>id,:type=>"hidden",:name=>"input_key_#{id}",:value=>v[0]}
- %input.input-sm.form-control{:id=>id,:type=>"hidden",:name=>"input_value_#{id}",:value=>val[0]}
- %input.form-control{:id=>"example_id",:type=>"hidden",:name=>"example_id",:value=>example.id}
- %input.form-control{:id=>"core",:type=>"hidden",:name=>"core",:value=>"#{example.core}"}
- %input.form-control{:id=>"coating",:type=>"hidden",:name=>"coating",:value=>example.coating}
- %input.form-control{:id=>"prediction_model",:type=>"hidden",:name=>"prediction_model",:value=>m.id}
- - example_pc = example.physchem_descriptors
- %input.form-control{:id=>"example_pc",:type=>"hidden",:name=>"example_pc",:value=>"#{example_pc}"}
- - size = example.physchem_descriptors.size
- %input.form-control{:id=>"size",:type=>"hidden",:name=>"size",:value=>size}
+ %input{:id=>id,:type=>"hidden",:name=>"input_key_#{id}",:value=>v[0]}
%hr
#predict
%button.btn.btn-success{:id=>"submitbutton", :type=>"submit", :onclick=>"showcircle();"}
diff --git a/views/prediction.haml b/views/prediction.haml
index f8610f5..0438f1f 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -41,7 +41,7 @@
- @input.each do |key|
- feature = OpenTox::Feature.find_by(:id=>key[0])
- name = feature.name
- - if !feature[:conditions]["MEDIUM"].blank?
+ - if (feature[:conditions] && !feature[:conditions]["MEDIUM"].blank?)
- name = feature.name + " / " + feature[:conditions]["MEDIUM"]
- else
- name = feature.name
@@ -66,34 +66,39 @@
/ composition
%td
- if @match
- %h5 Core
+ %h5.th5 Core:
= "["+@nanoparticle[:core]["name"]+"]"
- %h5 Coating
+ %br
+ %h5.th5 Coating:
= @nanoparticle[:coating][0]["name"]
+ %br
- else
- %h5 x
+ %h5.th5 x
/ tox
%td.tox
- if @prediction[:value]
- %h5 Prediction:
+ %h5.th5 Prediction:
= @prediction[:value].round(3)
+ %br
- if @prediction[:rmse]
- %h5 Rmse:
+ %h5.th5 Rmse:
= @prediction[:rmse].round(3)
+ %br
- if @prediction[:r_squared]
- %h5 R_squared:
+ %h5.th5 R_squared:
= @prediction[:r_squared].round(3)
+ %br
- if @prediction[:prediction_interval]
%h5 95% Prediction interval:
- interval = @prediction[:prediction_interval].nil? ? " - - " : @prediction[:prediction_interval].collect{|i| i.round(2)}
= "#{interval[0]} - #{interval[1]}"
- if @prediction[:measurements]
%hr
- %h5 Measurement
+ %h5.th5 Measurement:
- @prediction[:measurements].each do |m|
- %p= m
+ = m
- if !@prediction[:value] && !@prediction[:measurements]
- %h5 not available
+ %h5.th5 not available
/ physchem
- if @prediction[:match]
- sorted = {}
@@ -115,7 +120,7 @@
- if @prediction[:neighbors]
- @prediction[:neighbors].each_with_index do |neighbor,idx|
- nano = OpenTox::Nanoparticle.find(neighbor["_id"])
- - pc_descriptors = nano.physchem_descriptors.delete_if{|k,v| feature = OpenTox::Feature.find_by(:id => k); feature.category != "P-CHEM"}
+ - pc_descriptors = nano.physchem_descriptors.delete_if{|k,v| feature = OpenTox::Feature.find_by(:id => k); feature.category != "P-CHEM"} if @type == "pc"
%tr
/ ID
%td
@@ -126,17 +131,19 @@
%h5= neighbor["similarity"].round(3)
/ Composition
%td
- %h5 Core
+ %h5.th5 Core:
= "["+nano[:core]["name"]+"]"
- %h5 Coating
+ %br
+ %h5.th5 Coating:
= nano[:coating][0]["name"]
/ Tox
%td.tox
- %h5 Measurement
- %p= neighbor["measurements"][0]
+ %h5.th5 Measurement:
+ = neighbor["measurements"][0]
/ Physchem
- - @input.each do |k,v|
+ -#- @input.each do |k,v|
+ - nano.physchem_descriptors.each do |k,v|
%td.physchem
%div
%div{:style=>"display:inline-block;padding-right:20px;"}
- %p= v[0].round(3) unless v.nil?
+ = v[0].round(3) unless v.nil?