:javascript
$(document).ready(function(){
$('[data-toggle="popover"]').popover();
$('.modal').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});
});
%div.well
%a.btn.btn-warning{:href => to('/predict')}
%i.glyphicon.glyphicon-menu-left
New Prediction
/ displays all prediction result in first table
%h3 Prediction Results:
%div.table-responsive
%table.table.table-bordered{:id=>"overview"}
%tbody
%tr
%td{:id=>"compound"}
%b.title Compound
%p= embedded_svg(@compound.svg, title: @compound.smiles)
%p= @compound.smiles
- @model_types = {}
- @dbhit = {}
- toxtree = @predictions.pop if @toxtree == true
- unless @predictions.blank?
- @predictions.each_with_index do |prediction,i|
- if prediction.dimension > 0
- sa_prediction = prediction[1]
- prediction = prediction[0]
- type = @models[i].model.class.to_s.match("Classification") ? "Classification" : "Regression"
- @model_types[i] = type
- unit = @models[i].unit
%td{:style=>"vertical-align:top;white-space:nowrap;"}
%b.title
= (sa_prediction ? "Consensus mutagenicity" : "#{@models[i].endpoint.gsub('_', ' ')} (#{@models[i].species})")
/ check kazius
- if sa_prediction
- hash = sa_prediction[:prediction]
- confidence = sa_prediction[:confidence]
/ check for database hit
- if prediction[:info] =~ /\b(identical)\b/i
- @dbhit[i] = true
%p
:plain
This compound was part of the training dataset. All information
from this compound was removed from the training data before the
prediction, to obtain unbiased results.
%p
%b Measured activity:
%br
= prediction[:measurements].join("; ")
%b Consensus prediction:
%br
=(hash[:prediction] == true ? "mutagenic" : "non-mutagenic")
%p
%b Consensus confidence:
%br
=confidence.to_f.signif(3)
%p
%b Structural alerts for mutagenicity:
%br
=hash[:matches].blank? ? "none" : hash[:matches].join("; ")
/ check for prediction
%p
/ regression
- if prediction[:value]
%b.title= ("Lazar #{@models[i].endpoint.gsub('_', ' ').downcase} (#{@models[i].species}):" if sa_prediction)
%p
/ check for database hit
- if prediction[:info] =~ /\b(identical)\b/i
- @dbhit[i] = true
/ show message about dbhit and measurements
- unless sa_prediction
%p
:plain
This compound was part of the training dataset. All information
from this compound was removed from the training data before the
prediction, to obtain unbiased results.
%p
%b Measured activity:
%br
- if prediction[:measurements].is_a?(Array)
= (type == "Regression") ? prediction[:measurements].collect{|value| "#{value.delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("") : prediction[:measurements].join(", ")
- else
= (type == "Regression") ? "#{prediction[:measurements].delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(prediction[:measurements].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements]
- else
- @dbhit[i] = false
/ show prediction
%p
%b Prediction:
%br
= (type == "Regression") ? "#{prediction[:value].delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(prediction[:value].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value]
/ show prediction interval or probability
%p
- if type == "Regression"
%b 95% Prediction interval:
- interval = (prediction[:prediction_interval].nil? ? nil : prediction[:prediction_interval])
%br
= interval.nil? ? "--" : "#{interval[1].delog10.signif(3)} - #{interval[0].delog10.signif(3)} (#{unit})"
%br
= "#{@compound.mmol_to_mg(interval[1].delog10).signif(3)} - #{@compound.mmol_to_mg(interval[0].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !interval.nil?
- else
%b Probability:
- unless prediction[:probabilities].nil?
%br
= "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0].signif(3)}"
- if prediction[:probabilities].size == 2
%br
= "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1].signif(3)}"
%p
- if !prediction[:warnings].blank?
%b Warnings:
%br
=prediction[:warnings].join("")
- else
- if !prediction[:info].blank?
%p
:plain
This compound was part of the training dataset. All information
from this compound was removed from the training data before the
prediction, to obtain unbiased results.
%p
%b Measured activity:
%br
- if prediction[:measurements].is_a?(Array)
= (type == "Regression") ? prediction[:measurements].collect{|value| "#{value.delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("") : prediction[:measurements].join(", ")
- else
= (type == "Regression") ? "#{prediction[:measurements].delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(prediction[:measurements].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements]
- if !prediction[:warnings].blank?
%p
%b Warnings:
%br
=prediction[:warnings].join("")
/ show Cramer rules if checked
- if @toxtree == true
%td{:style=>"vertical-align:top;white-space:nowrap;"}
%b.title Oral toxicity (Cramer rules)
%p
%b Cramer rules:
%br
=toxtree.first["Cramer rules"]
%p
%b Cramer rules, with extensions:
%br
=toxtree.last["Cramer rules, with extensions"]
/ always show the neighbors table, message is given there. Except only Cramer is selected.
- unless @predictions.blank?
= haml :neighbors, :layout => false