From ddbe5c5478c7dd71d9c851008340e28a61d5ba33 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 27 Oct 2015 12:24:58 +0000 Subject: enabled batch --- views/predict.haml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'views') diff --git a/views/predict.haml b/views/predict.haml index 9863cd9..0dc767b 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -125,12 +125,11 @@ %br %input{:type => 'text', :name => 'identifier', :id => 'identifier', :size => '60'} %p - // disable for public version %label{:for=>"fileselect"} or upload a CSV file for batch predictions (disabled in public version) %br %span.btn.btn-default.btn-file - %input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv", :disabled=>"disabled"} + %input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv"} %fieldset#middle.well %h2 2. Select one or more endpoints -- cgit v1.2.3 From 41f948d58ba99a635ae7e04573bd368d9ab34d99 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 27 Oct 2015 12:26:14 +0000 Subject: enabled batch --- views/predict.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'views') diff --git a/views/predict.haml b/views/predict.haml index 0dc767b..a4fa080 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -126,7 +126,7 @@ %input{:type => 'text', :name => 'identifier', :id => 'identifier', :size => '60'} %p %label{:for=>"fileselect"} - or upload a CSV file for batch predictions (disabled in public version) + or upload a CSV file for batch predictions %br %span.btn.btn-default.btn-file %input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv"} -- cgit v1.2.3 From d2d8db1e59e830b1a24e9b8d270a3b393d746b6c Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 28 Oct 2015 13:58:45 +0000 Subject: consisten use of brackets for units; collect measured activity for equal neighbors --- views/batch.haml | 3 +-- views/neighbors.haml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'views') diff --git a/views/batch.haml b/views/batch.haml index 8389651..ec987c4 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -44,7 +44,7 @@ %br %b Prediction: / TODO scientific notation - = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} #{model.unit}" : prediction[:value] + = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit})" : prediction[:value] %br / TODO probability %b Confidence: @@ -53,4 +53,3 @@ - else %p = "Not enough similar compounds
in training dataset." - %p diff --git a/views/neighbors.haml b/views/neighbors.haml index 21b4b35..a741b45 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -58,7 +58,7 @@ / %td %tbody - type = @model_types[j] - - prediction[:neighbors].each_with_index do |neighbor,count| + - prediction[:neighbors].uniq.each_with_index do |neighbor,count| %tr / Compound %td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"} @@ -67,7 +67,7 @@ %p= Compound.find(neighbor[0]).smiles / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} - = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.join(", ") : neighbor[2].join(", ") + = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.join("
") : neighbor[2].join(", ") / Similarity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} / TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset? -- cgit v1.2.3 From b452a81e9c0a470bf9aa51f0192378f5fba5177a Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 29 Oct 2015 09:54:15 +0000 Subject: trim and log SMILES input --- views/predict.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'views') diff --git a/views/predict.haml b/views/predict.haml index a4fa080..7f19071 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -24,7 +24,7 @@ }); function getInput(){ - identifier = document.getElementById("identifier").value; + identifier = document.getElementById("identifier").value.trim(); fileselect = document.getElementById("fileselect").value; if (fileselect != ""){ return 1; -- cgit v1.2.3 From efd241beab11fbfc200f0c32ffb9e198ed406c83 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 29 Oct 2015 18:20:39 +0000 Subject: added mg/kg_bw/day --- views/batch.haml | 5 +++-- views/neighbors.haml | 6 ++++-- views/prediction.haml | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'views') diff --git a/views/batch.haml b/views/batch.haml index ec987c4..f593188 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -18,6 +18,7 @@ / key = compound, values = array of arrays with model, prediction - @batch.each do |key, values| - compound = key + - mw = compound.molecular_weight %tr %td{:style=>"vertical-align:top;"} %p= compound.svg @@ -34,7 +35,7 @@ %p / TODO fix scientific notation from database %b Measured activity: - = prediction[:value].numeric? ? "#{prediction[:value].round(3)} (#{model.unit})" : prediction[:value] + = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] %p Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 %p @@ -44,7 +45,7 @@ %br %b Prediction: / TODO scientific notation - = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit})" : prediction[:value] + = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] %br / TODO probability %b Confidence: diff --git a/views/neighbors.haml b/views/neighbors.haml index a741b45..4a1f3ea 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -65,9 +65,11 @@ /%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor[0].to_s)}/details"), :id=>"link#{j+1}#{count}"}} %p= Compound.find(neighbor[0]).svg %p= Compound.find(neighbor[0]).smiles + - c = Compound.find(neighbor[0]) + - mw = c.molecular_weight / Measured Activity - %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} - = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n + " (#{@models[j].unit})"}.join("
") : neighbor[2].join(", ") + %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} + = (type == "Regression") ? neighbor[2].collect{|n| weight = c.mmol_to_mg(n, mw); '%.2e' % n + " (#{@models[j].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : neighbor[2].join(", ") / Similarity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} / TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset? diff --git a/views/prediction.haml b/views/prediction.haml index ef0c5db..11d542e 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -18,6 +18,7 @@ %td{:id=>"compound", :style=>"vertical-align:top;"} %p= @compound.svg %p= @compound.smiles + - mw = @compound.molecular_weight - @model_types = {} - @dbhit = {} - @predictions.each_with_index do |prediction,i| @@ -32,7 +33,7 @@ %p / TODO fix scientific notation from database %b Measured activity: - = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit})" : prediction[:value] + = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] %p Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 %p @@ -41,8 +42,7 @@ = type %br %b Prediction: - / TODO scientific notation - = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit})" : prediction[:value] + = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] / TODO update description / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", data: {toggle:"popover", placement:"left", html:"true", content:"LAZAR calculates searches the training dataset for similar compounds (neighbors) and calculates the prediction from their measured activities. LAZAR calculates predictions using Please keep in mind that predictions are based on the measured activities of neighbors."}} %br -- cgit v1.2.3 From a348f222c0b32bbb308083bb03127fe55b1563dc Mon Sep 17 00:00:00 2001 From: gebele Date: Fri, 30 Oct 2015 08:26:04 +0000 Subject: fixed weight for multiple database hits in prediction --- views/batch.haml | 12 +++++++----- views/prediction.haml | 10 +++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'views') diff --git a/views/batch.haml b/views/batch.haml index f593188..9bfa67e 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -33,10 +33,13 @@ %p - if prediction[:confidence] == "measured" %p - / TODO fix scientific notation from database - %b Measured activity: - = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] - %p Compound is part of the training dataset + %b Measured activity: + - if prediction[:value].is_a?(Array) + = prediction[:value][0].numeric? ? prediction[:value].collect{|v| weight = compound.mmol_to_mg(v, mw); '%.2e' % v + " (#{model.unit})"+" | #{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : prediction[:value].join(", ") + - else + = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] + %p + %b Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 %p / model type (classification|regression) @@ -44,7 +47,6 @@ = model.model.class.to_s.match("Classification") ? "Classification" : "Regression" %br %b Prediction: - / TODO scientific notation = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] %br / TODO probability diff --git a/views/prediction.haml b/views/prediction.haml index 11d542e..a74b95a 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -31,10 +31,14 @@ - if prediction[:confidence] == "measured" - @dbhit[i] = true %p - / TODO fix scientific notation from database %b Measured activity: - = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] - %p Compound is part of the training dataset + - p prediction[:value] + - if prediction[:value].is_a?(Array) + = (type == "Regression") ? prediction[:value].collect{|v| weight = Compound.from_smiles(@compound.smiles).mmol_to_mg(v, mw); '%.2e' % v + " (#{@models[i].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : prediction[:value].join(", ") + - else + = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] + %p + %b Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 %p / model type (classification|regression) -- cgit v1.2.3 From f7680842ee830af78d860b3a0a09b654368df90a Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 14 Jan 2016 09:37:39 +0000 Subject: changed weight method for lazar v8-nestec release --- views/neighbors.haml | 4 ++-- views/prediction.haml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'views') diff --git a/views/neighbors.haml b/views/neighbors.haml index 4a1f3ea..a69f38b 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -66,10 +66,10 @@ %p= Compound.find(neighbor[0]).svg %p= Compound.find(neighbor[0]).smiles - c = Compound.find(neighbor[0]) - - mw = c.molecular_weight + //- mw = c.molecular_weight / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} - = (type == "Regression") ? neighbor[2].collect{|n| weight = c.mmol_to_mg(n, mw); '%.2e' % n + " (#{@models[j].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : neighbor[2].join(", ") + = (type == "Regression") ? neighbor[2].collect{|n| weight = c.mmol_to_mg(n); '%.2e' % n + " (#{@models[j].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : neighbor[2].join(", ") / Similarity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} / TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset? diff --git a/views/prediction.haml b/views/prediction.haml index a74b95a..8d7e3d0 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -18,7 +18,7 @@ %td{:id=>"compound", :style=>"vertical-align:top;"} %p= @compound.svg %p= @compound.smiles - - mw = @compound.molecular_weight + -#- mw = @compound.molecular_weight - @model_types = {} - @dbhit = {} - @predictions.each_with_index do |prediction,i| @@ -34,9 +34,9 @@ %b Measured activity: - p prediction[:value] - if prediction[:value].is_a?(Array) - = (type == "Regression") ? prediction[:value].collect{|v| weight = Compound.from_smiles(@compound.smiles).mmol_to_mg(v, mw); '%.2e' % v + " (#{@models[i].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : prediction[:value].join(", ") + = (type == "Regression") ? prediction[:value].collect{|v| weight = Compound.from_smiles(@compound.smiles).mmol_to_mg(v); '%.2e' % v + " (#{@models[i].unit})"+"|#{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : prediction[:value].join(", ") - else - = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] + = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value])} (mg/kg_bw/day)" : prediction[:value] %p %b Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 @@ -46,7 +46,7 @@ = type %br %b Prediction: - = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] + = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit}) | #{'%.2e' % @compound.mmol_to_mg(prediction[:value])} (mg/kg_bw/day)" : prediction[:value] / TODO update description / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", data: {toggle:"popover", placement:"left", html:"true", content:"LAZAR calculates searches the training dataset for similar compounds (neighbors) and calculates the prediction from their measured activities. LAZAR calculates predictions using Please keep in mind that predictions are based on the measured activities of neighbors."}} %br -- cgit v1.2.3 From f0588c7e072ea3e22f26916d669e9baaa8fa3197 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 26 Jan 2016 11:45:30 +0000 Subject: enabled sticky headers for neighbors table --- views/neighbors.haml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'views') diff --git a/views/neighbors.haml b/views/neighbors.haml index a69f38b..6001605 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -29,7 +29,20 @@ debug: false, theme: "bootstrap", headerTemplate: '{content} {icon}', - widgets: ['zebra', 'columns', 'uitheme'], + widgets: ['zebra', 'columns', 'uitheme', 'stickyHeaders'], + widgetOptions: { + stickyHeaders_attachTo : '.tab-content', + stickyHeaders : '', + stickyHeaders_offset : 0, + stickyHeaders_cloneId : '-sticky', + stickyHeaders_addResizeEvent : true, + stickyHeaders_includeCaption : true, + stickyHeaders_zIndex : 2, + stickyHeaders_attachTo : null, + stickyHeaders_xScroll : null, + stickyHeaders_yScroll : null, + stickyHeaders_filteredToTop: true + }, headers: {0: {sorter: false}, 3: {sorter: false}}, sortList: [[2,1]], widthFixed: false -- cgit v1.2.3 From f86c084311282036ffa7b4588c0fa0d5b59af95b Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 24 Nov 2016 16:03:09 +0000 Subject: several fixes; works with lazar tree e111369ce5564f159b3f5f85c92afdd22352eaa1 --- views/details.haml | 2 +- views/layout.haml | 18 ++++--- views/license.haml | 1 + views/model_details.haml | 134 +++++++++++++++++++++++++++-------------------- views/neighbors.haml | 13 +++-- views/predict.haml | 1 + views/prediction.haml | 35 ++++++++----- views/style.scss | 14 +++-- views/validation.haml | 16 ------ 9 files changed, 127 insertions(+), 107 deletions(-) create mode 100644 views/license.haml delete mode 100644 views/validation.haml (limited to 'views') diff --git a/views/details.haml b/views/details.haml index 8a57440..bb8250d 100644 --- a/views/details.haml +++ b/views/details.haml @@ -19,6 +19,6 @@ %hr %p{:style=>"padding-left:0.5em;"} / pubchem link - %a.btn.btn-primary{:href=>"http://aop.in-silico.ch/", :title=>"Link opens in new window.", :alt=>"pubchem read across", :target=>"_blank"} PubChem read across + %a.btn.btn-primary{:href=>"http://aop.in-silico.ch/", :title=>"Link opens in new window.", :alt=>"pubchem read across", :rel=>"external"} PubChem read across %i (experimental) %br diff --git a/views/layout.haml b/views/layout.haml index a40b68c..dddf854 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -15,7 +15,7 @@ %script{:src=>"/javascripts/bootstrap.min.js"} %script{:src=>"/javascripts/jquery.tablesorter.min.js"} %script{:src=>"/javascripts/jquery.tablesorter.widgets.js"} - %script{ :src=>"/javascripts/lazar-gui.js"} + %script{:src=>"/javascripts/lazar-gui.js"} %body %noscript %div{ :style=>"width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"} @@ -26,7 +26,7 @@ %a{:href=> to("/predict")} %img.media-object{:src=>"/images/IST_logo_s.png", :alt=>"logo", :width=>"150px", :heigth=>"150px", :style=>"margin:0 3em 0 2em;"} %div.col-md-8 - %h1.media-heading{:style=>"margin: 0 0 0 2em;"} + %h1.media-heading lazar toxicity predictions %div.col-md-2 %h1.media-heading @@ -55,7 +55,7 @@ %img.share{:src=>"/images/Facebook.png"} %div.row Previous version: - %a{:href=>"http://lazar-old.in-silico.ch"} lazar-old + %a{:href=>"http://lazar-old.in-silico.ch", :rel => "external"} lazar-old :javascript $(document).ready(function(){ $("#back-top").hide(); @@ -79,15 +79,17 @@ %p.text-muted © %a{:href => 'http://www.in-silico.ch', :rel => "external"} in silico toxicology gmbh 2004 - #{Time.now.year.to_s} + | + %a{:href => to("/license"), :rel => "external"} GPL3 License %supporters.col-md-12 - %p Financial support: - %a{:href=>"http://www.bfr.bund.de/de/start.html", :target=>"_blank"} + %p Financial support by + %a{:href=>"http://www.bfr.bund.de/de/start.html", :rel=>"external"} %img{:src=>"/images/bfr_logo.gif"} - %a{:href=>"http://www.opentox.org/", :target=>"_blank"} + %a{:href=>"http://www.opentox.org/", :rel=>"external"} %img{:src=>"/images/ot_logo.png"} - %a{:href=>"https://enanomapper.net/", :target=>"_blank"} + %a{:href=>"https://enanomapper.net/", :rel=>"external"} %img{:src=>"/images/enm_logo.png"} - %a{:href=>"https://www.researchgate.net/institution/Nestle_SA/department/Nestle_Research_Center", :target=>"_blank"} + %a{:href=>"https://www.researchgate.net/institution/Nestle_SA/department/Nestle_Research_Center", :rel=>"external"} %img{:src=>"/images/nestec.jpg"} diff --git a/views/license.haml b/views/license.haml new file mode 100644 index 0000000..2813220 --- /dev/null +++ b/views/license.haml @@ -0,0 +1 @@ += @license diff --git a/views/model_details.haml b/views/model_details.haml index 1be75e7..7646471 100644 --- a/views/model_details.haml +++ b/views/model_details.haml @@ -1,26 +1,39 @@ %b Model: %br Source: -%a{:href=>model.source, :target=>"external"} +%a{:href=>model.source, :rel=>"external"} = model.source %br - model.classification? ? type = "Classification" : type = "Regression" = "Type:\t" = type %br -- training_dataset = OpenTox::Dataset.find model.training_dataset.id +- training_dataset = OpenTox::Dataset.find model.model.training_dataset_id = "Training compounds:\t" = training_dataset.compounds.size - +%br +%b Algorithms: +%br +Similarity: +%a{:href=> "http://www.rubydoc.info/gems/lazar/OpenTox%2F#{model.model.algorithms["similarity"]["method"].sub("::", "%2F")}", :rel=>"external"} + = model.model.algorithms["similarity"]["method"] += ", min: #{model.model.algorithms["similarity"]["min"]}" +%br +Prediction: +%a{:href=>"http://www.rubydoc.info/gems/lazar/OpenTox%2F#{model.model.algorithms["prediction"]["method"].sub("::","%2f")}", :rel=>"external"} + = model.model.algorithms["prediction"]["method"] +%br +Descriptors: += model.model.algorithms["descriptors"]["method"]+"," += model.model.algorithms["descriptors"]["type"] %p - if type == "Classification" %b Independent crossvalidations: - else %b Independent crossvalidations (-log10 transformed): %div.row{:id=>"validations#{model.id}", :style=>"background-color:#f5f5f5;"} - - model.crossvalidations.each do |crossvalidation| + - crossvalidations.each do |cv| %span.col-xs-4.col-sm-4.col-md-4.col-lg-4 - - cv = OpenTox::CrossValidation.find crossvalidation.id = "Num folds:\t" = cv.folds %br @@ -34,76 +47,81 @@ Source: = "Accuracy:\t" = cv.accuracy.round(3) if cv.accuracy %br + = "Weighted accuracy:\t" + = cv.weighted_accuracy.round(3) if cv.weighted_accuracy + %br = "True positive rate:\t" - = cv.true_rate["active"].round(3) if cv.true_rate["active"] + = cv.true_rate["active"].round(3) if cv.true_rate %br = "True negative rate:\t" - = cv.true_rate["inactive"].round(3) if cv.true_rate["inactive"] + = cv.true_rate["inactive"].round(3) if cv.true_rate %br = "Positive predictive value:\t" - = cv.predictivity["active"].round(3) if cv.predictivity["active"] + = cv.predictivity["active"].round(3) if cv.predictivity %br = "Negative predictive value:\t" - = cv.predictivity["inactive"].round(3) if cv.predictivity["inactive"] + = cv.predictivity["inactive"].round(3) if cv.predictivity %p - %b Confusion Matrix: - %table.table.table-condensed.table-borderless{:style=>"width:20%;"} - %tbody - %tr - %td - %td - %td - %b actual - %td - %td - %tr - %td - %td - %td active - %td inactive - -#%td total - %tr - %td - %b predicted - %td active - %td - =cv.confusion_matrix[0][0] - %td - =cv.confusion_matrix[0][1] - -#%td - =cv.confusion_matrix[0][0]+cv.confusion_matrix[0][1] - %tr - %td - %td inactive - %td - =cv.confusion_matrix[1][0] - %td - =cv.confusion_matrix[1][1] - -#%td - =cv.confusion_matrix[1][0]+cv.confusion_matrix[1][1] - -#%tr - %td - %td total - %td - =cv.confusion_matrix[0][0]+cv.confusion_matrix[1][0] - %td - =cv.confusion_matrix[0][1]+cv.confusion_matrix[1][1] - %td - -#= "Confusion Matrix:\t" - -#= cv.confusion_matrix + - ["confusion_matrix", "weighted_confusion_matrix"].each_with_index do |matrix,idx| + %b= (idx == 0 ? "Confusion Matrix" : "Weighted Confusion Matrix") + %table.table.table-condensed.table-borderless{:style=>"width:20%;"} + %tbody + %tr + %td + %td + %td + %b actual + %td + %td + %tr + %td + %td + %td active + %td inactive + -#%td total + %tr + %td + %b predicted + %td active + %td + =( idx == 1 ? cv.send(matrix)[0][0].round(3) : cv.send(matrix)[0][0]) + %td + =( idx == 1 ? cv.send(matrix)[0][1].round(3) : cv.send(matrix)[0][1]) + -#%td + =cv.confusion_matrix[0][0]+cv.confusion_matrix[0][1] + %tr + %td + %td inactive + %td + =( idx == 1 ? cv.send(matrix)[1][0].round(3) : cv.send(matrix)[1][0]) + %td + =( idx == 1 ? cv.send(matrix)[1][1].round(3) : cv.send(matrix)[1][1]) + -#%td + =cv.confusion_matrix[1][0]+cv.confusion_matrix[1][1] + -#%tr + %td + %td total + %td + =cv.confusion_matrix[0][0]+cv.confusion_matrix[1][0] + %td + =cv.confusion_matrix[0][1]+cv.confusion_matrix[1][1] + %td + -#= "Confusion Matrix:\t" + -#= cv.confusion_matrix + %br %br /= "Confidence plot:" /%p.plot / %img{:src=>"confp#{cv.id}.svg"} - if model.regression? %br - = "Root mean squared error:\t" + %a.ht5{:href=>"https://en.wikipedia.org/wiki/Root-mean-square_deviation", :rel=>"external"} RMSE: = cv.rmse.round(3) if cv.rmse %br - = "Mean absolute error:\t" + %a.ht5{:href=>"https://en.wikipedia.org/wiki/Mean_absolute_error", :rel=>"external"} MAE: = cv.mae.round(3) if cv.mae %br - = "R square:\t" + %a.ht5{:href=>"https://en.wikipedia.org/wiki/Coefficient_of_determination", :rel=>"external"}= "R"+"2"+":" = cv.r_squared.round(3) if cv.r_squared %br /= "Confidence plot:" @@ -113,5 +131,5 @@ Source: /= "Correlation plot" /%p.plot / %img{:src=>"/corrp#{cv.id}.svg"} - + %br diff --git a/views/neighbors.haml b/views/neighbors.haml index 096e432..d9f2796 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -79,20 +79,19 @@ - prediction[:neighbors].uniq.each_with_index do |neighbor,count| %tr / Compound - - c = Compound.find(neighbor["_id"]) + - c = Compound.find(neighbor) %td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"} /%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor["_id"])}/details"), :id=>"link#{j+1}#{count}"}} %p= c.svg %p= c.smiles - - mw = c.molecular_weight - / Measured Activity = compound.features + / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} - - features = c.features.collect{|k,v| v if k == predictionFeature[j]["id"] }.compact.flatten - = (predictionFeature[j]["type"] == "numeric") ? features.collect{|v| weight = c.mmol_to_mg(v); '%.2e' % v + " (#{@models[j].unit})"+" , #{'%.2e' % weight} #{(unit == "mmol/L") ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : features.join("
") + = (type == "Regression" ? "#{neighbor[:measurement].delog10}" + " (#{unit})" : neighbor[:measurement]) + %br + = "#{c.mmol_to_mg(neighbor[:measurement].delog10)}" + " (#{(unit =~ /\b(mol\/L)\b/) ? "mg/L" : "mg/kg_bw/day"})" if type == "Regression" / Similarity = tanimoto %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} - / TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset? - = neighbor[:tanimoto] != nil ? neighbor[:tanimoto].to_f.round(3) : "Not enough similar compounds
in training dataset." + = neighbor[:similarity].round(3) - else %span.btn.btn-default.disabled diff --git a/views/predict.haml b/views/predict.haml index 010ed12..8ae5684 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -162,6 +162,7 @@ document.getElementById("details#{model.id}").appendChild(details); $(button).show(); $(image).hide(); + addExternalLinks(); }); } } diff --git a/views/prediction.haml b/views/prediction.haml index 0f3d57b..1aefe06 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -18,7 +18,6 @@ %td{:id=>"compound", :style=>"vertical-align:top;"} %p= @compound.svg %p= @compound.smiles - - mw = @compound.molecular_weight - @model_types = {} - @dbhit = {} - @predictions.each_with_index do |prediction,i| @@ -29,17 +28,20 @@ %b{:class => "title"} = "#{@models[i].endpoint.gsub('_', ' ')} (#{@models[i].species})" %p - - if prediction[:confidence] == "measured" + - if prediction[:warning] =~ /\b(identical)\b/i - @dbhit[i] = true %p + /TODO combine with regular view, if prediction value is present %b Measured activity: - p prediction[:value] - if prediction[:value].is_a?(Array) - = (type == "Regression") ? prediction[:value].collect{|v| weight = Compound.from_smiles(@compound.smiles).mmol_to_mg(v); '%.2e' % v + " (#{unit})"+", #{'%.2e' % weight} #{unit == "mmol/L" ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : prediction[:value].join(", ") + = (type == "Regression") ? prediction[:value].collect{|value| "#{value} (#{unit}) , #{@compound.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : prediction[:value].join(", ") - else - = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{unit}), #{'%.2e' % @compound.mmol_to_mg(prediction[:value])} #{(unit == "mmol/L") ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] + = (type == "Regression") ? "#{prediction[:value]} (#{unit}), #{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] %p %b Compound is part of the training dataset + / warning popover + %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Warnings", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"#{prediction[:warning]}"}} - elsif prediction[:neighbors].size > 0 %p / model type (classification|regression) @@ -47,23 +49,30 @@ = type %br %b Prediction: - = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{unit}) , #{'%.2e' % @compound.mmol_to_mg(prediction[:value])} #{(unit == "mmol/L") ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] - / tabindex=0 seems the best fix for FF|S browsers on OSX better than trigger="click focus" which ends up in double click for FF. / prediction popover %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"

lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.

Classification:
Majority vote of neighbor activities weighted by similarity.

Regression:
Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.

Original publication."}} %br + = (type == "Regression") ? "#{prediction[:value].delog10} (#{unit})
#{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] + / tabindex=0 seems the best fix for FF|S browsers on OSX better than trigger="click focus" which ends up in double click for FF. + %br - if type == "Regression" %b 95% Prediction interval: - - interval = prediction[:prediction_interval].nil? ? " - - " : prediction[:prediction_interval].collect{|i| i.round(2)} - %br - = "#{interval[0]} - #{interval[1]} (#{unit}), #{'%.2e' % @compound.mmol_to_mg(interval[0])} - #{'%.2e' % @compound.mmol_to_mg(interval[1])} #{(unit == "mmol/L") ? "(mg/L)" : "(mg/kg_bw/day)"}" + - interval = (prediction[:prediction_interval].nil? ? ["- -","- -"] : prediction[:prediction_interval]) / prediction intervall popover %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}} + %br + = "#{interval[0].delog10} - #{interval[1].delog10} (#{unit})" + %br + = "#{@compound.mmol_to_mg(interval[0].delog10)} - #{@compound.mmol_to_mg(interval[1].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? - else - %b Confidence: - = prediction[:confidence].round(2) unless prediction[:confidence].nil? - / confidence popover - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"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 > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}} + %b Probability: + - unless prediction[:probabilities].nil? + %br + = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0]}" + %br + = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1]}" + / probability popover + -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"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 > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}} %p /TODO add tooltip for significant ftagments and descriptors / - if @model_type[i] =~ /classification/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0) diff --git a/views/style.scss b/views/style.scss index 49e03ab..2c84781 100644 --- a/views/style.scss +++ b/views/style.scss @@ -51,10 +51,12 @@ ul.share-buttons{ padding: 0 2px 1px 2px !important; } .page-header{ - margin:20px 0 20px; - text-align:justify; + background-color: #fff; + padding:20px 0 20px 0; + margin: 0; + text-align:center; display:inline-block; - width:98.5%; + width:100%; } .share{ width: 30px; @@ -62,9 +64,13 @@ ul.share-buttons{ } supporters{ background-color: white; - + text-align:center; img{ width: 200px; margin-right: 1em; } } + +.footer{ + margin-top:3em; +} diff --git a/views/validation.haml b/views/validation.haml deleted file mode 100644 index fd63ea6..0000000 --- a/views/validation.haml +++ /dev/null @@ -1,16 +0,0 @@ -- case @model_type -- when "classification" - - prediction = @cv.metadata["http://www.opentox.org/api/1.2#classificationStatistics"]["http://www.opentox.org/api/1.2#numCorrect"] + @cv.metadata["http://www.opentox.org/api/1.2#classificationStatistics"]["http://www.opentox.org/api/1.2#numIncorrect"] - %p= "Number of predictions: #{prediction}" - - percent = @cv.metadata["http://www.opentox.org/api/1.2#classificationStatistics"]["http://www.opentox.org/api/1.2#percentCorrect"] - %p= "Correct predictions: #{percent.round(2)} %" -- when "regression" - - prediction = @cv.metadata["http://www.opentox.org/api/1.2#numInstances"].to_i - @cv.metadata["http://www.opentox.org/api/1.2#numUnpredicted"].to_i - %p= "Number of predictions: #{prediction}" - - rSquare = @cv.metadata["http://www.opentox.org/api/1.2#regressionStatistics"]["http://www.opentox.org/api/1.2#rSquare"] - %p= "R-squared: #{rSquare.round(2)} %" - - rootMeanSquaredError = @cv.metadata["http://www.opentox.org/api/1.2#regressionStatistics"]["http://www.opentox.org/api/1.2#rootMeanSquaredError"] - %p= "Root Mean Square Error: #{rootMeanSquaredError.round(2)} %" - - meanAbsoluteError = @cv.metadata["http://www.opentox.org/api/1.2#regressionStatistics"]["http://www.opentox.org/api/1.2#meanAbsoluteError"] - %p= "Mean Absolute Error: #{meanAbsoluteError.round(2)} %" - -- cgit v1.2.3 From c5ca09fb039e38abd89005d49ef373cf18b79039 Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 28 Nov 2016 14:13:18 +0000 Subject: bumped version;training dataset download;show warnings for batch;csv info and upload catch;code cleanup --- views/batch.haml | 106 +++++++++++++++++++++++++++++++++-------------- views/layout.haml | 38 +---------------- views/model_details.haml | 4 ++ views/neighbors.haml | 13 +++--- views/predict.haml | 1 + views/prediction.haml | 103 +++++++++++++++++++++++---------------------- 6 files changed, 142 insertions(+), 123 deletions(-) (limited to 'views') diff --git a/views/batch.haml b/views/batch.haml index 9bfa67e..6c37a2b 100644 --- a/views/batch.haml +++ b/views/batch.haml @@ -2,57 +2,99 @@ %a.btn.btn-warning{:href => to('/predict')} %span.glyphicon.glyphicon-menu-left{:aria=>{:hidden=>"true"}} New Prediction - / displays all prediction result in first table + %a.btn.btn-success{:href=>"#{to("/predict/#{@filename}")}", :title=>"download"} + %span.glyphicon.glyphicon-download-alt + download CSV + + / show processed file name + %topline + %div.row + %div.col-md-4 + %h3 Batch Prediction Results: + %div.col-md-8 + %h3= @filename + + / displays all prediction result in one table %div.table-responsive %table.table.table-bordered{:id=>"batch", :style=>"background-color:white;"} - %thead - %tr - %h3.col-md-4{:style=>"padding-left:0;"} Batch Prediction Results: - %h3.col-md-8= @filename - %tr - %span.btn.btn-default - %a{:href=>"#{to("/predict/#{@filename}")}", :title=>"download"} - %span.glyphicon.glyphicon-download-alt{:aria=>{:hidden=>"true"}} - CSV %tbody - / key = compound, values = array of arrays with model, prediction + - if @warnings + - @warnings.each do |warning| + %tr + %td + %b Warning + %td + = warning.sub(/\b(tmp\/)\b/,"") + / key = compound, values = [model,prediction] - @batch.each do |key, values| - compound = key - - mw = compound.molecular_weight %tr %td{:style=>"vertical-align:top;"} %p= compound.svg %p= compound.smiles - / array = single prediction [endpoint, result] + + / array[0] = model, array[1] = prediction - values.each_with_index do |array,i| %td{:style=>"vertical-align:top;white-space:nowrap;"} - model = array[0] + / model type (classification|regression) + - model.model.class.to_s.match("Classification") ? type = "Classification" : type = "Regression" + - unit = model.unit - prediction = array[1] + %b{:class => "title"} = "#{model.endpoint.gsub('_', ' ')} (#{model.species})" - %p - - if prediction[:confidence] == "measured" + + / check for prediction + - if prediction[:neighbors].size > 0 %p - %b Measured activity: - - if prediction[:value].is_a?(Array) - = prediction[:value][0].numeric? ? prediction[:value].collect{|v| weight = compound.mmol_to_mg(v, mw); '%.2e' % v + " (#{model.unit})"+" | #{'%.2e' % weight} (mg/kg_bw/day)"}.join("
") : prediction[:value].join(", ") - - else - = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] + / show model type (classification|regression) + %b Type: + = type %p - %b Compound is part of the training dataset - - elsif prediction[:neighbors].size > 0 + / check for database hit + - if prediction[:warning] =~ /\b(identical)\b/i + + / show message about dbhit and measurements + %p + %b Compound is part of the training dataset + %p + %b Measured activity: + %br + - if prediction[:measurements].is_a?(Array) + = (type == "Regression") ? prediction[:measurements].collect{|value| "#{value.delog10} (#{unit})
#{compound.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : prediction[:measurements].join(", ") + - else + = (type == "Regression") ? "#{prediction[:measurements].delog10} (#{unit})
#{compound.mmol_to_mg(prediction[:measurements].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements] + + + / show prediction %p - / model type (classification|regression) - %b Type: - = model.model.class.to_s.match("Classification") ? "Classification" : "Regression" - %br - %b Prediction: - = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value] - %br - / TODO probability - %b Confidence: - = prediction[:confidence].round(3) + %b Prediction: + %br + = (type == "Regression") ? "#{prediction[:value].delog10} (#{unit})
#{compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/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} - #{interval[0].delog10} (#{unit})" + %br + = "#{compound.mmol_to_mg(interval[1].delog10)} - #{compound.mmol_to_mg(interval[0].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? + - else + %b Probability: + - unless prediction[:probabilities].nil? + %br + = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0]}" + %br + / show warnings %p + - if !prediction[:warning].nil? + %b Warnings: + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Warnings", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"#{prediction[:warning]}"}} + + / no prediction - else %p = "Not enough similar compounds
in training dataset." diff --git a/views/layout.haml b/views/layout.haml index dddf854..5ed63e8 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -29,33 +29,11 @@ %h1.media-heading lazar toxicity predictions %div.col-md-2 - %h1.media-heading + %h5 %small - %a{:href=>"https://nano-lazar.in-silico.ch"} nano-lazar + [version: #{@version}] %div.container-fluid - %topline - %div.row - %div.col-md-8 - Problems, bugs, ideas for improvements ? Please report at our - %a{:href => 'https://github.com/opentox/lazar-gui/issues', :rel => "external"} issue tracker - or send us an email - %a{ :href=>"mailto:info@in-silico.ch", :target=>"_top"} - %img.share{:src=>"/images/Email.png"} - (version #{@version}). - %div.col-md-2 - %div.col-md-2 - %a{:href=>"https://twitter.com/intent/tweet?source=http%3A%2F%2Flazar.in-silico.ch&text=:%20http%3A%2F%2Flazar.in-silico.ch", :target=>"_blank", :title=>"Tweet"} - %img.share{:src=>"/images/Twitter.png"} - %a{:href=>"https://plus.google.com/share?url=http%3A%2F%2Flazar.in-silico.ch", :target=>"_blank", :title=>"Share on Google+"} - %img.share{:src=>"/images/Google+.png"} - %a{:href=>"http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Flazar.in-silico.ch&title=&summary=&source=http%3A%2F%2Flazar.in-silico.ch", :target=>"_blank", :title=>"Share on LinkedIn"} - %img.share{:src=>"/images/LinkedIn.png"} - %a{:href=>"https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Flazar.in-silico.ch&title=&summary=&source=http%3A%2F%2Flazar.in-silico.ch", :target=>"_blank", :title=>"Share on Facebook"} - %img.share{:src=>"/images/Facebook.png"} - %div.row - Previous version: - %a{:href=>"http://lazar-old.in-silico.ch", :rel => "external"} lazar-old :javascript $(document).ready(function(){ $("#back-top").hide(); @@ -79,18 +57,6 @@ %p.text-muted © %a{:href => 'http://www.in-silico.ch', :rel => "external"} in silico toxicology gmbh 2004 - #{Time.now.year.to_s} - | - %a{:href => to("/license"), :rel => "external"} GPL3 License - %supporters.col-md-12 - %p Financial support by - %a{:href=>"http://www.bfr.bund.de/de/start.html", :rel=>"external"} - %img{:src=>"/images/bfr_logo.gif"} - %a{:href=>"http://www.opentox.org/", :rel=>"external"} - %img{:src=>"/images/ot_logo.png"} - %a{:href=>"https://enanomapper.net/", :rel=>"external"} - %img{:src=>"/images/enm_logo.png"} - %a{:href=>"https://www.researchgate.net/institution/Nestle_SA/department/Nestle_Research_Center", :rel=>"external"} - %img{:src=>"/images/nestec.jpg"} #back-top{:style => "z-index:100;position:fixed;bottom:1%;right:1%;"} diff --git a/views/model_details.haml b/views/model_details.haml index 7646471..3fa8c8b 100644 --- a/views/model_details.haml +++ b/views/model_details.haml @@ -12,6 +12,10 @@ Source: = "Training compounds:\t" = training_dataset.compounds.size %br += "Training dataset:\t" +%a{:href=>"#{to("/predict/dataset/#{training_dataset.name}")}"} + = training_dataset.name +%br %b Algorithms: %br Similarity: diff --git a/views/neighbors.haml b/views/neighbors.haml index d9f2796..32b8389 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -67,10 +67,10 @@ Compound %th.sorter-false{:style =>"vertical-align:middle;"} Measured Activity - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Measured Activity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"left", html:"true", content:"Experimental result(s) from the training dataset."}, :style=>"z-index:auto+10;"} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Measured Activity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Experimental result(s) from the training dataset."}, :style=>"z-index:auto+10;"} %th.sorter-false{:style =>"vertical-align:middle;"} Similarity - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"left", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} / %th{:style =>"vertical-align:middle;"} / Supporting Information %tbody @@ -84,11 +84,14 @@ /%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor["_id"])}/details"), :id=>"link#{j+1}#{count}"}} %p= c.svg %p= c.smiles + / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} - = (type == "Regression" ? "#{neighbor[:measurement].delog10}" + " (#{unit})" : neighbor[:measurement]) - %br - = "#{c.mmol_to_mg(neighbor[:measurement].delog10)}" + " (#{(unit =~ /\b(mol\/L)\b/) ? "mg/L" : "mg/kg_bw/day"})" if type == "Regression" + - if neighbor[:measurement].is_a?(Array) + = (type == "Regression") ? neighbor[:measurement].collect{|value| "#{value.delog10} (#{unit})
#{c.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : neighbor[:measurement].join(", ") + - else + = (type == "Regression") ? "#{neighbor[:measurement].delog10} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] + / Similarity = tanimoto %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} = neighbor[:similarity].round(3) diff --git a/views/predict.haml b/views/predict.haml index 66006d4..9a7d0d4 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -127,6 +127,7 @@ %p %label{:for=>"fileselect"} or upload a CSV file for batch predictions + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"File format", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"auto", html:"true", content:"One column with compounds and keyword SMILES or InChI in the first row."}} %br %span.btn.btn-default.btn-file %input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv"} diff --git a/views/prediction.haml b/views/prediction.haml index 2454aca..b090be5 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -18,7 +18,6 @@ %td{:id=>"compound", :style=>"vertical-align:top;"} %p= @compound.svg %p= @compound.smiles - -#- mw = @compound.molecular_weight - @model_types = {} - @dbhit = {} - @predictions.each_with_index do |prediction,i| @@ -28,62 +27,66 @@ %td{:style=>"vertical-align:top;white-space:nowrap;"} %b{:class => "title"} = "#{@models[i].endpoint.gsub('_', ' ')} (#{@models[i].species})" - %p - - if prediction[:warning] =~ /\b(identical)\b/i - - @dbhit[i] = true + + / check for prediction + - if prediction[:neighbors].size > 0 %p - /TODO combine with regular view, if prediction value is present - %b Measured activity: - - p prediction[:value] - - if prediction[:value].is_a?(Array) - = (type == "Regression") ? prediction[:value].collect{|value| "#{value} (#{unit}) , #{@compound.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : prediction[:value].join(", ") - - else - = (type == "Regression") ? "#{prediction[:value]} (#{unit}), #{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] - %p - %b Compound is part of the training dataset - / warning popover - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Warnings", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"#{prediction[:warning]}"}} - - elsif prediction[:neighbors].size > 0 - %p - / model type (classification|regression) + / show model type (classification|regression) %b Type: = type - %br - %b Prediction: - / prediction popover - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"

lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.

Classification:
Majority vote of neighbor activities weighted by similarity.

Regression:
Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.

Original publication."}} - %br - = (type == "Regression") ? "#{prediction[:value].delog10} (#{unit})
#{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] - / tabindex=0 seems the best fix for FF|S browsers on OSX better than trigger="click focus" which ends up in double click for FF. - %br - - if type == "Regression" - %b 95% Prediction interval: - - interval = (prediction[:prediction_interval].nil? ? ["- -","- -"] : prediction[:prediction_interval]) - / prediction intervall popover - %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}} - %br - = "#{interval[0].delog10} - #{interval[1].delog10} (#{unit})" - %br - = "#{@compound.mmol_to_mg(interval[0].delog10)} - #{@compound.mmol_to_mg(interval[1].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? + %p + / check for database hit + - if prediction[:warning] =~ /\b(identical)\b/i + - @dbhit[i] = true + + / show message about dbhit and measurements + %p + %b Compound is part of the training dataset + %p + %b Measured activity: + %br + - if prediction[:measurements].is_a?(Array) + = (type == "Regression") ? prediction[:measurements].collect{|value| "#{value.delog10} (#{unit})
#{@compound.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : prediction[:measurements].join(", ") + - else + = (type == "Regression") ? "#{prediction[:measurements].delog10} (#{unit})
#{@compound.mmol_to_mg(prediction[:measurements].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements] + - else - %b Probability: - - unless prediction[:probabilities].nil? + - @dbhit[i] = false + + / show prediction + %p + %b Prediction: + / prediction popover + -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"

lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.

Classification:
Majority vote of neighbor activities weighted by similarity.

Regression:
Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.

Original publication."}} + %br + = (type == "Regression") ? "#{prediction[:value].delog10} (#{unit})
#{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/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]) + / prediction interval popover + -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}} %br - = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0]}" + = interval.nil? ? "--" : "#{interval[1].delog10} - #{interval[0].delog10} (#{unit})" %br - = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1]}" - / probability popover - -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"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 > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}} - %p - /TODO add tooltip for significant ftagments and descriptors - / - if @model_type[i] =~ /classification/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0) - / Significant fragments: - / %a.btn.btn-default.btn-sm{:id=>"linkSigFragments", :href => "#detailsTop", :tabindex=>"0", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[i]}/#{CGI.escape(@compound.uri)}/fingerprints")}} Significant fragments - / - if @model_type[i] =~ /regression/i && (p.data_entries[0][1] != nil && p.data_entries[0][1] != 0.0) - / Descriptors - / %a.btn.btn-default.btn-sm{:id=>"linkDescriptors", :href => "#detailsTop", :tabindex=>"0", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@model_uri)}/#{@model_type[i]}/#{CGI.escape(@compound.uri)}/fingerprints")}} Descriptors - / %p + = "#{@compound.mmol_to_mg(interval[1].delog10)} - #{@compound.mmol_to_mg(interval[0].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? + - else + %b Probability: + - unless prediction[:probabilities].nil? + %br + = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0]}" + %br + = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1]}" + / probability popover + -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"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 > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}} + + / show warnings %p + - if !prediction[:warning].nil? + %b Warnings: + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Warnings", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"auto", html:"true", content:"#{prediction[:warning]}"}} - else - @dbhit[i] = false %p -- cgit v1.2.3 From 55bf06381a42c9bb1e1e991e990f5d6e90c8e33e Mon Sep 17 00:00:00 2001 From: gebele Date: Wed, 7 Dec 2016 12:07:13 +0000 Subject: rebuild code for public release;prepared to work with lazar v1.0.0;reintroduced compound details --- views/details.haml | 6 +++++- views/layout.haml | 37 ++++++++++++++++++++++++++++++++++--- views/neighbors.haml | 4 ++-- views/predict.haml | 12 ++++++------ views/prediction.haml | 22 ++++++++++------------ 5 files changed, 57 insertions(+), 24 deletions(-) (limited to 'views') diff --git a/views/details.haml b/views/details.haml index bb8250d..be4948a 100644 --- a/views/details.haml +++ b/views/details.haml @@ -1,8 +1,12 @@ +:javascript + $(document).ready(function(){ + addExternalLinks(); + }); %div.modal-body{:style=>"padding:10px;"} %button.close{ :type=>" button", data: { dismiss:"modal"}} × %h3 Names and synonyms: - %img.img-responsive{:src=>"#{@compound.uri}/image", :alt=>"Compound image not available", :width=>"300px", :heigth=>"300px", :style=>"float:left;"} + %p= @compound.svg %p %b="SMILES:" %p= @smiles diff --git a/views/layout.haml b/views/layout.haml index 5ed63e8..62a224b 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -29,11 +29,30 @@ %h1.media-heading lazar toxicity predictions %div.col-md-2 - %h5 + %h1.media-heading %small - [version: #{@version}] + %a{:href=>"https://nano-lazar.in-silico.ch", :rel=>"external"} nano-lazar %div.container-fluid + %topline + %div.row + %div.col-md-8 + Problems, bugs, ideas for improvements ? Please report at our + %a{:href => 'https://github.com/opentox/lazar-gui/issues', :rel => "external"} issue tracker + or send us an email. + %a{ :href=>"mailto:info@in-silico.ch", :target=>"_top"} + %img.share{:src=>"/images/Email.png"} + [version: #{@version}] + %div.col-md-2 + %div.col-md-2 + %a{:href=>"https://twitter.com/intent/tweet?source=http%3A%2F%2Flazar.in-silico.ch&text=http%3A%2F%2Flazar.in-silico.ch", :rel=>"external", :title=>"Tweet"} + %img.share{:src=>"/images/Twitter.png"} + %a{:href=>"https://plus.google.com/share?url=http%3A%2F%2Flazar.in-silico.ch", :rel=>"external", :title=>"Share on Google+"} + %img.share{:src=>"/images/Google+.png"} + %a{:href=>"http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Flazar.in-silico.ch&title=&summary=&source=http%3A%2F%2Flazar.in-silico.ch", :rel=>"external", :title=>"Share on LinkedIn"} + %img.share{:src=>"/images/LinkedIn.png"} + %a{:href=>"https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Flazar.in-silico.ch&title=&summary=&source=http%3A%2F%2Flazar.in-silico.ch", :rel=>"external", :title=>"Share on Facebook"} + %img.share{:src=>"/images/Facebook.png"} :javascript $(document).ready(function(){ $("#back-top").hide(); @@ -57,7 +76,19 @@ %p.text-muted © %a{:href => 'http://www.in-silico.ch', :rel => "external"} in silico toxicology gmbh 2004 - #{Time.now.year.to_s} - + | + %a{:href => to("/license"), :rel => "external"} GPL3 License + %supporters.col-md-12 + %p Financial support by + %a{:href=>"http://www.bfr.bund.de/de/start.html", :rel=>"external"} + %img{:src=>"/images/bfr_logo.gif"} + %a{:href=>"http://www.opentox.org/", :rel=>"external"} + %img{:src=>"/images/ot_logo.png"} + %a{:href=>"https://enanomapper.net/", :rel=>"external"} + %img{:src=>"/images/enm_logo.png"} + %a{:href=>"https://www.researchgate.net/institution/Nestle_SA/department/Nestle_Research_Center", :rel=>"external"} + %img{:src=>"/images/nestec.jpg"} + #back-top{:style => "z-index:100;position:fixed;bottom:1%;right:1%;"} %a{:href => "", :style=>"text:decoration:none;color:#ccc;"} diff --git a/views/neighbors.haml b/views/neighbors.haml index 32b8389..a608c4d 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -81,8 +81,8 @@ / Compound - c = Compound.find(neighbor) %td{:style =>"vertical-align:middle;padding-left:1em;width:50%;"} - /%a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(neighbor["_id"])}/details"), :id=>"link#{j+1}#{count}"}} - %p= c.svg + %a.btn.btn-link{:href => "#details#{j+1}", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(c.id.to_s)}/details"), :id=>"link#{j+1}#{count}"}} + = c.svg %p= c.smiles / Measured Activity diff --git a/views/predict.haml b/views/predict.haml index 9a7d0d4..b7a4087 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -125,12 +125,12 @@ %br %input{:type => 'text', :name => 'identifier', :id => 'identifier', :size => '60'} %p - %label{:for=>"fileselect"} - or upload a CSV file for batch predictions - %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"File format", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"auto", html:"true", content:"One column with compounds and keyword SMILES or InChI in the first row."}} - %br - %span.btn.btn-default.btn-file - %input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv"} + -#%label{:for=>"fileselect"} + or upload a CSV file for batch predictions (disabled in public version) + -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"File format", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"auto", html:"true", content:"One column with compounds and keyword SMILES or InChI in the first row."}} + -#%br + -#%span.btn.btn-default.btn-file + %input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv", :disabled=>"disabled"} %fieldset#middle.well %h2 2. Select one or more endpoints diff --git a/views/prediction.haml b/views/prediction.haml index b090be5..362f006 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -1,10 +1,3 @@ -: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 @@ -16,7 +9,8 @@ %tbody %tr %td{:id=>"compound", :style=>"vertical-align:top;"} - %p= @compound.svg + %a.btn.btn-link{:href => "#details0", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@compound.id.to_s)}/details"), :id=>"link01"}} + = @compound.svg %p= @compound.smiles - @model_types = {} - @dbhit = {} @@ -57,7 +51,7 @@ %p %b Prediction: / prediction popover - -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"

lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.

Classification:
Majority vote of neighbor activities weighted by similarity.

Regression:
Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.

Original publication."}} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"

lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.

Classification:
Majority vote of neighbor activities weighted by similarity.

Regression:
Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.

Original publication."}} %br = (type == "Regression") ? "#{prediction[:value].delog10} (#{unit})
#{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] @@ -67,20 +61,20 @@ %b 95% Prediction interval: - interval = (prediction[:prediction_interval].nil? ? nil : prediction[:prediction_interval]) / prediction interval popover - -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}} %br = interval.nil? ? "--" : "#{interval[1].delog10} - #{interval[0].delog10} (#{unit})" %br = "#{@compound.mmol_to_mg(interval[1].delog10)} - #{@compound.mmol_to_mg(interval[0].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? - else %b Probability: + / probability popover + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"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 > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}} - unless prediction[:probabilities].nil? %br = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0]}" %br = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1]}" - / probability popover - -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"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 > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}} / show warnings %p @@ -94,4 +88,8 @@ / always show the neighbors table, message is given there = haml :neighbors, :layout => false, :model_type => @model_types, :dbhit => @dbhit + +%div.modal.fade{:id=>"details0", :role=>"dialog"} + %div.modal-dialog.modal-lg + %div.modal-content -- cgit v1.2.3 From cb2ad5835eae10c85ee426102b2a9bf165c5c848 Mon Sep 17 00:00:00 2001 From: gebele Date: Tue, 20 Dec 2016 16:25:27 +0000 Subject: result values round by signif(n);set dependent lazar gem version --- views/model_details.haml | 30 ++++++++++++++++-------------- views/neighbors.haml | 4 ++-- views/prediction.haml | 16 ++++++++-------- 3 files changed, 26 insertions(+), 24 deletions(-) (limited to 'views') diff --git a/views/model_details.haml b/views/model_details.haml index 3fa8c8b..5c3aa4f 100644 --- a/views/model_details.haml +++ b/views/model_details.haml @@ -10,7 +10,7 @@ Source: %br - training_dataset = OpenTox::Dataset.find model.model.training_dataset_id = "Training compounds:\t" -= training_dataset.compounds.size += training_dataset.data_entries.size %br = "Training dataset:\t" %a{:href=>"#{to("/predict/dataset/#{training_dataset.name}")}"} @@ -53,18 +53,20 @@ Descriptors: %br = "Weighted accuracy:\t" = cv.weighted_accuracy.round(3) if cv.weighted_accuracy - %br - = "True positive rate:\t" - = cv.true_rate["active"].round(3) if cv.true_rate - %br - = "True negative rate:\t" - = cv.true_rate["inactive"].round(3) if cv.true_rate - %br - = "Positive predictive value:\t" - = cv.predictivity["active"].round(3) if cv.predictivity - %br - = "Negative predictive value:\t" - = cv.predictivity["inactive"].round(3) if cv.predictivity + - if cv.true_rate + %br + = "True positive rate:\t" + = cv.true_rate[cv.accept_values[0]].round(3) + %br + = "True negative rate:\t" + = cv.true_rate[cv.accept_values[1]].round(3) + - if cv.predictivity + %br + = "Positive predictive value:\t" + = cv.predictivity[cv.accept_values[0]].round(3) + %br + = "Negative predictive value:\t" + = cv.predictivity[cv.accept_values[1]].round(3) %p - ["confusion_matrix", "weighted_confusion_matrix"].each_with_index do |matrix,idx| %b= (idx == 0 ? "Confusion Matrix" : "Weighted Confusion Matrix") @@ -136,4 +138,4 @@ Descriptors: /%p.plot / %img{:src=>"/corrp#{cv.id}.svg"} -%br +%br diff --git a/views/neighbors.haml b/views/neighbors.haml index a608c4d..2f0b3d7 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -88,9 +88,9 @@ / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;white-space:nowrap;"} - if neighbor[:measurement].is_a?(Array) - = (type == "Regression") ? neighbor[:measurement].collect{|value| "#{value.delog10} (#{unit})
#{c.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : neighbor[:measurement].join(", ") + = (type == "Regression") ? neighbor[:measurement].collect{|value| "#{value.delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : neighbor[:measurement].join(", ") - else - = (type == "Regression") ? "#{neighbor[:measurement].delog10} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] + = (type == "Regression") ? "#{neighbor[:measurement].delog10.signif(3)} (#{unit})
#{c.mmol_to_mg(neighbor[:measurement].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement] / Similarity = tanimoto %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} diff --git a/views/prediction.haml b/views/prediction.haml index 362f006..1b8d38d 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -40,9 +40,9 @@ %b Measured activity: %br - if prediction[:measurements].is_a?(Array) - = (type == "Regression") ? prediction[:measurements].collect{|value| "#{value.delog10} (#{unit})
#{@compound.mmol_to_mg(value.delog10)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("
") : prediction[:measurements].join(", ") + = (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} (#{unit})
#{@compound.mmol_to_mg(prediction[:measurements].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements] + = (type == "Regression") ? "#{prediction[:measurements].delog10.signif(3)} (#{unit})
#{@compound.mmol_to_mg(prediction[:measurements].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements] - else - @dbhit[i] = false @@ -53,7 +53,7 @@ / prediction popover %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"

lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.

Classification:
Majority vote of neighbor activities weighted by similarity.

Regression:
Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.

Original publication."}} %br - = (type == "Regression") ? "#{prediction[:value].delog10} (#{unit})
#{@compound.mmol_to_mg(prediction[:value].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] + = (type == "Regression") ? "#{prediction[:value].delog10.signif(3)} (#{unit})
#{@compound.mmol_to_mg(prediction[:value].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value] / show prediction interval or probability %p @@ -63,18 +63,18 @@ / prediction interval popover %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}} %br - = interval.nil? ? "--" : "#{interval[1].delog10} - #{interval[0].delog10} (#{unit})" + = interval.nil? ? "--" : "#{interval[1].delog10.signif(3)} - #{interval[0].delog10.signif(3)} (#{unit})" %br - = "#{@compound.mmol_to_mg(interval[1].delog10)} - #{@compound.mmol_to_mg(interval[0].delog10)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? + = "#{@compound.mmol_to_mg(interval[1].delog10).signif(3)} - #{@compound.mmol_to_mg(interval[0].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil? - else %b Probability: / probability popover - %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Confidence", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"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 > 0.025 is a sensible (hard) cutoff to distinguish between reliable and unreliable predictions."}} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Pobability", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"Probability that the prediction belongs to one of the given classes."}} - unless prediction[:probabilities].nil? %br - = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0]}" + = "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0].signif(3)}" %br - = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1]}" + = "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1].signif(3)}" / show warnings %p -- cgit v1.2.3 From e6b8488b757f1d6036fd74b75f44d8c75ed3779f Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 16 Jan 2017 16:53:13 +0000 Subject: issue fixes;added faq --- views/faq_layout.haml | 67 --------------------------------------------------- views/layout.haml | 11 +++++---- views/neighbors.haml | 8 +++++- views/predict.haml | 5 ++-- 4 files changed, 16 insertions(+), 75 deletions(-) delete mode 100644 views/faq_layout.haml (limited to 'views') diff --git a/views/faq_layout.haml b/views/faq_layout.haml deleted file mode 100644 index a9b6664..0000000 --- a/views/faq_layout.haml +++ /dev/null @@ -1,67 +0,0 @@ -!!! -%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"} - %head - %meta{'charset'=>"utf-8"} - %meta{'http-equiv'=>"X-UA-Compatible", :content=>"IE=edge"} - %meta{'name'=>"viewport", :content=>"width=device-width, initial-scale=1"} - %title Lazar GUI FAQ - %link{:rel=>'icon', :type=>'image/x-icon', :href=>'/images/favicon.ico'} - %link{:rel=>'stylesheet', :href=>"#{'/css/bootstrap.min.css'}"} - %link{:rel=>'stylesheet', :href=>"#{'/css/theme.default.min.css'}"} - %link{:rel=>'stylesheet', :href=>"#{'/css/theme.bootstrap.min.css'}"} - %link{ :href=>"/style.css", :rel=>"stylesheet"} - %link{ :href=>"/stylesheets/jquery-ui.css", :rel=>"stylesheet"} - %script{:src=>"/javascripts/jquery-1.11.2.min.js"} - %script{:src=>"/javascripts/bootstrap.min.js"} - %script{ :src=>"/javascripts/lazar-gui.js"} - %body - %noscript - %div{ :style=>"width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"} - Your web browser must have JavaScript enabled in order for this application to display correctly. - %header.page-header - %div.row - %div.col-md-2 - %a{:href=> to("/predict")} - %img.media-object{:src=>"/images/ist_logo.png", :alt=>"logo", :style=>"margin:0 3em 0 2em;"} - %div.col-md-10 - %h1.media-heading{:style=>"margin: 0 0 0 1em;display:inline;"} Lazar GUI - A Graphical User Interface for the Lazar framework - - %div.container-fluid - :javascript - $(document).ready(function(){ - $("#back-top").hide(); - $(".blind").error(function(){ - $(this).attr('src', '/images/blind.png'); - }); - }); - - = yield - - %footer.footer - %div.container-fluid - %p.text-muted - © - %a{:href => 'http://www.in-silico.ch', :rel => "external"} in silico toxicology gmbh 2004 - #{Time.now.year.to_s} - - #back-top{:style => "z-index:100;position:fixed;bottom:1%;right:1%;"} - %a{:href => "", :style=>"text:decoration:none;color:#ccc;"} - %span.glyphicon.glyphicon-circle-arrow-up{:style => "font-size:3em;color:black;"} - :javascript - $("#back-top").hide(); - $(function () { - $(window).scroll(function () { - if ($(this).scrollTop() > 600) { - $('#back-top').fadeIn(); - } else { - $('#back-top').fadeOut(); - } - }); - // scroll body to 0px on click - $('#back-top a').click(function () { - $('body,html').animate({ - scrollTop: 0 - }, 500); - return false; - }); - }); diff --git a/views/layout.haml b/views/layout.haml index 62a224b..dc83956 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -36,15 +36,16 @@ %div.container-fluid %topline %div.row - %div.col-md-8 + %div.col-md-10 Problems, bugs, ideas for improvements ? Please report at our %a{:href => 'https://github.com/opentox/lazar-gui/issues', :rel => "external"} issue tracker - or send us an email. - %a{ :href=>"mailto:info@in-silico.ch", :target=>"_top"} + , check out the + %a{:href=> to("/faq"), :rel => "external"} FAQ + page or send us an email. + %a{ :href=>"mailto:info@in-silico.ch?subject=[lazar v#{@version}]", :target=>"_top"} %img.share{:src=>"/images/Email.png"} [version: #{@version}] - %div.col-md-2 - %div.col-md-2 + %div.col-md-2{:style=>"text-align:right;"} %a{:href=>"https://twitter.com/intent/tweet?source=http%3A%2F%2Flazar.in-silico.ch&text=http%3A%2F%2Flazar.in-silico.ch", :rel=>"external", :title=>"Tweet"} %img.share{:src=>"/images/Twitter.png"} %a{:href=>"https://plus.google.com/share?url=http%3A%2F%2Flazar.in-silico.ch", :rel=>"external", :title=>"Share on Google+"} diff --git a/views/neighbors.haml b/views/neighbors.haml index 2f0b3d7..18c23f8 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -3,6 +3,11 @@ / align single prediction to endpoint ; / display preordered in table view ; +:javascript + $(document).ready(function(){ + addExternalLinks(); + }); + %div.results %h3 Neighbors: / tabs div @@ -35,6 +40,7 @@ / presort by similarity ; :javascript $(document).ready(function(){ + addExternalLinks(); $("table##{j+1}").tablesorter({ debug: false, theme: "bootstrap", @@ -70,7 +76,7 @@ %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Measured Activity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Experimental result(s) from the training dataset."}, :style=>"z-index:auto+10;"} %th.sorter-false{:style =>"vertical-align:middle;"} Similarity - %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} + %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Similarity", :tabindex=>"0", data: {trigger:"focus", container:"body", toggle:"popover", placement:"auto", html:"true", content:"Tanimoto/Jaccard similarity based on Molprint2D fingerprints."}, :style=>"z-index:auto+10;"} / %th{:style =>"vertical-align:middle;"} / Supporting Information %tbody diff --git a/views/predict.haml b/views/predict.haml index b7a4087..59630d0 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -111,7 +111,7 @@ }; // whole site content needs to be in one form. Input and checkboxes are proofed by js functions. -%form{:name => "form", :action => to('/predict'), :method => "post", :enctype => "multipart/form-data", :onsubmit => "return !!(showcircle())" } +%form{:name => "form", :action => to('/predict'), :method => "post", :enctype => "multipart/form-data", :onsubmit => "return !!(showcircle())" } %fieldset#top.well %h2 1. Draw a chemical structure #insert @@ -130,7 +130,8 @@ -#%a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"File format", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"auto", html:"true", content:"One column with compounds and keyword SMILES or InChI in the first row."}} -#%br -#%span.btn.btn-default.btn-file - %input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv", :disabled=>"disabled"} + -#%input{:type=>"file", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv", :disabled=>"disabled"} + %input{:type=>"hidden", :name=> "fileselect", :id=>"fileselect", :accept=>"text/csv", :disabled=>"disabled"} %fieldset#middle.well %h2 2. Select one or more endpoints -- cgit v1.2.3