summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2010-12-06 12:19:49 +0100
committermr <mr@mrautenberg.de>2010-12-06 12:19:49 +0100
commitf5e96aba9ebf6c97d2f17f79571faf25c201b95f (patch)
treeb15d415ea97a586de3a7a00d5e8590e90e7de7f6 /views
parent04c0b50d08292f2754e1d2a6ac00a644f251f593 (diff)
parent1bcac85620afbccae1164a9a880a2290e360aa62 (diff)
merge with helma/development
Diffstat (limited to 'views')
-rw-r--r--views/classification.haml11
-rw-r--r--views/classification_validation.haml33
-rw-r--r--views/compound_image.haml2
-rw-r--r--views/confidence.haml7
-rw-r--r--views/create.haml41
-rw-r--r--views/endpoint.haml12
-rw-r--r--views/feature_table.haml28
-rw-r--r--views/fragment.haml9
-rw-r--r--views/help.haml104
-rw-r--r--views/js_link.haml5
-rw-r--r--views/layout.haml43
-rw-r--r--views/lazar.haml58
-rw-r--r--views/lazar_algorithm.haml50
-rw-r--r--views/lazar_description.haml29
-rw-r--r--views/model.haml67
-rw-r--r--views/model_status.haml2
-rw-r--r--views/models.haml21
-rw-r--r--views/neighbors.haml44
-rw-r--r--views/neighbors_navigation.haml22
-rw-r--r--views/predict.haml34
-rw-r--r--views/prediction.haml50
-rw-r--r--views/regression.haml11
-rw-r--r--views/regression_validation.haml9
-rw-r--r--views/significant_fragments.haml10
-rw-r--r--views/similarity.haml19
-rw-r--r--views/style.sass239
-rw-r--r--views/training_data.haml7
-rw-r--r--views/unit.haml10
-rw-r--r--views/validation.haml23
29 files changed, 1000 insertions, 0 deletions
diff --git a/views/classification.haml b/views/classification.haml
new file mode 100644
index 0000000..5c739cf
--- /dev/null
+++ b/views/classification.haml
@@ -0,0 +1,11 @@
+%dl#classification{ :style => "display: none;" }
+ %dt
+ Classification
+ (
+ = hide_link "#classification"
+ )
+ %dd
+ Prediction of
+ %em qualitative
+ properties, e.g. to distinguish between toxic and non-toxic compounds
+
diff --git a/views/classification_validation.haml b/views/classification_validation.haml
new file mode 100644
index 0000000..94ba8f9
--- /dev/null
+++ b/views/classification_validation.haml
@@ -0,0 +1,33 @@
+%dt Correct predictions:
+%dd
+ = sprintf("%.2f", model.correct_predictions) if model.correct_predictions
+ = '%'
+%dt
+ %a{:href => "http://en.wikipedia.org/wiki/Receiver_operating_characteristic", :target => "_blank"} Weighted area under ROC:
+%dd
+ = sprintf("%.3f", model.weighted_area_under_roc) if model.weighted_area_under_roc
+%dt
+ %a{:href => "http://en.wikipedia.org/wiki/Sensitivity_and_specificity", :target => "_blank"} Specificity:
+%dd= sprintf("%.3f", model.specificity) if model.specificity
+%dt
+ %a{:href => "http://en.wikipedia.org/wiki/Sensitivity_and_specificity", :target => "_blank"} Sensitivity:
+%dd= sprintf("%.3f", model.sensitivity) if model.sensitivity
+%dt
+ %a{:href => "http://en.wikipedia.org/wiki/Confusion_matrix", :target => "_blank"} Confusion Matrix:
+%dd
+ %table
+ %tr
+ %td{:colspan => 2, :rowspan => 2}
+ %th{:colspan => 2} Measured
+ %tr
+ %th{:bgcolor => "#CCD2DC"} active
+ %th{:bgcolor => "#CCD2DC"} inactive
+ %tr
+ %th{:rowspan => 2} Predicted
+ %th{:bgcolor => "#CCD2DC"} active
+ %td= model.true_positives if model.true_positives
+ %td= model.false_positives if model.false_positives
+ %tr
+ %th{:bgcolor => "#CCD2DC"} inactive
+ %td= model.false_negatives if model.false_negatives
+ %td= model.true_negatives if model.true_negatives
diff --git a/views/compound_image.haml b/views/compound_image.haml
new file mode 100644
index 0000000..18944dc
--- /dev/null
+++ b/views/compound_image.haml
@@ -0,0 +1,2 @@
+%img{:src => compound.matching_smarts_image_uri(features[:activating].collect{|f| f[:smarts]},features[:deactivating].collect{|f| f[:smarts]}), :alt => compound.to_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/create.haml b/views/create.haml
new file mode 100644
index 0000000..6563494
--- /dev/null
+++ b/views/create.haml
@@ -0,0 +1,41 @@
+.input
+
+ %p
+ This service creates
+ %ul
+ %li
+ = toggle_link("#lazar_description","lazar")
+ %em= toggle_link("#classification","classification")
+ models and
+ %li
+ = toggle_link("#lazar_description","lazar")
+ %em= toggle_link("#regression","regression")
+ models
+ from your uploaded datasets. Further modelling algorithms will be added in future versions.
+
+ %p
+ Please read the
+ = link_to "instructions for creating training datasets", '/help'
+ before submitting.
+
+ %form{ :action => url_for('/models'), :method => "post", :enctype => "multipart/form-data" }
+ %fieldset
+ -#%label{:for => 'endpoint'} 1. Enter #{toggle_link("#endpoint_description","endpoint")} name and #{toggle_link("#unit","unit")} (for #{toggle_link("#regression","regression")}):
+ -#%input{:type => 'text', :name => 'endpoint', :id => 'endpoint', :size => '50'}
+ -#%br
+ %label{:for => 'file'}
+ Select training dataset in
+ = link_to "Excel", '/help'
+ or
+ = link_to "CSV", '/help'
+ format:
+ %input{:type => 'file', :name => 'file', :id => 'file', :size => '41'}
+ %input{ :type => "submit", :value => "Create model"}
+ = link_to "Cancel", '/create'
+
+ -# explanations
+ = haml :lazar_description, :layout => false
+ = haml :classification, :layout => false
+ = haml :regression, :layout => false
+ = haml :endpoint, :layout => false
+ = haml :unit, :layout => false
diff --git a/views/endpoint.haml b/views/endpoint.haml
new file mode 100644
index 0000000..af06b80
--- /dev/null
+++ b/views/endpoint.haml
@@ -0,0 +1,12 @@
+%dl#endpoint_description{ :style => "display: none;" }
+ %dt
+ Endpoint
+ (
+ = hide_link "#endpoint_description"
+ )
+ %dd
+ Toxic effect that constitutes the outcome of an
+ %em in-vitro,
+ or
+ %em in-vivo
+ expriment, clinical trial or epidemiological study
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/fragment.haml b/views/fragment.haml
new file mode 100644
index 0000000..fa7495d
--- /dev/null
+++ b/views/fragment.haml
@@ -0,0 +1,9 @@
+%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}
+ - if smarts.nil?
+ %input{ :type => "submit", :value => "Reset"}
+ - else
+ %input{ :type => "submit", :value => smarts}
+
diff --git a/views/help.haml b/views/help.haml
new file mode 100644
index 0000000..eabf978
--- /dev/null
+++ b/views/help.haml
@@ -0,0 +1,104 @@
+= link_to "Back to model creation", '/create'
+%p
+ Input files have two columns. Enter in the first column the chemical structure in
+ %a{:href => "http://en.wikipedia.org/wiki/Simplified_molecular_input_line_entry_specification"} SMILES
+ format, in the second column the toxic activity.
+%dl
+ %dt Classification datasets
+ %dd Please use 1/0, active/inactive or true/false to indicate active/inactive compounds.
+ %dt Regression datasets
+ %dd
+ Enter a quantitative value. For optimal performance you should
+ %ul
+ %li
+ use
+ %a{:href => "http://en.wikipedia.org/wiki/Molar_(concentration)"} molar
+ units
+ %li enter non-logarithmic values (logarithms are taken internally)
+ %li avoid 0 activities (will be ignored)
+%p
+ Input files are accepted in
+ %a{:href => "http://en.wikipedia.org/wiki/Microsoft_Excel"} Excel
+ and
+ %a{:href => "en.wikipedia.org/wiki/Comma-separated_values"} CSV
+ formats.
+
+%h3 Excel example
+
+- n = 0
+
+.code
+ %table
+ %tr
+ %td
+ %th A
+ %th B
+ %tr
+ - n += 1
+ %th= n
+ %td CC(=O)Nc1ccc(O)cc1
+ %td 1
+ %tr
+ - n += 1
+ %th= n
+ %td O=c1[nH]cnc2[nH]ncc12
+ %td 1
+ %tr
+ - n += 1
+ %th= n
+ %td CCCCNc1cc(cc(c1Oc2ccccc2)S(=O)(=O)N)C(=O)O
+ %td 1
+ %tr
+ - n += 1
+ %th= n
+ %td CC(C)(C)NCC(O)COc1cccc2NC(=O)CCc12
+ %td 1
+ %tr
+ - n += 1
+ %th= n
+ %td CN(C)CCCC1(OCc2cc(C#N)ccc21)c3ccc(F)cc3
+ %td 1
+ %tr
+ - n += 1
+ %th= n
+ %td CCC(CC)CCN1C(=O)CN=C(C2CCCCC2F)c3cc(Cl)ccc13
+ %td 0
+ %tr
+ - n += 1
+ %th= n
+ %td CCN(CC)CC(=O)Nc1c(C)cccc1C
+ %td 0
+ %tr
+ - n += 1
+ %th= n
+ %td CC(C)(C)NCC(O)COc1cccc2CC(O)C(O)Cc12
+ %td 0
+ %tr
+ - n += 1
+ %th= n
+ %td CN1CCCC1c2cccnc2
+ %td 0
+
+%p
+ Excel example file for download:
+ = link_to "hamster_carcinogenicity.xls", "/hamster_carcinogenicity.xls"
+
+%h3 CSV example
+
+.code
+ %code
+ %br CC(=O)Nc1ccc(O)cc1, 1
+ %br O=c1[nH]cnc2[nH]ncc12, 1
+ %br CCCCNc1cc(cc(c1Oc2ccccc2)S(=O)(=O)N)C(=O)O, 1
+ %br CC(C)(C)NCC(O)COc1cccc2NC(=O)CCc12, 1
+ %br CN(C)CCCC1(OCc2cc(C#N)ccc21)c3ccc(F)cc3, 1
+ %br CCC(CC)CCN1C(=O)CN=C(C2CCCCC2F)c3cc(Cl)ccc13, 0
+ %br CCN(CC)CC(=O)Nc1c(C)cccc1C, 0
+ %br CC(C)(C)NCC(O)COc1cccc2CC(O)C(O)Cc12, 0
+ %br CN1CCCC1c2cccnc2, 0
+
+%p
+ CSV example for download:
+ = link_to "hamster_carcinogenicity.csv", "/hamster_carcinogenicity.csv"
+
+%p You can create CSV files in Excel: Create a sheet with two columns and export them as CSV file with the "Save As" option from the menu, selecting the CSV (comma delimited) format.
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
new file mode 100644
index 0000000..a3db5e9
--- /dev/null
+++ b/views/layout.haml
@@ -0,0 +1,43 @@
+!!!
+%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
+
+ %head
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}
+ %title ToxCreate
+ %script{:type => "text/javascript", :src => "javascripts/jquery.js"}
+ %script{:type => "text/javascript", :src => "javascripts/toxcreate.js"}
+ %link{:rel=>'stylesheet', :href=>'stylesheets/style.css', :type => "text/css"}
+
+ %body
+ .logo
+ = image_tag "/ToxCreate_rgb_72.png", :alt => 'ToxCreate', :align => 'right'
+ %br Create and evaluate models to predict toxicity
+ .index
+ %ul
+ %li{:class => ("selected" if /\/create/ =~ request.path )}
+ = link_to "Create", "/create"
+ %li{:class => ("selected" if /models/ =~ request.path )}
+ = link_to "Inspect", "/models"
+ %li{:class => ("selected" if /predict|lazar/ =~ request.path )}
+ = link_to "Predict", "/predict"
+ %li{:class => ("selected" if /help/ =~ request.path )}
+ = link_to "Help", "/help"
+
+ .content
+ - if `hostname`.match(/ot-test/)
+ .notice
+ This service is for testing purposes only - once a week all models will be deleted. Please send bug reports and feature requests to our
+ %a{:href => 'http://github.com/helma/opentox-toxmodel/issues'} issue tracker.
+
+ - if flash[:notice]
+ %p
+ .notice#flashnotice
+ = flash[:notice]
+
+ = yield
+
+ .footer
+ &copy;
+ %a{:href => 'http://www.in-silico.ch'} in silico toxicology
+ 2009-2010, powered by
+ %a{:href => 'http://www.opentox.org'} <span style="color:#5D308A;font-family:arial,sans-serif,helvetica;letter-spacing:-1px;">Open</span><span style="color:#000;font-family:arial,sans-serif,helvetica;font-weight:bold;letter-spacing:-1px;position:relative;">Tox</span>
diff --git a/views/lazar.haml b/views/lazar.haml
new file mode 100644
index 0000000..a46f82c
--- /dev/null
+++ b/views/lazar.haml
@@ -0,0 +1,58 @@
+%p= link_to "New prediction", "/predict"
+.lazar-predictions
+
+ -# explanations
+ = haml :lazar_algorithm, :layout => false
+ = haml :confidence, :layout => false
+ = haml :similarity, :layout => false
+ = haml :significant_fragments, :layout => false
+ = haml :training_data, :layout => false
+
+ %a{:name => "prediction"}
+ %table
+ %thead
+ %tr
+ %th= @prediction.title
+ %th= toggle_link("#lazar_algorithm","Prediction")
+ %th= toggle_link("#confidence","Confidence")
+ %th Supporting information
+
+ %tr
+ -# %td
+ %img{:src => @compound.to_image_uri, :alt => @compound.to_smiles}
+ %td.image= compound_image(@compound,@prediction.descriptors(@compound))
+ %td= activity_markup(@prediction.value(@compound))
+ %td= sprintf('%.03g', @prediction.confidence(@compound))
+ -#%td= @prediction.confidence(@compound)
+ %td
+ %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 => sort(@prediction.descriptors(@compound))}, :layout => false
+
+ %tbody#neighbors
+ = haml :neighbors, :locals => {:neighbors => @prediction.neighbors(@compound), :page => @page}, :layout => :false
diff --git a/views/lazar_algorithm.haml b/views/lazar_algorithm.haml
new file mode 100644
index 0000000..b83de6b
--- /dev/null
+++ b/views/lazar_algorithm.haml
@@ -0,0 +1,50 @@
+%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
+ (
+ %a{:href => "http://www.in-silico.de/articles/modi020905.pdf"} 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
+ )
+
+ %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/lazar_description.haml b/views/lazar_description.haml
new file mode 100644
index 0000000..d870425
--- /dev/null
+++ b/views/lazar_description.haml
@@ -0,0 +1,29 @@
+%dl#lazar_description{ :style => "display: none;" }
+ %dt
+ %code lazar
+ (
+ = hide_link "#lazar_description"
+ )
+ %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= toggle_link("#classification","classification")
+ (
+ %a{:href => "http://www.in-silico.de/articles/modi020905.pdf"} original publication
+ )
+ %li
+ a local QSAR model based on neighbors for
+ %em= toggle_link("#regression","regression")
+ (
+ %a{:href => "http://www.in-silico.de/articles/mh_tf.pdf"} original publication
+ )
diff --git a/views/model.haml b/views/model.haml
new file mode 100644
index 0000000..d34079d
--- /dev/null
+++ b/views/model.haml
@@ -0,0 +1,67 @@
+- uri = url_for("/model/#{model.id}", :full)
+- js = "$('#delete_#{model.id}').deleteModel('DELETE', {elem: '#model_#{model.id}'});\n " + "$('#show_model_#{model.id}_warnings').toggleWarnings('#{model.id}');"
+:javascript
+ $(function() {
+ #{js}
+ });
+
+%div{:id => "model_#{model.id}"}
+ %h2
+ = model.name
+ .model
+ %dl
+ %dt Status:
+ %dd
+ %span{:id => "model_#{model.id}_status", :class => model.status}
+ = haml :model_status, :locals=>{:model=>model}, :layout => false
+ (
+ %a{:href => url_for("/model/#{model.id}"), :id => "delete_#{model.id}", :class => 'delete'} delete
+ )
+ %dt Started:
+ %dd= model.created_at.strftime("%m/%d/%Y - %I:%M:%S%p")
+ - if model.nr_compounds
+ %dt Training compounds:
+ %dd= model.nr_compounds
+ - if model.error_messages
+ %dt Errors:
+ %dd= model.error_messages
+ - if model.warnings
+ %dt Warnings:
+ %a{:href => "#", :id => "show_model_#{model.id}_warnings"} show
+ %dd{:id => "model_#{model.id}_warnings", :style => "display: none;"}= model.warnings
+ %dt Algorithm:
+ %dd= toggle_link("#lazar_description","lazar")
+ - if model.type
+ %dt Type:
+ %dd= toggle_link("##{model.type}","#{model.type}")
+ %dt Descriptors:
+ %dd
+ %a{:href => 'http://www.maunz.de/libfminer2-bbrc-doc/'} Fminer backbone refinement classes
+ - if model.training_dataset
+ %dt Training dataset:
+ %dd
+ %a{:href => "#{model.training_dataset}.xls"} Excel sheet
+ ,
+ -#%a{:href => "#{model.training_dataset}.rdf"} RDF/XML
+ -#%em (experts) ,
+ %a{:href => "#{model.training_dataset}.yaml"} YAML
+ %em (experts)
+ - if model.feature_dataset
+ %dt Feature dataset:
+ %dd
+ -#%a{:href => "#{model.feature_dataset}.rdf"} RDF/XML
+ -#,
+ %a{:href => "#{model.feature_dataset}.xls"} Excel sheet
+ ,
+ %a{:href => "#{model.feature_dataset}.yaml"} YAML
+ %em (experts)
+ - if model.uri
+ %dt Model:
+ %dd
+ -#%a{:href => "#{model.uri}.rdf"} RDF/XML
+ -#,
+ - if model.validation_qmrf_uri
+ %a{:href => File.join(model.validation_qmrf_uri,"editor")} QMRF Editor,
+ %a{:href => "#{model.uri}.yaml"} YAML
+ %em (experts, models cannot be represented in Excel)
+ = haml :validation, :locals=>{:model=>model}, :layout => false
diff --git a/views/model_status.haml b/views/model_status.haml
new file mode 100644
index 0000000..897e792
--- /dev/null
+++ b/views/model_status.haml
@@ -0,0 +1,2 @@
+-#= image_tag("/snake_transparent.gif") if model.status.match(/running|started|created/i)
+= model.status
diff --git a/views/models.haml b/views/models.haml
new file mode 100644
index 0000000..17d9c8a
--- /dev/null
+++ b/views/models.haml
@@ -0,0 +1,21 @@
+- stati = @models.map{|m| "#{m.id}" if m.status != "Completed"}.compact
+- stati_to_check = stati.length > 0 ? stati.join(", ") : stati = 0
+:javascript
+ $(function() {
+ if(#{stati != 0}) {
+ setTimeout('checkStati("#{stati_to_check}")',1500);
+ }
+ var reload_validation = true;
+ if(reload_validation) setTimeout('checkValidation()',15000);
+ });
+
+-# %p Get an overview about ToxCreate models. This page is refreshed every 15 seconds to update the model status.
+%p Get an overview about ToxCreate models. This page is refreshed every 5 seconds to update the model status.
+
+-# explanations
+= haml :lazar_description, :layout => false
+= haml :classification, :layout => false
+= haml :regression, :layout => false
+
+- @models.each do |model|
+ = haml :model, :locals=>{:model=>model}, :layout => false
diff --git a/views/neighbors.haml b/views/neighbors.haml
new file mode 100644
index 0000000..87fef13
--- /dev/null
+++ b/views/neighbors.haml
@@ -0,0 +1,44 @@
+%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
+-# LOGGER.debug neighbors.to_yaml
+- neighbors.sort{|a,b| b[OT.similarity] <=> a[OT.similarity]}[first..last].each do |neighbor|
+ - neighbor_id += 1
+ - compound = OpenTox::Compound.new(neighbor[OT.compound])
+ %tr
+ %td.image= compound_image(compound,@prediction.descriptors(compound))
+ %td= activity_markup(neighbor[OT.activity])
+ %td= sprintf('%.03g', neighbor[OT.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 => sort(@prediction.descriptors(compound))}, :layout => false
+
diff --git a/views/neighbors_navigation.haml b/views/neighbors_navigation.haml
new file mode 100644
index 0000000..864a99f
--- /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}/#{@prediction.neighbors(@compound).size})"
+
+ #next= "next" unless 5*@page.to_i+5 >= @prediction.neighbors(@compound).size
+
+ :javascript
+ $("#prev").click(function() {
+ $("#page").val(#{@page-1});
+ $("#nav").submit();
+ });
+ $("#next").click(function() {
+ $("#page").val(#{@page+1});
+ $("#nav").submit();
+ });
diff --git a/views/predict.haml b/views/predict.haml
new file mode 100644
index 0000000..26c8094
--- /dev/null
+++ b/views/predict.haml
@@ -0,0 +1,34 @@
+:javascript
+ function getsmiles() {
+ if (document.JME.smiles() != '') {
+ document.form.identifier.value = document.JME.smiles() ;
+ }
+ }
+
+.input
+ %p Use this service to obtain predictions from OpenTox models.
+ - unless @models.empty?
+
+ %form{:name => "form", :action => url_for('/predict'), :method => "post", :enctype => "multipart/form-data" }
+ %fieldset
+ %legend Draw a compound
+ %label &nbsp;
+ .jme
+ %applet{:code => "JME.class", :name => "JME", :archive => "JME.jar", :width => "500", :height => "360"}
+ %param{ :name => "options", :value => "polarnitro"}
+ Please enable Java and JavaScript in your browser to use the JME editor.
+
+ %label{:for => 'identifier'} or enter a Name, InChI, Smiles, CAS, ...
+ %input{:type => 'text', :name => 'identifier', :id => 'identifier', :size => '60'}
+ %fieldset
+ %legend
+ Choose one or more prediction models
+ - @models.each do |model|
+ %label{:for => model.id}
+ = model.name
+ %input{:type => 'checkbox', :name => "selection[#{model.id}]", :value => true, :id => model.id}
+ %br
+
+ %input{ :type => "submit", :value => "Predict", :onclick => "getsmiles();"}
+ = link_to 'Cancel', '/predict'
+
diff --git a/views/prediction.haml b/views/prediction.haml
new file mode 100644
index 0000000..8498abc
--- /dev/null
+++ b/views/prediction.haml
@@ -0,0 +1,50 @@
+%p
+ = link_to "New prediction", "/predict"
+.predictions
+ %table
+ %tr
+ %th{:colspan => @predictions.size+1}
+ = @identifier
+ %tr
+ %td
+ %img{:src => @compound.to_image_uri, :alt => @compound.to_smiles}
+ - @predictions.each do |p|
+ - LOGGER.debug p.to_yaml
+ %td
+ %b
+ = p[:title] + ":"
+ - if p[:measured_activities]
+ %br
+ - p[:measured_activities].each do |a|
+ = activity_markup(a)
+ %br
+ (
+ %a{:href => "#", :id => "linkTrainingData#{p.object_id}"} Measured activity
+ :javascript
+ $("a#linkTrainingData#{p.object_id}").click(function () {
+ $("dl#training_data").toggle();
+ });
+ )
+
+ - elsif p[:error]
+ %br= p[:error]
+ - else
+ = activity_markup(p[:prediction])
+ - if p[:confidence]
+ %br
+ (
+ %a{:href => "#", :id => "linkConfidence#{p.object_id}"} Confidence
+ = ": #{sprintf('%.03g', p[:confidence].to_f.abs)}"
+ :javascript
+ $("a#linkConfidence#{p.object_id}").click(function () {
+ $("dl#confidence").toggle();
+ });
+ )
+ %br
+ %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 => p[:model_uri]}
+ %input{ :type => "submit", :value => "Details"}
+
+= haml :confidence, :layout => false
+= haml :training_data, :layout => false
diff --git a/views/regression.haml b/views/regression.haml
new file mode 100644
index 0000000..4866b08
--- /dev/null
+++ b/views/regression.haml
@@ -0,0 +1,11 @@
+%dl#regression{ :style => "display: none;" }
+ %dt
+ Regression
+ (
+ = hide_link "#regression"
+ )
+ %dd
+ Prediction of
+ %em quantitative
+ properties, e.g. LC50 values
+
diff --git a/views/regression_validation.haml b/views/regression_validation.haml
new file mode 100644
index 0000000..00267a9
--- /dev/null
+++ b/views/regression_validation.haml
@@ -0,0 +1,9 @@
+%dt
+ %a{:href => "http://en.wikipedia.org/wiki/R-squared"} R-squared
+%dd= sprintf '%.03g', model.r_square
+%dt
+ %a{:href => "http://en.wikipedia.org/wiki/Root_mean_square_deviation"} Root Mean Square Error
+%dd= sprintf '%.03g', model.root_mean_squared_error
+%dt
+ %a{:href => "http://en.wikipedia.org/wiki/Mean_absolute_error"} Mean Absolute Error
+%dd= sprintf '%.03g', model.mean_absolute_error
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
new file mode 100644
index 0000000..5f362a3
--- /dev/null
+++ b/views/style.sass
@@ -0,0 +1,239 @@
+$bg_color: #b9dcff
+$bg_color2: #e5e7eb
+$fg_color: #424345
+$ot_purple: #5d308a
+$body_color: white
+$text_color: black
+$notice_border: black
+
+body
+ min-width: 30em
+ font-family: verdana, arial, helvetica, sans-serif
+ background-color: $body_color
+ color: $text_color
+ padding: 1em
+ a
+ text-decoration: none
+ font-weight: bold
+ color: $ot_purple
+ a:hover
+ color: black
+
+ .headline
+ .logo
+ float: right
+
+ .index
+ clear: both
+ ul
+ margin: 0 0 2px 0
+ padding: 0
+ white-space: nowrap
+ list-style-type: none
+ li
+ margin: 0
+ padding: 2px
+ display: inline
+ border-right: 1px solid
+ color: $body_color
+ border-top: 1px solid
+ color: $body_color
+ background-color: $fg_color
+ padding-left: 0.5em
+ padding-right: 0.5em
+ font-weight: bold
+ a
+ text-decoration: none
+ color: $bg_color
+ &:hover
+ color: $body_color
+ li.selected
+ font-weight: bold
+ background-color: $bg_color
+ border: 1px solid
+ color: $fg_color
+ border-bottom: 1px solid
+ color: $bg_color
+ a
+ color: $text_color
+
+ .content
+ background-color: $bg_color
+ height: 100%
+ padding: 1em
+ border: 1px solid
+ color: $fg_color
+ h2
+ margin: 20px 3px 2px 3px
+ .notice
+ padding: 1em
+ background-color: $body_color
+ border: 1px solid
+ border-color: $notice_border
+ .input
+ text-align: left
+ form
+ padding: 1em
+ background-color: $bg_color2
+ border: 1px solid
+ color: $fg_color
+ fieldset
+ margin: 0
+ padding: 0
+ border: 0
+ legend
+ font-weight: bold
+ color: $fg_color
+ label
+ width: 28em
+ display: block
+ float: left
+ br
+ clear: both
+ .code
+ border: 1px solid black
+ padding: 1%
+ background-color: white
+ table
+ display: inline-table
+ border-collapse: collapse
+ th
+ padding: 0.5em
+ border: 1px solid
+ background-color: #ccd2dc
+ td
+ padding: 0.5em
+ border: 1px solid
+
+ .predictions
+ text-align: center
+ overflow: auto
+ table
+ border-spacing: 0
+ border-collapse: collapse
+ margin: 0
+ th
+ color: $body_color
+ background-color: $fg_color
+ border: 1px solid
+ margin: 0.5em
+ td
+ border: 1px solid
+ background-color: $bg_color2
+ padding: 0.5em
+ img
+ padding: 0
+ height: 100%
+
+ .lazar-predictions
+ clear: both
+ margin-top: 2%
+ .neighbors_navigation
+ font-size: x-small
+ #prev
+ @extend a
+ display: inline
+ cursor: pointer
+ #next
+ @extend a
+ display: inline
+ cursor: pointer
+
+ dt
+ font-weight: bold
+ table
+ width: 100%
+ //height: 100%
+ background-color: $bg_color2
+ border-spacing: 0
+ border-collapse: collapse
+ margin: 0
+ tbody
+ //height: 10em
+ th
+ text-align: center
+ border: 1px solid
+ color: $body_color
+ background-color: $fg_color
+ margin: 0.5em
+ a
+ text-decoration: underline
+ font-weight: bold
+ color: $bg_color
+
+ a:hover
+ color: $bg_color2
+ td
+ border: 1px solid
+ 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
+ //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
+ 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
+ padding: 0.5em
+
+.active
+ color: red
+
+.inactive
+ color: green
+
+.inconclusive
+ color: yellow
+
+.other
+ color: black
+
+dl
+ dd
+ td
+ border: 1px dotted white
+ text-align: right
+ padding: 0.2em
+ .blank
+ border: 0
+ th
+ border-bottom: 1px dotted white
+ text-align: center
+ padding: 0.3em
+ table
+ border-collapse: collapse
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.
diff --git a/views/unit.haml b/views/unit.haml
new file mode 100644
index 0000000..a352599
--- /dev/null
+++ b/views/unit.haml
@@ -0,0 +1,10 @@
+%dl#unit{ :style => "display: none;" }
+ %dt
+ Unit
+ (
+ = hide_link "#unit"
+ )
+ %dd
+ Unit of measurement, e.g. mmol or mmol/kg-bodyweight. For optimal performance you should use
+ %a{:href => "http://en.wikipedia.org/wiki/Molar_(concentration)"} molar
+ units.
diff --git a/views/validation.haml b/views/validation.haml
new file mode 100644
index 0000000..5fc7371
--- /dev/null
+++ b/views/validation.haml
@@ -0,0 +1,23 @@
+- if model.validation_uri
+ %dl{:id => "model_validation_#{model.id}"}
+ %dt
+ Validation:
+ -# %input{ :id => "model_validation_report_#{model.id}", :type => "hidden", :value => "#{model.validation_report_status}", :class => "model_validation_report" }
+ %dd
+ %dl
+ - if model.validation_report_uri
+ %dt Detailed report:
+ %dd
+ %a{:href => model.validation_report_uri, :target => "_blank"} show
+ %dt Number of predictions
+ %dd= model.nr_predictions
+ - case model.type
+ - when "classification"
+ = haml :classification_validation, :locals=>{:model=>model}, :layout => false if model.correct_predictions
+ - when "regression"
+ = haml :regression_validation, :locals=>{:model=>model}, :layout => false
+-# else
+ = image_tag("/snake_transparent.gif") if model.validation_status == "Running"
+ %a{:href => model.validation_task_uri} #{model.validation_status}
+
+